@@ -48,26 +48,26 @@ discard block |
||
48 | 48 | { |
49 | 49 | global $moddir; |
50 | 50 | $this->db = Database::getInstance(); |
51 | - $this->initVar('fieldtypeid', XOBJ_DTYPE_INT, null, false); |
|
52 | - $this->initVar('dirid', XOBJ_DTYPE_INT, null, false); |
|
53 | - $this->initVar('title', XOBJ_DTYPE_TXTBOX); |
|
54 | - $this->initVar('fieldtype', XOBJ_DTYPE_TXTBOX); |
|
55 | - $this->initVar('descr', XOBJ_DTYPE_TXTAREA); |
|
56 | - $this->initVar('ext', XOBJ_DTYPE_TXTBOX); |
|
51 | + $this->initVar('fieldtypeid', XOBJ_DTYPE_INT, null, false); |
|
52 | + $this->initVar('dirid', XOBJ_DTYPE_INT, null, false); |
|
53 | + $this->initVar('title', XOBJ_DTYPE_TXTBOX); |
|
54 | + $this->initVar('fieldtype', XOBJ_DTYPE_TXTBOX); |
|
55 | + $this->initVar('descr', XOBJ_DTYPE_TXTAREA); |
|
56 | + $this->initVar('ext', XOBJ_DTYPE_TXTBOX); |
|
57 | 57 | $this->initVar('activeyn', XOBJ_DTYPE_INT, 0, false); |
58 | 58 | |
59 | 59 | if ($fieldtype != false) { |
60 | 60 | if (is_array($fieldtype)) { |
61 | - $this->assignVars($fieldtype); |
|
62 | - } else { |
|
61 | + $this->assignVars($fieldtype); |
|
62 | + } else { |
|
63 | 63 | $fieldtype_handler = new efqFieldTypeHandler($this->db); |
64 | - $objFieldtype =& $fieldtype_handler->get($fieldtype); |
|
65 | - foreach ($objFieldtype->vars as $k => $v) { |
|
66 | - $this->assignVar($k, $v['value']); |
|
67 | - } |
|
68 | - unset($objFieldtype); |
|
69 | - } |
|
70 | - } |
|
64 | + $objFieldtype =& $fieldtype_handler->get($fieldtype); |
|
65 | + foreach ($objFieldtype->vars as $k => $v) { |
|
66 | + $this->assignVar($k, $v['value']); |
|
67 | + } |
|
68 | + unset($objFieldtype); |
|
69 | + } |
|
70 | + } |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | |
@@ -201,37 +201,37 @@ discard block |
||
201 | 201 | $sql = "DELETE * FROM ".$this->db->prefix("efqdiralpha1_fieldtypes")." WHERE typeid='".intval($this->getVar("typeid"))."'"; |
202 | 202 | if ($force) { |
203 | 203 | if (!$result = $this->db->queryF($sql)) { |
204 | - return false; |
|
205 | - } |
|
204 | + return false; |
|
205 | + } |
|
206 | 206 | } else { |
207 | 207 | if (!$result = $this->db->query($sql)) { |
208 | - return false; |
|
209 | - } |
|
208 | + return false; |
|
209 | + } |
|
210 | 210 | } |
211 | - return true; |
|
211 | + return true; |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | /** |
215 | - * retrieve all field types for a directory |
|
216 | - * |
|
217 | - * @param int $dirid ID of the directory |
|
218 | - * @return array $arr or boolean false |
|
219 | - */ |
|
215 | + * retrieve all field types for a directory |
|
216 | + * |
|
217 | + * @param int $dirid ID of the directory |
|
218 | + * @return array $arr or boolean false |
|
219 | + */ |
|
220 | 220 | function getByDir($dirid=0) |
221 | 221 | { |
222 | 222 | //Get all fieldtypes for the selected directory |
223 | 223 | $sql = "SELECT typeid,title,fieldtype,descr,ext,activeyn FROM ".$this->db->prefix("efqdiralpha1_fieldtypes")." WHERE dirid=".intval($dirid).""; |
224 | - if (!$result = $this->db->query($sql)) { |
|
225 | - return false; |
|
226 | - } |
|
227 | - $result = $this->db->query($sql); |
|
224 | + if (!$result = $this->db->query($sql)) { |
|
225 | + return false; |
|
226 | + } |
|
227 | + $result = $this->db->query($sql); |
|
228 | 228 | $numrows = $this->db->getRowsNum($result); |
229 | 229 | $result = $this->db->query($sql); |
230 | 230 | $arr = array(); |
231 | - while ( list($typeid,$title,$fieldtype,$descr,$ext,$activeyn) = $this->db->fetchRow($result) ) { |
|
231 | + while ( list($typeid,$title,$fieldtype,$descr,$ext,$activeyn) = $this->db->fetchRow($result) ) { |
|
232 | 232 | $arr[$typeid] = array('typeid' => $typeid,'title' => $title,'fieldtype' => $fieldtype,'descr' => $descr, 'ext' => $ext, 'activeyn' => $activeyn); |
233 | 233 | } |
234 | - return $arr; |
|
234 | + return $arr; |
|
235 | 235 | } |
236 | 236 | |
237 | 237 |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | class efqFieldType extends XoopsObject |
45 | 45 | { |
46 | 46 | |
47 | - function efqFieldType($fieldtype=false) |
|
47 | + function efqFieldType($fieldtype = false) |
|
48 | 48 | { |
49 | 49 | global $moddir; |
50 | 50 | $this->db = Database::getInstance(); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $this->assignVars($fieldtype); |
62 | 62 | } else { |
63 | 63 | $fieldtype_handler = new efqFieldTypeHandler($this->db); |
64 | - $objFieldtype =& $fieldtype_handler->get($fieldtype); |
|
64 | + $objFieldtype = & $fieldtype_handler->get($fieldtype); |
|
65 | 65 | foreach ($objFieldtype->vars as $k => $v) { |
66 | 66 | $this->assignVar($k, $v['value']); |
67 | 67 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @return bool true if insertion is succesful, false if unsuccesful |
102 | 102 | */ |
103 | - function insertFieldType($obj, $forceQuery=false) { |
|
103 | + function insertFieldType($obj, $forceQuery = false) { |
|
104 | 104 | $tablename = "efqdiralpha1_fieldtypes"; |
105 | 105 | $keyName = "typeid"; |
106 | 106 | $excludedVars = array(); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $strFields = ""; |
118 | 118 | $strValues = ""; |
119 | 119 | foreach ($cleanvars as $k => $v) { |
120 | - if ( !in_array($k, $excludedVars) ) { |
|
120 | + if (!in_array($k, $excludedVars)) { |
|
121 | 121 | $strFields .= $k; |
122 | 122 | $strValues .= "'".$v."'"; |
123 | 123 | if ($i < $countVars) { |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * |
155 | 155 | * @return bool true if update is succesful, false if unsuccesful |
156 | 156 | */ |
157 | - function updateFieldType($obj, $forceQuery=false) { |
|
157 | + function updateFieldType($obj, $forceQuery = false) { |
|
158 | 158 | $tablename = "efqdiralpha1_fieldtypes"; |
159 | 159 | $keyName = "typeid"; |
160 | 160 | $excludedVars = array(); |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $strSet = ""; |
173 | 173 | $strValues = ""; |
174 | 174 | foreach ($cleanvars as $k => $v) { |
175 | - if ( !in_array($k, $excludedVars) ) { |
|
175 | + if (!in_array($k, $excludedVars)) { |
|
176 | 176 | if ($i < $countVars and $i > 1) { |
177 | 177 | $strSet .= ", "; |
178 | 178 | } |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | return false; |
194 | 194 | } |
195 | 195 | |
196 | - function delete($obj_fieldtype,$force=false) |
|
196 | + function delete($obj_fieldtype, $force = false) |
|
197 | 197 | { |
198 | 198 | if (!is_object($obj_fieldtype)) { |
199 | 199 | return false; |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | * @param int $dirid ID of the directory |
218 | 218 | * @return array $arr or boolean false |
219 | 219 | */ |
220 | - function getByDir($dirid=0) |
|
220 | + function getByDir($dirid = 0) |
|
221 | 221 | { |
222 | 222 | //Get all fieldtypes for the selected directory |
223 | 223 | $sql = "SELECT typeid,title,fieldtype,descr,ext,activeyn FROM ".$this->db->prefix("efqdiralpha1_fieldtypes")." WHERE dirid=".intval($dirid).""; |
@@ -228,8 +228,8 @@ discard block |
||
228 | 228 | $numrows = $this->db->getRowsNum($result); |
229 | 229 | $result = $this->db->query($sql); |
230 | 230 | $arr = array(); |
231 | - while ( list($typeid,$title,$fieldtype,$descr,$ext,$activeyn) = $this->db->fetchRow($result) ) { |
|
232 | - $arr[$typeid] = array('typeid' => $typeid,'title' => $title,'fieldtype' => $fieldtype,'descr' => $descr, 'ext' => $ext, 'activeyn' => $activeyn); |
|
231 | + while (list($typeid, $title, $fieldtype, $descr, $ext, $activeyn) = $this->db->fetchRow($result)) { |
|
232 | + $arr[$typeid] = array('typeid' => $typeid, 'title' => $title, 'fieldtype' => $fieldtype, 'descr' => $descr, 'ext' => $ext, 'activeyn' => $activeyn); |
|
233 | 233 | } |
234 | 234 | return $arr; |
235 | 235 | } |
@@ -74,54 +74,54 @@ discard block |
||
74 | 74 | class XoopsImageHandler extends XoopsObjectHandler |
75 | 75 | { |
76 | 76 | |
77 | - /** |
|
78 | - * Create a new {@link XoopsImage} |
|
79 | - * |
|
80 | - * @param boolean $isNew Flag the object as "new" |
|
81 | - * @return object |
|
82 | - **/ |
|
83 | - function &create($isNew = true) |
|
84 | - { |
|
85 | - $image = new XoopsImage(); |
|
86 | - if ($isNew) { |
|
87 | - $image->setNew(); |
|
88 | - } |
|
89 | - return $image; |
|
90 | - } |
|
77 | + /** |
|
78 | + * Create a new {@link XoopsImage} |
|
79 | + * |
|
80 | + * @param boolean $isNew Flag the object as "new" |
|
81 | + * @return object |
|
82 | + **/ |
|
83 | + function &create($isNew = true) |
|
84 | + { |
|
85 | + $image = new XoopsImage(); |
|
86 | + if ($isNew) { |
|
87 | + $image->setNew(); |
|
88 | + } |
|
89 | + return $image; |
|
90 | + } |
|
91 | 91 | |
92 | - /** |
|
93 | - * Write a {@link XoopsImage} object to the database |
|
94 | - * |
|
95 | - * @param object &$image {@link XoopsImage} |
|
96 | - * @return bool |
|
97 | - **/ |
|
98 | - function insert(&$image, $itemid='0') |
|
99 | - { |
|
100 | - global $image_name; |
|
101 | - if ($itemid == '0') { |
|
92 | + /** |
|
93 | + * Write a {@link XoopsImage} object to the database |
|
94 | + * |
|
95 | + * @param object &$image {@link XoopsImage} |
|
96 | + * @return bool |
|
97 | + **/ |
|
98 | + function insert(&$image, $itemid='0') |
|
99 | + { |
|
100 | + global $image_name; |
|
101 | + if ($itemid == '0') { |
|
102 | 102 | return false; |
103 | 103 | } |
104 | 104 | //if (strtolower(get_class($image)) != 'xoopsimage') { |
105 | - // return false; |
|
106 | - //} |
|
107 | - if (!$image->isDirty()) { |
|
108 | - return true; |
|
109 | - } |
|
110 | - if (!$image->cleanVars()) { |
|
111 | - return false; |
|
112 | - } |
|
113 | - foreach ($image->cleanVars as $k => $v) { |
|
114 | - ${$k} = $v; |
|
115 | - } |
|
116 | - if ($image->isNew()) { |
|
117 | - $image_id = $this->db->genId('image_image_id_seq'); |
|
118 | - $sql = sprintf("INSERT INTO %s WHERE itemid=".$itemid." (logourl) VALUES (%s)", $this->db->prefix('efqdiralpha1_items'), $this->db->quoteString($image_name)); |
|
119 | - if (!$result = $this->db->query($sql)) { |
|
120 | - return false; |
|
121 | - } |
|
122 | - if (empty($image_id)) { |
|
123 | - $image_id = $this->db->getInsertId(); |
|
124 | - } |
|
105 | + // return false; |
|
106 | + //} |
|
107 | + if (!$image->isDirty()) { |
|
108 | + return true; |
|
109 | + } |
|
110 | + if (!$image->cleanVars()) { |
|
111 | + return false; |
|
112 | + } |
|
113 | + foreach ($image->cleanVars as $k => $v) { |
|
114 | + ${$k} = $v; |
|
115 | + } |
|
116 | + if ($image->isNew()) { |
|
117 | + $image_id = $this->db->genId('image_image_id_seq'); |
|
118 | + $sql = sprintf("INSERT INTO %s WHERE itemid=".$itemid." (logourl) VALUES (%s)", $this->db->prefix('efqdiralpha1_items'), $this->db->quoteString($image_name)); |
|
119 | + if (!$result = $this->db->query($sql)) { |
|
120 | + return false; |
|
121 | + } |
|
122 | + if (empty($image_id)) { |
|
123 | + $image_id = $this->db->getInsertId(); |
|
124 | + } |
|
125 | 125 | /* if (isset($image_body) && $image_body != '') { |
126 | 126 | $sql = sprintf("INSERT INTO %s (image_id, image_body) VALUES (%u, %s)", $this->db->prefix('imagebody'), $image_id, $this->db->quoteString($image_body)); |
127 | 127 | if (!$result = $this->db->query($sql)) { |
@@ -130,12 +130,12 @@ discard block |
||
130 | 130 | return false; |
131 | 131 | } |
132 | 132 | } */ |
133 | - /* $image->assignVar('image_id', $image_id); */ |
|
134 | - } else { |
|
135 | - $sql = sprintf("UPDATE %s SET image_name = %s WHERE itemid = %u", $this->db->prefix('efqdiralpha1_items'), $this->db->quoteString($image_name)); |
|
136 | - if (!$result = $this->db->query($sql)) { |
|
137 | - return false; |
|
138 | - } |
|
133 | + /* $image->assignVar('image_id', $image_id); */ |
|
134 | + } else { |
|
135 | + $sql = sprintf("UPDATE %s SET image_name = %s WHERE itemid = %u", $this->db->prefix('efqdiralpha1_items'), $this->db->quoteString($image_name)); |
|
136 | + if (!$result = $this->db->query($sql)) { |
|
137 | + return false; |
|
138 | + } |
|
139 | 139 | /* if (isset($image_body) && $image_body != '') { |
140 | 140 | $sql = sprintf("UPDATE %s SET image_body = %s WHERE image_id = %u", $this->db->prefix('imagebody'), $this->db->quoteString($image_body), $image_id); |
141 | 141 | if (!$result = $this->db->query($sql)) { |
@@ -143,110 +143,110 @@ discard block |
||
143 | 143 | return false; |
144 | 144 | } |
145 | 145 | } */ |
146 | - } |
|
147 | - return true; |
|
148 | - } |
|
146 | + } |
|
147 | + return true; |
|
148 | + } |
|
149 | 149 | |
150 | - /** |
|
151 | - * Delete an image from the database |
|
152 | - * |
|
153 | - * @param object &$image {@link XoopsImage} |
|
154 | - * @return bool |
|
155 | - **/ |
|
156 | - function delete(&$image) |
|
157 | - { |
|
158 | - if (strtolower(get_class($image)) != 'xoopsimage') { |
|
159 | - return false; |
|
160 | - } |
|
161 | - $id = $image->getVar('image_id'); |
|
162 | - $sql = sprintf("DELETE FROM %s WHERE image_id = %u", $this->db->prefix('image'), $id); |
|
163 | - if (!$result = $this->db->query($sql)) { |
|
164 | - return false; |
|
165 | - } |
|
166 | - $sql = sprintf("DELETE FROM %s WHERE image_id = %u", $this->db->prefix('imagebody'), $id); |
|
167 | - $this->db->query($sql); |
|
168 | - return true; |
|
169 | - } |
|
150 | + /** |
|
151 | + * Delete an image from the database |
|
152 | + * |
|
153 | + * @param object &$image {@link XoopsImage} |
|
154 | + * @return bool |
|
155 | + **/ |
|
156 | + function delete(&$image) |
|
157 | + { |
|
158 | + if (strtolower(get_class($image)) != 'xoopsimage') { |
|
159 | + return false; |
|
160 | + } |
|
161 | + $id = $image->getVar('image_id'); |
|
162 | + $sql = sprintf("DELETE FROM %s WHERE image_id = %u", $this->db->prefix('image'), $id); |
|
163 | + if (!$result = $this->db->query($sql)) { |
|
164 | + return false; |
|
165 | + } |
|
166 | + $sql = sprintf("DELETE FROM %s WHERE image_id = %u", $this->db->prefix('imagebody'), $id); |
|
167 | + $this->db->query($sql); |
|
168 | + return true; |
|
169 | + } |
|
170 | 170 | |
171 | - /** |
|
172 | - * Load {@link XoopsImage}s from the database |
|
173 | - * |
|
174 | - * @param object $criteria {@link CriteriaElement} |
|
175 | - * @param boolean $id_as_key Use the ID as key into the array |
|
176 | - * @param boolean $getbinary |
|
177 | - * @return array Array of {@link XoopsImage} objects |
|
178 | - **/ |
|
179 | - function &getObjects($criteria = null, $id_as_key = false, $getbinary = false) |
|
180 | - { |
|
181 | - $ret = array(); |
|
182 | - $limit = $start = 0; |
|
183 | - if ($getbinary) { |
|
184 | - $sql = 'SELECT i.*, b.image_body FROM '.$this->db->prefix('image').' i LEFT JOIN '.$this->db->prefix('imagebody').' b ON b.image_id=i.image_id'; |
|
185 | - } else { |
|
186 | - $sql = 'SELECT * FROM '.$this->db->prefix('image'); |
|
187 | - } |
|
188 | - if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
|
189 | - $sql .= ' '.$criteria->renderWhere(); |
|
190 | - $sort = !in_array($criteria->getSort(), array('image_id', 'image_created', 'image_mimetype', 'image_display', 'image_weight')) ? 'image_weight' : $criteria->getSort(); |
|
191 | - $sql .= ' ORDER BY '.$sort.' '.$criteria->getOrder(); |
|
192 | - $limit = $criteria->getLimit(); |
|
193 | - $start = $criteria->getStart(); |
|
194 | - } |
|
195 | - $result = $this->db->query($sql, $limit, $start); |
|
196 | - if (!$result) { |
|
197 | - return $ret; |
|
198 | - } |
|
199 | - while ($myrow = $this->db->fetchArray($result)) { |
|
200 | - $image = new XoopsImage(); |
|
201 | - $image->assignVars($myrow); |
|
202 | - if (!$id_as_key) { |
|
203 | - $ret[] =& $image; |
|
204 | - } else { |
|
205 | - $ret[$myrow['image_id']] =& $image; |
|
206 | - } |
|
207 | - unset($image); |
|
208 | - } |
|
209 | - return $ret; |
|
210 | - } |
|
171 | + /** |
|
172 | + * Load {@link XoopsImage}s from the database |
|
173 | + * |
|
174 | + * @param object $criteria {@link CriteriaElement} |
|
175 | + * @param boolean $id_as_key Use the ID as key into the array |
|
176 | + * @param boolean $getbinary |
|
177 | + * @return array Array of {@link XoopsImage} objects |
|
178 | + **/ |
|
179 | + function &getObjects($criteria = null, $id_as_key = false, $getbinary = false) |
|
180 | + { |
|
181 | + $ret = array(); |
|
182 | + $limit = $start = 0; |
|
183 | + if ($getbinary) { |
|
184 | + $sql = 'SELECT i.*, b.image_body FROM '.$this->db->prefix('image').' i LEFT JOIN '.$this->db->prefix('imagebody').' b ON b.image_id=i.image_id'; |
|
185 | + } else { |
|
186 | + $sql = 'SELECT * FROM '.$this->db->prefix('image'); |
|
187 | + } |
|
188 | + if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
|
189 | + $sql .= ' '.$criteria->renderWhere(); |
|
190 | + $sort = !in_array($criteria->getSort(), array('image_id', 'image_created', 'image_mimetype', 'image_display', 'image_weight')) ? 'image_weight' : $criteria->getSort(); |
|
191 | + $sql .= ' ORDER BY '.$sort.' '.$criteria->getOrder(); |
|
192 | + $limit = $criteria->getLimit(); |
|
193 | + $start = $criteria->getStart(); |
|
194 | + } |
|
195 | + $result = $this->db->query($sql, $limit, $start); |
|
196 | + if (!$result) { |
|
197 | + return $ret; |
|
198 | + } |
|
199 | + while ($myrow = $this->db->fetchArray($result)) { |
|
200 | + $image = new XoopsImage(); |
|
201 | + $image->assignVars($myrow); |
|
202 | + if (!$id_as_key) { |
|
203 | + $ret[] =& $image; |
|
204 | + } else { |
|
205 | + $ret[$myrow['image_id']] =& $image; |
|
206 | + } |
|
207 | + unset($image); |
|
208 | + } |
|
209 | + return $ret; |
|
210 | + } |
|
211 | 211 | |
212 | - /** |
|
213 | - * Count some images |
|
214 | - * |
|
215 | - * @param object $criteria {@link CriteriaElement} |
|
216 | - * @return int |
|
217 | - **/ |
|
218 | - function getCount($criteria = null) |
|
219 | - { |
|
220 | - $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('image'); |
|
221 | - if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
|
222 | - $sql .= ' '.$criteria->renderWhere(); |
|
223 | - } |
|
224 | - if (!$result =& $this->db->query($sql)) { |
|
225 | - return 0; |
|
226 | - } |
|
227 | - list($count) = $this->db->fetchRow($result); |
|
228 | - return $count; |
|
229 | - } |
|
212 | + /** |
|
213 | + * Count some images |
|
214 | + * |
|
215 | + * @param object $criteria {@link CriteriaElement} |
|
216 | + * @return int |
|
217 | + **/ |
|
218 | + function getCount($criteria = null) |
|
219 | + { |
|
220 | + $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('image'); |
|
221 | + if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
|
222 | + $sql .= ' '.$criteria->renderWhere(); |
|
223 | + } |
|
224 | + if (!$result =& $this->db->query($sql)) { |
|
225 | + return 0; |
|
226 | + } |
|
227 | + list($count) = $this->db->fetchRow($result); |
|
228 | + return $count; |
|
229 | + } |
|
230 | 230 | |
231 | - /** |
|
232 | - * Get a list of images |
|
233 | - * |
|
234 | - * @param int $imgcat_id |
|
235 | - * @param bool $image_display |
|
236 | - * @return array Array of {@link XoopsImage} objects |
|
237 | - **/ |
|
238 | - function &getList($imgcat_id, $image_display = null) |
|
239 | - { |
|
240 | - $criteria = new CriteriaCompo(new Criteria('imgcat_id', intval($imgcat_id))); |
|
241 | - if (isset($image_display)) { |
|
242 | - $criteria->add(new Criteria('image_display', intval($image_display))); |
|
243 | - } |
|
244 | - $images =& $this->getObjects($criteria, false, true); |
|
245 | - $ret = array(); |
|
246 | - foreach (array_keys($images) as $i) { |
|
247 | - $ret[$images[$i]->getVar('image_name')] = $images[$i]->getVar('image_nicename'); |
|
248 | - } |
|
249 | - return $ret; |
|
250 | - } |
|
231 | + /** |
|
232 | + * Get a list of images |
|
233 | + * |
|
234 | + * @param int $imgcat_id |
|
235 | + * @param bool $image_display |
|
236 | + * @return array Array of {@link XoopsImage} objects |
|
237 | + **/ |
|
238 | + function &getList($imgcat_id, $image_display = null) |
|
239 | + { |
|
240 | + $criteria = new CriteriaCompo(new Criteria('imgcat_id', intval($imgcat_id))); |
|
241 | + if (isset($image_display)) { |
|
242 | + $criteria->add(new Criteria('image_display', intval($image_display))); |
|
243 | + } |
|
244 | + $images =& $this->getObjects($criteria, false, true); |
|
245 | + $ret = array(); |
|
246 | + foreach (array_keys($images) as $i) { |
|
247 | + $ret[$images[$i]->getVar('image_name')] = $images[$i]->getVar('image_nicename'); |
|
248 | + } |
|
249 | + return $ret; |
|
250 | + } |
|
251 | 251 | } |
252 | 252 | ?> |
253 | 253 | \ No newline at end of file |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @param object &$image {@link XoopsImage} |
96 | 96 | * @return bool |
97 | 97 | **/ |
98 | - function insert(&$image, $itemid='0') |
|
98 | + function insert(&$image, $itemid = '0') |
|
99 | 99 | { |
100 | 100 | global $image_name; |
101 | 101 | if ($itemid == '0') { |
@@ -200,9 +200,9 @@ discard block |
||
200 | 200 | $image = new XoopsImage(); |
201 | 201 | $image->assignVars($myrow); |
202 | 202 | if (!$id_as_key) { |
203 | - $ret[] =& $image; |
|
203 | + $ret[] = & $image; |
|
204 | 204 | } else { |
205 | - $ret[$myrow['image_id']] =& $image; |
|
205 | + $ret[$myrow['image_id']] = & $image; |
|
206 | 206 | } |
207 | 207 | unset($image); |
208 | 208 | } |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
222 | 222 | $sql .= ' '.$criteria->renderWhere(); |
223 | 223 | } |
224 | - if (!$result =& $this->db->query($sql)) { |
|
224 | + if (!$result = & $this->db->query($sql)) { |
|
225 | 225 | return 0; |
226 | 226 | } |
227 | 227 | list($count) = $this->db->fetchRow($result); |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | if (isset($image_display)) { |
242 | 242 | $criteria->add(new Criteria('image_display', intval($image_display))); |
243 | 243 | } |
244 | - $images =& $this->getObjects($criteria, false, true); |
|
244 | + $images = & $this->getObjects($criteria, false, true); |
|
245 | 245 | $ret = array(); |
246 | 246 | foreach (array_keys($images) as $i) { |
247 | 247 | $ret[$images[$i]->getVar('image_name')] = $images[$i]->getVar('image_nicename'); |
@@ -54,15 +54,15 @@ discard block |
||
54 | 54 | { |
55 | 55 | global $moddir; |
56 | 56 | $this->db = Database::getInstance(); |
57 | - $this->initVar('dtypeid', XOBJ_DTYPE_INT, 0, false); |
|
58 | - $this->initVar('title', XOBJ_DTYPE_TXTBOX, null, true, 255); |
|
57 | + $this->initVar('dtypeid', XOBJ_DTYPE_INT, 0, false); |
|
58 | + $this->initVar('title', XOBJ_DTYPE_TXTBOX, null, true, 255); |
|
59 | 59 | $this->initVar('section', XOBJ_DTYPE_INT, 0, false); |
60 | 60 | $this->initVar('fieldtypeid', XOBJ_DTYPE_INT, 0, false); |
61 | 61 | $this->initVar('uid', XOBJ_DTYPE_INT, 0, true, 5); |
62 | 62 | $this->initVar('defaultyn', XOBJ_DTYPE_INT, 0, true, 2); |
63 | - $this->initVar('created', XOBJ_DTYPE_INT, 0, true, 10); |
|
64 | - $this->initVar('seq', XOBJ_DTYPE_INT, 0, true, 5); |
|
65 | - $this->initVar('options', XOBJ_DTYPE_TXTBOX, null, false, 10); |
|
63 | + $this->initVar('created', XOBJ_DTYPE_INT, 0, true, 10); |
|
64 | + $this->initVar('seq', XOBJ_DTYPE_INT, 0, true, 5); |
|
65 | + $this->initVar('options', XOBJ_DTYPE_TXTBOX, null, false, 10); |
|
66 | 66 | $this->initVar('activeyn', XOBJ_DTYPE_INT, 0, true, 2); |
67 | 67 | $this->initVar('custom', XOBJ_DTYPE_TXTBOX, null, false, 10); |
68 | 68 | $this->initVar('icons', XOBJ_DTYPE_TXTBOX, null, false, 50); |
@@ -206,11 +206,11 @@ discard block |
||
206 | 206 | */ |
207 | 207 | function setDataType($gpc_dtypeid=0) { |
208 | 208 | $sql = "SELECT dtypeid,title,section,fieldtypeid,uid,defaultyn,created,seq,activeyn,options,custom,icon WHERE dtypeid=".intval($gpc_dtypeid); |
209 | - $result = $this->db->query($sql); |
|
210 | - $numrows = $this->db->getRowsNum($result); |
|
211 | - if ( $numrows > 0 ) { |
|
212 | - while (list($dtypeid,$title,$section,$fieldtypeid,$uid,$defaultyn, $activeyn, |
|
213 | - $options,$custom,$icon) = $this->db->fetchRow($result)) { |
|
209 | + $result = $this->db->query($sql); |
|
210 | + $numrows = $this->db->getRowsNum($result); |
|
211 | + if ( $numrows > 0 ) { |
|
212 | + while (list($dtypeid,$title,$section,$fieldtypeid,$uid,$defaultyn, $activeyn, |
|
213 | + $options,$custom,$icon) = $this->db->fetchRow($result)) { |
|
214 | 214 | if (! $this->objDataType ) { |
215 | 215 | $this->objDataType = new efqDataType(); |
216 | 216 | } |
@@ -226,8 +226,8 @@ discard block |
||
226 | 226 | $this->objDataType->setVar('activeyn', $activeyn); |
227 | 227 | $this->objDataType->setVar('custom', $custom); |
228 | 228 | $this->objDataType->setVar('icon', $icon); |
229 | - } |
|
230 | - } else { |
|
229 | + } |
|
230 | + } else { |
|
231 | 231 | return false; |
232 | 232 | } |
233 | 233 | return true; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * @param bool $itemtype |
51 | 51 | * @return |
52 | 52 | */ |
53 | - function efqDataType($offer=false) |
|
53 | + function efqDataType($offer = false) |
|
54 | 54 | { |
55 | 55 | global $moddir; |
56 | 56 | $this->db = Database::getInstance(); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @return |
91 | 91 | */ |
92 | - function efqDataTypeHandler($obj=false) { |
|
92 | + function efqDataTypeHandler($obj = false) { |
|
93 | 93 | $this->db = Database::getInstance(); |
94 | 94 | $this->objDataType = $obj; |
95 | 95 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * |
105 | 105 | * @return bool true if insertion is succesful, false if unsuccesful |
106 | 106 | */ |
107 | - function insertDataType($obj, $forceQuery=false) { |
|
107 | + function insertDataType($obj, $forceQuery = false) { |
|
108 | 108 | $tablename = "efqdiralpha1_dtypes"; |
109 | 109 | $keyName = "dtypeid"; |
110 | 110 | $excludedVars = array(); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | $strFields = ""; |
122 | 122 | $strValues = ""; |
123 | 123 | foreach ($cleanvars as $k => $v) { |
124 | - if ( !in_array($k, $excludedVars) ) { |
|
124 | + if (!in_array($k, $excludedVars)) { |
|
125 | 125 | $strFields .= $k; |
126 | 126 | $strValues .= "'".$v."'"; |
127 | 127 | if ($i < $countVars) { |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * |
159 | 159 | * @return bool true if update is succesful, false if unsuccesful |
160 | 160 | */ |
161 | - function updateDataType($obj, $forceQuery=false) { |
|
161 | + function updateDataType($obj, $forceQuery = false) { |
|
162 | 162 | $tablename = "efqdiralpha1_dtypes"; |
163 | 163 | $keyName = "dtypeid"; |
164 | 164 | $excludedVars = array(); |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $strSet = ""; |
177 | 177 | $strValues = ""; |
178 | 178 | foreach ($cleanvars as $k => $v) { |
179 | - if ( !in_array($k, $excludedVars) ) { |
|
179 | + if (!in_array($k, $excludedVars)) { |
|
180 | 180 | if ($i < $countVars and $i > 1) { |
181 | 181 | $strSet .= ", "; |
182 | 182 | } |
@@ -204,14 +204,14 @@ discard block |
||
204 | 204 | * |
205 | 205 | * @return bool true or false |
206 | 206 | */ |
207 | - function setDataType($gpc_dtypeid=0) { |
|
207 | + function setDataType($gpc_dtypeid = 0) { |
|
208 | 208 | $sql = "SELECT dtypeid,title,section,fieldtypeid,uid,defaultyn,created,seq,activeyn,options,custom,icon WHERE dtypeid=".intval($gpc_dtypeid); |
209 | 209 | $result = $this->db->query($sql); |
210 | 210 | $numrows = $this->db->getRowsNum($result); |
211 | - if ( $numrows > 0 ) { |
|
212 | - while (list($dtypeid,$title,$section,$fieldtypeid,$uid,$defaultyn, $activeyn, |
|
213 | - $options,$custom,$icon) = $this->db->fetchRow($result)) { |
|
214 | - if (! $this->objDataType ) { |
|
211 | + if ($numrows > 0) { |
|
212 | + while (list($dtypeid, $title, $section, $fieldtypeid, $uid, $defaultyn, $activeyn, |
|
213 | + $options, $custom, $icon) = $this->db->fetchRow($result)) { |
|
214 | + if (!$this->objDataType) { |
|
215 | 215 | $this->objDataType = new efqDataType(); |
216 | 216 | } |
217 | 217 | $this->objDataType->setVar('dtypeid', $dtypeid); |
@@ -37,41 +37,41 @@ discard block |
||
37 | 37 | $this->image = $myts->makeTboxData4Save($_POST['image']); |
38 | 38 | $this->itemid = intval($_POST['itemid']); |
39 | 39 | $this->publish = strtotime($_POST['publish']['date']) + $_POST['publish']['time']; |
40 | - if (isset($_POST['expire_enable']) && ($_POST['expire_enable'] == 1)) { |
|
41 | - $this->expire = strtotime($_POST['expire']['date']) + $_POST['expire']['time']; |
|
42 | - } else { |
|
43 | - $this->expire = 0; |
|
44 | - } |
|
45 | - $this->lbr = $_POST['lbr']; |
|
46 | - $this->heading = $myts->makeTboxData4Save($_POST['heading']); |
|
47 | - if (!isset($_POST['couponid'])) { |
|
48 | - $this->_new = true; |
|
49 | - $this->message = _MD_COUPONADDED; |
|
50 | - if ($this->insert()) { |
|
51 | - return true; |
|
52 | - } else { |
|
53 | - return false; |
|
54 | - } |
|
55 | - } else { |
|
56 | - $this->message = _MD_COUPONUPDATED; |
|
57 | - $this->couponid = intval($_POST['couponid']); |
|
58 | - if ($this->update()) { |
|
59 | - return true; |
|
60 | - } else { |
|
61 | - return false; |
|
62 | - } |
|
63 | - } |
|
40 | + if (isset($_POST['expire_enable']) && ($_POST['expire_enable'] == 1)) { |
|
41 | + $this->expire = strtotime($_POST['expire']['date']) + $_POST['expire']['time']; |
|
42 | + } else { |
|
43 | + $this->expire = 0; |
|
44 | + } |
|
45 | + $this->lbr = $_POST['lbr']; |
|
46 | + $this->heading = $myts->makeTboxData4Save($_POST['heading']); |
|
47 | + if (!isset($_POST['couponid'])) { |
|
48 | + $this->_new = true; |
|
49 | + $this->message = _MD_COUPONADDED; |
|
50 | + if ($this->insert()) { |
|
51 | + return true; |
|
52 | + } else { |
|
53 | + return false; |
|
54 | + } |
|
55 | + } else { |
|
56 | + $this->message = _MD_COUPONUPDATED; |
|
57 | + $this->couponid = intval($_POST['couponid']); |
|
58 | + if ($this->update()) { |
|
59 | + return true; |
|
60 | + } else { |
|
61 | + return false; |
|
62 | + } |
|
63 | + } |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | function insert() { |
67 | 67 | $sql = "INSERT INTO ".$this->db->prefix("efqdiralpha1_coupon")." |
68 | 68 | (itemid, description, image, publish, expire, heading, lbr) VALUES |
69 | 69 | (".$this->itemid.", ".$this->db->quoteString($this->descr).", ".$this->db->quoteString($this->image).", ".$this->publish.", ".$this->expire.", ".$this->db->quoteString($this->heading).", ".$this->lbr.")"; |
70 | - if ($this->db->query($sql)) { |
|
71 | - $this->couponid = $this->db->getInsertId(); |
|
72 | - return true; |
|
73 | - } |
|
74 | - return false; |
|
70 | + if ($this->db->query($sql)) { |
|
71 | + $this->couponid = $this->db->getInsertId(); |
|
72 | + return true; |
|
73 | + } |
|
74 | + return false; |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | function update() { |
@@ -88,34 +88,34 @@ discard block |
||
88 | 88 | |
89 | 89 | function get($couponid=false) { |
90 | 90 | if ($couponid == false) { |
91 | - //echo 'couponid is false'; |
|
92 | - return false; |
|
93 | - } |
|
94 | - //$couponid = intval($couponid); |
|
95 | - if ($couponid > 0) { |
|
96 | - $sql = "SELECT itemid, description, image, publish, expire, heading, lbr FROM ".$this->db->prefix("efqdiralpha1_coupon")." WHERE couponid=".$couponid; |
|
97 | - //echo $sql; |
|
98 | - if (!$result = $this->db->query($sql)) { |
|
99 | - return false; |
|
100 | - } |
|
101 | - while(list($itemid, $descr, $image, $publish, $expire, $heading, $lbr) = $this->db->fetchRow($result)) { |
|
102 | - $this->itemid = $itemid; |
|
103 | - $this->descr = $descr; |
|
104 | - $this->image = $image; |
|
105 | - $this->publish = $publish; |
|
106 | - $this->expire = $expire; |
|
107 | - $this->heading = $heading; |
|
108 | - $this->lbr = $lbr; |
|
109 | - } |
|
110 | - return true; |
|
111 | - } |
|
112 | - return false; |
|
91 | + //echo 'couponid is false'; |
|
92 | + return false; |
|
93 | + } |
|
94 | + //$couponid = intval($couponid); |
|
95 | + if ($couponid > 0) { |
|
96 | + $sql = "SELECT itemid, description, image, publish, expire, heading, lbr FROM ".$this->db->prefix("efqdiralpha1_coupon")." WHERE couponid=".$couponid; |
|
97 | + //echo $sql; |
|
98 | + if (!$result = $this->db->query($sql)) { |
|
99 | + return false; |
|
100 | + } |
|
101 | + while(list($itemid, $descr, $image, $publish, $expire, $heading, $lbr) = $this->db->fetchRow($result)) { |
|
102 | + $this->itemid = $itemid; |
|
103 | + $this->descr = $descr; |
|
104 | + $this->image = $image; |
|
105 | + $this->publish = $publish; |
|
106 | + $this->expire = $expire; |
|
107 | + $this->heading = $heading; |
|
108 | + $this->lbr = $lbr; |
|
109 | + } |
|
110 | + return true; |
|
111 | + } |
|
112 | + return false; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | function delete($couponid) { |
116 | 116 | $sql = "DELETE FROM ".$this->db->prefix("efqdiralpha1_coupon")." WHERE couponid=".intval($couponid); |
117 | - $this->db->query($sql); |
|
118 | - return true; |
|
117 | + $this->db->query($sql); |
|
118 | + return true; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /* Returns number of coupons for a listing |
@@ -124,43 +124,43 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @return |
126 | 126 | */ |
127 | - function getCountByLink($itemid=0) { |
|
128 | - $ret = 0; |
|
129 | - $now = time(); |
|
127 | + function getCountByLink($itemid=0) { |
|
128 | + $ret = 0; |
|
129 | + $now = time(); |
|
130 | 130 | $sql = "SELECT count(*) FROM ".$this->db->prefix("efqdiralpha1_coupon")." WHERE itemid=".$itemid.' AND publish < '.$now.' AND (expire = 0 OR expire > '.$now.')'; |
131 | 131 | //echo $sql; |
132 | - if (!$result = $this->db->query($sql)) { |
|
133 | - return false; |
|
134 | - } |
|
135 | - list($ret) = $this->db->fetchRow($result); |
|
136 | - return $ret; |
|
137 | - } |
|
132 | + if (!$result = $this->db->query($sql)) { |
|
133 | + return false; |
|
134 | + } |
|
135 | + list($ret) = $this->db->fetchRow($result); |
|
136 | + return $ret; |
|
137 | + } |
|
138 | 138 | |
139 | - function getByItem($itemid=0) { |
|
140 | - if ($itemid == false) { |
|
141 | - //echo 'couponid is false'; |
|
142 | - return false; |
|
143 | - } |
|
144 | - //$couponid = intval($couponid); |
|
145 | - if ($itemid > 0) { |
|
146 | - $sql = "SELECT couponid, itemid, description, image, publish, expire, heading, lbr FROM ".$this->db->prefix("efqdiralpha1_coupon")." WHERE itemid=".$itemid; |
|
147 | - //echo $sql; |
|
148 | - if (!$result = $this->db->query($sql)) { |
|
149 | - return false; |
|
150 | - } |
|
151 | - while(list($couponid, $itemid, $descr, $image, $publish, $expire, $heading, $lbr) = $this->db->fetchRow($result)) { |
|
152 | - if ($publish == 0) { |
|
153 | - $publish = time(); |
|
154 | - } |
|
155 | - if ($expire > 0) { |
|
156 | - $expire = formatTimestamp($expire, 's'); |
|
157 | - } |
|
158 | - $publish = formatTimestamp($publish, 's'); |
|
159 | - $ret[] = array('couponid' => $couponid, 'itemid' => $itemid, 'descr' => $descr, 'image' => $image, 'publish' => $publish, 'expire' => $expire, 'heading' => $heading, 'lbr' => $lbr ); |
|
160 | - } |
|
161 | - return $ret; |
|
162 | - } |
|
163 | - return false; |
|
164 | - } |
|
139 | + function getByItem($itemid=0) { |
|
140 | + if ($itemid == false) { |
|
141 | + //echo 'couponid is false'; |
|
142 | + return false; |
|
143 | + } |
|
144 | + //$couponid = intval($couponid); |
|
145 | + if ($itemid > 0) { |
|
146 | + $sql = "SELECT couponid, itemid, description, image, publish, expire, heading, lbr FROM ".$this->db->prefix("efqdiralpha1_coupon")." WHERE itemid=".$itemid; |
|
147 | + //echo $sql; |
|
148 | + if (!$result = $this->db->query($sql)) { |
|
149 | + return false; |
|
150 | + } |
|
151 | + while(list($couponid, $itemid, $descr, $image, $publish, $expire, $heading, $lbr) = $this->db->fetchRow($result)) { |
|
152 | + if ($publish == 0) { |
|
153 | + $publish = time(); |
|
154 | + } |
|
155 | + if ($expire > 0) { |
|
156 | + $expire = formatTimestamp($expire, 's'); |
|
157 | + } |
|
158 | + $publish = formatTimestamp($publish, 's'); |
|
159 | + $ret[] = array('couponid' => $couponid, 'itemid' => $itemid, 'descr' => $descr, 'image' => $image, 'publish' => $publish, 'expire' => $expire, 'heading' => $heading, 'lbr' => $lbr ); |
|
160 | + } |
|
161 | + return $ret; |
|
162 | + } |
|
163 | + return false; |
|
164 | + } |
|
165 | 165 | } |
166 | 166 | ?> |
167 | 167 | \ No newline at end of file |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | |
30 | 30 | function efqCouponHandler() { |
31 | - $this->db =& Database::getInstance(); |
|
31 | + $this->db = & Database::getInstance(); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | function create() { |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | if (isset($_POST['expire_enable']) && ($_POST['expire_enable'] == 1)) { |
41 | 41 | $this->expire = strtotime($_POST['expire']['date']) + $_POST['expire']['time']; |
42 | 42 | } else { |
43 | - $this->expire = 0; |
|
43 | + $this->expire = 0; |
|
44 | 44 | } |
45 | 45 | $this->lbr = $_POST['lbr']; |
46 | 46 | $this->heading = $myts->makeTboxData4Save($_POST['heading']); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | return true; |
87 | 87 | } |
88 | 88 | |
89 | - function get($couponid=false) { |
|
89 | + function get($couponid = false) { |
|
90 | 90 | if ($couponid == false) { |
91 | 91 | //echo 'couponid is false'; |
92 | 92 | return false; |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | if (!$result = $this->db->query($sql)) { |
99 | 99 | return false; |
100 | 100 | } |
101 | - while(list($itemid, $descr, $image, $publish, $expire, $heading, $lbr) = $this->db->fetchRow($result)) { |
|
101 | + while (list($itemid, $descr, $image, $publish, $expire, $heading, $lbr) = $this->db->fetchRow($result)) { |
|
102 | 102 | $this->itemid = $itemid; |
103 | 103 | $this->descr = $descr; |
104 | 104 | $this->image = $image; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @return |
126 | 126 | */ |
127 | - function getCountByLink($itemid=0) { |
|
127 | + function getCountByLink($itemid = 0) { |
|
128 | 128 | $ret = 0; |
129 | 129 | $now = time(); |
130 | 130 | $sql = "SELECT count(*) FROM ".$this->db->prefix("efqdiralpha1_coupon")." WHERE itemid=".$itemid.' AND publish < '.$now.' AND (expire = 0 OR expire > '.$now.')'; |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | return $ret; |
137 | 137 | } |
138 | 138 | |
139 | - function getByItem($itemid=0) { |
|
139 | + function getByItem($itemid = 0) { |
|
140 | 140 | if ($itemid == false) { |
141 | 141 | //echo 'couponid is false'; |
142 | 142 | return false; |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | if (!$result = $this->db->query($sql)) { |
149 | 149 | return false; |
150 | 150 | } |
151 | - while(list($couponid, $itemid, $descr, $image, $publish, $expire, $heading, $lbr) = $this->db->fetchRow($result)) { |
|
151 | + while (list($couponid, $itemid, $descr, $image, $publish, $expire, $heading, $lbr) = $this->db->fetchRow($result)) { |
|
152 | 152 | if ($publish == 0) { |
153 | 153 | $publish = time(); |
154 | 154 | } |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | $expire = formatTimestamp($expire, 's'); |
157 | 157 | } |
158 | 158 | $publish = formatTimestamp($publish, 's'); |
159 | - $ret[] = array('couponid' => $couponid, 'itemid' => $itemid, 'descr' => $descr, 'image' => $image, 'publish' => $publish, 'expire' => $expire, 'heading' => $heading, 'lbr' => $lbr ); |
|
159 | + $ret[] = array('couponid' => $couponid, 'itemid' => $itemid, 'descr' => $descr, 'image' => $image, 'publish' => $publish, 'expire' => $expire, 'heading' => $heading, 'lbr' => $lbr); |
|
160 | 160 | } |
161 | 161 | return $ret; |
162 | 162 | } |
@@ -52,21 +52,21 @@ |
||
52 | 52 | class efqFormRadio extends XoopsFormElement { |
53 | 53 | |
54 | 54 | /** |
55 | - * Array of Options |
|
55 | + * Array of Options |
|
56 | 56 | * @var array |
57 | 57 | * @access private |
58 | 58 | */ |
59 | 59 | var $_options = array(); |
60 | 60 | |
61 | 61 | /** |
62 | - * Pre-selected value |
|
62 | + * Pre-selected value |
|
63 | 63 | * @var string |
64 | 64 | * @access private |
65 | 65 | */ |
66 | 66 | var $_value; |
67 | 67 | |
68 | 68 | /** |
69 | - * Pre-selected value |
|
69 | + * Pre-selected value |
|
70 | 70 | * @var string |
71 | 71 | * @access private |
72 | 72 | */ |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @param string $name "name" attribute |
79 | 79 | * @param string $value Pre-selected value |
80 | 80 | */ |
81 | - function efqFormRadio($caption, $name, $value = null, $linebreak = null){ |
|
81 | + function efqFormRadio($caption, $name, $value = null, $linebreak = null) { |
|
82 | 82 | $this->setCaption($caption); |
83 | 83 | $this->setName($name); |
84 | 84 | if (isset($value)) { |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * |
97 | 97 | * @return string |
98 | 98 | */ |
99 | - function getValue(){ |
|
99 | + function getValue() { |
|
100 | 100 | return $this->_value; |
101 | 101 | } |
102 | 102 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @return string |
107 | 107 | */ |
108 | - function getLineBreak(){ |
|
108 | + function getLineBreak() { |
|
109 | 109 | return $this->_linebreak; |
110 | 110 | } |
111 | 111 | /** |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @param $value string |
115 | 115 | */ |
116 | - function setValue($value){ |
|
116 | + function setValue($value) { |
|
117 | 117 | $this->_value = $value; |
118 | 118 | } |
119 | 119 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * |
123 | 123 | * @param $value string |
124 | 124 | */ |
125 | - function setLineBreak($linebreak){ |
|
125 | + function setLineBreak($linebreak) { |
|
126 | 126 | $this->_linebreak = $linebreak; |
127 | 127 | } |
128 | 128 | |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | * @param string $value "value" attribute - This gets submitted as form-data. |
133 | 133 | * @param string $name "name" attribute - This is displayed. If empty, we use the "value" instead. |
134 | 134 | */ |
135 | - function addOption($value, $name=""){ |
|
136 | - if ( $name != "" ) { |
|
135 | + function addOption($value, $name = "") { |
|
136 | + if ($name != "") { |
|
137 | 137 | $this->_options[$value] = $name; |
138 | 138 | } else { |
139 | 139 | $this->_options[$value] = $value; |
@@ -145,9 +145,9 @@ discard block |
||
145 | 145 | * |
146 | 146 | * @param array $options Associative array of value->name pairs. |
147 | 147 | */ |
148 | - function addOptionArray($options){ |
|
149 | - if ( is_array($options) ) { |
|
150 | - foreach ( $options as $k=>$v ) { |
|
148 | + function addOptionArray($options) { |
|
149 | + if (is_array($options)) { |
|
150 | + foreach ($options as $k=>$v) { |
|
151 | 151 | $this->addOption($k, $v); |
152 | 152 | } |
153 | 153 | } |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * |
159 | 159 | * @return array Associative array of value->name pairs. |
160 | 160 | */ |
161 | - function getOptions(){ |
|
161 | + function getOptions() { |
|
162 | 162 | return $this->_options; |
163 | 163 | } |
164 | 164 | |
@@ -167,12 +167,12 @@ discard block |
||
167 | 167 | * |
168 | 168 | * @return string HTML |
169 | 169 | */ |
170 | - function render(){ |
|
170 | + function render() { |
|
171 | 171 | $ret = ""; |
172 | - foreach ( $this->getOptions() as $value => $name ) { |
|
172 | + foreach ($this->getOptions() as $value => $name) { |
|
173 | 173 | $ret .= "<input type='radio' name='".$this->getName()."' value='".$value."'"; |
174 | 174 | $selected = $this->getValue(); |
175 | - if ( isset($selected) && ($value == $selected) ) { |
|
175 | + if (isset($selected) && ($value == $selected)) { |
|
176 | 176 | $ret .= " checked='checked'"; |
177 | 177 | } |
178 | 178 | $ret .= $this->getExtra()." />".$name."".$this->getLineBreak()."\n"; |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | /** |
566 | 566 | * Get the size |
567 | 567 | * |
568 | - * @return int |
|
568 | + * @return int |
|
569 | 569 | */ |
570 | 570 | function getSize(){ |
571 | 571 | return $this->_size; |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | /** |
575 | 575 | * Get an array of pre-selected values |
576 | 576 | * |
577 | - * @return array |
|
577 | + * @return array |
|
578 | 578 | */ |
579 | 579 | function getValue(){ |
580 | 580 | return $this->_value; |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | /** |
584 | 584 | * Set pre-selected values |
585 | 585 | * |
586 | - * @param $value mixed |
|
586 | + * @param $value mixed |
|
587 | 587 | */ |
588 | 588 | function setValue($value){ |
589 | 589 | if (is_array($value)) { |
@@ -597,9 +597,9 @@ discard block |
||
597 | 597 | |
598 | 598 | /** |
599 | 599 | * Add an option |
600 | - * |
|
600 | + * |
|
601 | 601 | * @param string $value "value" attribute |
602 | - * @param string $name "name" attribute |
|
602 | + * @param string $name "name" attribute |
|
603 | 603 | */ |
604 | 604 | function addOption($value, $name=""){ |
605 | 605 | if ( $name != "" ) { |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | /** |
613 | 613 | * Add multiple options |
614 | 614 | * |
615 | - * @param array $options Associative array of value->name pairs |
|
615 | + * @param array $options Associative array of value->name pairs |
|
616 | 616 | */ |
617 | 617 | function addOptionArray($options){ |
618 | 618 | if ( is_array($options) ) { |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | /** |
626 | 626 | * Get all options |
627 | 627 | * |
628 | - * @return array Associative array of value->name pairs |
|
628 | + * @return array Associative array of value->name pairs |
|
629 | 629 | */ |
630 | 630 | function getOptions(){ |
631 | 631 | return $this->_options; |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | /** |
636 | 636 | * Prepare HTML for output |
637 | 637 | * |
638 | - * @return string HTML |
|
638 | + * @return string HTML |
|
639 | 639 | */ |
640 | 640 | function render(){ |
641 | 641 | $ret = "<img src='".$this->getSrc()."' width='".$this->getWidth()."' height='".$this->getHeight()."'"; |
@@ -91,168 +91,168 @@ discard block |
||
91 | 91 | $ext_item_value = $ext_item_arr[1]; |
92 | 92 | |
93 | 93 | switch ($ext_item_name) { |
94 | - case "cols": |
|
95 | - $cols = $ext_item_value; |
|
96 | - break; |
|
97 | - case "rows": |
|
98 | - $rows = $ext_item_value; |
|
99 | - break; |
|
100 | - case "size": |
|
101 | - $size = $ext_item_value; |
|
102 | - break; |
|
103 | - case "maxsize": |
|
104 | - $maxsize = $ext_item_value; |
|
105 | - break; |
|
106 | - case "multiple": |
|
107 | - $multiple = true; |
|
108 | - $size = 5; |
|
109 | - case "value": |
|
110 | - if ($ext_item_value != '' and $value == '' ) { |
|
111 | - $value = $ext_item_value; |
|
112 | - } |
|
113 | - break; |
|
94 | + case "cols": |
|
95 | + $cols = $ext_item_value; |
|
96 | + break; |
|
97 | + case "rows": |
|
98 | + $rows = $ext_item_value; |
|
99 | + break; |
|
100 | + case "size": |
|
101 | + $size = $ext_item_value; |
|
102 | + break; |
|
103 | + case "maxsize": |
|
104 | + $maxsize = $ext_item_value; |
|
105 | + break; |
|
106 | + case "multiple": |
|
107 | + $multiple = true; |
|
108 | + $size = 5; |
|
109 | + case "value": |
|
110 | + if ($ext_item_value != '' and $value == '' ) { |
|
111 | + $value = $ext_item_value; |
|
112 | + } |
|
113 | + break; |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
118 | 118 | switch ($fieldtype) { |
119 | - case "address": |
|
120 | - //Query all address fields associated with the address type that belongs to the locid. |
|
121 | - $addressfields = getAddressFields('0'); |
|
122 | - $addressvalues = getAddressValues($value); |
|
123 | - $form->addElement(new XoopsFormLabel("", "<strong>".$title."</strong>")); |
|
124 | - $fieldtitles = array('address' => _MD_DF_ADDRESS, 'address2' => _MD_DF_ADDRESS2, 'zip' => _MD_DF_ZIP, 'postcode' => _MD_DF_POSTCODE, 'lat' => _MD_DF_LAT, 'lon' => _MD_DF_LON, 'phone' => _MD_DF_PHONE, 'fax' => _MD_DF_FAX, 'mobile' => _MD_DF_MOBILE, 'city' => _MD_DF_CITY, 'country' => _MD_DF_COUNTRY, 'typename' => _MD_DF_TYPENAME, 'uselocyn' => _MD_DF_USELOCYN); |
|
125 | - foreach ($addressfields['addressfields'] as $field => $fieldvalue) { |
|
126 | - $storedvalue = $addressvalues["$field"]; |
|
127 | - if ($fieldvalue == 1) { |
|
128 | - $title = $fieldtitles["$field"]; |
|
129 | - $form->addElement(new XoopsFormText($title, $name.$field, 50, 250, $myts->makeTboxData4Show($storedvalue))); |
|
119 | + case "address": |
|
120 | + //Query all address fields associated with the address type that belongs to the locid. |
|
121 | + $addressfields = getAddressFields('0'); |
|
122 | + $addressvalues = getAddressValues($value); |
|
123 | + $form->addElement(new XoopsFormLabel("", "<strong>".$title."</strong>")); |
|
124 | + $fieldtitles = array('address' => _MD_DF_ADDRESS, 'address2' => _MD_DF_ADDRESS2, 'zip' => _MD_DF_ZIP, 'postcode' => _MD_DF_POSTCODE, 'lat' => _MD_DF_LAT, 'lon' => _MD_DF_LON, 'phone' => _MD_DF_PHONE, 'fax' => _MD_DF_FAX, 'mobile' => _MD_DF_MOBILE, 'city' => _MD_DF_CITY, 'country' => _MD_DF_COUNTRY, 'typename' => _MD_DF_TYPENAME, 'uselocyn' => _MD_DF_USELOCYN); |
|
125 | + foreach ($addressfields['addressfields'] as $field => $fieldvalue) { |
|
126 | + $storedvalue = $addressvalues["$field"]; |
|
127 | + if ($fieldvalue == 1) { |
|
128 | + $title = $fieldtitles["$field"]; |
|
129 | + $form->addElement(new XoopsFormText($title, $name.$field, 50, 250, $myts->makeTboxData4Show($storedvalue))); |
|
130 | + } |
|
131 | + } |
|
132 | + $form->addElement(new XoopsFormHidden("submitaddress","1")); |
|
133 | + $form->addElement(new XoopsFormHidden($name, $value)); |
|
134 | + $form->addElement(new XoopsFormHidden("addrid", $value)); |
|
135 | + break; |
|
136 | + case "checkbox": |
|
137 | + $options_arr = split("[|]",$options); |
|
138 | + $form_checkbox = new XoopsFormCheckbox($title, $name, $value, 1); |
|
139 | + foreach($options_arr as $option) { |
|
140 | + $form_checkbox->addOption($option, $option); |
|
141 | + } |
|
142 | + $form->addElement($form_checkbox); |
|
143 | + break; |
|
144 | + case "date": |
|
145 | + $form->addElement(new XoopsFormText($title, $name, 10, 10, $value)); |
|
146 | + break; |
|
147 | + case "datetime": |
|
148 | + $form->addElement(new XoopsFormDateTime($title, $name, 10, $value)); |
|
149 | + break; |
|
150 | + case "dhtml": |
|
151 | + if ($custom == '1') { |
|
152 | + $form_dhtmlarea_tray = new XoopsFormElementTray($title, "", $name); |
|
153 | + $form_dhtmlarea_tray->addElement(new XoopsFormLabel("", "<table><tr><td>")); |
|
154 | + $form_dhtmlarea_tray->addElement(new XoopsFormText("<b>"._MD_CUSTOM_TITLE."</b></td><td>", "custom".$name, 50, 250, $customtitle)); |
|
155 | + $form_dhtmlarea_tray->addElement(new XoopsFormLabel("", "</td></tr><tr><td>")); |
|
156 | + $form_dhtmlarea_tray->addElement(new XoopsFormDhtmlTextArea("<b>"._MD_CUSTOM_VALUE."</b></td><td>", $name, $value, $rows, $cols)); |
|
157 | + $form_dhtmlarea_tray->addElement(new XoopsFormLabel("", "</td></tr></table>")); |
|
158 | + $form->addElement($form_dhtmlarea_tray); |
|
159 | + } else { |
|
160 | + $form->addElement(new XoopsFormDhtmlTextArea($title, $name, $value, $rows, $cols)); |
|
161 | + } |
|
162 | + break; |
|
163 | + //case "gmap": |
|
164 | + //$gmap = new efqGmap(); |
|
165 | + // $gmapHandler = new efqGmapHandler(); |
|
166 | + // $gmap_lon = ''; |
|
167 | + // $gmap_lat = ''; |
|
168 | + // $gmap_descr = ''; |
|
169 | + // if (intval($value) > 0) { |
|
170 | + // $gmap->setData($gmapHandler->getGmapById($value)); |
|
171 | + // $gmap_lon = $gmap->getVar('lon'); |
|
172 | + // $gmap_lat = $gmap->getVar('lat'); |
|
173 | + // $gmap_descr = $gmap->getVar('descr'); |
|
174 | + // } |
|
175 | + // $form->addElement(new XoopsFormHidden($name.'_dataid', $name)); |
|
176 | + // $form->addElement(new XoopsFormText(_MD_GMAP_LON, $name.'_lon', 10, 30, $gmap_lon)); |
|
177 | + // $form->addElement(new XoopsFormText(_MD_GMAP_LAT, $name.'_lat', 10, 30, $gmap_lat)); |
|
178 | + // $form->addElement(new XoopsFormTextArea(_MD_GMAP_DESCR, $name.'_descr', $gmap_descr, 5, 50)); |
|
179 | + // break; |
|
180 | + case "radio": |
|
181 | + $options_arr = split("[|]",$options); |
|
182 | + $form_radio = new XoopsFormRadio($title, $name, $value, 1); |
|
183 | + foreach($options_arr as $option) { |
|
184 | + $form_radio->addOption($option, $option); |
|
185 | + } |
|
186 | + $form->addElement($form_radio); |
|
187 | + break; |
|
188 | + case "rating": |
|
189 | + $rating_options = array(1,2,3,4,5,6,7,8,9,10); |
|
190 | + $form_rating = new XoopsFormSelect($title, $name, $value, 1); |
|
191 | + $form_rating->addOption('0', '----'); |
|
192 | + foreach($rating_options as $option) { |
|
193 | + $form_rating->addOption($option, $option); |
|
194 | + } |
|
195 | + $form->addElement($form_rating); |
|
196 | + break; |
|
197 | + case "select": |
|
198 | + $options_arr = split("[|]",$options); |
|
199 | + $value_arr = split("[|]",$value); |
|
200 | + $form_select = new XoopsFormSelect($title, $name, $value, $size, $multiple); |
|
201 | + $form_select->addOption('-', '----'); |
|
202 | + $form_select->setValue($value_arr); |
|
203 | + foreach($options_arr as $key => $option) { |
|
204 | + $form_select->addOption($option, $option); |
|
205 | + } |
|
206 | + $form->addElement($form_select); |
|
207 | + break; |
|
208 | + case "textarea": |
|
209 | + if ($custom == '1') { |
|
210 | + $form_textarea_tray = new XoopsFormElementTray($title, "", $name); |
|
211 | + $form_textarea_tray->addElement(new XoopsFormLabel("", "<table><tr><td>")); |
|
212 | + $form_textarea_tray->addElement(new XoopsFormText("<b>"._MD_CUSTOM_TITLE."</b></td><td>", "custom".$name, 50, 250, $customtitle)); |
|
213 | + $form_textarea_tray->addElement(new XoopsFormLabel("", "</td></tr><tr><td>")); |
|
214 | + $form_textarea_tray->addElement(new XoopsFormTextArea("<b>"._MD_CUSTOM_VALUE."</b></td><td>", $name, $value, $rows, $cols)); |
|
215 | + $form_textarea_tray->addElement(new XoopsFormLabel("", "</td></tr></table>")); |
|
216 | + $form->addElement($form_textarea_tray); |
|
217 | + } else { |
|
218 | + $form->addElement(new XoopsFormTextArea($title, $name, $value, $rows, $cols)); |
|
219 | + } |
|
220 | + break; |
|
221 | + case "textbox": |
|
222 | + if ($custom == '1') { |
|
223 | + $form_text_tray = new XoopsFormElementTray($title, "", $name); |
|
224 | + $form_text_tray->addElement(new XoopsFormLabel("", "<table><tr><td>")); |
|
225 | + $form_text_tray->addElement(new XoopsFormText("<b>"._MD_CUSTOM_TITLE."</b></td><td>", "custom".$name, 50, 250, $customtitle)); |
|
226 | + $form_text_tray->addElement(new XoopsFormLabel("", "</td></tr><tr><td>")); |
|
227 | + $form_text_tray->addElement(new XoopsFormText("<b>"._MD_CUSTOM_VALUE."</b></td><td>", $name, $size, $maxsize, $value)); |
|
228 | + $form_text_tray->addElement(new XoopsFormLabel("", "</td></tr></table>")); |
|
229 | + $form->addElement($form_text_tray); |
|
230 | + } else { |
|
231 | + $form->addElement(new XoopsFormText($title, $name, 50, 250, $myts->makeTboxData4Show($value))); |
|
232 | + } |
|
233 | + break; |
|
234 | + case "url": |
|
235 | + if ($value != '') { |
|
236 | + $link = explode('|',$value); |
|
237 | + } else { |
|
238 | + $link = array(); |
|
239 | + $link[0] = ''; |
|
240 | + $link[1] = ''; |
|
130 | 241 | } |
131 | - } |
|
132 | - $form->addElement(new XoopsFormHidden("submitaddress","1")); |
|
133 | - $form->addElement(new XoopsFormHidden($name, $value)); |
|
134 | - $form->addElement(new XoopsFormHidden("addrid", $value)); |
|
135 | - break; |
|
136 | - case "checkbox": |
|
137 | - $options_arr = split("[|]",$options); |
|
138 | - $form_checkbox = new XoopsFormCheckbox($title, $name, $value, 1); |
|
139 | - foreach($options_arr as $option) { |
|
140 | - $form_checkbox->addOption($option, $option); |
|
141 | - } |
|
142 | - $form->addElement($form_checkbox); |
|
143 | - break; |
|
144 | - case "date": |
|
145 | - $form->addElement(new XoopsFormText($title, $name, 10, 10, $value)); |
|
146 | - break; |
|
147 | - case "datetime": |
|
148 | - $form->addElement(new XoopsFormDateTime($title, $name, 10, $value)); |
|
149 | - break; |
|
150 | - case "dhtml": |
|
151 | - if ($custom == '1') { |
|
152 | - $form_dhtmlarea_tray = new XoopsFormElementTray($title, "", $name); |
|
153 | - $form_dhtmlarea_tray->addElement(new XoopsFormLabel("", "<table><tr><td>")); |
|
154 | - $form_dhtmlarea_tray->addElement(new XoopsFormText("<b>"._MD_CUSTOM_TITLE."</b></td><td>", "custom".$name, 50, 250, $customtitle)); |
|
155 | - $form_dhtmlarea_tray->addElement(new XoopsFormLabel("", "</td></tr><tr><td>")); |
|
156 | - $form_dhtmlarea_tray->addElement(new XoopsFormDhtmlTextArea("<b>"._MD_CUSTOM_VALUE."</b></td><td>", $name, $value, $rows, $cols)); |
|
157 | - $form_dhtmlarea_tray->addElement(new XoopsFormLabel("", "</td></tr></table>")); |
|
158 | - $form->addElement($form_dhtmlarea_tray); |
|
159 | - } else { |
|
160 | - $form->addElement(new XoopsFormDhtmlTextArea($title, $name, $value, $rows, $cols)); |
|
161 | - } |
|
162 | - break; |
|
163 | - //case "gmap": |
|
164 | - //$gmap = new efqGmap(); |
|
165 | -// $gmapHandler = new efqGmapHandler(); |
|
166 | -// $gmap_lon = ''; |
|
167 | -// $gmap_lat = ''; |
|
168 | -// $gmap_descr = ''; |
|
169 | -// if (intval($value) > 0) { |
|
170 | -// $gmap->setData($gmapHandler->getGmapById($value)); |
|
171 | -// $gmap_lon = $gmap->getVar('lon'); |
|
172 | -// $gmap_lat = $gmap->getVar('lat'); |
|
173 | -// $gmap_descr = $gmap->getVar('descr'); |
|
174 | -// } |
|
175 | -// $form->addElement(new XoopsFormHidden($name.'_dataid', $name)); |
|
176 | -// $form->addElement(new XoopsFormText(_MD_GMAP_LON, $name.'_lon', 10, 30, $gmap_lon)); |
|
177 | -// $form->addElement(new XoopsFormText(_MD_GMAP_LAT, $name.'_lat', 10, 30, $gmap_lat)); |
|
178 | -// $form->addElement(new XoopsFormTextArea(_MD_GMAP_DESCR, $name.'_descr', $gmap_descr, 5, 50)); |
|
179 | -// break; |
|
180 | - case "radio": |
|
181 | - $options_arr = split("[|]",$options); |
|
182 | - $form_radio = new XoopsFormRadio($title, $name, $value, 1); |
|
183 | - foreach($options_arr as $option) { |
|
184 | - $form_radio->addOption($option, $option); |
|
185 | - } |
|
186 | - $form->addElement($form_radio); |
|
187 | - break; |
|
188 | - case "rating": |
|
189 | - $rating_options = array(1,2,3,4,5,6,7,8,9,10); |
|
190 | - $form_rating = new XoopsFormSelect($title, $name, $value, 1); |
|
191 | - $form_rating->addOption('0', '----'); |
|
192 | - foreach($rating_options as $option) { |
|
193 | - $form_rating->addOption($option, $option); |
|
194 | - } |
|
195 | - $form->addElement($form_rating); |
|
196 | - break; |
|
197 | - case "select": |
|
198 | - $options_arr = split("[|]",$options); |
|
199 | - $value_arr = split("[|]",$value); |
|
200 | - $form_select = new XoopsFormSelect($title, $name, $value, $size, $multiple); |
|
201 | - $form_select->addOption('-', '----'); |
|
202 | - $form_select->setValue($value_arr); |
|
203 | - foreach($options_arr as $key => $option) { |
|
204 | - $form_select->addOption($option, $option); |
|
205 | - } |
|
206 | - $form->addElement($form_select); |
|
207 | - break; |
|
208 | - case "textarea": |
|
209 | - if ($custom == '1') { |
|
210 | 242 | $form_textarea_tray = new XoopsFormElementTray($title, "", $name); |
211 | 243 | $form_textarea_tray->addElement(new XoopsFormLabel("", "<table><tr><td>")); |
212 | - $form_textarea_tray->addElement(new XoopsFormText("<b>"._MD_CUSTOM_TITLE."</b></td><td>", "custom".$name, 50, 250, $customtitle)); |
|
244 | + $form_textarea_tray->addElement(new XoopsFormText("<b>"._MD_FIELDNAMES_URL_TITLE."</b></td><td>", "url_title".$name, 50, 250, $link[1])); |
|
213 | 245 | $form_textarea_tray->addElement(new XoopsFormLabel("", "</td></tr><tr><td>")); |
214 | - $form_textarea_tray->addElement(new XoopsFormTextArea("<b>"._MD_CUSTOM_VALUE."</b></td><td>", $name, $value, $rows, $cols)); |
|
246 | + $form_textarea_tray->addElement(new XoopsFormText("<b>"._MD_FIELDNAMES_URL_LINK."</b></td><td>", "url_link".$name, 50, 250, $link[0])); |
|
215 | 247 | $form_textarea_tray->addElement(new XoopsFormLabel("", "</td></tr></table>")); |
216 | 248 | $form->addElement($form_textarea_tray); |
217 | - } else { |
|
218 | - $form->addElement(new XoopsFormTextArea($title, $name, $value, $rows, $cols)); |
|
219 | - } |
|
220 | - break; |
|
221 | - case "textbox": |
|
222 | - if ($custom == '1') { |
|
223 | - $form_text_tray = new XoopsFormElementTray($title, "", $name); |
|
224 | - $form_text_tray->addElement(new XoopsFormLabel("", "<table><tr><td>")); |
|
225 | - $form_text_tray->addElement(new XoopsFormText("<b>"._MD_CUSTOM_TITLE."</b></td><td>", "custom".$name, 50, 250, $customtitle)); |
|
226 | - $form_text_tray->addElement(new XoopsFormLabel("", "</td></tr><tr><td>")); |
|
227 | - $form_text_tray->addElement(new XoopsFormText("<b>"._MD_CUSTOM_VALUE."</b></td><td>", $name, $size, $maxsize, $value)); |
|
228 | - $form_text_tray->addElement(new XoopsFormLabel("", "</td></tr></table>")); |
|
229 | - $form->addElement($form_text_tray); |
|
230 | - } else { |
|
231 | - $form->addElement(new XoopsFormText($title, $name, 50, 250, $myts->makeTboxData4Show($value))); |
|
232 | - } |
|
233 | - break; |
|
234 | - case "url": |
|
235 | - if ($value != '') { |
|
236 | - $link = explode('|',$value); |
|
237 | - } else { |
|
238 | - $link = array(); |
|
239 | - $link[0] = ''; |
|
240 | - $link[1] = ''; |
|
241 | - } |
|
242 | - $form_textarea_tray = new XoopsFormElementTray($title, "", $name); |
|
243 | - $form_textarea_tray->addElement(new XoopsFormLabel("", "<table><tr><td>")); |
|
244 | - $form_textarea_tray->addElement(new XoopsFormText("<b>"._MD_FIELDNAMES_URL_TITLE."</b></td><td>", "url_title".$name, 50, 250, $link[1])); |
|
245 | - $form_textarea_tray->addElement(new XoopsFormLabel("", "</td></tr><tr><td>")); |
|
246 | - $form_textarea_tray->addElement(new XoopsFormText("<b>"._MD_FIELDNAMES_URL_LINK."</b></td><td>", "url_link".$name, 50, 250, $link[0])); |
|
247 | - $form_textarea_tray->addElement(new XoopsFormLabel("", "</td></tr></table>")); |
|
248 | - $form->addElement($form_textarea_tray); |
|
249 | - break; |
|
250 | - case "yesno": |
|
251 | - $form->addElement(new XoopsFormRadioyn($title, $name, $value, _YES, _NO)); |
|
252 | - break; |
|
253 | - default: |
|
254 | - echo $fieldtype." is an unknown field type."; |
|
255 | - break; |
|
249 | + break; |
|
250 | + case "yesno": |
|
251 | + $form->addElement(new XoopsFormRadioyn($title, $name, $value, _YES, _NO)); |
|
252 | + break; |
|
253 | + default: |
|
254 | + echo $fieldtype." is an unknown field type."; |
|
255 | + break; |
|
256 | 256 | } |
257 | 257 | } |
258 | 258 | |
@@ -391,30 +391,30 @@ discard block |
||
391 | 391 | global $form, $myts; |
392 | 392 | |
393 | 393 | switch ($fieldtype) { |
394 | - case "textbox": |
|
395 | - $this->createSearchField_text($title, $name, $value, $options); |
|
396 | - break; |
|
397 | - case "textarea": |
|
398 | - $this->createSearchField_text($title, $value, $options); |
|
399 | - break; |
|
400 | - case "yesno": |
|
401 | - $form->addElement(new XoopsFormRadioyn($title, $name, "", _YES, _NO)); |
|
402 | - break; |
|
403 | - case "radio": |
|
404 | - $this->createSearchField_select($title, $name, $value, $options); |
|
405 | - break; |
|
406 | - case "checkbox": |
|
407 | - $this->createSearchField_checkbox($title, $name, $value, $options); |
|
408 | - break; |
|
409 | - case "select": |
|
410 | - $this->createSearchField_checkbox($title, $name, $value, $options); |
|
411 | - break; |
|
412 | - case "dhtml": |
|
413 | - $this->createSearchField_text($title, $name, $value, $options); |
|
414 | - break; |
|
415 | - case "address": |
|
416 | - //Query all address fields associated with the address type that belongs to the locid. |
|
417 | - /* $addressfields = getAddressFields('0'); |
|
394 | + case "textbox": |
|
395 | + $this->createSearchField_text($title, $name, $value, $options); |
|
396 | + break; |
|
397 | + case "textarea": |
|
398 | + $this->createSearchField_text($title, $value, $options); |
|
399 | + break; |
|
400 | + case "yesno": |
|
401 | + $form->addElement(new XoopsFormRadioyn($title, $name, "", _YES, _NO)); |
|
402 | + break; |
|
403 | + case "radio": |
|
404 | + $this->createSearchField_select($title, $name, $value, $options); |
|
405 | + break; |
|
406 | + case "checkbox": |
|
407 | + $this->createSearchField_checkbox($title, $name, $value, $options); |
|
408 | + break; |
|
409 | + case "select": |
|
410 | + $this->createSearchField_checkbox($title, $name, $value, $options); |
|
411 | + break; |
|
412 | + case "dhtml": |
|
413 | + $this->createSearchField_text($title, $name, $value, $options); |
|
414 | + break; |
|
415 | + case "address": |
|
416 | + //Query all address fields associated with the address type that belongs to the locid. |
|
417 | + /* $addressfields = getAddressFields('0'); |
|
418 | 418 | $fieldtitles = array('address' => _MD_DF_ADDRESS, 'address2' => _MD_DF_ADDRESS2, 'zip' => _MD_DF_ZIP, 'postcode' => _MD_DF_POSTCODE, 'lat' => _MD_DF_LAT, 'lon' => _MD_DF_LON, 'phone' => _MD_DF_PHONE, 'fax' => _MD_DF_FAX, 'mobile' => _MD_DF_MOBILE, 'city' => _MD_DF_CITY, 'country' => _MD_DF_COUNTRY, 'typename' => _MD_DF_TYPENAME); |
419 | 419 | $form->addElement(new XoopsFormLabel("", "<strong>".$title."</strong>")); |
420 | 420 | foreach ($addressfields['addressfields'] as $field => $fieldvalue) { |
@@ -426,18 +426,18 @@ discard block |
||
426 | 426 | $form->addElement(new XoopsFormHidden("submitaddress","1")); |
427 | 427 | $form->addElement(new XoopsFormHidden($name, $value)); |
428 | 428 | $form->addElement(new XoopsFormHidden("addrid", $value)); */ |
429 | - break; |
|
430 | - case "rating": |
|
431 | - $this->createSearchField_rating($title, $name, $value, $options); |
|
432 | - break; |
|
433 | - case "date": |
|
434 | - $this->createSearchField_text($title, $name, $value, $options); |
|
435 | - break; |
|
436 | - case "url": |
|
437 | - $this->createSearchField_text($title, $name, $value, $options); |
|
438 | - default: |
|
439 | - echo $fieldtype." geen bekend veldtype "; |
|
440 | - break; |
|
429 | + break; |
|
430 | + case "rating": |
|
431 | + $this->createSearchField_rating($title, $name, $value, $options); |
|
432 | + break; |
|
433 | + case "date": |
|
434 | + $this->createSearchField_text($title, $name, $value, $options); |
|
435 | + break; |
|
436 | + case "url": |
|
437 | + $this->createSearchField_text($title, $name, $value, $options); |
|
438 | + default: |
|
439 | + echo $fieldtype." geen bekend veldtype "; |
|
440 | + break; |
|
441 | 441 | } |
442 | 442 | } |
443 | 443 |
@@ -51,14 +51,14 @@ discard block |
||
51 | 51 | } |
52 | 52 | |
53 | 53 | function loadFormFiles() { |
54 | - if ( !$this->formfilesloaded ) { |
|
54 | + if (!$this->formfilesloaded) { |
|
55 | 55 | include_once XOOPS_ROOT_PATH.'/include/xoopscodes.php'; |
56 | 56 | include_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
57 | 57 | $this->setFormFilesLoaded(); |
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
61 | - function setFormFilesLoaded($set=true) { |
|
61 | + function setFormFilesLoaded($set = true) { |
|
62 | 62 | $this->formfilesloaded = true; |
63 | 63 | } |
64 | 64 | |
@@ -72,11 +72,11 @@ discard block |
||
72 | 72 | $value = $arr['value']; |
73 | 73 | $custom = $arr['custom']; |
74 | 74 | $customtitle = $arr['customtitle']; |
75 | - $this->createField($title,$name,$fieldtype,$ext,$options,$value,$custom,$customtitle); |
|
75 | + $this->createField($title, $name, $fieldtype, $ext, $options, $value, $custom, $customtitle); |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | |
79 | - function createField($title="", $name="", $fieldtype="", $ext="", $options="", $value="", $custom='0', $customtitle=NULL) { |
|
79 | + function createField($title = "", $name = "", $fieldtype = "", $ext = "", $options = "", $value = "", $custom = '0', $customtitle = NULL) { |
|
80 | 80 | global $form, $myts, $moddir; |
81 | 81 | $this->loadFormFiles(); |
82 | 82 | if ($customtitle == NULL) { |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | } |
85 | 85 | $multiple = false; |
86 | 86 | if ($ext != "") { |
87 | - $ext_arr = split("[|]",$ext); |
|
88 | - foreach($ext_arr as $ext_item) { |
|
89 | - $ext_item_arr = split("[=]",$ext_item); |
|
87 | + $ext_arr = split("[|]", $ext); |
|
88 | + foreach ($ext_arr as $ext_item) { |
|
89 | + $ext_item_arr = split("[=]", $ext_item); |
|
90 | 90 | $ext_item_name = $ext_item_arr[0]; |
91 | 91 | $ext_item_value = $ext_item_arr[1]; |
92 | 92 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $multiple = true; |
108 | 108 | $size = 5; |
109 | 109 | case "value": |
110 | - if ($ext_item_value != '' and $value == '' ) { |
|
110 | + if ($ext_item_value != '' and $value == '') { |
|
111 | 111 | $value = $ext_item_value; |
112 | 112 | } |
113 | 113 | break; |
@@ -129,14 +129,14 @@ discard block |
||
129 | 129 | $form->addElement(new XoopsFormText($title, $name.$field, 50, 250, $myts->makeTboxData4Show($storedvalue))); |
130 | 130 | } |
131 | 131 | } |
132 | - $form->addElement(new XoopsFormHidden("submitaddress","1")); |
|
132 | + $form->addElement(new XoopsFormHidden("submitaddress", "1")); |
|
133 | 133 | $form->addElement(new XoopsFormHidden($name, $value)); |
134 | 134 | $form->addElement(new XoopsFormHidden("addrid", $value)); |
135 | 135 | break; |
136 | 136 | case "checkbox": |
137 | - $options_arr = split("[|]",$options); |
|
137 | + $options_arr = split("[|]", $options); |
|
138 | 138 | $form_checkbox = new XoopsFormCheckbox($title, $name, $value, 1); |
139 | - foreach($options_arr as $option) { |
|
139 | + foreach ($options_arr as $option) { |
|
140 | 140 | $form_checkbox->addOption($option, $option); |
141 | 141 | } |
142 | 142 | $form->addElement($form_checkbox); |
@@ -178,29 +178,29 @@ discard block |
||
178 | 178 | // $form->addElement(new XoopsFormTextArea(_MD_GMAP_DESCR, $name.'_descr', $gmap_descr, 5, 50)); |
179 | 179 | // break; |
180 | 180 | case "radio": |
181 | - $options_arr = split("[|]",$options); |
|
181 | + $options_arr = split("[|]", $options); |
|
182 | 182 | $form_radio = new XoopsFormRadio($title, $name, $value, 1); |
183 | - foreach($options_arr as $option) { |
|
183 | + foreach ($options_arr as $option) { |
|
184 | 184 | $form_radio->addOption($option, $option); |
185 | 185 | } |
186 | 186 | $form->addElement($form_radio); |
187 | 187 | break; |
188 | 188 | case "rating": |
189 | - $rating_options = array(1,2,3,4,5,6,7,8,9,10); |
|
189 | + $rating_options = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); |
|
190 | 190 | $form_rating = new XoopsFormSelect($title, $name, $value, 1); |
191 | 191 | $form_rating->addOption('0', '----'); |
192 | - foreach($rating_options as $option) { |
|
192 | + foreach ($rating_options as $option) { |
|
193 | 193 | $form_rating->addOption($option, $option); |
194 | 194 | } |
195 | 195 | $form->addElement($form_rating); |
196 | 196 | break; |
197 | 197 | case "select": |
198 | - $options_arr = split("[|]",$options); |
|
199 | - $value_arr = split("[|]",$value); |
|
198 | + $options_arr = split("[|]", $options); |
|
199 | + $value_arr = split("[|]", $value); |
|
200 | 200 | $form_select = new XoopsFormSelect($title, $name, $value, $size, $multiple); |
201 | 201 | $form_select->addOption('-', '----'); |
202 | 202 | $form_select->setValue($value_arr); |
203 | - foreach($options_arr as $key => $option) { |
|
203 | + foreach ($options_arr as $key => $option) { |
|
204 | 204 | $form_select->addOption($option, $option); |
205 | 205 | } |
206 | 206 | $form->addElement($form_select); |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | break; |
234 | 234 | case "url": |
235 | 235 | if ($value != '') { |
236 | - $link = explode('|',$value); |
|
236 | + $link = explode('|', $value); |
|
237 | 237 | } else { |
238 | 238 | $link = array(); |
239 | 239 | $link[0] = ''; |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | } |
388 | 388 | }*/ |
389 | 389 | |
390 | - function createSearchField($title="", $name="", $fieldtype="", $ext="", $options="", $value="", $custom='0', $customtitle=NULL) { |
|
390 | + function createSearchField($title = "", $name = "", $fieldtype = "", $ext = "", $options = "", $value = "", $custom = '0', $customtitle = NULL) { |
|
391 | 391 | global $form, $myts; |
392 | 392 | |
393 | 393 | switch ($fieldtype) { |
@@ -449,12 +449,12 @@ discard block |
||
449 | 449 | 'contains' => _MD_CONTAINS, |
450 | 450 | 'begins' => _MD_BEGINSWITH, |
451 | 451 | 'ends' => _MD_ENDSWITH, |
452 | - 'notcontain' => _MD_NOTCONTAIN ); |
|
452 | + 'notcontain' => _MD_NOTCONTAIN); |
|
453 | 453 | $form_tray = new XoopsFormElementTray($title, "", $name); |
454 | 454 | $form_tray->addElement(new XoopsFormLabel("", "<table><tr><td width=\"150\">")); |
455 | 455 | $form_select_constr = new XoopsFormSelect("", $name."constr", $value, 1); |
456 | 456 | //$form_select->addOption('0', '----'); |
457 | - foreach($options_arr_constr as $optionname => $option) { |
|
457 | + foreach ($options_arr_constr as $optionname => $option) { |
|
458 | 458 | $form_select_constr->addOption($optionname, $option); |
459 | 459 | } |
460 | 460 | $form_tray->addElement($form_select_constr); |
@@ -465,8 +465,8 @@ discard block |
||
465 | 465 | } |
466 | 466 | function createSearchField_checkbox($title = "", $name = "", $value = "", $options = "") { |
467 | 467 | global $form, $myts; |
468 | - $options_arr = split("[|]",$options); |
|
469 | - $countoptions = count($options_arr)+1; |
|
468 | + $options_arr = split("[|]", $options); |
|
469 | + $countoptions = count($options_arr) + 1; |
|
470 | 470 | $form_checkbox = new XoopsFormCheckBox($title, $name, $value); |
471 | 471 | foreach ($options_arr as $optionname) { |
472 | 472 | $form_checkbox->addOption($optionname, $optionname); |
@@ -475,18 +475,18 @@ discard block |
||
475 | 475 | } |
476 | 476 | function createSearchField_select($title = "", $name = "", $value = "", $options = "") { |
477 | 477 | global $form, $myts; |
478 | - $options_arr = split("[|]",$options); |
|
479 | - $options_arr_constr = array('equal' => _MD_EQUAL_TO, 'notequal' => _MD_NOT_EQUAL_TO ); |
|
478 | + $options_arr = split("[|]", $options); |
|
479 | + $options_arr_constr = array('equal' => _MD_EQUAL_TO, 'notequal' => _MD_NOT_EQUAL_TO); |
|
480 | 480 | $form_tray = new XoopsFormElementTray($title, "", $name); |
481 | 481 | $form_tray->addElement(new XoopsFormLabel("", "<table><tr><td width=\"150\">")); |
482 | 482 | $form_select_constr = new XoopsFormSelect("", $name, $value, 1); |
483 | - foreach($options_arr_constr as $option) { |
|
483 | + foreach ($options_arr_constr as $option) { |
|
484 | 484 | $form_select_constr->addOption($option, $option); |
485 | 485 | } |
486 | 486 | $form_tray->addElement($form_select_constr); |
487 | 487 | $form_tray->addElement(new XoopsFormLabel("", "</td><td>")); |
488 | - $countoptions = count($options_arr)+1; |
|
489 | - if ( $countoptions >= 5 ) { |
|
488 | + $countoptions = count($options_arr) + 1; |
|
489 | + if ($countoptions >= 5) { |
|
490 | 490 | $selectformsize = 5; |
491 | 491 | } else { |
492 | 492 | $selectformsize = $countoptions; |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | $form_select = new XoopsFormSelect("", $name, $value, $selectformsize); |
495 | 495 | $form_select->setExtra(" multiple='multiple'"); |
496 | 496 | $form_select->addOption('0', '----'); |
497 | - foreach($options_arr as $option) { |
|
497 | + foreach ($options_arr as $option) { |
|
498 | 498 | $form_select->addOption($option, $option); |
499 | 499 | } |
500 | 500 | $form_tray->addElement($form_select); |
@@ -503,33 +503,33 @@ discard block |
||
503 | 503 | } |
504 | 504 | function createSearchField_rating2($title = "", $name = "", $value = "", $options = "") { |
505 | 505 | global $form, $myts; |
506 | - $options_arr = split("[|]",$options); |
|
507 | - $rating_options = array(1,2,3,4,5,6,7,8,9,10); |
|
506 | + $options_arr = split("[|]", $options); |
|
507 | + $rating_options = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); |
|
508 | 508 | $form_rating = new XoopsFormSelect($title, $name, $value, 1); |
509 | 509 | $form_rating->addOption('0', '----'); |
510 | - foreach($rating_options as $option) { |
|
510 | + foreach ($rating_options as $option) { |
|
511 | 511 | $form_rating->addOption($option, $option); |
512 | 512 | } |
513 | 513 | $form->addElement($form_rating); |
514 | 514 | } |
515 | 515 | function createSearchField_rating($title = "", $name = "", $value = "", $options = "") { |
516 | 516 | global $form, $myts; |
517 | - $options_arr = split("[|]",$options); |
|
518 | - $rating_options = array(1,2,3,4,5,6,7,8,9,10); |
|
517 | + $options_arr = split("[|]", $options); |
|
518 | + $rating_options = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); |
|
519 | 519 | $options_arr_constr = array('equal' => _MD_EQUAL_TO, |
520 | 520 | 'notequal' => _MD_NOT_EQUAL_TO, |
521 | 521 | 'smaller' => _MD_SMALLER_THAN, |
522 | - 'bigger' => _MD_GREATER_THAN ); |
|
522 | + 'bigger' => _MD_GREATER_THAN); |
|
523 | 523 | $form_tray = new XoopsFormElementTray($title, "", $name); |
524 | 524 | $form_tray->addElement(new XoopsFormLabel("", "<table><tr><td width=\"150\">")); |
525 | 525 | $form_select_constr = new XoopsFormSelect("", $name."constr", $value, 1); |
526 | - foreach($options_arr_constr as $optionname => $option) { |
|
526 | + foreach ($options_arr_constr as $optionname => $option) { |
|
527 | 527 | $form_select_constr->addOption($optionname, $option); |
528 | 528 | } |
529 | 529 | $form_tray->addElement($form_select_constr); |
530 | 530 | $form_tray->addElement(new XoopsFormLabel("", "</td><td>")); |
531 | - $countoptions = count($rating_options)+1; |
|
532 | - if ( $countoptions >= 5 ) { |
|
531 | + $countoptions = count($rating_options) + 1; |
|
532 | + if ($countoptions >= 5) { |
|
533 | 533 | $selectformsize = 5; |
534 | 534 | } else { |
535 | 535 | $selectformsize = $rating_options; |
@@ -537,20 +537,20 @@ discard block |
||
537 | 537 | $form_select = new XoopsFormSelect("", $name, $value, $selectformsize); |
538 | 538 | //$form_select->setExtra(" multiple='multiple'"); |
539 | 539 | $form_select->addOption('0', '----'); |
540 | - foreach($rating_options as $option) { |
|
540 | + foreach ($rating_options as $option) { |
|
541 | 541 | $form_select->addOption($option, $option); |
542 | 542 | } |
543 | 543 | $form_tray->addElement($form_select); |
544 | 544 | $form_tray->addElement(new XoopsFormLabel("", "</td></tr></table>")); |
545 | 545 | $form->addElement($form_tray); |
546 | 546 | } |
547 | - function getWidth(){ |
|
547 | + function getWidth() { |
|
548 | 548 | return $this->_width; |
549 | 549 | } |
550 | - function getHeight(){ |
|
550 | + function getHeight() { |
|
551 | 551 | return $this->_height; |
552 | 552 | } |
553 | - function getSrc(){ |
|
553 | + function getSrc() { |
|
554 | 554 | return $this->_src; |
555 | 555 | } |
556 | 556 | /* |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | * |
559 | 559 | * @return bool |
560 | 560 | */ |
561 | - function isMultiple(){ |
|
561 | + function isMultiple() { |
|
562 | 562 | return $this->_multiple; |
563 | 563 | } |
564 | 564 | |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | * |
568 | 568 | * @return int |
569 | 569 | */ |
570 | - function getSize(){ |
|
570 | + function getSize() { |
|
571 | 571 | return $this->_size; |
572 | 572 | } |
573 | 573 | |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | * |
577 | 577 | * @return array |
578 | 578 | */ |
579 | - function getValue(){ |
|
579 | + function getValue() { |
|
580 | 580 | return $this->_value; |
581 | 581 | } |
582 | 582 | |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | * |
586 | 586 | * @param $value mixed |
587 | 587 | */ |
588 | - function setValue($value){ |
|
588 | + function setValue($value) { |
|
589 | 589 | if (is_array($value)) { |
590 | 590 | foreach ($value as $v) { |
591 | 591 | $this->_value[] = $v; |
@@ -601,8 +601,8 @@ discard block |
||
601 | 601 | * @param string $value "value" attribute |
602 | 602 | * @param string $name "name" attribute |
603 | 603 | */ |
604 | - function addOption($value, $name=""){ |
|
605 | - if ( $name != "" ) { |
|
604 | + function addOption($value, $name = "") { |
|
605 | + if ($name != "") { |
|
606 | 606 | $this->_options[$value] = $name; |
607 | 607 | } else { |
608 | 608 | $this->_options[$value] = $value; |
@@ -614,9 +614,9 @@ discard block |
||
614 | 614 | * |
615 | 615 | * @param array $options Associative array of value->name pairs |
616 | 616 | */ |
617 | - function addOptionArray($options){ |
|
618 | - if ( is_array($options) ) { |
|
619 | - foreach ( $options as $k=>$v ) { |
|
617 | + function addOptionArray($options) { |
|
618 | + if (is_array($options)) { |
|
619 | + foreach ($options as $k=>$v) { |
|
620 | 620 | $this->addOption($k, $v); |
621 | 621 | } |
622 | 622 | } |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | * |
628 | 628 | * @return array Associative array of value->name pairs |
629 | 629 | */ |
630 | - function getOptions(){ |
|
630 | + function getOptions() { |
|
631 | 631 | return $this->_options; |
632 | 632 | } |
633 | 633 | |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | * |
638 | 638 | * @return string HTML |
639 | 639 | */ |
640 | - function render(){ |
|
640 | + function render() { |
|
641 | 641 | $ret = "<img src='".$this->getSrc()."' width='".$this->getWidth()."' height='".$this->getHeight()."'"; |
642 | 642 | $ret .= " />"; |
643 | 643 | return $ret; |
@@ -65,24 +65,24 @@ discard block |
||
65 | 65 | $this->setPointsJS(''); |
66 | 66 | |
67 | 67 | $this->db = Database::getInstance(); |
68 | - $this->initVar('id', XOBJ_DTYPE_INT, null, false); |
|
69 | - $this->initVar('dataid', XOBJ_DTYPE_INT, null, true); |
|
70 | - $this->initVar('lat', XOBJ_DTYPE_TXTBOX, null, true); |
|
68 | + $this->initVar('id', XOBJ_DTYPE_INT, null, false); |
|
69 | + $this->initVar('dataid', XOBJ_DTYPE_INT, null, true); |
|
70 | + $this->initVar('lat', XOBJ_DTYPE_TXTBOX, null, true); |
|
71 | 71 | $this->initVar('lon', XOBJ_DTYPE_TXTBOX, null, true); |
72 | 72 | $this->initVar('descr', XOBJ_DTYPE_TXTAREA); |
73 | 73 | |
74 | 74 | if ($gmap != false) { |
75 | 75 | if (is_array($gmap)) { |
76 | - $this->assignVars($gmap); |
|
77 | - } else { |
|
76 | + $this->assignVars($gmap); |
|
77 | + } else { |
|
78 | 78 | $$gmap_handler = xoops_getmodulehandler('gmap', $moddir); |
79 | - $objGmap =& $$gmap_handler->get($directory); |
|
80 | - foreach ($objGmap->vars as $k => $v) { |
|
81 | - $this->assignVar($k, $v['value']); |
|
82 | - } |
|
83 | - unset($objGmap); |
|
84 | - } |
|
85 | - } |
|
79 | + $objGmap =& $$gmap_handler->get($directory); |
|
80 | + foreach ($objGmap->vars as $k => $v) { |
|
81 | + $this->assignVar($k, $v['value']); |
|
82 | + } |
|
83 | + unset($objGmap); |
|
84 | + } |
|
85 | + } |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | function setKey($key='') |
@@ -91,8 +91,8 @@ discard block |
||
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
94 | - * Set the value of the script that triggers the points to be added to the google map. |
|
95 | - */ |
|
94 | + * Set the value of the script that triggers the points to be added to the google map. |
|
95 | + */ |
|
96 | 96 | function setPointsJS($pointsJS) |
97 | 97 | { |
98 | 98 | $this->_jsPointsArray = $pointsJS; |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
103 | - * Get the value of the script that triggers the points to be added to the google map. |
|
104 | - */ |
|
103 | + * Get the value of the script that triggers the points to be added to the google map. |
|
104 | + */ |
|
105 | 105 | function getPointsJS() |
106 | 106 | { |
107 | 107 | return $this->_jsPointsArray; |
@@ -195,8 +195,8 @@ discard block |
||
195 | 195 | } |
196 | 196 | |
197 | 197 | /** |
198 | - * Adds a script which triggers the other javascript code to execute |
|
199 | - */ |
|
198 | + * Adds a script which triggers the other javascript code to execute |
|
199 | + */ |
|
200 | 200 | function printTrigger() |
201 | 201 | { |
202 | 202 | $trigger = <<<EOH |
@@ -262,34 +262,34 @@ discard block |
||
262 | 262 | } |
263 | 263 | |
264 | 264 | /** |
265 | - * create instance of efqGmap class or reset the existing instance. |
|
266 | - * |
|
267 | - * @return object $efqGmap |
|
268 | - */ |
|
265 | + * create instance of efqGmap class or reset the existing instance. |
|
266 | + * |
|
267 | + * @return object $efqGmap |
|
268 | + */ |
|
269 | 269 | function &create($isNew = true) |
270 | - { |
|
271 | - $gmap = new efqGmap(); |
|
272 | - if ($isNew) { |
|
273 | - $gmap->setNew(); |
|
274 | - } |
|
275 | - return $gmap; |
|
276 | - } |
|
270 | + { |
|
271 | + $gmap = new efqGmap(); |
|
272 | + if ($isNew) { |
|
273 | + $gmap->setNew(); |
|
274 | + } |
|
275 | + return $gmap; |
|
276 | + } |
|
277 | 277 | |
278 | 278 | /** |
279 | - * retrieve all points from the database |
|
280 | - * |
|
281 | - * @param int $dirid ID of the directory |
|
282 | - * @return mixed reference to the {@link efqGmap} object, FALSE if failed |
|
283 | - */ |
|
279 | + * retrieve all points from the database |
|
280 | + * |
|
281 | + * @param int $dirid ID of the directory |
|
282 | + * @return mixed reference to the {@link efqGmap} object, FALSE if failed |
|
283 | + */ |
|
284 | 284 | function getPointsJS($gmap) { |
285 | 285 | if (!is_object($gmap)) { |
286 | 286 | return false; |
287 | 287 | } |
288 | 288 | $sql = 'SELECT * FROM '.$this->db->prefix("efqdiralpha1_gmaps"); |
289 | 289 | if (!$result = $this->db->query($sql)) { |
290 | - return false; |
|
291 | - } |
|
292 | - $gmap =& $this->create(false); |
|
290 | + return false; |
|
291 | + } |
|
292 | + $gmap =& $this->create(false); |
|
293 | 293 | $javaScript = ''; |
294 | 294 | while ($row = $this->db->fetchArray($result)) { |
295 | 295 | //$row{'descr'} = addslashes($row{'descr'}); |
@@ -309,31 +309,31 @@ discard block |
||
309 | 309 | $arr = array(); |
310 | 310 | $sql = sprintf('SELECT * FROM %s WHERE id=%u', |
311 | 311 | $this->db->prefix("efqdiralpha1_gmaps"), intval($id)); |
312 | - $result = $this->db->query($sql) or $eh->show("0013"); |
|
313 | - while (list($id, $lat, $lon, $descr, $dataid) = $this->db->fetchRow($result)) |
|
312 | + $result = $this->db->query($sql) or $eh->show("0013"); |
|
313 | + while (list($id, $lat, $lon, $descr, $dataid) = $this->db->fetchRow($result)) |
|
314 | 314 | { |
315 | 315 | $arr = array('id'=>$id, 'lat'=>$lat, 'lon'=>$lon, 'descr'=>$descr, 'dataid'=>$dataid); |
316 | 316 | } |
317 | - return $arr; |
|
317 | + return $arr; |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | function getByDataId($id=0) |
321 | 321 | { |
322 | 322 | if ($id == false) { |
323 | - return false; |
|
324 | - } |
|
325 | - $id = intval($id); |
|
326 | - echo $id; |
|
327 | - if ($id > 0) { |
|
328 | - $sql = 'SELECT * FROM '.$this->db->prefix("efqdiralpha1_gmaps").' WHERE dataid='.intval($id); |
|
329 | - if (!$result = $this->db->query($sql)) { |
|
330 | - return false; |
|
331 | - } |
|
332 | - $gmap =& $this->create(false); |
|
333 | - $gmap->assignVars($this->db->fetchArray($result)); |
|
334 | - return $gmap; |
|
335 | - } |
|
336 | - return false; |
|
323 | + return false; |
|
324 | + } |
|
325 | + $id = intval($id); |
|
326 | + echo $id; |
|
327 | + if ($id > 0) { |
|
328 | + $sql = 'SELECT * FROM '.$this->db->prefix("efqdiralpha1_gmaps").' WHERE dataid='.intval($id); |
|
329 | + if (!$result = $this->db->query($sql)) { |
|
330 | + return false; |
|
331 | + } |
|
332 | + $gmap =& $this->create(false); |
|
333 | + $gmap->assignVars($this->db->fetchArray($result)); |
|
334 | + return $gmap; |
|
335 | + } |
|
336 | + return false; |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | /** |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $this->assignVars($gmap); |
77 | 77 | } else { |
78 | 78 | $$gmap_handler = xoops_getmodulehandler('gmap', $moddir); |
79 | - $objGmap =& $$gmap_handler->get($directory); |
|
79 | + $objGmap = & $$gmap_handler->get($directory); |
|
80 | 80 | foreach ($objGmap->vars as $k => $v) { |
81 | 81 | $this->assignVar($k, $v['value']); |
82 | 82 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | } |
87 | 87 | |
88 | - function setKey($key='') |
|
88 | + function setKey($key = '') |
|
89 | 89 | { |
90 | 90 | $this->_key = $key; |
91 | 91 | } |
@@ -120,13 +120,13 @@ discard block |
||
120 | 120 | $this->_map .= $this->printTrigger(); |
121 | 121 | } |
122 | 122 | |
123 | - function printPlaceHolder($width=700, $height=500) |
|
123 | + function printPlaceHolder($width = 700, $height = 500) |
|
124 | 124 | { |
125 | 125 | return '<div id="map" style="width:'.$width.'px; height:'.$height.'px"></div>'; |
126 | 126 | } |
127 | 127 | |
128 | 128 | |
129 | - function printScript($jsPointsArray='', $key='') |
|
129 | + function printScript($jsPointsArray = '', $key = '') |
|
130 | 130 | { |
131 | 131 | global $icmsPreloadHandler; |
132 | 132 | |
@@ -289,13 +289,13 @@ discard block |
||
289 | 289 | if (!$result = $this->db->query($sql)) { |
290 | 290 | return false; |
291 | 291 | } |
292 | - $gmap =& $this->create(false); |
|
292 | + $gmap = & $this->create(false); |
|
293 | 293 | $javaScript = ''; |
294 | 294 | while ($row = $this->db->fetchArray($result)) { |
295 | 295 | //$row{'descr'} = addslashes($row{'descr'}); |
296 | 296 | $row['descr'] = addslashes($row['descr']); |
297 | 297 | //$row{'descr'} = str_replace(';',',',$row{'descr'}); |
298 | - $row['descr'] = str_replace(';',',',$row['descr']); |
|
298 | + $row['descr'] = str_replace(';', ',', $row['descr']); |
|
299 | 299 | //$javaScript .= "mArray.push('{$row{'lat'}};{$row{'lon'}};{$row{'descr'}}')\n"; |
300 | 300 | //echo $row['lat']; |
301 | 301 | $javaScript .= "mArray.push('{".$row['lat']."};{".$row['lon']."};{".$row['descr']."}')\n"; |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | return true; |
305 | 305 | } |
306 | 306 | |
307 | - function getGmapById($id=0) |
|
307 | + function getGmapById($id = 0) |
|
308 | 308 | { |
309 | 309 | $arr = array(); |
310 | 310 | $sql = sprintf('SELECT * FROM %s WHERE id=%u', |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | return $arr; |
318 | 318 | } |
319 | 319 | |
320 | - function getByDataId($id=0) |
|
320 | + function getByDataId($id = 0) |
|
321 | 321 | { |
322 | 322 | if ($id == false) { |
323 | 323 | return false; |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | if (!$result = $this->db->query($sql)) { |
330 | 330 | return false; |
331 | 331 | } |
332 | - $gmap =& $this->create(false); |
|
332 | + $gmap = & $this->create(false); |
|
333 | 333 | $gmap->assignVars($this->db->fetchArray($result)); |
334 | 334 | return $gmap; |
335 | 335 | } |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | * |
347 | 347 | * @return bool true if insertion is succesful, false if unsuccesful |
348 | 348 | */ |
349 | - function insertGmap($obj, $forceQuery=false) { |
|
349 | + function insertGmap($obj, $forceQuery = false) { |
|
350 | 350 | $tablename = "efqdiralpha1_gmaps"; |
351 | 351 | $keyName = "id"; |
352 | 352 | if ($obj instanceof efqGmap) { |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | * |
399 | 399 | * @return bool true if update is succesful, false if unsuccesful |
400 | 400 | */ |
401 | - function updateGmap($obj, $forceQuery=false) { |
|
401 | + function updateGmap($obj, $forceQuery = false) { |
|
402 | 402 | $tablename = "efqdiralpha1_gmaps"; |
403 | 403 | $keyName = "id"; |
404 | 404 | if ($obj instanceof efqGmap) { |
@@ -140,18 +140,18 @@ discard block |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
143 | - * create instance of directory class or reset the existing instance. |
|
144 | - * |
|
145 | - * @return object $directory |
|
146 | - */ |
|
143 | + * create instance of directory class or reset the existing instance. |
|
144 | + * |
|
145 | + * @return object $directory |
|
146 | + */ |
|
147 | 147 | function &create($isNew = true) |
148 | - { |
|
149 | - $subscription = new efqSubscription(); |
|
150 | - if ($isNew) { |
|
151 | - $subscription->setNew(); |
|
152 | - } |
|
153 | - return $subscription; |
|
154 | - } |
|
148 | + { |
|
149 | + $subscription = new efqSubscription(); |
|
150 | + if ($isNew) { |
|
151 | + $subscription->setNew(); |
|
152 | + } |
|
153 | + return $subscription; |
|
154 | + } |
|
155 | 155 | |
156 | 156 | /** |
157 | 157 | * Function delete: Delete subscription order |
@@ -406,10 +406,10 @@ discard block |
||
406 | 406 | function countSubscriptionsForType($typeid=0) { |
407 | 407 | $sql = "SELECT COUNT(itemid) FROM ".$this->db->prefix("efqdiralpha1_items")." WHERE typeid=".intval($typeid).""; |
408 | 408 | if (!$result = $this->db->query($sql)) { |
409 | - return false; |
|
410 | - } |
|
411 | - list($ret) = $this->db->fetchRow($result); |
|
412 | - return $ret; |
|
409 | + return false; |
|
410 | + } |
|
411 | + list($ret) = $this->db->fetchRow($result); |
|
412 | + return $ret; |
|
413 | 413 | } |
414 | 414 | |
415 | 415 | function getOffers($dirid=0) { |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * Constructor |
37 | 37 | * |
38 | 38 | */ |
39 | - function efqSubscription(){ |
|
39 | + function efqSubscription() { |
|
40 | 40 | //Constructor |
41 | 41 | } |
42 | 42 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * |
52 | 52 | * @return array $arr |
53 | 53 | */ |
54 | - function durationArray($dashes=false) { |
|
54 | + function durationArray($dashes = false) { |
|
55 | 55 | if ($dashes) { |
56 | 56 | $arr = array('0' => '---', '1' => _MD_DAYS, '2' => _MD_WEEKS, '3' => _MD_MONTHS, '4' => _MD_QUARTERS, '5' => _MD_YEARS); |
57 | 57 | } else { |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @param int $orderid - Default: '0' - Order ID |
102 | 102 | * @param int $userid - Default: '0' - User ID |
103 | 103 | */ |
104 | - function notifyExpireWarning($orderid='0', $userid='0') { |
|
104 | + function notifyExpireWarning($orderid = '0', $userid = '0') { |
|
105 | 105 | global $xoopsConfig, $moddir; |
106 | 106 | include_once(XOOPS_ROOT_PATH."/class/mail/xoopsmultimailer.php"); |
107 | 107 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | { |
136 | 136 | //Instantiate class |
137 | 137 | global $eh; |
138 | - $this->db =& XoopsDatabaseFactory::getDatabaseConnection(); |
|
138 | + $this->db = & XoopsDatabaseFactory::getDatabaseConnection(); |
|
139 | 139 | $this->errorhandler = $eh; |
140 | 140 | } |
141 | 141 | |
@@ -163,8 +163,8 @@ discard block |
||
163 | 163 | * @param int $orderid - Default: '0' - Order ID |
164 | 164 | * @return array $arr |
165 | 165 | */ |
166 | - function delete($orderid='0') { |
|
167 | - if ( $orderid != '0' ) { |
|
166 | + function delete($orderid = '0') { |
|
167 | + if ($orderid != '0') { |
|
168 | 168 | $sql = "DELETE FROM ".$this->db->prefix('efqdiralpha1_subscr_orders')." WHERE orderid=".intval($orderid).""; |
169 | 169 | $this->db->query($sql); |
170 | 170 | return true; |
@@ -186,8 +186,8 @@ discard block |
||
186 | 186 | function createOrder($itemid = 0) { |
187 | 187 | $orderid = 0; |
188 | 188 | if ($itemid != 0) { |
189 | - if ( isset( $_POST['typeofferid'] ) ) { |
|
190 | - $typeofferid = split("_",$_POST['typeofferid']); |
|
189 | + if (isset($_POST['typeofferid'])) { |
|
190 | + $typeofferid = split("_", $_POST['typeofferid']); |
|
191 | 191 | $typeid = $typeofferid[0]; |
192 | 192 | $offerid = $typeofferid[1]; |
193 | 193 | } else { |
@@ -240,12 +240,12 @@ discard block |
||
240 | 240 | return $orderid; |
241 | 241 | }*/ |
242 | 242 | |
243 | - function getOrderItemName($offerid=0) { |
|
243 | + function getOrderItemName($offerid = 0) { |
|
244 | 244 | $sql = "SELECT o.offerid, o.duration, o.count, o.price, o.currency, o.descr, t.typeid, t.typename FROM ".$this->db->prefix("efqdiralpha1_subscr_offers")." o, ".$this->db->prefix("efqdiralpha1_itemtypes")." t WHERE o.typeid=t.typeid AND o.offerid='$offerid' ORDER BY t.typename ASC"; |
245 | 245 | $result = $this->db->query($sql); |
246 | 246 | $numrows = $this->db->getRowsNum($result); |
247 | 247 | $result = $this->db->query($sql); |
248 | - while ( list($offerid, $duration, $count, $price, $currency, $descr, $typeid, $typename) = $this->db->fetchRow($result) ) { |
|
248 | + while (list($offerid, $duration, $count, $price, $currency, $descr, $typeid, $typename) = $this->db->fetchRow($result)) { |
|
249 | 249 | if ($count == '1') { |
250 | 250 | $duration_arr = $this->durationSingleArray(); |
251 | 251 | } else { |
@@ -258,33 +258,33 @@ discard block |
||
258 | 258 | } |
259 | 259 | |
260 | 260 | |
261 | - function updateOrder( $orderid='0', $status='1', $startdate='0', $billto='0' ) { |
|
261 | + function updateOrder($orderid = '0', $status = '1', $startdate = '0', $billto = '0') { |
|
262 | 262 | $ordervars = $this->getOrderVars($orderid); |
263 | 263 | $typeid = $ordervars['typeid']; |
264 | 264 | $itemid = $ordervars['itemid']; |
265 | 265 | $sql = "UPDATE ".$this->db->prefix("efqdiralpha1_subscr_orders")." SET status='$status'"; |
266 | - if ( $startdate != '0' ) { |
|
266 | + if ($startdate != '0') { |
|
267 | 267 | $sql .= ", startdate='$startdate'"; |
268 | 268 | } |
269 | - if ( $billto != '0' ) { |
|
269 | + if ($billto != '0') { |
|
270 | 270 | $sql .= ", billto='$billto'"; |
271 | 271 | } |
272 | 272 | $sql .= " WHERE orderid=".intval($orderid).""; |
273 | 273 | $this->db->queryF($sql); |
274 | - if ( $startdate > time() ) { |
|
275 | - $this->updateScheduler( 'add', $itemid, $typeid, $startdate ); |
|
274 | + if ($startdate > time()) { |
|
275 | + $this->updateScheduler('add', $itemid, $typeid, $startdate); |
|
276 | 276 | } else { |
277 | - $this->updateItem( $itemid, $typeid ); |
|
277 | + $this->updateItem($itemid, $typeid); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | } |
281 | 281 | |
282 | - function getOrderVars( $orderid='0' ) { |
|
282 | + function getOrderVars($orderid = '0') { |
|
283 | 283 | $sql = "SELECT ord.uid, ord.billto, ord.startdate, ord.typeid, ord.status, ord.itemid, ord.offerid FROM ".$this->db->prefix("efqdiralpha1_subscr_orders")." ord WHERE ord.orderid=".intval($orderid).""; |
284 | 284 | $result = $this->db->query($sql); |
285 | 285 | $numrows = $this->db->getRowsNum($result); |
286 | 286 | $arr = $this->db->fetchArray($result); |
287 | - while ( list($uid, $billto, $startdate, $typeid, $status, $itemid, $offerid ) = $this->db->fetchRow($result) ) { |
|
287 | + while (list($uid, $billto, $startdate, $typeid, $status, $itemid, $offerid) = $this->db->fetchRow($result)) { |
|
288 | 288 | $arr['uid'] = $uid; |
289 | 289 | $arr['billto'] = $billto; |
290 | 290 | $arr['startdate'] = $startdate; |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | return $arr; |
297 | 297 | } |
298 | 298 | |
299 | - function getOfferVars( $offerid='0', $showactive='1' ) { |
|
299 | + function getOfferVars($offerid = '0', $showactive = '1') { |
|
300 | 300 | $sql = "SELECT count, duration FROM ".$this->db->prefix("efqdiralpha1_subscr_offers")." WHERE offerid=".intval($offerid).""; |
301 | 301 | if ($showactive == '1') { |
302 | 302 | $sql .= " AND activeyn='1'"; |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | $numrows = $this->db->getRowsNum($result); |
306 | 306 | $arr = array(); |
307 | 307 | $arr = $this->db->fetchArray($result); |
308 | - while ( list( $count, $duration ) = $this->db->fetchRow($result) ) { |
|
308 | + while (list($count, $duration) = $this->db->fetchRow($result)) { |
|
309 | 309 | $arr['count'] = $count; |
310 | 310 | $arr['duration'] = $duration; |
311 | 311 | } |
@@ -323,8 +323,8 @@ discard block |
||
323 | 323 | } |
324 | 324 | }*/ |
325 | 325 | |
326 | - function updateItem( $itemid='0', $typeid='0' ) { |
|
327 | - if ( $itemid != '0' && $typeid != '0' ) { |
|
326 | + function updateItem($itemid = '0', $typeid = '0') { |
|
327 | + if ($itemid != '0' && $typeid != '0') { |
|
328 | 328 | $sql = "UPDATE ".$this->db->prefix("efqdiralpha1_items")." SET typeid='".intval($typeid)."' WHERE itemid=".intval($itemid).""; |
329 | 329 | $this->db->queryF($sql); |
330 | 330 | return true; |
@@ -335,11 +335,11 @@ discard block |
||
335 | 335 | |
336 | 336 | |
337 | 337 | |
338 | - function getNewBillto($offerid='0') { |
|
338 | + function getNewBillto($offerid = '0') { |
|
339 | 339 | |
340 | 340 | } |
341 | 341 | |
342 | - function changeItemType($itemid=0, $itemtype=0) { |
|
342 | + function changeItemType($itemid = 0, $itemtype = 0) { |
|
343 | 343 | global $xoopsDB, $eh; |
344 | 344 | $sql = "UPDATE ".$this->db->prefix('efqdiralpha1_items')." SET typeid=$itemtype WHERE itemid=intval($itemid)"; |
345 | 345 | $this->db->queryF($sql); |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | if ($dashes != '0') { |
358 | 358 | $arr = array('0' => '---'); |
359 | 359 | } |
360 | - while ( list($offerid, $duration, $count, $price, $currency, $descr, $typeid, $typename) = $this->db->fetchRow($result) ) { |
|
360 | + while (list($offerid, $duration, $count, $price, $currency, $descr, $typeid, $typename) = $this->db->fetchRow($result)) { |
|
361 | 361 | if ($count == '1') { |
362 | 362 | $duration_arr = $this->durationSingleArray(); |
363 | 363 | } else { |
@@ -369,17 +369,17 @@ discard block |
||
369 | 369 | return $arr; |
370 | 370 | } |
371 | 371 | |
372 | - function itemsSelBox($selname="", $none=false, $preselected=0) { |
|
372 | + function itemsSelBox($selname = "", $none = false, $preselected = 0) { |
|
373 | 373 | $sql = "SELECT typeid, typename FROM ".$this->db->prefix("efqdiralpha1_itemtypes").""; |
374 | 374 | $result = $this->db->query($sql); |
375 | 375 | $numrows = $this->db->getRowsNum($result); |
376 | 376 | echo "<select name='".$selname."'"; |
377 | 377 | echo ">\n"; |
378 | - if ( $none ) { |
|
378 | + if ($none) { |
|
379 | 379 | echo "<option value='0'>----</option>\n"; |
380 | 380 | } |
381 | - while ( list($typeid, $typename) = $this->db->fetchRow($result) ) { |
|
382 | - if ( $preselected == $typeid ) { |
|
381 | + while (list($typeid, $typename) = $this->db->fetchRow($result)) { |
|
382 | + if ($preselected == $typeid) { |
|
383 | 383 | $sel = " selected"; |
384 | 384 | } else { |
385 | 385 | $sel = ""; |
@@ -397,13 +397,13 @@ discard block |
||
397 | 397 | if ($dashes != 0) { |
398 | 398 | $arr = array('0' => '---'); |
399 | 399 | } |
400 | - while ( list($typeid, $typename) = $this->db->fetchRow($result) ) { |
|
400 | + while (list($typeid, $typename) = $this->db->fetchRow($result)) { |
|
401 | 401 | $arr[$typeid] = $typename; |
402 | 402 | } |
403 | 403 | return $arr; |
404 | 404 | } |
405 | 405 | |
406 | - function countSubscriptionsForType($typeid=0) { |
|
406 | + function countSubscriptionsForType($typeid = 0) { |
|
407 | 407 | $sql = "SELECT COUNT(itemid) FROM ".$this->db->prefix("efqdiralpha1_items")." WHERE typeid=".intval($typeid).""; |
408 | 408 | if (!$result = $this->db->query($sql)) { |
409 | 409 | return false; |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | return $ret; |
413 | 413 | } |
414 | 414 | |
415 | - function getOffers($dirid=0) { |
|
415 | + function getOffers($dirid = 0) { |
|
416 | 416 | $extendedwhere = ''; |
417 | 417 | if ($dirid != 0) { |
418 | 418 | $extendedwhere = ' AND o.dirid='.intval($dirid); |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | $sql = "SELECT o.dirid, o.offerid, o.typeid, o.title, o.duration, o.count, o.price, o.activeyn, o.currency, o.descr, t.typename, t.level FROM ".$this->db->prefix("efqdiralpha1_itemtypes")." t, ".$this->db->prefix("efqdiralpha1_subscr_offers")." o WHERE o.typeid=t.typeid".$extendedwhere; |
421 | 421 | $result = $this->db->query($sql) or $this->errorhandler->show("0013"); |
422 | 422 | $arr = array(); |
423 | - while(list($dirid, $offerid, $typeid, $title, $duration, $count, $price, $activeyn, $currency, $descr, $typename, $level) = $this->db->fetchRow($result)) { |
|
423 | + while (list($dirid, $offerid, $typeid, $title, $duration, $count, $price, $activeyn, $currency, $descr, $typename, $level) = $this->db->fetchRow($result)) { |
|
424 | 424 | $arr[] = array('dirid' => $dirid, |
425 | 425 | 'offerid' => $offerid, |
426 | 426 | 'typeid' => $typeid, |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | 'currency' => $currency, |
433 | 433 | 'descr' => $descr, |
434 | 434 | 'typename' => $typename, |
435 | - 'level' => $level ); |
|
435 | + 'level' => $level); |
|
436 | 436 | } |
437 | 437 | return $arr; |
438 | 438 | } |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | { |
55 | 55 | global $moddir; |
56 | 56 | $this->db = Database::getInstance(); |
57 | - $this->initVar('typeid', XOBJ_DTYPE_INT, 0, false); |
|
58 | - $this->initVar('typename', XOBJ_DTYPE_TXTBOX, null, false, 50); |
|
59 | - $this->initVar('level', XOBJ_DTYPE_INT, 0, true, 4); |
|
57 | + $this->initVar('typeid', XOBJ_DTYPE_INT, 0, false); |
|
58 | + $this->initVar('typename', XOBJ_DTYPE_TXTBOX, null, false, 50); |
|
59 | + $this->initVar('level', XOBJ_DTYPE_INT, 0, true, 4); |
|
60 | 60 | $this->initVar('dirid', XOBJ_DTYPE_INT, 0, true, 5); |
61 | 61 | |
62 | 62 | } |
@@ -198,10 +198,10 @@ discard block |
||
198 | 198 | */ |
199 | 199 | function set($typeid=0) { |
200 | 200 | $sql = "SELECT typeid,typename,level,dirid FROM ".$this->db->prefix("efqdiralpha1_itemtypes")." WHERE typeid=".intval($typeid).""; |
201 | - $result = $this->db->query($sql); |
|
202 | - $numrows = $this->db->getRowsNum($result); |
|
203 | - if ( $numrows > 0 ) { |
|
204 | - while (list($typeid, $typename, $level, $dirid) = $this->db->fetchRow($result)) { |
|
201 | + $result = $this->db->query($sql); |
|
202 | + $numrows = $this->db->getRowsNum($result); |
|
203 | + if ( $numrows > 0 ) { |
|
204 | + while (list($typeid, $typename, $level, $dirid) = $this->db->fetchRow($result)) { |
|
205 | 205 | if (! $this->objItemType) { |
206 | 206 | $this->objItemType = new efqSubscriptionOffer(); |
207 | 207 | } |
@@ -209,8 +209,8 @@ discard block |
||
209 | 209 | $this->objItemType->setVar('typename', $typename); |
210 | 210 | $this->objItemType->setVar('level', $level); |
211 | 211 | $this->objItemType->setVar('dirid', $dirid); |
212 | - } |
|
213 | - } else { |
|
212 | + } |
|
213 | + } else { |
|
214 | 214 | return false; |
215 | 215 | } |
216 | 216 | return true; |
@@ -229,14 +229,14 @@ discard block |
||
229 | 229 | function getByDir($dirid=0) { |
230 | 230 | $arr = array(); |
231 | 231 | $sql = "SELECT typeid,typename,level FROM ".$this->db->prefix("efqdiralpha1_itemtypes")." WHERE dirid=".intval($dirid).""; |
232 | - if (!$result = $this->db->query($sql)) { |
|
233 | - return false; |
|
234 | - } |
|
232 | + if (!$result = $this->db->query($sql)) { |
|
233 | + return false; |
|
234 | + } |
|
235 | 235 | $numrows = $this->db->getRowsNum($result); |
236 | - while ( list($typeid,$typename,$level) = $this->db->fetchRow($result) ) { |
|
236 | + while ( list($typeid,$typename,$level) = $this->db->fetchRow($result) ) { |
|
237 | 237 | $arr[$typeid] = array('typeid' => $typeid,'typename' => $typename,'level' => $level); |
238 | 238 | } |
239 | - return $arr; |
|
239 | + return $arr; |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | /** |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * @param bool $itemtype |
51 | 51 | * @return |
52 | 52 | */ |
53 | - function efqItemType($obj=false) |
|
53 | + function efqItemType($obj = false) |
|
54 | 54 | { |
55 | 55 | global $moddir; |
56 | 56 | $this->db = Database::getInstance(); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * |
97 | 97 | * @return bool true if insertion is succesful, false if unsuccesful |
98 | 98 | */ |
99 | - function insert($obj, $forceQuery=false) { |
|
99 | + function insert($obj, $forceQuery = false) { |
|
100 | 100 | $tablename = "efqdiralpha1_itemtypes"; |
101 | 101 | $keyName = "typeid"; |
102 | 102 | $excludedVars = array(); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $strFields = ""; |
114 | 114 | $strValues = ""; |
115 | 115 | foreach ($cleanvars as $k => $v) { |
116 | - if ( !in_array($k, $excludedVars) ) { |
|
116 | + if (!in_array($k, $excludedVars)) { |
|
117 | 117 | $strFields .= $k; |
118 | 118 | $strValues .= "'".$v."'"; |
119 | 119 | if ($i < $countVars) { |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * |
151 | 151 | * @return bool true if update is succesful, false if unsuccesful |
152 | 152 | */ |
153 | - function update($obj, $forceQuery=false) { |
|
153 | + function update($obj, $forceQuery = false) { |
|
154 | 154 | $tablename = "efqdiralpha1_itemtypes"; |
155 | 155 | $keyName = "typeid"; |
156 | 156 | $excludedVars = array(); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | $strSet = ""; |
169 | 169 | $strValues = ""; |
170 | 170 | foreach ($cleanvars as $k => $v) { |
171 | - if ( !in_array($k, $excludedVars) ) { |
|
171 | + if (!in_array($k, $excludedVars)) { |
|
172 | 172 | if ($i < $countVars and $i > 0) { |
173 | 173 | $strSet .= ", "; |
174 | 174 | } |
@@ -196,13 +196,13 @@ discard block |
||
196 | 196 | * |
197 | 197 | * @return bool true or false |
198 | 198 | */ |
199 | - function set($typeid=0) { |
|
199 | + function set($typeid = 0) { |
|
200 | 200 | $sql = "SELECT typeid,typename,level,dirid FROM ".$this->db->prefix("efqdiralpha1_itemtypes")." WHERE typeid=".intval($typeid).""; |
201 | 201 | $result = $this->db->query($sql); |
202 | 202 | $numrows = $this->db->getRowsNum($result); |
203 | - if ( $numrows > 0 ) { |
|
203 | + if ($numrows > 0) { |
|
204 | 204 | while (list($typeid, $typename, $level, $dirid) = $this->db->fetchRow($result)) { |
205 | - if (! $this->objItemType) { |
|
205 | + if (!$this->objItemType) { |
|
206 | 206 | $this->objItemType = new efqSubscriptionOffer(); |
207 | 207 | } |
208 | 208 | $this->objItemType->setVar('typeid', $typeid); |
@@ -226,15 +226,15 @@ discard block |
||
226 | 226 | * @param integer $dirid |
227 | 227 | * @return array $arr or boolean false |
228 | 228 | */ |
229 | - function getByDir($dirid=0) { |
|
229 | + function getByDir($dirid = 0) { |
|
230 | 230 | $arr = array(); |
231 | 231 | $sql = "SELECT typeid,typename,level FROM ".$this->db->prefix("efqdiralpha1_itemtypes")." WHERE dirid=".intval($dirid).""; |
232 | 232 | if (!$result = $this->db->query($sql)) { |
233 | 233 | return false; |
234 | 234 | } |
235 | 235 | $numrows = $this->db->getRowsNum($result); |
236 | - while ( list($typeid,$typename,$level) = $this->db->fetchRow($result) ) { |
|
237 | - $arr[$typeid] = array('typeid' => $typeid,'typename' => $typename,'level' => $level); |
|
236 | + while (list($typeid, $typename, $level) = $this->db->fetchRow($result)) { |
|
237 | + $arr[$typeid] = array('typeid' => $typeid, 'typename' => $typename, 'level' => $level); |
|
238 | 238 | } |
239 | 239 | return $arr; |
240 | 240 | } |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | $tablename = "efqdiralpha1_itemtypes"; |
254 | 254 | $keyName = "typeid"; |
255 | 255 | $id = $obj->getVar($keyName); |
256 | - if ( $id != 0 ) { |
|
256 | + if ($id != 0) { |
|
257 | 257 | $sql = "DELETE FROM ".$this->db->prefix($tablename)." WHERE ".$keyName."=".intval($id).""; |
258 | 258 | $this->db->queryF($sql); |
259 | 259 | return true; |