| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Server module for HiPanel |
||
| 4 | * |
||
| 5 | * @link https://github.com/hiqdev/hipanel-module-server |
||
| 6 | * @package hipanel-module-server |
||
| 7 | * @license BSD-3-Clause |
||
| 8 | * @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/) |
||
| 9 | */ |
||
| 10 | |||
| 11 | namespace hipanel\modules\server\widgets; |
||
| 12 | |||
| 13 | use Yii; |
||
| 14 | use yii\base\Widget; |
||
| 15 | use yii\helpers\Url; |
||
| 16 | |||
| 17 | class ServerSwitcher extends Widget |
||
| 18 | { |
||
| 19 | public $model; |
||
| 20 | |||
| 21 | public function run() |
||
| 22 | { |
||
| 23 | if (!Yii::$app->user->can('support')) { |
||
|
0 ignored issues
–
show
|
|||
| 24 | return null; |
||
| 25 | } |
||
| 26 | |||
| 27 | $this->initClientScript(); |
||
| 28 | |||
| 29 | return $this->render('ServerSwitcher', ['model' => $this->model]); |
||
| 30 | } |
||
| 31 | |||
| 32 | protected function initClientScript() |
||
| 33 | { |
||
| 34 | $url = Url::to(['@server/view', 'id' => '']); |
||
| 35 | $this->view->registerJs(" |
||
| 36 | $('.server-switcher select').on('select2:select', function (e) { |
||
| 37 | var selectedId = this.value; |
||
| 38 | window.location.href = '{$url}' + selectedId; |
||
| 39 | }); |
||
| 40 | "); |
||
| 41 | } |
||
| 42 | } |
||
| 43 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.