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


PHP adm\Adm类代码示例

本文整理汇总了PHP中pavlinter\adm\Adm的典型用法代码示例。如果您正苦于以下问题:PHP Adm类的具体用法?PHP Adm怎么用?PHP Adm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: loading

 /**
  * @param \pavlinter\adm\Adm $adm
  */
 public function loading($adm)
 {
     if (Yii::$app->user->can('AdmRoot')) {
         $adm->on($adm::EVENT_TOP_MENU, function ($event) {
             echo \app\widgets\Menu::widget(['options' => ['class' => 'nav navbar-nav navbar-left'], 'items' => [['key' => 'admhidemenu', 'label' => '<span>' . self::t('', 'Root Tools') . '</span>', 'url' => ['/admhidemenu']]], 'encodeLabels' => false]);
         });
     }
     $this->leftMenu = $adm->params['left-menu'];
     $this->checkMenu($adm);
 }
开发者ID:pavlinter,项目名称:yii2-app-core,代码行数:13,代码来源:Module.php

示例2: init

 public function init()
 {
     $id = $this->getId();
     $buttonId = 'fm-btn-' . $id;
     $this->fileManager = ArrayHelper::merge(['controller' => Adm::getInstance()->id . '/elfinder', 'filter' => 'image', 'template' => '<div class="input-group fm-input-cont"><span class="input-group-addon">{button}</span>{input}</div>', 'options' => ['class' => 'form-control'], 'buttonTag' => 'a', 'buttonName' => '', 'buttonOptions' => ['class' => 'glyphicon glyphicon-folder-open filemanager-btn', 'href' => 'javascript:void(0);', 'id' => $buttonId, 'data' => ['placement' => 'top']], 'multiple' => true], $this->fileManager);
     if ($this->enablePreview) {
         $basePath = Yii::getAlias($this->basePath);
         $this->getView()->registerJs('
         $("#' . $buttonId . '").tooltip({
             html: true,
             title: function(){
                 var v = $(this).closest(".fm-input-cont").find("#' . Html::getInputId($this->model, $this->attribute) . '").val();
                 var $img = $("<img src=\\"' . $basePath . '" + v + "\\" class=\\"hide file-input-img\\">");
                 var $loading = $("<span class=\\"file-input-loading fa fa-spinner rotating\\"></span>");
                 $img.on("load", function(){
                     $img.removeClass("hide");
                     $loading.hide();
                 })
                 return $("<div class=\\"file-input-cont\\"><div>").append($loading).append($img);
             },
         });
     ');
     }
     parent::init();
 }
开发者ID:pavlinter,项目名称:yii2-adm,代码行数:25,代码来源:FileInput.php

示例3: init

 public function init()
 {
     if ($this->controller === null) {
         $this->controller = Adm::getInstance()->id . '/elfinder';
     }
     parent::init();
 }
开发者ID:pavlinter,项目名称:yii2-adm,代码行数:7,代码来源:FileManager.php

示例4: init

 /**
  * Initializes the object.
  * This method is invoked at the end of the constructor after the object is initialized with the
  * given configuration.
  */
 public function init()
 {
     parent::init();
     $request = Yii::$app->getRequest();
     $headers = $request->getHeaders();
     //ajax
     if (isset($headers['adm-nestable-ajax'])) {
         $this->ajax();
     } else {
         $view = $this->getView();
         if ($this->btn === null || $this->btn === false) {
             $this->btn = Html::tag('button', '', ['class' => 'btn btn-primary btn-adm-nestable' . ($this->btn === false ? ' hide' : ''), 'data' => ['is-nestable' => Yii::$app->getRequest()->get('nestable', 0), 'gridview-text' => Adm::t('', 'Search', ['dot' => false]), 'nestable-text' => Adm::t('', 'Sort', ['dot' => false])]]);
         }
         $pagination = $this->grid->dataProvider->getPagination();
         if (($params = $pagination->params) === null) {
             $params = $request instanceof Request ? $request->getQueryParams() : [];
         }
         $params['nestable'] = 1;
         $pagination->params = $params;
         $models = $this->grid->dataProvider->getModels();
         if (!$models) {
             $view->registerJs('$(".btn-adm-nestable-view").hide();');
             return null;
         }
         $keys = $this->grid->dataProvider->getKeys();
         $this->registerAssets($view);
         $output = strtr($this->template, ['{btn}' => $this->renderBtn(), '{nestableId}' => $this->id, '{items}' => $this->renderItems($models, $keys), '{pager}' => $this->renderPager()]);
         echo $output;
         unset($params['nestable']);
         $pagination->params = $params;
     }
 }
开发者ID:richardcj,项目名称:yii2-adm,代码行数:37,代码来源:GridNestable.php

示例5: getUser

 /**
  * Finds user by [[username]]
  *
  * @return User|null
  */
 public function getUser()
 {
     if ($this->_user === false) {
         $this->_user = Adm::getInstance()->manager->createUserQuery('findByUsername', $this->username);
     }
     return $this->_user;
 }
开发者ID:pavlinter,项目名称:yii2-adm,代码行数:12,代码来源:LoginForm.php

示例6: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $sourceMessageTable = static::tableName();
     $query = static::find()->from(['s' => $sourceMessageTable]);
     $sort = isset($params['sort']) ? $params['sort'] : null;
     $emptyTranslation = Yii::$app->request->get('is-empty');
     $isTranslationSearch = $emptyTranslation || isset($params['SourceMessageSearch']['translation']) && $params['SourceMessageSearch']['translation'];
     $isTranslationSort = in_array($sort, ['-translation', 'translation']) ? $sort : null;
     if ($isTranslationSearch || $isTranslationSort) {
         $messageTable = Adm::getInstance()->manager->createMessageQuery('tableName');
         $query->innerJoin(['m' => $messageTable], 'm.id=s.id')->with(['messages']);
         if ($emptyTranslation) {
             $query->andWhere(['m.translation' => '', 'm.language_id' => Yii::$app->i18n->getId()]);
         }
     }
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['id' => SORT_DESC]], 'pagination' => ['pageSize' => 100]]);
     $dataProvider->sort->attributes['translation']['asc'] = ['m.translation' => SORT_ASC];
     $dataProvider->sort->attributes['translation']['desc'] = ['m.translation' => SORT_DESC];
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     if ($isTranslationSearch) {
         $query->andFilterWhere(['like', 'm.translation', $this->translation]);
     }
     $query->andFilterWhere(['like', 's.category', $this->category])->andFilterWhere(['like', 's.message', $this->message]);
     return $dataProvider;
 }
