/** * @inheritdoc */ public function run() { try { $this->_initAndValidate(); $valueArray = []; $trees = []; $valueSingle = ""; $select = ""; $singleInput = ""; if (in_array($this->mode, [self::MOD_COMBO, self::MOD_MULTI])) { $valueArray = Html::getAttributeValue($this->model, $this->attribute); $select = Html::activeListBox($this->model, $this->attribute, ['16' => "16"], ['multiple' => true, 'class' => 'sx-controll-element', 'style' => 'display: none;']); $trees = Tree::find()->where(['id' => $valueArray])->all(); } if (in_array($this->mode, [self::MOD_COMBO, self::MOD_SINGLE])) { $singleInput = Html::activeInput("hidden", $this->model, $this->attributeSingle, ['class' => 'sx-single']); $valueSingle = Html::getAttributeValue($this->model, $this->attributeSingle); } $src = UrlHelper::construct('/cms/admin-tree')->set('mode', $this->mode)->set('s', $valueArray)->setSystemParam(Module::SYSTEM_QUERY_EMPTY_LAYOUT, 'true')->setSystemParam(Module::SYSTEM_QUERY_NO_ACTIONS_MODEL, 'true')->enableAdmin()->toString(); $id = "sx-id-" . md5(serialize([$this->clientOptions, $this->mode, $this->attributeMulti, $this->attributeSingle])); $selected = []; foreach ($trees as $tree) { $selected[] = $tree->id; } return $this->render('widget', ['widget' => $this, 'id' => $id, 'select' => $select, 'src' => $src, 'valueSingle' => $valueSingle, 'singleInput' => $singleInput, 'clientOptions' => Json::encode(['src' => $src, 'name' => $id, 'id' => $id, 'selected' => $selected, 'valueSingle' => $valueSingle])]); //$this->registerClientScript(); } catch (Exception $e) { echo $e->getMessage(); } }
/** * Подготовка данных для шаблона * @return $this */ public function run() { if (!$this->user) { return '-'; } return (new AdminImagePreviewWidget(['image' => $this->user ? $this->user->image : null, 'maxWidth' => "25px"]))->run() . " " . Html::a($this->user->displayName, \skeeks\cms\helpers\UrlHelper::construct(['/shop/admin-buyer-user/update', 'pk' => $this->user->id])->enableAdmin(), ['data-pjax' => 0]); }
/** * @inheritdoc */ protected function renderDataCellContent($model, $key, $index) { $userId = (int) $model->{$this->attribute}; $user = User::findOne($userId); if ($user) { if (!($srcImage = $user->getAvatarSrc())) { $srcImage = \Yii::$app->cms->moduleAdmin->noImage; } $this->grid->view->registerCss(<<<CSS .sx-user-preview { } .sx-user-preview .sx-user-preview-controll { display: none; } .sx-user-preview:hover .sx-user-preview-controll { display: inline; } CSS ); return "<div class='sx-user-preview'>" . Html::img($srcImage, ['width' => 25, 'style' => 'margin-right: 5px;']) . $user->getDisplayName() . "\n <div class='sx-user-preview-controll'>" . Html::a("<i class='glyphicon glyphicon-pencil' title='Редактировать'></i>", UrlHelper::construct(['/cms/admin-user/update', 'pk' => $user->id])->enableAdmin()->toString(), ['class' => 'btn btn-xs btn-default', 'data-pjax' => 0]) . '</div></div>'; } else { return null; } }
public function create() { $rr = new RequestResponse(); $modelClass = $this->modelClassName; $model = new $modelClass(); $model->loadDefaultValues(); if ($post = \Yii::$app->request->post()) { $model->load($post); } $handler = $model->handler; if ($handler) { if ($post = \Yii::$app->request->post()) { $handler->load($post); } } if ($rr->isRequestPjaxPost()) { if (!\Yii::$app->request->post($this->notSubmitParam)) { $model->component_settings = $handler->toArray(); $handler->load(\Yii::$app->request->post()); if ($model->load(\Yii::$app->request->post()) && $model->validate() && $handler->validate()) { $model->save(); \Yii::$app->getSession()->setFlash('success', \Yii::t('skeeks/cms', 'Saved')); return $this->redirect(UrlHelper::constructCurrent()->setCurrentRef()->enableAdmin()->setRoute($this->modelDefaultAction)->normalizeCurrentRoute()->addData([$this->requestPkParamName => $model->{$this->modelPkAttribute}])->toString()); } else { \Yii::error(Json::encode($model->errors), self::className()); \Yii::$app->getSession()->setFlash('error', \Yii::t('skeeks/cms', 'Could not save')); } } } return $this->render('_form', ['model' => $model, 'handler' => $handler]); }
/** * @inheritdoc */ public function run() { if ($this->hasModel()) { $name = Html::getInputName($this->model, $this->attribute); $value = null; if (is_array($this->model->{$this->attribute})) { $value = StringHelper::base64EncodeUrl(serialize((array) $this->model->{$this->attribute})); } else { if (is_string($this->model->{$this->attribute})) { $value = $this->model->{$this->attribute}; } } $this->options['id'] = Html::getInputId($this->model, $this->attribute); //$element = Html::activeHiddenInput($this->model, $this->attribute, $this->options); $element = Html::hiddenInput($name, $value, $this->options); } else { $element = Html::hiddenInput($this->name, $this->value, $this->options); } $this->registerPlugin(); $this->clientOptions['componentSelectId'] = $this->componentSelectId; $this->clientOptions['componentSettingsId'] = Html::getInputId($this->model, $this->attribute); $this->clientOptions['id'] = $this->id; $this->clientOptions['backend'] = UrlHelper::construct('/cms/admin-universal-component-settings/index')->setSystemParam(Module::SYSTEM_QUERY_EMPTY_LAYOUT, 'true')->enableAdmin()->toString(); return $this->render('element', ['widget' => $this, 'element' => $element]); }
/** * Sends an email with a link, for resetting the password. * * @return boolean whether the email was send */ public function sendEmail() { /* @var $user \common\models\User */ $identityClassName = \Yii::$app->user->identityClass; $user = $identityClassName::findByUsernameOrEmail($this->identifier); //$user = $identityClassName:: if ($user) { if (!$identityClassName::isPasswordResetTokenValid($user->password_reset_token)) { $user->generatePasswordResetToken(); } if ($user->save()) { if (!$user->email) { return false; } if ($this->isAdmin) { $resetLink = \skeeks\cms\helpers\UrlHelper::construct('admin/auth/reset-password', ['token' => $user->password_reset_token])->enableAbsolute()->enableAdmin(); } else { $resetLink = \skeeks\cms\helpers\UrlHelper::construct('cms/auth/reset-password', ['token' => $user->password_reset_token])->enableAbsolute(); } $message = \Yii::$app->mailer->compose('@skeeks/cms/mail/passwordResetToken', ['user' => $user, 'resetLink' => $resetLink])->setFrom([\Yii::$app->cms->adminEmail => \Yii::$app->cms->appName])->setTo($user->email)->setSubject(\Yii::t('app', 'The request to change the password for') . \Yii::$app->cms->appName); return $message->send(); } } return false; }
public function init() { parent::init(); if ($this->backendUrl === null) { $this->backendUrl = UrlHelper::construct('cms/admin-storage-files/link-to-models')->enableAdmin()->toString(); } }
public function run() { $modelClassName = $this->controller->modelClassName; $model = new $modelClassName(); $scenarios = $model->scenarios(); if ($scenarios && $this->modelScenario) { if (isset($scenarios[$this->modelScenario])) { $model->scenario = $this->modelScenario; } } $rr = new RequestResponse(); if (\Yii::$app->request->isAjax && !\Yii::$app->request->isPjax) { return $rr->ajaxValidateForm($model); } if ($rr->isRequestPjaxPost()) { if ($model->load(\Yii::$app->request->post()) && $model->save($this->modelValidate)) { \Yii::$app->getSession()->setFlash('success', \Yii::t('app', 'Saved')); if (\Yii::$app->request->post('submit-btn') == 'apply') { return $this->controller->redirect(UrlHelper::constructCurrent()->setCurrentRef()->enableAdmin()->setRoute($this->controller->modelDefaultAction)->normalizeCurrentRoute()->addData([$this->controller->requestPkParamName => $model->{$this->controller->modelPkAttribute}])->toString()); } else { return $this->controller->redirect($this->controller->indexUrl); } } else { \Yii::$app->getSession()->setFlash('error', \Yii::t('app', 'Could not save')); } } $this->viewParams = ['model' => $model]; return parent::run(); }
public function run() { if ($this->parentModel->isNewRecord) { return ""; } /** * @var $controller AdminModelEditorController */ $controller = \Yii::$app->createController($this->controllerRoute)[0]; $rerlation = []; foreach ($this->relation as $relationLink => $parent) { if ($this->parentModel->getAttribute($parent)) { $rerlation[$relationLink] = $this->parentModel->{$parent}; } else { $rerlation[$relationLink] = $parent; } } $createUrl = \skeeks\cms\helpers\UrlHelper::construct($this->controllerRoute . '/' . $this->controllerCreateAction, $rerlation)->setSystemParam(\skeeks\cms\modules\admin\Module::SYSTEM_QUERY_EMPTY_LAYOUT, 'true')->setSystemParam(\skeeks\cms\modules\admin\Module::SYSTEM_QUERY_NO_ACTIONS_MODEL, 'true')->enableAdmin()->toString(); $sortableUrl = \skeeks\cms\helpers\UrlHelper::construct($this->controllerRoute . '/' . $this->controllerSortableAction)->enableAdmin()->toString(); $search = new \skeeks\cms\models\Search($controller->modelClassName); $search->getDataProvider()->query->where($rerlation); if (isset($this->sort['defaultOrder'])) { $search->getDataProvider()->sort->defaultOrder = $this->sort['defaultOrder']; } if ($this->dataProviderCallback && is_callable($this->dataProviderCallback)) { $function = $this->dataProviderCallback; $function($search->getDataProvider()); } $pjaxId = "sx-table-" . md5($this->label . $this->hint . $this->parentModel->className()); $gridOptions = ArrayHelper::merge(['pjaxOptions' => ['id' => $pjaxId], "sortableOptions" => ['backend' => $sortableUrl], 'dataProvider' => $search->getDataProvider(), 'layout' => "\n{beforeTable}\n{items}\n{afterTable}\n{pager}", 'columns' => [['class' => \skeeks\cms\modules\admin\grid\ActionColumn::className(), 'controller' => $controller, 'isOpenNewWindow' => true]]], (array) $this->gridViewOptions); return $this->render('related-models-grid', ['widget' => $this, 'createUrl' => $createUrl, 'controller' => $controller, 'gridOptions' => $gridOptions, 'pjaxId' => $pjaxId]); }
public function __construct($config = []) { $this->validationUrl = \skeeks\cms\helpers\UrlHelper::construct('form2/backend/validate')->toString(); $this->action = \skeeks\cms\helpers\UrlHelper::construct('form2/backend/submit')->toString(); $this->enableAjaxValidation = true; parent::__construct($config); }
/** * Запрос пришел на валидацию ajax формы? * @return bool */ public function isRequestOnValidateAjaxForm() { if (\Yii::$app->request->isAjax && !\Yii::$app->request->isPjax && UrlHelper::getCurrent()->issetSystemParam(static::VALIDATION_AJAX_FORM_SYSTEM_NAME)) { return true; } return false; }
public function __construct($config = []) { $this->validationUrl = \skeeks\cms\helpers\UrlHelper::construct('cms/model-properties/validate')->toString(); $this->action = \skeeks\cms\helpers\UrlHelper::construct('cms/model-properties/submit')->toString(); $this->enableAjaxValidation = true; parent::__construct($config); }
public function init() { parent::init(); if (!$this->selectUrl) { $additionalData = []; $additionalData['callbackEvent'] = $this->getCallbackEvent(); $this->selectUrl = \skeeks\cms\helpers\UrlHelper::construct($this->baseRoute, $additionalData)->setSystemParam(\skeeks\cms\modules\admin\Module::SYSTEM_QUERY_EMPTY_LAYOUT, 'true')->enableAdmin()->toString(); } }
/** * @return static */ public function run() { Yii::$app->user->logout(); if ($ref = UrlHelper::getCurrent()->getRef()) { return Yii::$app->getResponse()->redirect($ref); } else { return Yii::$app->getResponse()->redirect(Yii::$app->getUser()->getReturnUrl()); } }
public function init() { $additionalData = []; if ($this->relatedModel && ($this->relatedModel instanceof ActiveRecord && !$this->relatedModel->isNewRecord)) { $additionalData = ['className' => $this->relatedModel->className(), 'pk' => $this->relatedModel->primaryKey]; } $this->clientOptions['filebrowserImageBrowseUrl'] = UrlHelper::construct('cms/admin-tools/select-file', $additionalData)->setSystemParam(\skeeks\cms\modules\admin\Module::SYSTEM_QUERY_EMPTY_LAYOUT, 'true')->enableAdmin()->toString(); parent::init(); }
public function init() { if ($this->model && \Yii::$app->cmsToolbar) { $controller = \Yii::$app->createController('cms/admin-cms-content-element')[0]; $adminControllerRoute = ['cms/admin-cms-content-element/update', $controller->requestPkParamName => $this->model->{$controller->modelPkAttribute}]; $urlEditModel = UrlHelper::construct($adminControllerRoute)->enableAdmin()->setSystemParam(\skeeks\cms\modules\admin\Module::SYSTEM_QUERY_EMPTY_LAYOUT, 'true')->toString(); \Yii::$app->cmsToolbar->editUrl = $urlEditModel; } parent::init(); }
/** * @return string */ public function getIndexUrl() { $contentTypePk = null; if ($this->model) { if ($contentType = $this->model->contentType) { $contentTypePk = $contentType->id; } } return UrlHelper::construct(["cms/admin-cms-content-type/update", 'pk' => $contentTypePk])->enableAdmin()->toString(); }
/** * @inheritdoc */ public function run() { try { $this->_initAndValidate(); $this->registerClientScript(); $id = "sx-id-" . Yii::$app->security->generateRandomString(6); $clientOptions = ArrayHelper::merge($this->clientOptions, ['fieldNameAmmount' => $this->fieldNameAmmount, 'fieldNameCurrency' => $this->fieldNameCurrency, 'backend' => \skeeks\cms\helpers\UrlHelper::construct('money/ajax/data')->toString()]); return $this->render('money-input', ['widget' => $this, 'id' => $id, 'model' => $this->model, 'clientOptions' => $clientOptions, 'fieldNameAmmount' => $this->fieldNameAmmount, 'fieldNameCurrency' => $this->fieldNameCurrency]); } catch (Exception $e) { echo $e->getMessage(); } }
public function init() { if (\Yii::$app->request->get(static::REQUEST_PARAM_USERNAME) && !$this->user) { throw new NotFoundHttpException("User not found or inactive"); } else { if (\Yii::$app->request->get(static::REQUEST_PARAM_USERNAME) && \Yii::$app->cmsToolbar) { $controller = \Yii::$app->createController('cms/admin-user')[0]; $adminControllerRoute = ['cms/admin-user/update', $controller->requestPkParamName => $this->user->{$controller->modelPkAttribute}]; $urlEditModel = UrlHelper::construct($adminControllerRoute)->enableAdmin()->setSystemParam(\skeeks\cms\modules\admin\Module::SYSTEM_QUERY_EMPTY_LAYOUT, 'true')->toString(); \Yii::$app->cmsToolbar->editUrl = $urlEditModel; } } }
/** * Формируем данные для хлебных крошек. * Эти данные в layout - е будут передаваться в нужный виджет. * * @return $this */ protected function _initBreadcrumbsData() { $baseRoute = $this->controller->module instanceof Application ? $this->controller->id : "/" . $this->controller->module->id . "/" . $this->controller->id; if ($this->controller->name) { $this->controller->view->params['breadcrumbs'][] = ['label' => $this->controller->name, 'url' => $this->controller->getIndexUrl()]; } if ($this->controller->model) { $this->controller->view->params['breadcrumbs'][] = ['label' => $this->controller->model->{$this->controller->modelShowAttribute}, 'url' => UrlHelper::constructCurrent()->setRoute($baseRoute . '/' . $this->controller->modelDefaultAction)->set($this->controller->requestPkParamName, $this->controller->model->{$this->controller->modelPkAttribute})->enableAdmin()->normalizeCurrentRoute()->toString()]; } if (count($this->controller->actions) > 1) { $this->controller->view->params['breadcrumbs'][] = $this->name; } return $this; }
/** * Denies the access of the user. * The default implementation will redirect the user to the login page if he is a guest; * if the user is already logged, a 403 HTTP exception will be thrown. * @param User $user the current user * @throws ForbiddenHttpException if the user is already logged in. */ protected function denyAccess($user) { $rr = new RequestResponse(); if ($user->getIsGuest()) { $authUrl = UrlHelper::construct("admin/auth")->setCurrentRef()->enableAdmin()->createUrl(); if (\Yii::$app->request->isAjax && !\Yii::$app->request->isPjax) { $rr->redirect = $authUrl; return (array) $rr; } else { \Yii::$app->getResponse()->redirect($authUrl); } } else { throw new ForbiddenHttpException(\Yii::t('yii', \Yii::t('app', 'You are not allowed to perform this action.'))); } }
/** * @inheritdoc */ protected function renderDataCellContent($model, $key, $index) { /** * @var $element CmsContentElement */ if ($this->relation) { $element = $model->{$this->relation}; if (!$element) { return null; } else { return Html::a($element->name . " [{$element->id}]", $element->url, ['target' => '_blank', 'data-pjax' => 0, 'title' => 'Посмотреть на сайте (откроется в новом окне)']) . " " . Html::a('<span class="glyphicon glyphicon-pencil"></span>', UrlHelper::construct('/cms/admin-cms-content-element/update', ['content_id' => $element->content_id, 'pk' => $element->id]), ['data-pjax' => 0, 'class' => 'btn btn-xs btn-default']); } } return null; }
public function init() { parent::init(); if (!$this->selectFileUrl) { $additionalData = []; $modelForFile = $this->model; if ($this->filesModel) { $modelForFile = $this->filesModel; } if ($modelForFile instanceof ActiveRecord && !$modelForFile->isNewRecord) { $additionalData = ['className' => $modelForFile->className(), 'pk' => $modelForFile->primaryKey]; } $additionalData['callbackEvent'] = $this->getCallbackEvent(); $this->selectFileUrl = \skeeks\cms\helpers\UrlHelper::construct('cms/tools/select-file', $additionalData)->setSystemParam(\skeeks\cms\modules\admin\Module::SYSTEM_QUERY_EMPTY_LAYOUT, 'true')->enableAdmin()->toString(); } }
/** * @inheritdoc */ public function actions() { return ArrayHelper::merge(parent::actions(), ['index' => ["dataProviderCallback" => function (ActiveDataProvider $dataProvider) { $query = $dataProvider->query; /** * @var ActiveQuery $query */ //$query->select(['app_company.*', 'count(`app_company_officer_user`.`id`) as countOfficer']); $query->groupBy(['shop_fuser.id']); $query->with('user'); $query->with('personType'); $query->with('buyer'); $query->with('shopBaskets'); $query->with('shopBaskets.product'); }, "columns" => [['class' => UpdatedAtColumn::className()], ['class' => DataColumn::className(), 'filter' => false, 'format' => raw, 'label' => \skeeks\cms\shop\Module::t('app', 'User'), 'value' => function (ShopFuser $model) { return $model->user ? (new AdminBuyerUserWidget(['user' => $model->user]))->run() : \skeeks\cms\shop\Module::t('app', 'Not authorized'); }], ['class' => DataColumn::className(), 'filter' => false, 'format' => 'raw', 'label' => \skeeks\cms\shop\Module::t('app', 'Profile of buyer'), 'value' => function (ShopFuser $model) { if (!$model->buyer) { return null; } return Html::a($model->buyer->name . " [{$model->buyer->id}]", UrlHelper::construct('shop/admin-buyer/related-properties', ['pk' => $model->buyer->id])->enableAdmin()->toString()); }], ['class' => DataColumn::className(), 'filter' => ArrayHelper::map(ShopPersonType::find()->active()->all(), 'id', 'name'), 'attribute' => 'person_type_id', 'label' => \skeeks\cms\shop\Module::t('app', 'Profile type'), 'value' => function (ShopFuser $model) { return $model->personType->name; }], ['class' => DataColumn::className(), 'filter' => false, 'label' => \skeeks\cms\shop\Module::t('app', 'Price of basket'), 'value' => function (ShopFuser $model) { return \Yii::$app->money->intlFormatter()->format($model->money); }], ['class' => DataColumn::className(), 'filter' => false, 'label' => \skeeks\cms\shop\Module::t('app', 'Number of items'), 'value' => function (ShopFuser $model) { return $model->countShopBaskets; }], ['class' => DataColumn::className(), 'filter' => false, 'format' => 'raw', 'label' => \skeeks\cms\shop\Module::t('app', 'Good'), 'value' => function (ShopFuser $model) { if ($model->shopBaskets) { $result = []; foreach ($model->shopBaskets as $shopBasket) { $money = \Yii::$app->money->intlFormatter()->format($shopBasket->money); $result[] = Html::a($shopBasket->name, $shopBasket->product->cmsContentElement->url, ['target' => '_blank']) . <<<HTML ({$shopBasket->quantity} {$shopBasket->measure_name}) — {$money} HTML; } return implode('<hr />', $result); } }], ['class' => DataColumn::className(), 'filter' => ArrayHelper::map(CmsSite::find()->active()->all(), 'id', 'name'), 'attribute' => 'site_id', 'format' => 'raw', 'label' => \skeeks\cms\shop\Module::t('app', 'Site'), 'value' => function (ShopFuser $model) { return $model->site->name . " [{$model->site->code}]"; }], ['class' => CreatedAtColumn::className()]]]]); }
public function create(AdminAction $adminAction) { $modelClassName = $this->modelClassName; $model = new $modelClassName(); $model->loadDefaultValues(); $relatedModel = $model->relatedPropertiesModel; $relatedModel->loadDefaultValues(); $passwordChange = new PasswordChangeForm(['user' => $model]); $rr = new RequestResponse(); if (\Yii::$app->request->isAjax && !\Yii::$app->request->isPjax) { $model->load(\Yii::$app->request->post()); $relatedModel->load(\Yii::$app->request->post()); $passwordChange->load(\Yii::$app->request->post()); return \yii\widgets\ActiveForm::validateMultiple([$model, $relatedModel, $passwordChange]); } if ($rr->isRequestPjaxPost()) { $model->load(\Yii::$app->request->post()); $relatedModel->load(\Yii::$app->request->post()); if ($model->save() && $relatedModel->save()) { if ($passwordChange->new_password) { if (!$passwordChange->changePassword()) { \Yii::$app->getSession()->setFlash('error', "Пароль не изменен"); } } \Yii::$app->getSession()->setFlash('success', \Yii::t('skeeks/cms', 'Saved')); if (\Yii::$app->request->post('submit-btn') == 'apply') { return $this->redirect(UrlHelper::constructCurrent()->setCurrentRef()->enableAdmin()->setRoute($this->modelDefaultAction)->normalizeCurrentRoute()->addData([$this->requestPkParamName => $model->{$this->modelPkAttribute}])->toString()); } else { return $this->redirect($this->indexUrl); } } else { \Yii::$app->getSession()->setFlash('error', \Yii::t('skeeks/cms', 'Could not save')); } } return $this->render('_form', ['model' => $model, 'relatedModel' => $relatedModel, 'passwordChange' => $passwordChange]); }
?> <?php echo \skeeks\cms\modules\admin\widgets\BlockTitleWidget::widget(['content' => \skeeks\cms\shop\Module::t('app', 'Order')]); ?> <?php echo \yii\widgets\DetailView::widget(['model' => $model, 'template' => "<tr><th style='width: 50%; text-align: right;'>{label}</th><td>{value}</td></tr>", 'attributes' => [['label' => \skeeks\cms\shop\Module::t('app', 'Number of order'), 'format' => 'raw', 'value' => $model->id], ['label' => \skeeks\cms\shop\Module::t('app', 'Created At'), 'format' => 'raw', 'value' => \Yii::$app->formatter->asDatetime($model->created_at)], ['label' => \skeeks\cms\shop\Module::t('app', 'Last modified'), 'format' => 'raw', 'value' => \Yii::$app->formatter->asDatetime($model->updated_at)], ['label' => \skeeks\cms\shop\Module::t('app', 'Status'), 'format' => 'raw', 'value' => "<p>" . $form->fieldSelect($model, 'status_code', \yii\helpers\ArrayHelper::map(\skeeks\cms\shop\models\ShopOrderStatus::find()->all(), 'code', 'name'))->label(false) . "</p>"], ['label' => \skeeks\cms\shop\Module::t('app', 'Canceled'), 'format' => 'raw', 'value' => "<p>" . $form->fieldRadioListBoolean($model, 'canceled')->label(false) . "</p><p>" . $form->field($model, 'reason_canceled')->textarea(['rows' => 5]) . "</p>"], ['label' => \skeeks\cms\shop\Module::t('app', 'Date of status change'), 'format' => 'raw', 'value' => \Yii::$app->formatter->asDatetime($model->status_at)]]]); ?> <?php echo \skeeks\cms\modules\admin\widgets\BlockTitleWidget::widget(['content' => \skeeks\cms\shop\Module::t('app', 'Buyer')]); ?> <?php echo \yii\widgets\DetailView::widget(['model' => $model, 'template' => "<tr><th style='width: 50%; text-align: right;'>{label}</th><td>{value}</td></tr>", 'attributes' => [['label' => \skeeks\cms\shop\Module::t('app', 'User'), 'format' => 'raw', 'value' => (new \skeeks\cms\shop\widgets\AdminBuyerUserWidget(['user' => $model->user]))->run()], ['label' => \skeeks\cms\shop\Module::t('app', 'Type payer'), 'format' => 'raw', 'value' => $model->personType->name], ['label' => \skeeks\cms\shop\Module::t('app', 'Profile of buyer'), 'format' => 'raw', 'value' => Html::a($model->buyer->name . " [{$model->buyer->id}]", \skeeks\cms\helpers\UrlHelper::construct(['/shop/admin-buyer/update', 'pk' => $model->buyer->id])->enableAdmin(), ['data-pjax' => 0])]]]); ?> <?php echo \skeeks\cms\modules\admin\widgets\BlockTitleWidget::widget(['content' => \skeeks\cms\shop\Module::t('app', 'Customer data')]); ?> <?php echo \yii\widgets\DetailView::widget(['model' => $model->buyer->relatedPropertiesModel, 'template' => "<tr><th style='width: 50%; text-align: right;'>{label}</th><td>{value}</td></tr>", 'attributes' => array_keys($model->buyer->relatedPropertiesModel->attributeValues())]); ?> <?php echo \skeeks\cms\modules\admin\widgets\BlockTitleWidget::widget(['content' => \skeeks\cms\shop\Module::t('app', 'Payment order')]); ?> <?php echo \yii\widgets\DetailView::widget(['model' => $model, 'template' => "<tr><th style='width: 50%; text-align: right;'>{label}</th><td>{value}</td></tr>", 'attributes' => [['label' => \skeeks\cms\shop\Module::t('app', 'Payment method'), 'format' => 'raw', 'value' => $model->paySystem->name], ['label' => \skeeks\cms\shop\Module::t('app', 'Date'), 'format' => 'raw', 'value' => \Yii::$app->formatter->asDatetime($model->payed_at)], ['label' => \skeeks\cms\shop\Module::t('app', 'Payed'), 'format' => 'raw', 'value' => \Yii::$app->formatter->asBoolean($model->payed == \skeeks\cms\components\Cms::BOOL_Y)], ['label' => \skeeks\cms\shop\Module::t('app', 'Allow payment'), 'format' => 'raw', 'value' => $form->fieldRadioListBoolean($model, 'allow_payment')->label(false)]]]);
public function renderNodes($models) { $options["item"] = function ($model) { $isOpen = false; $isActive = false; $controller = \Yii::$app->cms->moduleCms()->createControllerByID("admin-tree"); $controller->setModel($model); $child = ""; foreach ($this->_openedTmp as $activeNode) { if (Validate::validate(new IsSame($activeNode), $model)->isValid()) { $isOpen = true; break; } } if ($isOpen && $model->children) { $child = $this->renderNodes($model->children); } $openCloseLink = ""; $currentLink = ""; if ($model->children) { $openedIds = $this->_getOpenIds(); if ($isOpen) { $newOptionsOpen = []; foreach ($openedIds as $id) { if ($id != $model->id) { $newOptionsOpen[] = $id; } } $urlOptionsOpen = array_unique($newOptionsOpen); $params = \Yii::$app->request->getQueryParams(); $params[$this->openedRequestName] = $urlOptionsOpen; $currentLink = UrlHelper::construct("cms/admin-tree/index")->setData($params); $openCloseLink = Html::a(Html::tag("span", "", ["class" => "glyphicon glyphicon-minus", "title" => \Yii::t('app', "Minimize")]), $currentLink, ['class' => 'btn btn-xs btn-default']); } else { $urlOptionsOpen = array_unique(array_merge($openedIds, [$model->id])); $params = \Yii::$app->request->getQueryParams(); $params[$this->openedRequestName] = $urlOptionsOpen; $currentLink = UrlHelper::construct("cms/admin-tree/index")->setData($params); $openCloseLink = Html::a(Html::tag("span", "", ["class" => "glyphicon glyphicon-plus", "title" => \Yii::t('app', "Restore")]), $currentLink, ['class' => 'btn btn-xs btn-default']); } $openCloseLink = Html::tag("div", $openCloseLink, ["class" => "sx-node-open-close"]); } if ($this->_getMode() == 'multi') { $params = \Yii::$app->request->getQueryParams(); $isSelected = in_array($model->id, $this->_getSelectedIds()) ? true : false; if ($isSelected) { $result = []; foreach ($this->_getSelectedIds() as $id) { if ($id != $model->id) { $result[] = $id; } } $params[$this->selectedRequestName] = $result; } else { $params[$this->selectedRequestName] = array_unique(array_merge($this->_getSelectedIds(), [$model->id])); } $link = UrlHelper::construct("cms/admin-tree/index")->setData($params); $controllElement = Html::checkbox('tree_id', $isSelected, ['value' => $model->id, 'style' => 'float: left; margin-left: 5px; margin-right: 5px;', 'onclick' => new JsExpression(<<<JS sx.Tree.select("{$model->id}", "{$link}"); return false; JS )]); } else { if ($this->_getMode() == 'single') { $params = \Yii::$app->request->getQueryParams(); $isSelected = in_array($model->id, $this->_getSelectedIds()) ? true : false; if ($isSelected) { $params[$this->selectedRequestName] = []; } else { $params[$this->selectedRequestName] = [$model->id]; } $link = UrlHelper::construct("cms/admin-tree/index")->setData($params); $controllElement = Html::radio('tree_id', $isSelected, ['value' => $model->id, 'class' => 'sx-readio', 'style' => 'float: left; margin-left: 5px; margin-right: 5px;', 'onclick' => new JsExpression(<<<JS sx.Tree.selectSingle("{$model->id}"); JS )]); } else { if ($this->_getMode() == 'combo') { $params = \Yii::$app->request->getQueryParams(); $isSelected = in_array($model->id, $this->_getSelectedIds()) ? true : false; if ($isSelected) { $result = []; foreach ($this->_getSelectedIds() as $id) { if ($id != $model->id) { $result[] = $id; } } $params[$this->selectedRequestName] = $result; } else { $params[$this->selectedRequestName] = array_unique(array_merge($this->_getSelectedIds(), [$model->id])); } $link = UrlHelper::construct("cms/admin-tree/index")->setData($params); $controllElement = Html::radio('tree_id', false, ['value' => $model->id, 'class' => 'sx-readio', 'style' => 'float: left; margin-left: 5px; margin-right: 5px;', 'onclick' => new JsExpression(<<<JS sx.Tree.selectSingle("{$model->id}"); JS )]); $controllElement .= Html::checkbox('tree_id', $isSelected, ['value' => $model->id, 'style' => 'float: left; margin-left: 5px; margin-right: 5px;', 'onclick' => new JsExpression(<<<JS sx.Tree.select("{$model->id}", "{$link}"); return false; JS )]); } else { $controllElement = ''; } } } /** * @var $model \skeeks\cms\models\Tree */ $additionalName = ''; if ($model->level == 0) { if ($model->site) { $additionalName = $model->site->name; } } else { if ($model->name_hidden) { $additionalName = $model->name_hidden; } } $link = Html::a('<span class="glyphicon glyphicon-eye-open"></span>', $model->getAbsoluteUrl(), ["target" => "_blank", "class" => "btn-tree-node-controll btn btn-default btn-xs show-at-site", "title" => \Yii::t('app', "Show at site")]); $subsection = \Yii::t('app', 'Create subsection'); return Html::tag("li", Html::tag("div", $openCloseLink . $controllElement . Html::tag("div", Html::a($model->name . ($additionalName ? ' [' . $additionalName . ']' : ''), $currentLink), ["class" => "sx-label-node level-" . $model->level . " status-" . $model->active]) . ($model->treeType ? Html::tag("div", $model->treeType->name, ["class" => "pull-left sx-tree-type"]) : '') . Html::tag("div", DropdownControllerActions::widget(["controller" => $controller, "renderFirstAction" => false, "containerClass" => "dropdown pull-left", 'clientOptions' => ['pjax-id' => 'sx-pjax-tree']]) . Html::tag("div", <<<HTML <a href="#" class="btn-tree-node-controll btn btn-default btn-xs add-tree-child" title="{$subsection}" data-id={$model->id}><span class="glyphicon glyphicon-plus"></span></a> HTML , ["class" => "pull-left sx-controll-act"]) . Html::tag("div", $link, ["class" => "pull-left sx-controll-act"]), ["class" => "sx-controll-node row"]), ["class" => "row"]) . $child, ["class" => "sx-tree-node " . ($isActive ? " active" : "") . ($isOpen ? " open" : ""), "data-id" => $model->id]); }; $ul = Html::ul($models, $options); return $ul; }
/** * @return array */ public function baseClientOptions() { return ['backend-add-product' => UrlHelper::construct('shop/cart/add-product')->toString(), 'backend-remove-basket' => UrlHelper::construct('shop/cart/remove-basket')->toString(), 'backend-update-basket' => UrlHelper::construct('shop/cart/update-basket')->toString(), 'backend-clear-cart' => UrlHelper::construct('shop/cart/clear')->toString(), 'backend-update-buyer' => UrlHelper::construct('shop/cart/update-buyer')->toString()]; }
$columns = \yii\helpers\ArrayHelper::merge($columns, [['label' => \Yii::t('skeeks/shop/app', 'Available quantity'), 'class' => \yii\grid\DataColumn::class, 'visible' => false, 'attribute' => 'quantity', 'value' => function (\skeeks\cms\shop\models\ShopCmsContentElement $shopCmsContentElement) { return $shopCmsContentElement->shopProduct ? $shopCmsContentElement->shopProduct->quantity : " - "; }]]); ?> <? $pjax = \yii\widgets\Pjax::begin(); ?> <?php echo $this->render('_search', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'content_id' => $content_id, 'cmsContent' => $cmsContent]); ?> <?php echo \skeeks\cms\modules\admin\widgets\GridViewStandart::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'autoColumns' => false, 'pjax' => $pjax, 'adminController' => $controller, 'settingsData' => ['namespace' => \Yii::$app->controller->action->getUniqueId() . $content_id], 'columns' => $columns]); ?> <? $pjax::end() ?> <? \yii\bootstrap\Alert::begin([ 'options' => [ 'class' => 'alert-info', ], ]); ?> <?php echo \Yii::t('skeeks/shop/app', 'Change the properties and rights of access to information block you can'); ?> <?php echo \yii\helpers\Html::a(\Yii::t('skeeks/shop/app', 'Content Settings'), \skeeks\cms\helpers\UrlHelper::construct(['/cms/admin-cms-content/update', 'pk' => $content_id])->enableAdmin()->toString()); ?> . <? \yii\bootstrap\Alert::end(); ?>
<?php /** * @author Semenov Alexander <*****@*****.**> * @link http://skeeks.com/ * @copyright 2010-2014 SkeekS (Sx) * @date 30.01.2015 * @since 1.0.0 */ /* @var $this yii\web\View */ use Yii; ?> <iframe src="<?php echo \skeeks\cms\helpers\UrlHelper::construct('gii'); ?> " width="100%" height="900" id="sx-smart-frame"></iframe> <?php /* $this->registerJs(<<<JS (function(sx, $, _) { new sx.classes.Iframe('sx-smart-frame', { 'autoHeight' : true, 'heightSelector' : 'html' }); })(sx, sx.$, sx._); JS )*/