1 | <?php |
---|
2 | |
---|
3 | class dogma |
---|
4 | { |
---|
5 | function dogma($itemID) |
---|
6 | { |
---|
7 | $qry = new DBQuery(); |
---|
8 | $query = 'select * from kb3_invtypes |
---|
9 | left join kb3_item_types on itt_id = groupID |
---|
10 | where typeID = '.$itemID; |
---|
11 | $qry->execute($query); |
---|
12 | |
---|
13 | if (!$row = $qry->getRow()) |
---|
14 | { |
---|
15 | $this->_valid = false; |
---|
16 | return; |
---|
17 | } |
---|
18 | $this->_valid = true; |
---|
19 | $this->_id = $row['typeID']; |
---|
20 | $this->item = $row; |
---|
21 | |
---|
22 | $this->attrib = array(); |
---|
23 | $query = 'select kb3_dgmtypeattributes.*,kb3_dgmattributetypes.*,kb3_eveunits.displayName as unit |
---|
24 | from kb3_dgmtypeattributes |
---|
25 | inner join kb3_dgmattributetypes on kb3_dgmtypeattributes.attributeID = kb3_dgmattributetypes.attributeID |
---|
26 | left join kb3_eveunits on kb3_dgmattributetypes.unitID = kb3_eveunits.unitID |
---|
27 | where typeID = '.$itemID; |
---|
28 | |
---|
29 | $qry->execute($query); |
---|
30 | while ($row = $qry->getRow()) |
---|
31 | { |
---|
32 | if ($row['displayName'] == '') |
---|
33 | { |
---|
34 | $row['displayName'] = $row['attributeName']; |
---|
35 | } |
---|
36 | $this->attrib[$row['attributeName']] = $row; |
---|
37 | } |
---|
38 | |
---|
39 | $this->effects = array(); |
---|
40 | $query = 'select * from kb3_dgmtypeeffects |
---|
41 | inner join kb3_dgmeffects on kb3_dgmtypeeffects.effectID = kb3_dgmeffects.effectID |
---|
42 | where typeID = '.$itemID; |
---|
43 | |
---|
44 | $qry->execute($query); |
---|
45 | while ($row = $qry->getRow()) |
---|
46 | { |
---|
47 | if (!$row['effectName']) |
---|
48 | { |
---|
49 | var_export($row); |
---|
50 | continue; |
---|
51 | } |
---|
52 | if ($row['displayName'] == '') |
---|
53 | { |
---|
54 | $row['displayName'] = $row['effectName']; |
---|
55 | } |
---|
56 | $this->effects[$row['effectName']] = $row; |
---|
57 | } |
---|
58 | } |
---|
59 | |
---|
60 | function get($string) |
---|
61 | { |
---|
62 | if (isset($this->item[$string])) |
---|
63 | { |
---|
64 | return $this->item[$string]; |
---|
65 | } |
---|
66 | |
---|
67 | return false; |
---|
68 | } |
---|
69 | |
---|
70 | function isValid() |
---|
71 | { |
---|
72 | return $this->_valid; |
---|
73 | } |
---|
74 | |
---|
75 | function resolveTypeID($id) |
---|
76 | { |
---|
77 | $id = intval($id); |
---|
78 | $qry = new DBQuery(); |
---|
79 | $qry->execute('select typeName from kb3_invtypes where typeID='.$id); |
---|
80 | $row = $qry->getRow(); |
---|
81 | return $row['typeName']; |
---|
82 | } |
---|
83 | |
---|
84 | function resolveGroupID($id) |
---|
85 | { |
---|
86 | $id = intval($id); |
---|
87 | $qry = new DBQuery(); |
---|
88 | $qry->execute('select itt_name from kb3_item_types where itt_id='.$id); |
---|
89 | $row = $qry->getRow(); |
---|
90 | return $row['itt_name']; |
---|
91 | } |
---|
92 | |
---|
93 | function resolveAttributeID($id) |
---|
94 | { |
---|
95 | $id = intval($id); |
---|
96 | $qry = new DBQuery(); |
---|
97 | $qry->execute('select displayName from kb3_dgmattributetypes where attributeID='.$id); |
---|
98 | $row = $qry->getRow(); |
---|
99 | return $row['displayName']; |
---|
100 | }} |
---|
101 | ?> |
---|