Esempio n. 1
0
 public function search($params)
 {
     $query = Establecimiento::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'dependencia_organizativa_id' => $this->dependencia_organizativa_id]);
     $query->andFilterWhere(['like', 'nombre', $this->nombre])->andFilterWhere(['like', 'codigo', $this->codigo])->andFilterWhere(['like', 'numero', $this->numero])->andFilterWhere(['like', 'telefono', $this->telefono])->andFilterWhere(['like', 'telefono_alternativo', $this->telefono_alternativo])->andFilterWhere(['like', 'fax', $this->fax])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'sitio_web', $this->sitio_web]);
     return $dataProvider;
 }
Esempio n. 2
0
 /**
  * Creates a new Sede model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @param integer $establecimiento_id
  * @return mixed
  */
 public function actionCreate($establecimiento_id)
 {
     $establecimiento = Establecimiento::findOne($establecimiento_id);
     $model = new Sede();
     $model->establecimiento_id = $establecimiento_id;
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['establecimientos/' . $model->establecimiento_id . '/sedes/view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
Esempio n. 3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getEstablecimiento()
 {
     return $this->hasOne(Establecimiento::className(), ['id' => 'establecimiento_id']);
 }
 public function store(Request $request)
 {
     Establecimiento::create($return->all());
     //  retornamos respuesta de confirmacion o de fallo
 }
 /**
  * Finds the Establecimiento model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Establecimiento the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Establecimiento::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Esempio n. 6
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getEstablecimientos()
 {
     return $this->hasMany(Establecimiento::className(), ['dependencia_organizativa_id' => 'id']);
 }