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