Exemplo 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;
 }
Exemplo 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;
 }
Exemplo 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 
Exemplo n.º 4
0
 public function actionSucursal()
 {
     $imgs = Sucursal::obtenerImagenesSucursal();
     //$imgs = Sucursal::getSucImages();
     $data = Sucursal::getData();
     return $this->render('sucursal', ['imgSucursal' => $imgs]);
 }
Exemplo n.º 5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSucursal()
 {
     return $this->hasOne(Sucursal::className(), ['id' => 'id_sucursal']);
 }
Exemplo n.º 6
0
 /**
  * Finds the Sucursal model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Sucursal the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Sucursal::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemplo n.º 7
0
use backend\models\User;
use common\models\Menu;
use common\models\Sucursal;
/* @var $this yii\web\View */
/* @var $model common\models\Promocion */
$this->title = $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Promociones', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="promocion-view">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <p>
        <?php 
echo Html::a('Actualizar', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']);
?>
        <?php 
echo Html::a('Eliminar', ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => 'Are you sure you want to delete this item?', 'method' => 'post']]);
?>
    </p>

    <?php 
echo DetailView::widget(['model' => $model, 'attributes' => ['id', ['attribute' => 'id_menu', 'value' => Menu::getMenuById($model->id_menu)], ['attribute' => 'id_sucursal', 'value' => Sucursal::getSucById($model->id_sucursal)], 'precio', 'descripcion', 'dia', ['attribute' => 'fecha_ini', 'format' => ['date', 'php:l, d \\d\\e F \\d\\e\\l Y']], ['attribute' => 'fecha_fin', 'format' => ['date', 'php:l, d \\d\\e F \\d\\e\\l Y']], ['attribute' => 'create_user', 'value' => User::getUserById($model->create_user)], ['attribute' => 'create_time', 'format' => ['date', 'php:l, d \\d\\e F \\d\\e\\l Y']], ['attribute' => 'update_user', 'value' => User::getUserById($model->update_user)], ['attribute' => 'update_time', 'format' => ['date', 'php:l, d \\d\\e F \\d\\e\\l Y']]]]);
?>

</div>