1 <?php
2
3 4 5 6 7 8 9 10
11
12 namespace Icybee\Modules\Nodes;
13
14 use ICanBoogie\I18n\FormattedString;
15 use ICanBoogie\Operation;
16
17 class OnlineOperation extends Operation
18 {
19 20 21
22 protected function get_controls()
23 {
24 return [
25
26 self::CONTROL_PERMISSION => Module::PERMISSION_MAINTAIN,
27 self::CONTROL_RECORD => true,
28 self::CONTROL_OWNERSHIP => true
29
30 ] + parent::get_controls();
31 }
32
33 protected function validate(\ICanboogie\Errors $errors)
34 {
35 return true;
36 }
37
38 39 40
41 protected function process()
42 {
43 $record = $this->record;
44 $record->is_online = true;
45 $record->save();
46
47 $this->response->message = new FormattedString('!title is now online', [ '!title' => $record->title ]);
48
49 return true;
50 }
51 }