|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace hipanel\controllers; |
|
4
|
|
|
|
|
5
|
|
|
use hipanel\actions\IndexAction; |
|
6
|
|
|
use hipanel\actions\OrientationAction; |
|
7
|
|
|
use hipanel\actions\SmartCreateAction; |
|
8
|
|
|
use hipanel\actions\SmartDeleteAction; |
|
9
|
|
|
use hipanel\actions\SmartUpdateAction; |
|
10
|
|
|
use yii\web\NotFoundHttpException; |
|
11
|
|
|
|
|
12
|
|
|
class ReminderController extends \hipanel\base\CrudController |
|
13
|
|
|
{ |
|
14
|
|
|
public function init() |
|
15
|
|
|
{ |
|
16
|
|
|
$this->viewPath = '@hipanel/views/reminder'; |
|
17
|
|
|
} |
|
18
|
|
|
|
|
19
|
|
|
public function actions() |
|
20
|
|
|
{ |
|
21
|
|
|
return [ |
|
22
|
|
|
'set-orientation' => [ |
|
23
|
|
|
'class' => OrientationAction::class, |
|
24
|
|
|
'allowedRoutes' => [ |
|
25
|
|
|
'reminder/index' |
|
26
|
|
|
] |
|
27
|
|
|
], |
|
28
|
|
|
'index' => [ |
|
29
|
|
|
'class' => IndexAction::class, |
|
30
|
|
|
'data' => function ($action, $data) { |
|
|
|
|
|
|
31
|
|
|
return [ |
|
32
|
|
|
|
|
33
|
|
|
]; |
|
34
|
|
|
}, |
|
35
|
|
|
], |
|
36
|
|
|
'create-modal' => [ |
|
37
|
|
|
'class' => SmartCreateAction::class, |
|
38
|
|
|
'scenario' => 'create', |
|
39
|
|
|
'view' => 'create-modal', |
|
40
|
|
|
'data' => function ($action, $data) { |
|
41
|
|
|
$object_id = \Yii::$app->request->get('object_id'); |
|
42
|
|
|
if (empty($object_id)) { |
|
43
|
|
|
throw new NotFoundHttpException('Object ID is missing'); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
$data['model']->object_id = $object_id; |
|
47
|
|
|
|
|
48
|
|
|
return $data; |
|
49
|
|
|
} |
|
50
|
|
|
], |
|
51
|
|
|
'create' => [ |
|
52
|
|
|
'class' => SmartCreateAction::class, |
|
53
|
|
|
], |
|
54
|
|
|
'update' => [ |
|
55
|
|
|
'class' => SmartUpdateAction::class, |
|
56
|
|
|
], |
|
57
|
|
|
'delete' => [ |
|
58
|
|
|
'class' => SmartDeleteAction::class, |
|
59
|
|
|
] |
|
60
|
|
|
]; |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* @return array |
|
65
|
|
|
*/ |
|
66
|
|
|
protected function prepareRefs() |
|
67
|
|
|
{ |
|
68
|
|
|
return [ |
|
69
|
|
|
'topic_data' => $this->getRefs('topic,ticket', 'hipanel/ticket'), |
|
70
|
|
|
'state_data' => $this->getClassRefs('state', 'hipanel/ticket'), |
|
71
|
|
|
'priority_data' => $this->getPriorities(), |
|
|
|
|
|
|
72
|
|
|
]; |
|
73
|
|
|
} |
|
74
|
|
|
} |
|
75
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.