Esempio n. 1
0
 public static function getData()
 {
     $rows = Sucursal::find()->all();
     $arrayData = array();
     foreach ($rows as $row) {
         $row->imagenes = Sucursal::getSucImagesById($row->id);
         $arrayData[$row->id] = $row->attributes + ['imagenes' => $row->imagenes];
     }
     $jsonData = Json::encode($arrayData);
     return $jsonData;
 }
Esempio n. 2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Sucursal::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, 'nombre' => $this->nombre, 'estado' => $this->estado, 'cp' => $this->cp, 'create_user' => $this->create_user, 'create_time' => $this->create_time, 'update_user' => $this->update_user, 'update_time' => $this->update_time]);
     $query->andFilterWhere(['like', 'nombre', $this->calle])->andFilterWhere(['like', 'calle', $this->calle])->andFilterWhere(['like', 'colonia', $this->colonia])->andFilterWhere(['like', 'ciudad', $this->ciudad])->andFilterWhere(['like', 'pais', $this->pais]);
     return $dataProvider;
 }
Esempio n. 3
0
/* @var $model common\models\Promocion */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="promocion-form">

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

    <?php 
echo $form->field($model, 'id_menu')->dropDownList(ArrayHelper::map(Menu::find()->all(), 'id', 'nombre'), ['prompt' => 'Seleccione menú']);
?>

    <?php 
echo $form->field($model, 'id_sucursal')->dropDownList(ArrayHelper::map(Sucursal::find()->all(), 'id', 'nombre'), ['prompt' => 'Seleccione sucursal']);
?>

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

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

    <?php 
echo $form->field($model, 'dia')->textInput();
?>

    <?php