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


PHP Adm::getInstance方法代码示例

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


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

示例1: 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

示例2: init

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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7:

<?php

use pavlinter\adm\Adm;
$adm = Adm::getInstance();
$adm->trigger(Adm::EVENT_FOOTER);
?>


开发者ID:pavlinter,项目名称:yii2-adm,代码行数:6,代码来源:_footer.php

示例8: actionFindUser

 /**
  * @param null $id
  * @return string
  */
 public function actionFindUser($id = null)
 {
     $search = Yii::$app->request->get('search');
     $out = ['more' => false];
     if (!is_null($search)) {
         $data = Adm::getInstance()->manager->createUserQuery()->select(['id', 'text' => 'username'])->where(['like', 'username', $search['term']])->limit(20)->asArray()->all();
         $out['results'] = array_values($data);
     } else {
         if ($id > 0) {
             $user = Adm::getInstance()->manager->createUserQuery()->where(['id' => $id])->one();
             $out['results'] = ['id' => $id, 'text' => $user->username];
         } else {
             $out['results'] = ['id' => 0, 'text' => 'No matching records found'];
         }
     }
     return Json::encode($out);
 }
开发者ID:pavlinter,项目名称:yii2-adm,代码行数:21,代码来源:AuthAssignmentController.php

示例9: 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

示例10: actionUserList

 /**
  * @param null $search
  * @param null $id
  */
 public function actionUserList($search = null, $id = null)
 {
     $viewCallback = Module::getInstance()->userSelect['viewCallback'];
     $querySearch = Module::getInstance()->userSelect['querySearch'];
     $queryLoad = Module::getInstance()->userSelect['queryLoad'];
     if ($viewCallback === null) {
         $viewCallback = function ($row) {
             return Adm::t('oplata', '{email}:select2 template', $row);
         };
     }
     if ($querySearch === null) {
         $querySearch = function ($query, $userTable, $search) {
             /* @var \yii\db\Query $query */
             return $query->from($userTable)->where(['like', 'email', $search])->limit(20)->all();
         };
     }
     if ($viewCallback === null) {
         $queryLoad = function ($query, $userTable, $id) {
             /* @var \yii\db\Query $query */
             return $query->from($userTable)->where(['id' => $id])->one();
         };
     }
     $userTable = forward_static_call(array(Adm::getInstance()->manager->userClass, 'tableName'));
     $out = ['more' => false];
     if (!is_null($search)) {
         $query = new \yii\db\Query();
         $rows = call_user_func($querySearch, $query, $userTable, $search);
         $results = [];
         foreach ($rows as $row) {
             $params = [];
             foreach ($row as $attribute => $value) {
                 if (in_array($attribute, ['auth_key', 'password_hash', 'password_reset_token', 'role', 'status'])) {
                     continue;
                 }
                 $params[$attribute] = $value;
             }
             $params['dot'] = false;
             $params['br'] = false;
             if (isset($row['dot'])) {
                 $row['dot'] = false;
             }
             $results[] = ['id' => $row['id'], 'text' => call_user_func($viewCallback, $row), 'template' => Adm::t('oplata', "Email - {email} Username - {username}", $params)];
         }
         $out['results'] = $results;
     } else {
         if ($id > 0) {
             $query = new \yii\db\Query();
             $row = call_user_func($queryLoad, $query, $userTable, $id);
             $out['results'] = ['id' => $id, 'text' => call_user_func($viewCallback, $row)];
         } else {
             $out['results'] = ['id' => 0, 'text' => 'No matching records found'];
         }
     }
     echo Json::encode($out);
 }
开发者ID:pavlinter,项目名称:yii2-adm-oplata,代码行数:59,代码来源:TransactionController.php

示例11:

        <a href="<?php 
echo $baseUrl;
?>
" class="nav-brand" target="_blank">ADM<sup>cms</sup></a>
        <a class="btn btn-link visible-xs" data-toggle="collapse" data-target=".navbar-collapse">
            <i class="fa fa-comment-o"></i>
        </a>
    </div>
    <div class="collapse navbar-collapse">

        <?php 
$adm->trigger(Adm::EVENT_TOP_MENU);
?>

        <?php 
if (!Adm::getInstance()->user->isGuest) {
    ?>
        <ul class="nav navbar-nav navbar-right">
            <li class="dropdown">
                <a href="#" class="dropdown-toggle dker" data-toggle="dropdown">
                        <?php 
    echo $adm->user->identity->username;
    ?>
 <b class="caret"></b>
                </a>
                <ul class="dropdown-menu">
                    <li>
                        <a href="<?php 
    echo Url::to(['/' . $adm->id . '/user/update']);
    ?>
"><?php 
开发者ID:pavlinter,项目名称:yii2-adm,代码行数:31,代码来源:_header.php

示例12: actionLogout

 /**
  * @inheritdoc
  */
 public function actionLogout()
 {
     Adm::getInstance()->user->logout(false);
     return Adm::redirect(['login']);
 }
开发者ID:richardcj,项目名称:yii2-adm,代码行数:8,代码来源:DefaultController.php

示例13:

                <ul class="dropdown-menu animated fadeInLeft">
                    <li>
                        <a href="<?php 
    echo Url::to(['/' . Adm::getInstance()->id . '/user/update']);
    ?>
"><?php 
    echo Adm::t("header", "Profile", ['dot' => false]);
    ?>
</a>
                    </li>
                    <?php 
    $adm->trigger(Adm::EVENT_INNER_PROFILE_MENU);
    ?>
                    <li>
                        <?php 
    echo Html::a(Adm::t("header", "Logout", ['dot' => false]), ['/' . Adm::getInstance()->id . '/default/logout'], ['data-method' => 'post']);
    ?>
                    </li>
                </ul>
            </li>

        </ul>
        <?php 
}
?>

        <?php 
if ($languages) {
    ?>
            <ul class="nav navbar-nav navbar-right">
                <li class="dropdown">
开发者ID:pavlinter,项目名称:yii2-app-core,代码行数:31,代码来源:_header.php

示例14: getLanguage

 /**
  * @return \yii\db\ActiveQuery
  */
 public function getLanguage()
 {
     return $this->hasOne(Adm::getInstance()->manager->createLanguageQuery('className'), ['id' => 'language_id']);
 }
开发者ID:pavlinter,项目名称:yii2-adm-oplata,代码行数:7,代码来源:OplataTransaction.php

示例15:

<?php

use kartik\widgets\Select2;
use pavlinter\adm\Adm;
use pavlinter\buttons\InputButton;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $model pavlinter\adm\models\AuthItem */
/* @var $form yii\widgets\ActiveForm */
$rules = Adm::getInstance()->manager->createAuthRuleQuery()->select('name')->asArray()->all();
$rules = Adm::getInstance()->manager->createAuthRuleQuery()->select('name')->asArray()->all();
?>

<div class="auth-item-form">

    <?php 
$form = Adm::begin('ActiveForm');
?>

    <div class="row">
        <div class="col-xs-12 col-sm-6 col-md-6">
            <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => 64]);
?>

            <?php 
echo $form->field($model, 'type')->widget(Select2::classname(), ['data' => $model::typeList(), 'options' => ['placeholder' => Adm::t('', 'Select ...', ['dot' => false])], 'pluginOptions' => []]);
?>
开发者ID:pavlinter,项目名称:yii2-adm,代码行数:30,代码来源:_form.php


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