1 | <?php |
||
23 | class BillController extends \hipanel\base\CrudController |
||
24 | { |
||
25 | 1 | public function actions() |
|
26 | { |
||
27 | return [ |
||
28 | 'set-orientation' => [ |
||
29 | 'class' => OrientationAction::class, |
||
30 | 'allowedRoutes' => [ |
||
31 | '@bill/index' |
||
32 | ] |
||
33 | 1 | ], |
|
34 | 'index' => [ |
||
35 | 'class' => IndexAction::class, |
||
36 | 'data' => function ($action) { |
||
37 | return [ |
||
38 | 'type' => $action->controller->getPaymentType(), |
||
39 | ]; |
||
40 | 1 | }, |
|
41 | ], |
||
42 | 'view' => [ |
||
43 | 'class' => ViewAction::class, |
||
44 | ], |
||
45 | 'validate-form' => [ |
||
46 | 'class' => ValidateFormAction::class, |
||
47 | ], |
||
48 | 'create' => [ |
||
49 | 'class' => SmartCreateAction::class, |
||
50 | 1 | 'data' => function ($action) { |
|
|
|||
51 | $types = $this->getRefs('type,bill', 'hipanel/finance', ['with_hierarchy' => 1, 'orderby' => 'name_asc']); |
||
52 | $billTypes = []; |
||
53 | $billGroupLabels = []; |
||
54 | |||
55 | foreach ($types as $key => $title) { |
||
56 | list($type, $name) = explode(',', $key); |
||
57 | |||
58 | if (!isset($billTypes[$type])) { |
||
59 | $billTypes[$type] = []; |
||
60 | $billGroupLabels[$type] = ['label' => $title]; |
||
61 | } |
||
62 | |||
63 | if (isset($name)) { |
||
64 | foreach ($types as $k => $t) { |
||
65 | if (strpos($k, $type . ',') === 0) { |
||
66 | $billTypes[$type][$k] = $t; |
||
67 | } |
||
68 | } |
||
69 | } |
||
70 | } |
||
71 | |||
72 | return ['billTypes' => $billTypes, 'billGroupLabels' => $billGroupLabels]; |
||
73 | 1 | }, |
|
74 | 1 | 'success' => Yii::t('hipanel/finance', 'Bill was created successfully'), |
|
75 | ], |
||
76 | 'update' => [ |
||
77 | 'class' => SmartUpdateAction::class, |
||
78 | 1 | 'success' => Yii::t('hipanel/finance', 'Bill was updated successfully'), |
|
79 | ], |
||
80 | 'delete' => [ |
||
81 | 'class' => SmartPerformAction::class, |
||
82 | 1 | 'success' => Yii::t('hipanel/finance', 'Bill was deleted successfully'), |
|
83 | ], |
||
84 | ]; |
||
85 | } |
||
86 | |||
87 | /** |
||
88 | * @return array |
||
89 | */ |
||
90 | public function getPaymentType() |
||
94 | } |
||
95 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.