当前位置: 首页>>代码示例>>PHP>>正文


PHP UrlHelper::construct方法代码示例

本文整理汇总了PHP中skeeks\cms\helpers\UrlHelper::construct方法的典型用法代码示例。如果您正苦于以下问题:PHP UrlHelper::construct方法的具体用法?PHP UrlHelper::construct怎么用?PHP UrlHelper::construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在skeeks\cms\helpers\UrlHelper的用法示例。


在下文中一共展示了UrlHelper::construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 /**
  * @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();
     }
 }
开发者ID:Liv1020,项目名称:cms,代码行数:33,代码来源:SelectTree.php

示例2: __construct

 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);
 }
开发者ID:skeeks-cms,项目名称:cms-module-form2,代码行数:7,代码来源:ActiveFormConstructForm.php

示例3: 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]);
 }
开发者ID:Liv1020,项目名称:cms,代码行数:32,代码来源:RelatedModelsGrid.php

示例4: renderDataCellContent

    /**
     * @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;
        }
    }
开发者ID:skeeks-cms,项目名称:cms,代码行数:32,代码来源:UserColumnData.php

示例5: run

 /**
  * @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]);
 }
开发者ID:skeeks-cms,项目名称:cms,代码行数:28,代码来源:ComponentSettingsWidget.php

示例6: sendEmail

 /**
  * 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;
 }
开发者ID:Insolita,项目名称:cms,代码行数:30,代码来源:PasswordResetRequestFormEmailOrLogin.php

示例7: init

 public function init()
 {
     parent::init();
     if ($this->backendUrl === null) {
         $this->backendUrl = UrlHelper::construct('cms/admin-storage-files/link-to-models')->enableAdmin()->toString();
     }
 }
开发者ID:skeeks-cms,项目名称:cms,代码行数:7,代码来源:ModelStorageFiles.php

示例8: run

 /**
  * Подготовка данных для шаблона
  * @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]);
 }
开发者ID:skeeks-cms,项目名称:cms-shop,代码行数:11,代码来源:AdminBuyerUserWidget.php

示例9: init

 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();
 }
开发者ID:skeeks-cms,项目名称:cms,代码行数:9,代码来源:Ckeditor.php

示例10: init

 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();
     }
 }
开发者ID:dextercool,项目名称:cms,代码行数:9,代码来源:CmsContentElementInput.php

示例11: getIndexUrl

 /**
  * @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();
 }
开发者ID:skeeks-cms,项目名称:cms,代码行数:13,代码来源:AdminCmsContentController.php

示例12: 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();
 }
开发者ID:skeeks-cms,项目名称:cms,代码行数:10,代码来源:ContentElementController.php

示例13: run

 /**
  * @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();
     }
 }
开发者ID:skeeks-cms,项目名称:cms-module-money,代码行数:15,代码来源:MoneyInput.php

示例14: init

 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;
         }
     }
 }
开发者ID:skeeks-cms,项目名称:cms,代码行数:13,代码来源:UserController.php

示例15: renderDataCellContent

 /**
  * @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;
 }
开发者ID:Liv1020,项目名称:cms,代码行数:18,代码来源:CmsContentElementColumn.php


注:本文中的skeeks\cms\helpers\UrlHelper::construct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。