예제 #1
0
 public function actionUpdate()
 {
     $name = Yii::$app->request->get('name');
     if (empty($name)) {
         return FALSE;
     }
     // Convert module array
     $ignoreModule = ['gii', 'config', 'debug'];
     foreach (array_keys(Yii::$app->modules) as $module) {
         if (!in_array($module, $ignoreModule)) {
             $modules[$module] = $module;
         }
     }
     $model = LetConfig::findOne($name);
     if ($model->load(Yii::$app->request->post())) {
         $model->name = $model->module . '.' . $model->key;
         $model->convertData($model->type);
         /*if (!$model->validate()) {
                         var_dump($model->value);
                         var_dump($model->errors);
         //                var_dump($model);
                     }*/
         var_dump($model->errors);
         if ($model->save()) {
             return $this->redirect(Url::toRoute(['backend/default/index']));
         }
     }
     return $this->render('update', ['model' => $model, 'modules' => $modules]);
 }
예제 #2
0
 public function actionKeylist()
 {
     try {
         $data = LetConfig::filter();
         $result = [];
         foreach ($data as $config) {
             $config = explode('.', $config->name);
             if (isset($config[1])) {
                 $result[] = $config[1];
             } else {
                 $result[] = $config[0];
             }
         }
         //            var_dump($result);
     } catch (ErrorException $e) {
         echo 0;
     }
 }
예제 #3
0
파일: index.php 프로젝트: letyii/cms
    </div>
    <div class="clearfix"></div>
</div>

<div class="panel panel-default">
    <!-- Default panel contents -->
    <div class="panel-heading">
        <div class="pull-left"><h4>Cấu hình</h4></div>
        <div class="pull-right">
            <?php 
echo Html::beginForm(['backend/default/index'], 'GET', ['role' => 'form', 'class' => 'form-inline']);
?>
            <div class="form-group">
                <?php 
$data = LetConfig::filter();
$data = LetConfig::asDataAutocomplete($data, 'name');
echo \yii\jui\AutoComplete::widget(['name' => 'keyword', 'value' => Yii::$app->request->get('keyword', ''), 'clientOptions' => ['source' => $data], 'options' => ['class' => 'form-control col-lg-2', 'onchange' => 'getListKey("' . yii\helpers\Url::toRoute(['backend/ajax/filter']) . '");', 'placeholder' => 'Tìm kiếm theo key']]);
?>
            </div>
            <div class="form-group">
            <?php 
echo Html::dropDownList('module', Yii::$app->request->get('module', ''), $modules, ['class' => 'form-control']);
?>
            </div>
            <div class="form-group">
                <?php 
echo Html::submitButton('Lọc', ['class' => 'btn btn-info', 'onclick' => '$("#formDefault").submit();']);
?>
            <?php 
echo Html::a('Reset', ['backend/default/index'], ['class' => 'btn btn-default']);
?>