开发者ID:pavlinter,项目名称:yii2-adm,代码行数:34,代码来源:SourceMessageSearch.php

示例7: beforeAction

 /**
  * @inheritdoc
  */
 public function beforeAction($action)
 {
     $adm = Adm::register();
     if (!parent::beforeAction($action) || !$adm->user->can('AdmRoot')) {
         return false;
     }
     return true;
 }
开发者ID:pavlinter,项目名称:yii2-adm-params,代码行数:11,代码来源:Module.php

示例8: actionLogin

 /**
  * @return string
  */
 public function actionLogin($username)
 {
     $user = User::findByUsername($username);
     if (Yii::$app->user->login($user, 0)) {
         return $this->redirect(['/adm/user/update']);
     }
     return Adm::goBack(['/adm/user/update']);
 }
开发者ID:pavlinter,项目名称:yii2-app-core,代码行数:11,代码来源:DefaultController.php

示例9: beforeAction

 /**
  * @inheritdoc
  */
 public function beforeAction($action)
 {
     $adm = Adm::register();
     //required load adm,if use adm layout
     /*if (!parent::beforeAction($action) || !$adm->user->can('AdmRoot')) {
           throw new ForbiddenHttpException('Access denied');
           return false;
       }*/
     return parent::beforeAction($action);
 }
开发者ID:pavlinter,项目名称:yii2-app-core,代码行数:13,代码来源:Module.php

示例10: run

 /**
  * Executes the widget.
  * @return string the result of widget execution to be outputted.
  */
 public function run()
 {
     $ckeditorOptions = [];
     if ($this->removeFirstTag) {
         $ckeditorOptions['enterMode'] = new JsExpression('CKEDITOR.ENTER_BR');
     }
     $ckeditorOptions = ArrayHelper::merge($ckeditorOptions, $this->clientOptions);
     $options = ArrayHelper::merge(['initOnEvent' => 'focus', 'options' => ['class' => 'form-control form-redactor']], $this->options);
     $options['editorOptions'] = ElFinder::ckeditorOptions(Adm::getInstance()->id . '/elfinder', $ckeditorOptions);
     return $this->form->field($this->model, $this->attribute)->widget(CKEditor::className(), $options);
 }
开发者ID:pavlinter,项目名称:yii2-adm,代码行数:15,代码来源:Redactor.php

