construct() public static method

public static construct ( $route, array $data = [] ) : static
$route
$data array
return static
Ejemplo n.º 1
1
 /**
  * @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();
     }
 }
 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);
 }
Ejemplo n.º 3
0
 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]);
 }
Ejemplo n.º 4
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;
        }
    }
Ejemplo n.º 5
0
 /**
  * @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]);
 }
Ejemplo n.º 6
0
 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);
 }
 /**
  * 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;
 }
Ejemplo n.º 8
0
 public function init()
 {
     parent::init();
     if ($this->backendUrl === null) {
         $this->backendUrl = UrlHelper::construct('cms/admin-storage-files/link-to-models')->enableAdmin()->toString();
     }
 }
Ejemplo n.º 9
0
 /**
  * Подготовка данных для шаблона
  * @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]);
 }
Ejemplo n.º 10
0
 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();
 }
Ejemplo n.º 11
0
 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();
     }
 }
Ejemplo n.º 12
0
 /**
  * @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();
 }
Ejemplo n.º 13
0
 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();
 }
Ejemplo n.º 14
0
 /**
  * @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();
     }
 }
Ejemplo n.º 15
0
 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;
         }
     }
 }
Ejemplo n.º 16
0
 /**
  * @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;
 }
Ejemplo n.º 17
0
 /**
  * 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.')));
     }
 }
Ejemplo n.º 18
0
 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();
     }
 }
Ejemplo n.º 19
0
    /**
     * @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()]]]]);
    }
Ejemplo n.º 20
0
?>

    <?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)]]]);
Ejemplo n.º 21
0
Archivo: Tree.php Proyecto: Liv1020/cms
    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;
    }
Ejemplo n.º 22
0
 /**
  * @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()];
 }
Ejemplo n.º 23
0
$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(); ?>
Ejemplo n.º 24
0
<?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
)*/
Ejemplo n.º 25
0
 /**
  * @return UrlHelper
  */
 public function getAdminUrl()
 {
     return UrlHelper::construct('/cms/admin-marketplace/catalog', ['code' => $this->packagistCode])->enableAdmin();
 }
Ejemplo n.º 26
0
<?php 
/**
 * auth
 *
 * @author Semenov Alexander <*****@*****.**>
 * @link http://skeeks.com/
 * @copyright 2010 SkeekS (СкикС)
 * @date 26.02.2015
 */
/* @var $this \yii\web\View */
use yii\helpers\Html;
use skeeks\cms\modules\admin\widgets\ActiveForm;
$authLink = \skeeks\cms\helpers\UrlHelper::construct('admin/index')->enableAbsolute()->enableAdmin();
$this->registerJs(<<<JS
    (function(sx, \$, _)
    {
        sx.createNamespace('classes', sx);

        sx.classes.Auth = sx.classes.Component.extend({

            _init: function()
            {
                this.loader = new sx.classes.AjaxLoader();
                this.blocker = new sx.classes.Blocker();
            },

            _onDomReady: function()
            {
                this.JloginContainer = \$('.sx-act-login');
                this.JSuccessLoginContainer = \$('.sx-act-successLogin');
Ejemplo n.º 27
0
<?php

/**
 * index
 *
 * @author Semenov Alexander <*****@*****.**>
 * @link http://skeeks.com/
 * @copyright 2010-2014 SkeekS (Sx)
 * @date 08.11.2014
 * @since 1.0.0
 */
/* @var $this yii\web\View */
$url = \skeeks\cms\helpers\UrlHelper::construct('admin/clear/index')->enableAdmin()->toString();
$data = \yii\helpers\Json::encode(['backend' => $url]);
?>

<div class="sx-box sx-p-10 sx-bg-primary">
    <?php 
echo \yii\helpers\Html::a(\Yii::t('app', 'Delete temporary files'), $url, ['class' => 'btn btn-primary', 'onclick' => 'new sx.classes.Clear(' . $data . '); return false;']);
?>
    <hr />

    <?php 
echo \skeeks\cms\modules\admin\widgets\GridView::widget(['dataProvider' => new \yii\data\ArrayDataProvider(['allModels' => $clearDirs]), 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'label', ['class' => \yii\grid\DataColumn::className(), 'value' => function ($data) {
    /**
     * @var $dir \skeeks\sx\Dir
     */
    $dir = $data['dir'];
    return $dir->getPath();
}], ['class' => \yii\grid\DataColumn::className(), 'value' => function ($data) {
    /**
Ejemplo n.º 28
0
                handler.bind('success', function(e, data)
                {
                    _.delay(function()
                    {
                        sx.AppUnAuthorized.triggerBeforeReddirect();
                    }, 200)
                });
            }
        });

        sx.Blocked = new sx.classes.Blocked();
    })(sx, sx.\$, sx._);
JS
);
$logoutUrl = \skeeks\cms\helpers\UrlHelper::construct("admin/auth/logout")->enableAdmin()->setCurrentRef();
?>

<div class="main sx-content-block sx-windowReady-fadeIn">
    <div class="col-lg-4"></div>

    <div class="col-lg-4">
        <div class="panel panel-primary sx-panel">
            <div class="panel-body">
                <div class="panel-content">
                        <?php 
$form = ActiveForm::begin(['id' => 'blocked-form', 'validationUrl' => (string) \skeeks\cms\helpers\UrlHelper::constructCurrent()->enableAjaxValidateForm(), 'afterValidateCallback' => 'sx.Blocked.afterValidate']);
?>

                                <div class="row">
                                    <div class="col-lg-3">
Ejemplo n.º 29
0
<?php 
echo Html::beginTag('h3');
?>
    Данные комментария:
<?php 
echo Html::endTag('h3');
?>

<?php 
echo Html::beginTag('p');
?>


    <?php 
echo \yii\widgets\DetailView::widget(['model' => $model, 'attributes' => ['id', 'comments']]);
?>

<?php 
echo Html::endTag('p');
?>


<?php 
echo Html::beginTag('p');
?>
    Для управления комментариями используйте инструмент: <?php 
echo Html::a('тут', \skeeks\cms\helpers\UrlHelper::construct('comments2/admin-message/update', ['pk' => $model->id])->enableAdmin()->enableAbsolute()->toString());
?>
.
<?php 
echo Html::endTag('p');
Ejemplo n.º 30
0
 public function getJsonString()
 {
     return Json::encode(['backendUrl' => UrlHelper::construct('cms/storage-files/link-to-models')->enableAdmin()->toString(), 'modelId' => $this->model->id, 'modelClassName' => $this->model->className(), 'modelRelation' => $this->attribute]);
 }