@@ 254-278 (lines=25) @@ | ||
251 | * |
|
252 | * @return array|bool |
|
253 | */ |
|
254 | public function get_handler_field_info_by_field_variable($variable) |
|
255 | { |
|
256 | $variable = Database::escape_string($variable); |
|
257 | $sql = "SELECT * FROM {$this->table} |
|
258 | WHERE |
|
259 | variable = '$variable' AND |
|
260 | extra_field_type = $this->extraFieldType"; |
|
261 | $result = Database::query($sql); |
|
262 | if (Database::num_rows($result)) { |
|
263 | $row = Database::fetch_array($result, 'ASSOC'); |
|
264 | ||
265 | // All the options of the field |
|
266 | $sql = "SELECT * FROM $this->table_field_options |
|
267 | WHERE field_id='".intval($row['id'])."' |
|
268 | ORDER BY option_order ASC"; |
|
269 | $result = Database::query($sql); |
|
270 | while ($option = Database::fetch_array($result)) { |
|
271 | $row['options'][$option['id']] = $option; |
|
272 | } |
|
273 | ||
274 | return $row; |
|
275 | } else { |
|
276 | return false; |
|
277 | } |
|
278 | } |
|
279 | ||
280 | /** |
|
281 | * @param int $fieldId |
|
@@ 285-309 (lines=25) @@ | ||
282 | * |
|
283 | * @return array|bool |
|
284 | */ |
|
285 | public function getFieldInfoByFieldId($fieldId) |
|
286 | { |
|
287 | $fieldId = intval($fieldId); |
|
288 | $sql = "SELECT * FROM {$this->table} |
|
289 | WHERE |
|
290 | field_id = '$fieldId' AND |
|
291 | extra_field_type = $this->extraFieldType"; |
|
292 | $result = Database::query($sql); |
|
293 | if (Database::num_rows($result)) { |
|
294 | $row = Database::fetch_array($result, 'ASSOC'); |
|
295 | ||
296 | // All the options of the field |
|
297 | $sql = "SELECT * FROM $this->table_field_options |
|
298 | WHERE field_id='".$fieldId."' |
|
299 | ORDER BY option_order ASC"; |
|
300 | $result = Database::query($sql); |
|
301 | while ($option = Database::fetch_array($result)) { |
|
302 | $row['options'][$option['id']] = $option; |
|
303 | } |
|
304 | ||
305 | return $row; |
|
306 | } else { |
|
307 | return false; |
|
308 | } |
|
309 | } |
|
310 | ||
311 | /** |
|
312 | * @return int |