1 | <?php |
||
20 | class acp_manager |
||
21 | { |
||
22 | /** @var driver_interface */ |
||
23 | protected $db; |
||
24 | |||
25 | /** @var request */ |
||
26 | protected $request; |
||
27 | |||
28 | /** @var user */ |
||
29 | protected $user; |
||
30 | |||
31 | /** |
||
32 | * Constructor |
||
33 | * |
||
34 | * @param driver_interface $db |
||
35 | * @param request $request |
||
36 | * @param user $user |
||
37 | * @access public |
||
38 | */ |
||
39 | 33 | public function __construct(driver_interface $db, request $request, user $user) |
|
45 | |||
46 | /** |
||
47 | * Update BBCode order fields in the db on move up/down |
||
48 | * |
||
49 | * @param string $action The action move_up|move_down |
||
50 | * @return null |
||
51 | * @access public |
||
52 | */ |
||
53 | 10 | public function move($action) |
|
93 | |||
94 | /** |
||
95 | * Update BBCode order fields in the db on drag_drop |
||
96 | * |
||
97 | * @return null |
||
98 | * @access public |
||
99 | */ |
||
100 | 3 | public function drag_drop() |
|
135 | |||
136 | /** |
||
137 | * Retrieve the maximum value from the bbcode_order field stored in the db |
||
138 | * |
||
139 | * @return int The maximum order |
||
140 | * @access public |
||
141 | */ |
||
142 | 1 | public function get_max_bbcode_order() |
|
146 | |||
147 | /** |
||
148 | * Get the bbcode_group data from the posted form |
||
149 | * |
||
150 | * @return string The usergroup id numbers, comma delimited, or empty |
||
151 | * @access public |
||
152 | */ |
||
153 | 3 | public function get_bbcode_group_form_data() |
|
160 | |||
161 | /** |
||
162 | * Get the bbcode_group data from the database |
||
163 | * |
||
164 | * @param int $bbcode_id Custom BBCode id |
||
165 | * @return array Custom BBCode user group ids |
||
166 | * @access public |
||
167 | */ |
||
168 | 6 | public function get_bbcode_group_data($bbcode_id) |
|
179 | |||
180 | /** |
||
181 | * Get the bbcode_group data from the database, |
||
182 | * for every BBCode that has groups assigned |
||
183 | * |
||
184 | * @return array Custom BBCode user group ids for each BBCode, by name |
||
185 | * @access public |
||
186 | */ |
||
187 | 1 | public function get_bbcode_groups_data() |
|
202 | |||
203 | /** |
||
204 | * Generate a select box containing user groups |
||
205 | * |
||
206 | * @param mixed $select_id The user groups to mark as selected |
||
207 | * @return string HTML markup of user groups select box for the form |
||
208 | * @access public |
||
209 | */ |
||
210 | 4 | public function bbcode_group_select_options($select_id = false) |
|
229 | |||
230 | /** |
||
231 | * Resynchronize the Custom BBCodes order field |
||
232 | * (Based on Custom BBCode Sorting MOD by RMcGirr83) |
||
233 | * |
||
234 | * @return null |
||
235 | * @access public |
||
236 | */ |
||
237 | 14 | public function resynchronize_bbcode_order() |
|
266 | |||
267 | /** |
||
268 | * Build SQL query to update a bbcode order value |
||
269 | * |
||
270 | * @param int $bbcode_id ID of the bbcode |
||
271 | * @param int $bbcode_order Value of the bbcode order |
||
272 | * @return string The SQl query to run |
||
273 | * @access protected |
||
274 | */ |
||
275 | 8 | protected function update_bbcode_order($bbcode_id, $bbcode_order) |
|
281 | |||
282 | /** |
||
283 | * Increment |
||
284 | * |
||
285 | * @param string $action The action move_up|move_down |
||
286 | * @return int Increment amount: Move up -1. Move down +1. |
||
287 | * @access protected |
||
288 | */ |
||
289 | 7 | protected function increment($action) |
|
293 | |||
294 | /** |
||
295 | * Retrieve the maximum value in a column from the bbcodes table |
||
296 | * |
||
297 | * @param string $column Name of the column (bbcode_id|bbcode_order) |
||
298 | * @return int The maximum value in the column |
||
299 | * @access protected |
||
300 | */ |
||
301 | 3 | protected function get_max_column_value($column) |
|
311 | |||
312 | /** |
||
313 | * Send a JSON response |
||
314 | * |
||
315 | * @param bool $content The content of the JSON response (true|false) |
||
316 | * @access protected |
||
317 | */ |
||
318 | 9 | protected function send_json_response($content) |
|
328 | } |
||
329 |