| @@ 13-54 (lines=42) @@ | ||
| 10 | ||
| 11 | namespace ernadoo\phpbbdirectory\textreparser\plugins; |
|
| 12 | ||
| 13 | class cat_description extends \phpbb\textreparser\row_based_plugin |
|
| 14 | { |
|
| 15 | /** |
|
| 16 | * {@inheritdoc} |
|
| 17 | */ |
|
| 18 | public function get_columns() |
|
| 19 | { |
|
| 20 | return array( |
|
| 21 | 'id' => 'cat_id', |
|
| 22 | 'text' => 'cat_desc', |
|
| 23 | 'bbcode_uid' => 'cat_desc_uid', |
|
| 24 | 'options' => 'cat_desc_options', |
|
| 25 | ); |
|
| 26 | } |
|
| 27 | ||
| 28 | /** |
|
| 29 | * {@inheritdoc} |
|
| 30 | */ |
|
| 31 | protected function get_records_by_range_query($min_id, $max_id) |
|
| 32 | { |
|
| 33 | $columns = $this->get_columns(); |
|
| 34 | $fields = array(); |
|
| 35 | foreach ($columns as $field_name => $column_name) |
|
| 36 | { |
|
| 37 | if ($column_name === $field_name) |
|
| 38 | { |
|
| 39 | $fields[] = $column_name; |
|
| 40 | } |
|
| 41 | else |
|
| 42 | { |
|
| 43 | $fields[] = $column_name . ' AS ' . $field_name; |
|
| 44 | } |
|
| 45 | } |
|
| 46 | ||
| 47 | $sql = 'SELECT ' . implode(', ', $fields) . ' |
|
| 48 | FROM ' . $this->table . ' |
|
| 49 | WHERE ' . $columns['id'] . ' BETWEEN ' . $min_id . ' AND ' . $max_id . ' |
|
| 50 | AND ' . $columns['text'] . ' <> ""'; |
|
| 51 | ||
| 52 | return $sql; |
|
| 53 | } |
|
| 54 | } |
|
| 55 | ||
| @@ 13-54 (lines=42) @@ | ||
| 10 | ||
| 11 | namespace ernadoo\phpbbdirectory\textreparser\plugins; |
|
| 12 | ||
| 13 | class link_description extends \phpbb\textreparser\row_based_plugin |
|
| 14 | { |
|
| 15 | /** |
|
| 16 | * {@inheritdoc} |
|
| 17 | */ |
|
| 18 | public function get_columns() |
|
| 19 | { |
|
| 20 | return array( |
|
| 21 | 'id' => 'link_id', |
|
| 22 | 'text' => 'link_description', |
|
| 23 | 'bbcode_uid' => 'link_uid', |
|
| 24 | 'options' => 'link_flags', |
|
| 25 | ); |
|
| 26 | } |
|
| 27 | ||
| 28 | /** |
|
| 29 | * {@inheritdoc} |
|
| 30 | */ |
|
| 31 | protected function get_records_by_range_query($min_id, $max_id) |
|
| 32 | { |
|
| 33 | $columns = $this->get_columns(); |
|
| 34 | $fields = array(); |
|
| 35 | foreach ($columns as $field_name => $column_name) |
|
| 36 | { |
|
| 37 | if ($column_name === $field_name) |
|
| 38 | { |
|
| 39 | $fields[] = $column_name; |
|
| 40 | } |
|
| 41 | else |
|
| 42 | { |
|
| 43 | $fields[] = $column_name . ' AS ' . $field_name; |
|
| 44 | } |
|
| 45 | } |
|
| 46 | ||
| 47 | $sql = 'SELECT ' . implode(', ', $fields) . ' |
|
| 48 | FROM ' . $this->table . ' |
|
| 49 | WHERE ' . $columns['id'] . ' BETWEEN ' . $min_id . ' AND ' . $max_id . ' |
|
| 50 | AND ' . $columns['text'] . ' <> ""'; |
|
| 51 | ||
| 52 | return $sql; |
|
| 53 | } |
|
| 54 | } |
|
| 55 | ||