| @@ 286-311 (lines=26) @@ | ||
| 283 | * |
|
| 284 | * @return array|bool |
|
| 285 | */ |
|
| 286 | public function get_handler_field_info_by_field_variable($variable) |
|
| 287 | { |
|
| 288 | $variable = Database::escape_string($variable); |
|
| 289 | $sql = "SELECT * FROM {$this->table} |
|
| 290 | WHERE |
|
| 291 | variable = '$variable' AND |
|
| 292 | extra_field_type = $this->extraFieldType"; |
|
| 293 | $result = Database::query($sql); |
|
| 294 | if (Database::num_rows($result)) { |
|
| 295 | $row = Database::fetch_array($result, 'ASSOC'); |
|
| 296 | $row['display_text'] = self::translateDisplayName($row['variable'], $row['display_text']); |
|
| 297 | ||
| 298 | // All the options of the field |
|
| 299 | $sql = "SELECT * FROM $this->table_field_options |
|
| 300 | WHERE field_id='".intval($row['id'])."' |
|
| 301 | ORDER BY option_order ASC"; |
|
| 302 | $result = Database::query($sql); |
|
| 303 | while ($option = Database::fetch_array($result)) { |
|
| 304 | $row['options'][$option['id']] = $option; |
|
| 305 | } |
|
| 306 | ||
| 307 | return $row; |
|
| 308 | } else { |
|
| 309 | return false; |
|
| 310 | } |
|
| 311 | } |
|
| 312 | ||
| 313 | /** |
|
| 314 | * Get all the field info for tags |
|
| @@ 319-344 (lines=26) @@ | ||
| 316 | * |
|
| 317 | * @return array|bool |
|
| 318 | */ |
|
| 319 | public function get_handler_field_info_by_tags($variable) |
|
| 320 | { |
|
| 321 | $variable = Database::escape_string($variable); |
|
| 322 | $sql = "SELECT * FROM {$this->table} |
|
| 323 | WHERE |
|
| 324 | variable = '$variable' AND |
|
| 325 | extra_field_type = $this->extraFieldType"; |
|
| 326 | $result = Database::query($sql); |
|
| 327 | if (Database::num_rows($result)) { |
|
| 328 | $row = Database::fetch_array($result, 'ASSOC'); |
|
| 329 | $row['display_text'] = self::translateDisplayName( |
|
| 330 | $row['variable'], |
|
| 331 | $row['display_text'] |
|
| 332 | ); |
|
| 333 | ||
| 334 | // All the tags of the field |
|
| 335 | $sql = "SELECT * FROM $this->table_field_tag |
|
| 336 | WHERE field_id='".intval($row['id'])."' |
|
| 337 | ORDER BY id ASC"; |
|
| 338 | $result = Database::query($sql); |
|
| 339 | while ($option = Database::fetch_array($result, 'ASSOC')) { |
|
| 340 | $row['options'][$option['id']] = $option; |
|
| 341 | } |
|
| 342 | ||
| 343 | return $row; |
|
| 344 | } else { |
|
| 345 | return false; |
|
| 346 | } |
|
| 347 | } |
|