Пример #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = AdmMenuItems::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'visible' => $this->visible, 'parent_id' => $this->parent_id]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'label', $this->label])->andFilterWhere(['like', 'icon', $this->icon])->andFilterWhere(['like', 'url', $this->url])->andFilterWhere(['like', 'options', $this->options]);
     return $dataProvider;
 }
Пример #2
0
//echo $form->field($model, 'icon')->textInput(['maxlength' => true])
?>

    <?php 
//echo $form->field($model, 'url')->textInput(['maxlength' => true])
?>

    <?php 
//echo $form->field($model, 'url')->dropDownList(ArrayHelper::map(AdmMenuItems::find()->where(['parent_id' => null])->orderBy("name ASC")->all(), 'id', 'id'),['prompt'=>'Nenhum','style'=>'width:300px'])->hint('Ao selecionar uma categoria, o item criado será considerado uma subcategoria')
?>

    <?php 
echo $form->field($model, 'visible')->radioList(['1' => 'Sim', '0' => 'Não'], ['itemOptions' => ['class' => 'radio-inline', 'labelOptions' => array('style' => 'padding:5px;')]])->label('Ativo');
?>

    <?php 
echo $form->field($model, 'parent_id')->dropDownList(ArrayHelper::map(AdmMenuItems::find()->where(['parent_id' => null])->orderBy("name ASC")->all(), 'id', 'label'), ['prompt' => 'Nenhum', 'style' => 'width:300px'])->hint('Ao selecionar uma categoria, o item criado será considerado uma subcategoria');
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Gravar' : 'Gravar Alteração', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-success']);
?>
    </div>

    <?php 
ActiveForm::end();
?>

</div>
Пример #3
0
<div class="admregulations-index">

    <h1><span><?php 
echo Html::encode($this->title);
?>
</span>
    <?php 
echo Html::a('<i class="fa fa-plus"></i> Adicionar', ['create'], ['class' => 'btn btn-success grid-button pull-right']);
?>
    </h1>
    <hr/>

    <div class="col-xs-6 col-md-3">

        <?php 
echo $this->render('_menu');
?>
    </div>
    <div class="col-xs-12 col-sm-6 col-md-9">
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'tableOptions' => ['class' => 'table table-striped table-hover '], 'emptyText' => '</br><p class="text-info">Nenhum documento encontrado!</p>', 'summary' => "<p class=\"text-info pull-right\"><h5>Exibindo {begin} a {end} de {totalCount} documento(s) em {pageCount} pagina(s)</h5></p>", 'columns' => [['attribute' => 'id', 'enableSorting' => true, 'contentOptions' => ['style' => 'width: 5%;text-align:center']], ['attribute' => 'subcat_id', 'format' => 'raw', 'enableSorting' => true, 'value' => function ($model) {
    return $model->admMenuItems->label;
}, 'filter' => ArrayHelper::map(AdmMenuItems::find()->orderBy('label')->asArray()->all(), 'id', 'label'), 'contentOptions' => ['style' => 'width: 20%;text-align:left']], ['attribute' => 'name', 'enableSorting' => true, 'contentOptions' => ['style' => 'width: 40%;text-align:left']], ['attribute' => 'is_active', 'format' => 'raw', 'value' => function ($model) {
    //return $model->status->name;
    return $model->is_active == 1 ? '<span style="color:green" class="glyphicon glyphicon-ok" aria-hidden="true"></span>' : '<span style="color:red" class="glyphicon glyphicon-remove" aria-hidden="true"></span>';
}, 'contentOptions' => ['style' => 'width: 5%;text-align:center']], ['class' => 'yii\\grid\\ActionColumn', 'contentOptions' => ['style' => 'width: 10%;text-align:right']]]]);
?>
    
    </div>
</div>