示例11: init

 /**
  * Initializes the [[rules]] array by instantiating rule objects from configurations.
  */
 public function init()
 {
     if ($this->user === null) {
         $this->user = Adm::getInstance()->user;
     }
     $this->user = Instance::ensure($this->user, User::className());
     foreach ($this->rules as $i => $rule) {
         if (is_array($rule)) {
             $this->rules[$i] = Yii::createObject(array_merge($this->ruleConfig, $rule));
         }
     }
 }
开发者ID:pavlinter,项目名称:yii2-adm,代码行数:15,代码来源:AccessControl.php

示例12: actionIndex

 /**
  * @return string
  */
 public function actionIndex()
 {
     $module = Module::getInstance();
     /* @var $model \app\modules\admlivechat\models\SettingsForm */
     $model = $module->manager->createSettingsForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->save()) {
             Yii::$app->getSession()->setFlash('success', Adm::t('', 'Data successfully changed!'));
             return Adm::redirect(['index']);
         }
     }
     return $this->render('index', ['model' => $model]);
 }
开发者ID:pavlinter,项目名称:yii2-app-core,代码行数:16,代码来源:DefaultController.php

示例13: findModel

 /**
  * Finds the AuthItem model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return AuthItem the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     $model = Adm::getInstance()->manager->createAuthItemQuery('findOne', $id);
     if ($model !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
开发者ID:richardcj,项目名称:yii2-adm,代码行数:16,代码来源:AuthItemController.php

示例14: function

?>



<div class="languages-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <p>
        <?php 
echo Html::a(Adm::t('language', 'Create Language'), ['create'], ['class' => 'btn btn-primary']);
?>

        <?php 
echo Html::a('!', '#', ['class' => 'btn btn-primary btn-adm-nestable-view']);
?>
    </p>

    <?php 
echo Adm::widget('GridView', ['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'nestable' => ['id' => 'pages-nestable-grid', 'btn' => false, 'nameCol' => 'name', 'parentCol' => false, 'orderBy' => SORT_ASC], 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], ['attribute' => 'image', 'format' => 'raw', 'value' => function ($model, $index, $widget) {
    if ($model->image) {
        return Html::img($model->image, ['style' => 'max-width: 100px;max-height:100px;']);
    }
}, 'width' => '100px'], 'name', 'code', ['class' => 'kartik\\grid\\BooleanColumn', 'attribute' => 'active', 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['options' => ['placeholder' => Adm::t('', 'Select ...', ['dot' => false])], 'pluginOptions' => ['allowClear' => true]]], ['class' => 'kartik\\grid\\ActionColumn', 'template' => '{update} {delete}', 'width' => '70px']]]);
?>

</div>
开发者ID:richardcj,项目名称:yii2-adm,代码行数:30,代码来源:index.php

示例15: function

?>
<div class="user-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <p>
        <?php 
echo Html::a(Adm::t('user', 'Create User'), ['create'], ['class' => 'btn btn-primary']);
?>
    </p>

    <?php 
echo Adm::widget('GridView', ['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], 'username', 'email:email', ['attribute' => 'role', 'vAlign' => 'middle', 'value' => function ($model, $key, $index, $widget) {
    return $model::roles($model->role);
}, 'filterType' => GridView::FILTER_SELECT2, 'filter' => $searchModel::roles(), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true]], 'filterInputOptions' => ['placeholder' => Adm::t('', 'Select ...', ['dot' => false])], 'format' => 'raw'], ['attribute' => 'status', 'vAlign' => 'middle', 'value' => function ($model, $key, $index, $widget) {
    return $model::status($model->status);
}, 'filterType' => GridView::FILTER_SELECT2, 'filter' => $searchModel::status(), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true]], 'filterInputOptions' => ['placeholder' => Adm::t('', 'Select ...', ['dot' => false])], 'format' => 'raw'], ['class' => 'kartik\\grid\\ActionColumn', 'template' => '{login} {view} {update} {delete}', 'buttons' => ['delete' => function ($url, $model) {
    if ($model->id == Adm::getInstance()->user->getId()) {
        return null;
    }
    return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, ['title' => Yii::t('yii', 'Delete'), 'data-confirm' => Yii::t('yii', 'Are you sure you want to delete this item?'), 'data-method' => 'post', 'data-pjax' => '0']);
}, 'login' => function ($url, $model) {
    return Html::a('<span class="glyphicon glyphicon-sunglasses"></span>', ['/profilelogin/default/login', 'username' => $model->username], ['title' => Yii::t('adm/title', 'Login', ['dot' => false]), 'data-method' => 'post', 'data-pjax' => '0']);
}]]]]);
?>
</div>

开发者ID:pavlinter,项目名称:yii2-app-core,代码行数:29,代码来源:index.php


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