1 <?php
2
3 /*
4 * This file is part of the Icybee package.
5 *
6 * (c) Olivier Laviale <olivier.laviale@gmail.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Icybee\Modules\Dashboard;
13
14 use ICanBoogie\Errors;
15 use ICanBoogie\Operation;
16
17 /**
18 * Saves the order of the user's dashboard blocks.
19 */
20 class OrderOperation extends Operation
21 {
22 protected function get_controls()
23 {
24 return array
25 (
26 self::CONTROL_AUTHENTICATION => true
27 )
28
29 + parent::get_controls();
30 }
31
32 protected function validate(Errors $errors)
33 {
34 return !empty($this->request['order']);
35 }
36
37 protected function process()
38 {
39 global $core;
40
41 $core->user->metas['dashboard.order'] = json_encode($this->request['order']);
42
43 return true;
44 }
45 }