/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = CategoryGoogle::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->joinWith('parent');
     $query->andFilterWhere(['id' => $this->id, 'parent_id' => $this->parent_id]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'category.nombre_categoria', $this->categoryName]);
     return $dataProvider;
 }
Exemplo n.º 2
0
            <?php 
$items = yii\helpers\ArrayHelper::map(\app\models\Category::find()->all(), 'id_categoria', 'nombre_categoria');
echo Html::label('Categorias');
echo Html::dropDownList('lista-categorias', '', $items, ['class' => 'form-control', 'prompt' => 'Elija una categoria Superior', 'onchange' => 'cambiarChecklist($(this).val())']);
?>


        </div>     
    </div>

    <?php 
\yii\widgets\Pjax::begin();
?>

    <?php 
$items = yii\helpers\ArrayHelper::map(\app\models\CategoryGoogle::find()->all(), 'id', 'nombre');
$model->categoryGoogles = yii\helpers\ArrayHelper::getColumn($model->getCategoryGoogles(), 'id');
echo $form->field($model, 'categoryGoogles')->checkboxList($items, ['class' => '']);
?>



    <?php 
\yii\widgets\Pjax::end();
?>


    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
Exemplo n.º 3
0
 public function getCategoryGoogles()
 {
     $cats = CategoryGoogle::find()->join('JOIN', 'place_category', '`category_google`.`id`=`place_category`.`categoria_id`')->join('JOIN', 'place', '`place_category`.`place_id`=`place`.`place_id`')->where(['place.place_id' => $this->place_id])->all();
     return $cats;
 }
Exemplo n.º 4
0
 public function actionListSubCategory($id)
 {
     $model = new Place();
     $categorys = \yii\helpers\ArrayHelper::map(\app\models\CategoryGoogle::find()->where(['parent_id' => $id])->orderBy('nombre ASC')->all(), 'id', 'nombre');
     echo \yii\helpers\Html::checkboxList("Place[categoryGoogles]", null, $categorys);
 }