コード例 #1
0
ファイル: DictSearch.php プロジェクト: hucongyang/lulucms2
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Dict::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([
     //    'id' => $this->id,
     //    'parent_id' => $this->parent_id,
     //    'status' => $this->status,
     //    'sort_num' => $this->sort_num,
     //]);
     $query->andFilterWhere(['like', 'category_id', $this->category_id])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'value', $this->value])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'thumb', $this->thumb]);
     return $dataProvider;
 }
コード例 #2
0
ファイル: DictController.php プロジェクト: shunzi250/lulucms2
 /**
  * Finds the Dict model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Dict the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Dict::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #3
0
ファイル: _form.php プロジェクト: ruzuojun/lulucms2
<?php

use yii\helpers\Html;
use source\core\widgets\ActiveForm;
use source\models\Dict;
use source\libs\Common;
use source\libs\Constants;
use source\libs\TreeHelper;
/* @var $this yii\web\View */
/* @var $model source\models\Menu */
/* @var $form yii\widgets\ActiveForm */
$category = $model->category_id;
$categories = Dict::getArrayTree($category);
$options = TreeHelper::buildTreeOptionsForSelf($categories, $model);
?>

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

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

    <div class="da-form-row">
        <label>父结点</label>
        <div class="da-form-item small">
            <?php 
echo Html::activeHiddenInput($model, 'category_id');
?>
            <select type="text" id="menu-parent_id" class="form-control" name="Dict[parent_id]">
コード例 #4
0
ファイル: DictCategory.php プロジェクト: ruzuojun/lulucms2
 public function beforeDelete()
 {
     Dict::deleteAll(['category_id' => $this->id]);
     return true;
 }