|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* Hosting Plugin for HiPanel |
|
5
|
|
|
* |
|
6
|
|
|
* @link https://github.com/hiqdev/hipanel-module-hosting |
|
7
|
|
|
* @package hipanel-module-hosting |
|
8
|
|
|
* @license BSD-3-Clause |
|
9
|
|
|
* @copyright Copyright (c) 2015-2016, HiQDev (http://hiqdev.com/) |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* @link http://hiqdev.com/hipanel-module-hosting |
|
14
|
|
|
* @license http://hiqdev.com/hipanel-module-hosting/license |
|
15
|
|
|
* @copyright Copyright (c) 2015 HiQDev |
|
16
|
|
|
*/ |
|
17
|
|
|
|
|
18
|
|
|
namespace hipanel\modules\hosting\controllers; |
|
19
|
|
|
|
|
20
|
|
|
use hipanel\actions\IndexAction; |
|
21
|
|
|
use hipanel\actions\OrientationAction; |
|
22
|
|
|
use hipanel\actions\SmartDeleteAction; |
|
23
|
|
|
use hipanel\actions\ViewAction; |
|
24
|
|
|
use Yii; |
|
25
|
|
|
|
|
26
|
|
|
class RequestController extends \hipanel\base\CrudController |
|
27
|
|
|
{ |
|
28
|
|
|
public function actions() |
|
29
|
|
|
{ |
|
30
|
|
|
return [ |
|
31
|
|
|
'set-orientation' => [ |
|
32
|
|
|
'class' => OrientationAction::class, |
|
33
|
|
|
'allowedRoutes' => [ |
|
34
|
|
|
'/hosting/request/index' |
|
35
|
|
|
] |
|
36
|
|
|
], |
|
37
|
|
|
'index' => [ |
|
38
|
|
|
'class' => IndexAction::class, |
|
39
|
|
|
'findOptions' => [ |
|
40
|
|
|
'object_class_ni' => 'domain', |
|
41
|
|
|
], |
|
42
|
|
|
'data' => function ($action) { |
|
|
|
|
|
|
43
|
|
|
return [ |
|
44
|
|
|
'objects' => $this->getObjects(), |
|
45
|
|
|
'states' => $this->getFilteredStates(), |
|
46
|
|
|
]; |
|
47
|
|
|
}, |
|
48
|
|
|
'filterStorageMap' => [ |
|
49
|
|
|
'state' => 'hosting.request.state', |
|
50
|
|
|
'server' => 'server.server.name', |
|
51
|
|
|
'account' => 'hosting.account.login', |
|
52
|
|
|
'client_id' => 'client.client.id', |
|
53
|
|
|
] |
|
54
|
|
|
], |
|
55
|
|
|
'view' => [ |
|
56
|
|
|
'class' => ViewAction::class, |
|
57
|
|
|
'findOptions' => [ |
|
58
|
|
|
'object_class_ni' => 'domain', |
|
59
|
|
|
], |
|
60
|
|
|
], |
|
61
|
|
|
'delete' => [ |
|
62
|
|
|
'class' => SmartDeleteAction::class, |
|
63
|
|
|
'success' => Yii::t('hipanel:hosting', 'Deleted'), |
|
64
|
|
|
'error' => Yii::t('hipanel:hosting', 'An error occurred when trying to delete request.') |
|
65
|
|
|
], |
|
66
|
|
|
]; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
public function getFilteredStates() |
|
70
|
|
|
{ |
|
71
|
|
|
$result = $this->getStates(); |
|
72
|
|
|
unset($result['done']); |
|
73
|
|
|
|
|
74
|
|
|
return $result; |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
public function getStates() |
|
78
|
|
|
{ |
|
79
|
|
|
return $this->getRefs('state,request', 'hipanel:hosting'); |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
public function getObjects() |
|
83
|
|
|
{ |
|
84
|
|
|
return [ |
|
85
|
|
|
'db' => Yii::t('hipanel:hosting', 'Database'), |
|
86
|
|
|
'hdomain' => Yii::t('hipanel:hosting', 'Domain'), |
|
87
|
|
|
'device' => Yii::t('hipanel:hosting', 'Server'), |
|
88
|
|
|
'service' => Yii::t('hipanel:hosting', 'Service'), |
|
89
|
|
|
]; |
|
90
|
|
|
} |
|
91
|
|
|
} |
|
92
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.