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