public function actionFinish() { $cart = $this->module->getCart(); $finisher = new CartFinisher(['cart' => $cart]); $finisher->run(); $client = Client::findOne(['id' => Yii::$app->user->identity->id]); return $this->render('finish', ['balance' => $client->balance, 'success' => $finisher->getSuccess(), 'error' => $finisher->getError(), 'pending' => $finisher->getPending(), 'remarks' => (array) Yii::$app->getView()->params['remarks']]); }
public function actions() { return ['set-orientation' => ['class' => OrientationAction::class, 'allowedRoutes' => ['@ticket/index']], 'index' => ['class' => IndexAction::class, 'data' => $this->prepareRefs()], 'view' => ['class' => ViewAction::class, 'findOptions' => $this->getSearchOptions(), 'on beforeSave' => function (Event $event) { /** @var PrepareBulkAction $action */ $action = $event->sender; $dataProvider = $action->getDataProvider(); $dataProvider->query->joinWith('answers'); }, 'data' => function ($action) { $client = Client::find()->where(['id' => $action->model->recipient_id, 'with_contact' => 1])->withDomains()->withServers()->one(); if ($client->login === 'anonym') { $client->name = $action->model->anonym_name; $client->email = $action->model->anonym_email; $client->seller = $action->model->anonym_seller; } return array_merge(compact('client'), $this->prepareRefs()); }], 'validate-form' => ['class' => ValidateFormAction::class], 'answer' => ['class' => SmartUpdateAction::class, 'success' => Yii::t('hipanel:ticket', 'Ticket changed')], 'create' => ['class' => SmartCreateAction::class, 'success' => Yii::t('hipanel:ticket', 'Ticket posted'), 'data' => function () { return $this->prepareRefs(); }], 'delete' => ['class' => SmartPerformAction::class, 'success' => Yii::t('hipanel:ticket', 'Ticket deleted')], 'subscribe' => ['class' => SmartPerformAction::class, 'scenario' => 'answer', 'success' => Yii::t('hipanel:ticket', 'Subscribed'), 'on beforeSave' => function (Event $event) { /** @var Action $action */ $action = $event->sender; foreach ($action->collection->models as $model) { $model->{$this->_subscribeAction[$action->id]} = Yii::$app->user->identity->username; } }, 'POST pjax' => ['save' => true, 'success' => ['class' => ViewAction::class, 'view' => '_subscribeButton', 'findOptions' => ['with_answers' => 1, 'show_closed' => 1]]]], 'unsubscribe' => ['class' => SmartPerformAction::class, 'scenario' => 'answer', 'success' => Yii::t('hipanel:ticket', 'Unsubscribed'), 'on beforeSave' => function (Event $event) { /** @var Action $action */ $action = $event->sender; foreach ($action->collection->models as $model) { $model->{$this->_subscribeAction[$action->id]} = Yii::$app->user->identity->username; } }, 'POST pjax' => ['save' => true, 'success' => ['class' => ViewAction::class, 'view' => '_subscribeButton', 'findOptions' => ['with_answers' => 1, 'show_closed' => 1]]]], 'close' => ['class' => SmartPerformAction::class, 'scenario' => 'close', 'success' => Yii::t('hipanel:ticket', 'Ticket closed'), 'on beforeSave' => function (Event $event) { /** @var Action $action */ $action = $event->sender; foreach ($action->collection->models as $model) { $model->{'state'} = Thread::STATE_CLOSE; } }, 'POST pjax' => ['save' => true, 'success' => ['class' => ProxyAction::class, 'action' => 'view', 'params' => function ($action, $model) { return ['id' => $model->id]; }]]], 'open' => ['class' => SmartPerformAction::class, 'scenario' => 'open', 'success' => Yii::t('hipanel:ticket', 'Ticket opened'), 'on beforeSave' => function (Event $event) { /** @var Action $action */ $action = $event->sender; foreach ($action->collection->models as $model) { $model->{'state'} = Thread::STATE_OPEN; } }, 'POST pjax' => ['save' => true, 'success' => ['class' => ProxyAction::class, 'action' => 'view', 'params' => function ($action, $model) { return ['id' => $model->id]; }]]], 'update-answer-modal' => ['class' => PrepareAjaxViewAction::class, 'on beforeSave' => function (Event $event) { /** @var PrepareBulkAction $action */ $action = $event->sender; $dataProvider = $action->getDataProvider(); $dataProvider->query->joinWith('answers'); }, 'data' => function ($action, $data) { $answer_id = Yii::$app->request->get('answer_id'); if (!is_numeric($answer_id)) { throw new NotFoundHttpException('Invalid answer_id'); } return ArrayHelper::merge($data, ['answer_id' => $answer_id]); }, 'findOptions' => $this->getSearchOptions(), 'scenario' => 'answer-update', 'view' => '_updateAnswerModal']]; }
public function actionChangeContact($contactId = null, $contactType = null, $domainId = null, $domainName = null) { if (!Yii::$app->request->isPost) { $model = $this->findModel($contactId); $model->scenario = 'change-contact'; return $this->render('changeContact', ['countries' => $this->getRefs('country_code', 'hipanel'), 'askPincode' => Client::perform('HasPincode'), 'model' => $model, 'domainId' => $domainId, 'domainName' => $domainName, 'contactType' => $contactType]); } else { $model = new Contact(['scenario' => 'create']); if ($model->load(Yii::$app->request->post())) { $domainContactInfo = Domain::perform('GetContactsInfo', ['id' => $model->domainId]); $setContactOptions = ['domain' => $model->domainName, 'id' => $model->domainId]; if ($model->save()) { foreach (Domain::$contactOptions as $contact) { $setContactOptions[$contact] = $contact === $model->contactType ? $model->id : $domainContactInfo[$contact]['id']; } Domain::perform('SetContacts', $setContactOptions); $this->redirect(['@domain/view', 'id' => $model->domainId]); } } } }
/** {@inheritdoc} */ public function rules() { return [[['id', 'zone_id', 'seller_id', 'client_id', 'remoteid', 'daysleft', 'prem_daysleft'], 'integer'], [['domain', 'statuses', 'name', 'zone', 'state', 'lastop', 'state_label'], 'safe'], [['seller', 'seller_name', 'client', 'client_name'], 'safe'], [['created_date', 'updated_date', 'transfer_date', 'expiration_date', 'expires', 'since', 'prem_expires'], 'date'], [['registered', 'operated'], 'date'], [['is_expired', 'is_served', 'is_holded', 'is_premium', 'is_secured', 'is_freezed', 'wp_freezed'], 'boolean'], [['premium_autorenewal', 'expires_soon', 'autorenewal', 'whois_protected'], 'boolean'], [['foa_sent_to'], 'email'], [['url_fwval', 'mailval', 'parkval', 'soa', 'dns', 'counters'], 'safe'], [['block', 'epp_client_id', 'nameservers', 'nsips'], 'safe'], [['note'], 'safe', 'on' => ['set-note', 'default']], [['enable'], 'safe', 'on' => ['set-lock', 'set-whois-protect']], [['domain', 'autorenewal'], 'safe', 'on' => 'set-autorenewal'], [['domain', 'whois_protected'], 'safe', 'on' => 'set-whois-protect'], [['domain', 'is_secured'], 'safe', 'on' => 'set-lock'], [['domain'], 'safe', 'on' => ['sync', 'only-object']], [['id'], 'required', 'on' => ['enable-freeze', 'disable-freeze', 'sync', 'regen-password', 'set-note', 'set-autorenewal', 'set-whois-protect', 'set-lock', 'push-with-pincode', 'enable-hold', 'disable-hold', 'enable-w-p-freeze', 'disable-w-p-freeze']], [['domain'], DomainPartValidator::className(), 'message' => Yii::t('hipanel:domain', '\'{value}\' is not valid domain name'), 'on' => ['check-domain']], [['domain'], 'filter', 'filter' => function ($value) { if (strpos($value, '.') !== false) { return substr($value, 0, strpos($value, '.')); } else { return $value; } }, 'on' => 'check-domain'], [['domain'], 'required', 'on' => ['check-domain']], [['zone'], 'safe', 'on' => ['check-domain']], [['zone'], 'trim', 'on' => ['check-domain']], [['zone'], 'default', 'value' => static::DEFAULT_ZONE, 'on' => ['check-domain']], [['is_available'], 'boolean', 'on' => ['check-domain']], [['resource'], 'safe', 'on' => ['check-domain']], [['domain', 'password'], 'required', 'when' => function ($model) { return empty($model->domains); }, 'on' => ['transfer']], [['domains'], 'required', 'when' => function ($model) { return empty($model->domain) && empty($model->password); }, 'on' => ['transfer']], [['domain'], DomainValidator::class, 'on' => ['transfer']], [['domain', 'password'], 'trim', 'on' => ['transfer']], [['domain', 'nameservers', 'nsips'], 'safe', 'on' => 'set-nss'], [['nameservers', 'nsips'], 'filter', 'filter' => function ($value) { return !is_array($value) ? StringHelper::mexplode($value) : $value; }, 'on' => 'OLD-set-ns'], [['nameservers'], 'each', 'rule' => [DomainValidator::class], 'on' => 'OLD-set-ns'], [['nsips'], 'each', 'rule' => [NsValidator::class], 'on' => 'OLD-set-ns'], [['dumb'], 'safe', 'on' => ['get-zones']], [['receiver'], 'required', 'on' => ['push', 'push-with-pincode']], [['pincode'], 'required', 'on' => ['push-with-pincode']], [['pincode'], function ($attribute, $params) { try { $response = Client::perform('CheckPincode', [$attribute => $this->{$attribute}, 'id' => Yii::$app->user->id]); } catch (Exception $e) { $this->addError($attribute, Yii::t('hipanel:client', 'Wrong pincode')); } }, 'on' => ['push-with-pincode']], [['domain', 'sender', 'pincode'], 'safe', 'on' => ['push', 'push-with-pincode']], [['id', 'domain'], 'safe', 'on' => ['bulk-set-contacts']]]; }
public function actions() { return ['set-orientation' => ['class' => OrientationAction::class, 'allowedRoutes' => ['@client/index']], 'index' => ['class' => IndexAction::class, 'on beforePerform' => function ($event) { if (!Yii::$app->user->can('support')) { Yii::$app->response->redirect(Url::to(['@client/view', 'id' => Yii::$app->user->id]))->send(); } }, 'data' => function ($action) { return ['types' => $this->getRefs('type,client', 'hipanel:client'), 'states' => $this->getRefs('state,client', 'hipanel:client')]; }, 'filterStorageMap' => ['login_like' => 'client.client.login_like', 'state' => 'client.client.state', 'type' => 'client.client.type', 'seller' => 'client.client.seller']], 'search' => ['class' => SearchAction::class], 'create' => ['class' => SmartCreateAction::class, 'success' => Yii::t('hipanel:client', 'Client was created')], 'update' => ['class' => SmartUpdateAction::class, 'success' => Yii::t('hipanel:client', 'Client was updated')], 'delete' => ['class' => SmartDeleteAction::class, 'success' => Yii::t('hipanel:client', 'Client was deleted')], 'enable-block' => ['class' => SmartPerformAction::class, 'success' => 'Client was blocked successfully', 'error' => 'Error during the client account blocking'], 'disable-block' => ['class' => SmartPerformAction::class, 'success' => 'Client was unblocked successfully', 'error' => 'Error during the client account unblocking'], 'change-password' => ['class' => SmartUpdateAction::class, 'view' => '_changePasswordModal', 'POST' => ['save' => true, 'success' => ['class' => RenderJsonAction::class, 'return' => function ($action) { return ['success' => !$action->collection->hasErrors()]; }]]], 'set-tmp-password' => ['class' => SmartUpdateAction::class, 'view' => '_setTmpPasswordModal', 'success' => Yii::t('hipanel:client', 'Temporary password was sent on your email'), 'error' => Yii::t('hipanel:client', 'Error during temporary password setting')], 'view' => ['class' => ViewAction::class, 'on beforePerform' => function ($event) { $action = $event->sender; $action->getDataProvider()->query->addSelect(array_filter(['last_seen', 'contacts_count', Yii::getAlias('@domain', false) ? 'domains_count' : null, Yii::getAlias('@ticket', false) ? 'tickets_count' : null, Yii::getAlias('@server', false) ? 'servers_count' : null, Yii::getAlias('@hosting', false) ? 'hosting_count' : null]))->joinWith('contact')->joinWith(['purses' => function ($query) { $query->joinWith('contact')->joinWith('requisite')->joinWith('files'); }]); }], 'validate-form' => ['class' => ValidateFormAction::class], 'set-credit' => ['class' => SmartUpdateAction::class, 'success' => Yii::t('hipanel:client', 'Credit changed')], 'set-note' => ['class' => SmartUpdateAction::class, 'success' => Yii::t('hipanel:client', 'Note changed'), 'error' => Yii::t('hipanel:client', 'Failed to change note')], 'bulk-enable-block' => ['class' => SmartUpdateAction::class, 'scenario' => 'enable-block', 'success' => Yii::t('hipanel:client', 'Clients were blocked successfully'), 'error' => Yii::t('hipanel:client', 'Error during the clients blocking'), 'POST html' => ['save' => true, 'success' => ['class' => RedirectAction::class]], 'on beforeSave' => function (Event $event) { /** @var \hipanel\actions\Action $action */ $action = $event->sender; $type = Yii::$app->request->post('type'); $comment = Yii::$app->request->post('comment'); if (!empty($type)) { foreach ($action->collection->models as $model) { $model->setAttributes(['type' => $type, 'comment' => $comment]); } } }], 'bulk-enable-block-modal' => ['class' => PrepareBulkAction::class, 'scenario' => 'enable-block', 'view' => '_bulkEnableBlock', 'data' => function ($action, $data) { return array_merge($data, ['blockReasons' => $this->getBlockReasons()]); }], 'bulk-disable-block' => ['class' => SmartUpdateAction::class, 'scenario' => 'disable-block', 'success' => Yii::t('hipanel:client', 'Clients were unblocked successfully'), 'error' => Yii::t('hipanel:client', 'Error during the clients unblocking'), 'POST html' => ['save' => true, 'success' => ['class' => RedirectAction::class]], 'on beforeSave' => function (Event $event) { /** @var \hipanel\actions\Action $action */ $action = $event->sender; $comment = Yii::$app->request->post('comment'); if (!empty($type)) { foreach ($action->collection->models as $model) { $model->setAttribute('comment', $comment); } } }], 'bulk-disable-block-modal' => ['class' => PrepareBulkAction::class, 'scenario' => 'disable-block', 'view' => '_bulkDisableBlock'], 'ip-restrictions' => ['class' => ClassValuesAction::class, 'valuesClass' => 'client,access', 'view' => '_ipRestrictionsModal'], 'domain-settings' => ['class' => ClassValuesAction::class, 'valuesClass' => 'client,domain_defaults', 'view' => '_domainSettingsModal', 'on beforePerform' => function (Event $event) { $action = $event->sender; foreach (['registrant', 'admin', 'billing', 'tech'] as $key) { if (!$action->model->{$key}) { unset($action->model->{$key}); } } }], 'mailing-settings' => ['class' => ClassValuesAction::class, 'valuesClass' => 'client,mailing', 'view' => '_mailingSettingsModal'], 'ticket-settings' => ['class' => ClassValuesAction::class, 'valuesClass' => 'client,ticket_settings', 'view' => '_ticketSettingsModal'], 'pincode-settings' => ['class' => SmartUpdateAction::class, 'view' => '_pincodeSettingsModal', 'on beforeFetch' => function ($event) { /** @var \hipanel\actions\SearchAction $action */ $action = $event->sender; $dataProvider = $action->getDataProvider(); $dataProvider->query->addSelect('pincode_enabled'); }, 'data' => function ($action, $data) { $apiData = $this->getRefs('type,question', 'hipanel:client'); $questionList = array_merge(Client::makeTranslateQuestionList($apiData), ['own' => Yii::t('hipanel:client', 'Own question')]); return array_merge(['questionList' => $questionList], $data); }]]; }
public function actions() { return ['set-orientation' => ['class' => OrientationAction::class, 'allowedRoutes' => ['@domain/index']], 'add-to-cart-renewal' => ['class' => AddToCartAction::class, 'productClass' => DomainRenewalProduct::class, 'redirectToCart' => true], 'bulk-renewal' => ['class' => AddToCartAction::class, 'productClass' => DomainRenewalProduct::class, 'bulkLoad' => true], 'add-to-cart-registration' => ['class' => AddToCartAction::class, 'redirectToCart' => true, 'productClass' => DomainRegistrationProduct::class], 'add-to-cart-transfer' => ['class' => AddToCartAction::class, 'productClass' => DomainTransferProduct::class, 'bulkLoad' => true], 'bulk-set-contacts-modal' => ['class' => PrepareBulkAction::class, 'scenario' => 'bulk-set-contacts', 'view' => '_bulkSetContacts'], 'domain-push-modal' => ['class' => PrepareBulkAction::class, 'view' => '_modalPush', 'on beforePerform' => function ($event) { /** @var Action $action */ $action = $event->sender; $pincodeData = Client::perform('HasPincode', ['id' => Yii::$app->user->id]); $hasPincode = $pincodeData['pincode_enabled']; $action->data['hasPincode'] = $hasPincode; $action->setScenario($hasPincode ? 'push-with-pincode' : 'push'); }], 'validate-set-contacts-form' => ['class' => ValidateFormAction::class, 'collectionLoader' => function ($action) { /** @var SmartPerformAction $action */ $request = Yii::$app->request; $action->collection->load([['registrant' => $request->post('registrant'), 'admin' => $request->post('admin'), 'tech' => $request->post('tech'), 'billing' => $request->post('billing')]]); }, 'validatedInputId' => function ($action, $model, $id, $attribute, $errors) { return 'domain-' . $attribute; }], 'bulk-set-contacts' => ['class' => SmartPerformAction::class, 'scenario' => 'set-contacts', 'collectionLoader' => function ($action) { /** @var SmartPerformAction $action */ $request = Yii::$app->request; $contactOptions = Domain::$contactOptions; $data = $request->post($action->collection->getModel()->formName()); foreach ($data as $k => &$item) { foreach ($contactOptions as $contact) { $item[$contact] = $request->post($contact); } } $action->collection->load($data); }], 'push' => ['class' => SmartPerformAction::class, 'collectionLoader' => function ($action) { /** @var SmartPerformAction $action */ $data = Yii::$app->request->post($action->collection->getModel()->formName()); $pincode = $data['pincode']; $receiver = $data['receiver']; unset($data['pincode'], $data['receiver']); foreach ($data as &$item) { $item['pincode'] = $pincode; $item['receiver'] = $receiver; } $action->collection->load($data); }, 'POST' => ['save' => true, 'success' => ['class' => RedirectAction::class, 'url' => function ($action) { if (Yii::$app->user->can('support')) { return null; } return ['@domain']; }], 'error' => ['class' => RedirectAction::class]], 'success' => Yii::t('hipanel:domain', 'Domain was successfully pushed'), 'error' => Yii::t('hipanel:domain', 'Failed to push the domain')], 'index' => ['class' => IndexAction::class, 'data' => function ($action) { return ['stateData' => $action->controller->getStateData()]; }, 'filterStorageMap' => ['domain_like' => 'domain.domain.domain_like', 'ips' => 'hosting.ip.ip_in', 'state' => 'domain.domain.state', 'client_id' => 'client.client.id', 'seller_id' => 'client.client.seller_id']], 'view' => ['class' => ViewAction::class, 'on beforePerform' => function ($event) { $action = $event->sender; $action->getDataProvider()->query->addSelect(['nsips', 'contacts'])->joinWith('registrant')->joinWith('admin')->joinWith('tech')->joinWith('billing'); }, 'data' => function ($action) { return ['pincodeModel' => new DynamicModel(['pincode'])]; }], 'validate-form' => ['class' => ValidateFormAction::class], 'validate-nss' => ['class' => ValidateFormAction::class, 'model' => Ns::class, 'scenario' => 'default', 'allowDynamicScenario' => false], 'validate-push-form' => ['class' => ValidateFormAction::class, 'collectionLoader' => function ($action) { /** @var SmartPerformAction $action */ $request = Yii::$app->request; $action->collection->load([['pincode' => $request->post('pincode'), 'receiver' => $request->post('receiver')]]); }, 'validatedInputId' => function ($action, $model, $id, $attribute, $errors) { return 'push-' . $attribute; }], 'set-note' => ['class' => SmartUpdateAction::class, 'success' => Yii::t('hipanel', 'Note changed'), 'error' => Yii::t('hipanel', 'Failed change note'), 'POST html' => ['save' => true, 'success' => ['class' => RedirectAction::class]], 'on beforeSave' => function (Event $event) { /** @var \hipanel\actions\Action $action */ $action = $event->sender; $bulkNote = Yii::$app->request->post('bulk_note'); if (!empty($bulkNote)) { foreach ($action->collection->models as $model) { $model->note = $bulkNote; } } }], 'bulk-set-note' => ['class' => PrepareBulkAction::class, 'scenario' => 'set-note', 'view' => '_bulkSetNote'], 'set-nss' => ['class' => SmartUpdateAction::class, 'success' => Yii::t('hipanel:domain', 'Name servers changed'), 'POST html' => ['save' => true, 'success' => ['class' => RedirectAction::class, 'url' => function ($action) { return $action->controller->redirect(Yii::$app->request->referrer); }]]], 'bulk-set-nss' => ['class' => SmartUpdateAction::class, 'scenario' => 'set-nss', 'view' => '_bulkSetNs', 'success' => Yii::t('hipanel:domain', 'Name servers changed'), 'POST pjax' => ['save' => true, 'success' => ['class' => ProxyAction::class, 'action' => 'index']], 'on beforeFetch' => function (Event $event) { /** @var \hipanel\actions\SearchAction $action */ $action = $event->sender; $dataProvider = $action->getDataProvider(); $dataProvider->query->andWhere(['with_nsips' => 1]); }, 'on beforeSave' => function (Event $event) { /** @var \hipanel\actions\Action $action */ $action = $event->sender; $bulkNsIps = Yii::$app->request->post('nsips'); if ($bulkNsIps !== null) { foreach ($action->collection->models as $model) { $model->nsips = $bulkNsIps; } } }], 'delete' => ['class' => SmartDeleteAction::class, 'success' => Yii::t('hipanel:domain', 'Domain deleted'), 'error' => Yii::t('hipanel:domain', 'Failed delete domain')], 'delete-agp' => ['class' => SmartPerformAction::class, 'success' => Yii::t('hipanel:domain', 'Domain deleted'), 'error' => Yii::t('hipanel:domain', 'Failed delete domain')], 'cancel-transfer' => ['class' => SmartPerformAction::class, 'success' => Yii::t('hipanel:domain', 'Domain transfer was canceled'), 'error' => Yii::t('hipanel:domain', 'Failed cancel domain transfer')], 'reject-transfer' => ['class' => SmartPerformAction::class, 'success' => Yii::t('hipanel:domain', 'Domain transfer was cancelled'), 'error' => Yii::t('hipanel:domain', 'Failed cancel domain transfer')], 'approve-transfer' => ['class' => SmartPerformAction::class, 'success' => Yii::t('hipanel:domain', 'Domain transfer was approved'), 'error' => Yii::t('hipanel:domain', 'Failed approve domain transfer')], 'notify-transfer-in' => ['class' => SmartPerformAction::class, 'success' => Yii::t('hipanel:domain', 'FOA was sent'), 'error' => Yii::t('hipanel:domain', 'Failed send FOA')], 'enable-hold' => ['class' => SmartPerformAction::class, 'scenario' => 'enable-hold', 'success' => Yii::t('hipanel:domain', 'Hold was enabled'), 'error' => Yii::t('hipanel:domain', 'Failed enabling Hold')], 'disable-hold' => ['class' => SmartPerformAction::class, 'scenario' => 'disable-hold', 'success' => Yii::t('hipanel:domain', 'Hold was disabled'), 'error' => Yii::t('hipanel:domain', 'Failed disabling Hold')], 'enable-freeze' => ['class' => SmartPerformAction::class, 'success' => Yii::t('hipanel:domain', 'Freeze was enabled')], 'disable-freeze' => ['class' => SmartPerformAction::class, 'success' => Yii::t('hipanel:domain', 'Freeze was disabled')], 'enable-w-p-freeze' => ['class' => SmartPerformAction::class, 'success' => Yii::t('hipanel:domain', 'WP Freeze Enabled')], 'disable-w-p-freeze' => ['class' => SmartPerformAction::class, 'success' => Yii::t('hipanel:domain', 'WP Freeze Disabled')], 'OLD-set-ns' => ['class' => RenderAction::class, 'on beforeSave' => function (Event $event) { /** @var Action $action */ $action = $event->sender; $templateModel = null; $template = Yii::$app->request->post('check'); foreach ($action->collection->models as $model) { if ($model->id === $template) { $templateModel = $model; } } foreach ($action->collection->models as $model) { $model->nameservers = $templateModel->nameservers; } }, 'POST' => ['save' => true, 'success' => ['class' => RenderJsonAction::class, 'return' => function ($action) { /* @var Action $action */ return $action->collection->models; }], 'error' => ['class' => RenderJsonAction::class, 'return' => function ($action) { /* @var Action $action */ return $action->collection->getFirstError(); }]]], 'set-paid-feature-autorenewal' => ['class' => SmartPerformAction::class, 'scenario' => 'set-autorenewal', 'success' => Yii::t('hipanel:domain', 'Premium autorenewal has been changed'), 'on beforeSave' => function (Event $event) { /** @var Action $action */ $action = $event->sender; foreach ($action->collection->models as $model) { $model->autorenewal = 1; } }], 'set-autorenewal' => ['class' => DomainOptionSwitcherAction::class, 'success' => Yii::t('hipanel:domain', 'Autorenewal has been changed')], 'enable-autorenewal' => ['class' => SmartPerformAction::class, 'success' => Yii::t('hipanel:domain', 'Autorenewal has been enabled'), 'scenario' => 'set-autorenewal', 'on beforeSave' => function (Event $event) { /** @var Action $action */ $action = $event->sender; foreach ($action->collection->models as $model) { $model->autorenewal = 1; } }], 'disable-autorenewal' => ['class' => SmartPerformAction::class, 'success' => Yii::t('hipanel:domain', 'Autorenewal has been disabled'), 'scenario' => 'set-autorenewal', 'on beforeSave' => function (Event $event) { /** @var Action $action */ $action = $event->sender; foreach ($action->collection->models as $model) { $model->autorenewal = 0; } }], 'set-whois-protect' => ['class' => DomainOptionSwitcherAction::class, 'success' => Yii::t('hipanel:domain', 'WHOIS protect is changed')], 'enable-whois-protect' => ['class' => SmartPerformAction::class, 'success' => Yii::t('hipanel:domain', 'WHOIS protect is enabled'), 'scenario' => 'set-whois-protect', 'on beforeSave' => function (Event $event) { /** @var Action $action */ $action = $event->sender; foreach ($action->collection->models as $model) { $model->enable = 1; } }], 'disable-whois-protect' => ['class' => SmartPerformAction::class, 'success' => Yii::t('hipanel:domain', 'WHOIS protect is disabled'), 'scenario' => 'set-whois-protect', 'on beforeSave' => function (Event $event) { /** @var Action $action */ $action = $event->sender; foreach ($action->collection->models as $model) { $model->enable = 0; } }], 'set-lock' => ['class' => DomainOptionSwitcherAction::class, 'success' => Yii::t('hipanel:domain', 'Lock was changed')], 'enable-lock' => ['class' => SmartPerformAction::class, 'success' => Yii::t('hipanel:domain', 'Lock was enabled'), 'scenario' => 'set-lock', 'on beforeSave' => function (Event $event) { /** @var Action $action */ $action = $event->sender; foreach ($action->collection->models as $model) { $model->enable = 1; } }], 'disable-lock' => ['class' => SmartPerformAction::class, 'success' => Yii::t('hipanel:domain', 'Lock was disabled'), 'scenario' => 'set-lock', 'on beforeSave' => function (Event $event) { /** @var Action $action */ $action = $event->sender; foreach ($action->collection->models as $model) { $model->enable = 0; } }], 'regen-password' => ['class' => SmartPerformAction::class, 'success' => Yii::t('hipanel:domain', 'The password has been changed')], 'sync' => ['class' => SmartPerformAction::class, 'success' => Yii::t('hipanel:domain', 'Contacts synced')], 'buy' => ['class' => RedirectAction::class, 'url' => Yii::$app->params['orgUrl']]]; }
/** * @param array $logins all logins used current import session to be pre-fetched * @void */ private function resolveClients($logins) { $clients = Client::find()->where(['login' => $logins])->all(); $this->clientsMap = array_combine(ArrayHelper::getColumn($clients, 'login'), ArrayHelper::getColumn($clients, 'id')); }
/** * Set form data to API. */ public function setFormData() { Client::perform('SetClassValues', ['class' => 'client,ticket_settings', 'values' => ['ticket_emails' => $this->ticket_emails, 'send_message_text' => $this->send_message_text, 'new_messages_first' => $this->new_messages_first]]); }
<?php use hipanel\helpers\Url; use hipanel\modules\client\models\Client; use hipanel\modules\client\widgets\combo\SellerCombo; use hipanel\widgets\PasswordInput; use yii\bootstrap\ActiveForm; use yii\helpers\Html; $form = ActiveForm::begin(['id' => 'client-form', 'enableAjaxValidation' => true, 'validationUrl' => Url::toRoute(['validate-form', 'scenario' => $model->isNewRecord ? 'create' : 'update'])]); ?> <?php echo $form->field($model, '[0]login')->textInput(['autocomplete' => 'off']); echo $form->field($model, '[0]email')->textInput(['autocomplete' => 'off']); echo $form->field($model, '[0]password')->widget(PasswordInput::class); echo $form->field($model, '[0]type')->dropDownList(Client::getTypeOptions()); echo $form->field($model, '[0]seller_id')->widget(SellerCombo::class); ?> <?php echo Html::submitButton(Yii::t('hipanel', 'Save'), ['class' => 'btn btn-success']); ?> <?php echo Html::button(Yii::t('hipanel', 'Cancel'), ['class' => 'btn btn-default', 'onclick' => 'history.go(-1)']); $form->end();
<?php use hipanel\modules\client\models\Client; use yii\helpers\Url; $client = Client::findOne(Yii::$app->user->identity->id); if ($client->balance > 0) { $balanceColor = 'text-success'; } elseif ($client->balance < 0) { $balanceColor = 'text-danger'; } else { $balanceColor = 'text-muted'; } ?> <!-- Left side column. contains the sidebar --> <aside class="main-sidebar"> <section class="sidebar"> <!-- Sidebar user panel --> <div class="user-panel"> <div class="pull-left image"> <?php echo $this->render('//layouts/gravatar', ['size' => 45]); ?> </div> <div class="pull-left info"> <a href="<?php echo Yii::$app->user->can('deposit') ? Url::to('@pay/deposit') : '#'; ?> "> <i class="fa fa-circle <?php echo $balanceColor;