/**
  * Finds the DictCategory model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return DictCategory the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = DictCategory::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemplo n.º 2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = DictCategory::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['like', 'id', $this->id])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'description', $this->description]);
     return $dataProvider;
 }
Exemplo n.º 3
0
<?php

use yii\helpers\Html;
use yii\helpers\Url;
use source\LuLu;
use source\libs\Constants;
use source\core\grid\GridView;
use source\modules\dict\models\DictCategory;
/* @var $this source\core\back\BackView */
/* @var $searchModel source\models\search\DictSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$category = LuLu::getGetValue('category');
$categoryModel = DictCategory::findOne(['id' => $category]);
$this->title = '字典';
$this->params['breadcrumbs'][] = $this->title;
?>

<?php 
$this->toolbars([Html::a('返回', ['/dict/dict-category'], ['class' => 'btn btn-xs btn-primary mod-site-save']), Html::a('新建', ['create', 'category' => $category], ['class' => 'btn btn-xs btn-primary mod-site-save'])]);
?>


    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'source\\core\\grid\\IdColumn'], ['attribute' => 'name', 'width' => '250px'], ['attribute' => 'value', 'format' => 'ntext', 'width' => 'auto'], ['class' => 'source\\core\\grid\\SortColumn'], ['class' => 'source\\core\\grid\\StatusColumn'], ['class' => 'source\\core\\grid\\ActionColumn', 'queryParams' => ['view' => ['category' => $category]]]]]);
Exemplo n.º 4
0
use source\modules\dict\models\DictCategory;
use source\core\grid\ActionColumn;
/* @var $this yii\web\View */
/* @var $searchModel source\models\search\DictSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = '字典管理';
echo source\libs\Message::getMessage();
?>
<div class="page-header">
    <h3>
        <strong><?php 
echo Html::encode($this->title);
?>
</strong>
        <small><?php 
echo Html::encode(DictCategory::getDictCategoryName($category_id));
?>
</small>
        <div class="pull-right">
            <?php 
echo Html::a('<span class="glyphicon glyphicon-plus"></span> ' . LsYii::gT('添加字典'), ['/dict/dict/create', 'category_id' => $category_id], ['class' => 'btn btn-primary']);
?>
            <?php 
echo Html::a('<span class="glyphicon glyphicon-share-alt"></span> ' . LsYii::gT('Return'), ['/dict/dictcategory/index'], ['class' => 'btn btn-primary']);
?>
        </div>
    </h3>
</div>
<div class="dict-index">
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'layout' => '{items} {summary} {pager}', 'tableOptions' => ['class' => 'table table-hover'], 'columns' => [['attribute' => 'name'], ['attribute' => 'value'], ['attribute' => 'status', 'filter' => \source\libs\Constants::getDictStatus(), 'content' => function ($model, $key, $index, $gridView) {
Exemplo n.º 5
0
<?php

use source\helpers\Html;
use yii\grid\GridView;
use source\LsYii;
use source\modules\dict\models\Dict;
use source\modules\dict\models\DictCategory;
/* @var $this yii\web\View */
/* @var $model source\models\Dict */
$this->title = '修改字典';
echo source\libs\Message::getMessage();
?>
<div class="page-header">
    <h3>
        <strong><?php 
echo Html::encode($this->title);
?>
</strong>
        <small><?php 
echo Html::encode(DictCategory::getDictCategoryName($category_id) . '-' . $model->name);
?>
</small>
    </h3>
</div>
<div class="dict-update">
    <?php 
echo $this->render('_form', ['model' => $model, 'category_id' => $category_id]);
?>

</div>