/** {@inheritdoc} */ private function ensureRelatedData() { $this->_model = Server::findOne(['id' => $this->model_id]); $this->name = $this->_model->name; $this->description = Yii::t('hipanel:server', 'Renewal'); }
public function actionIsOperable($id) { Yii::$app->response->format = Response::FORMAT_JSON; $result = ['id' => $id, 'result' => false]; if ($server = Server::find()->where(['id' => $id])->one()) { $result['result'] = $server->isOperable(); } return $result; }
public function actionIndex() { $options = ['model' => ClientController::findModel(['id' => Yii::$app->user->identity->id, 'with_tickets_count' => true, 'with_domains_count' => Yii::getAlias('@domain', false) ? true : false, 'with_servers_count' => true, 'with_hosting_count' => true, 'with_contacts_count' => true]), 'totalCount' => []]; if (Yii::$app->user->can('manage')) { if (Yii::getAlias('@domain', false)) { $options['totalCount']['domains'] = Domain::find()->count(); } if (Yii::getAlias('@server', false)) { $options['totalCount']['servers'] = Server::find()->count(); } if (Yii::getAlias('@ticket', false)) { $options['totalCount']['tickets'] = Thread::find()->count(); } } return $this->render('index', $options); }