Esempio n. 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Local::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(['idlocal' => $this->idlocal]);
     $query->andFilterWhere(['like', 'descricao', $this->descricao])->andFilterWhere(['like', 'latitude', $this->latitude])->andFilterWhere(['like', 'longitude', $this->longitude]);
     return $dataProvider;
 }
Esempio n. 2
0
 /**
  * Updates an existing ItemProgramacao model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     $this->autorizaUsuario($model->evento_idevento);
     $arrayPalestrante = ArrayHelper::map(Palestrante::find()->all(), 'idPalestrante', 'nome');
     $arrayLocal = ArrayHelper::map(Local::find()->all(), 'idlocal', 'descricao');
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['index', 'idevento' => $model->evento_idevento]);
     } else {
         return $this->render('update', ['model' => $model, 'arrayLocal' => $arrayLocal, 'arrayPalestrante' => $arrayPalestrante]);
     }
 }
Esempio n. 3
0
 public function getLocalSeatArray(Request $request)
 {
     $local_id = $request['local_id'];
     $local = Local::find($local_id);
     if (empty($local) || $local == null) {
         return response()->json('invalid local id', 400);
     }
     $distribution = $local->distribution;
     $arreglo = array();
     for ($i = 1; $i <= $local->rows; $i++) {
         $texto = '';
         for ($j = 1; $j <= $local->columns; $j++) {
             $dist = Distribution::where('row', $i)->where('column', $j)->where('local_id', $local_id)->get()->first();
             if ($dist->seat) {
                 $texto = $texto . 'a';
             } else {
                 $texto = $texto . '_';
             }
         }
         array_push($arreglo, $texto);
     }
     return $arreglo;
 }
Esempio n. 4
0
 /**
  * Updates an existing Evento model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param string $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $this->autorizaUsuario();
     $model = $this->findModel($id);
     !$model->canAccess() ? $this->redirect(['evento/index']) : ($imagem = $model->imagem2);
     $arrayPalestrante = ArrayHelper::map(Palestrante::find()->all(), 'idPalestrante', 'nome');
     $arrayLocal = ArrayHelper::map(Local::find()->all(), 'idlocal', 'descricao');
     $arrayTipo = ArrayHelper::map(Tipo::find()->all(), 'idtipo', 'titulo');
     if ($model->load(Yii::$app->request->post())) {
         $model->imagem2 = $model->upload(UploadedFile::getInstance($model, 'imagem2'), 'uploads/identidade/');
         if ($model->imagem2 == null) {
             $model->imagem2 = $imagem;
         }
         if (!$model->save(true)) {
             return $this->render('update', ['model' => $model, 'arrayTipo' => $arrayTipo, 'arrayLocal' => $arrayLocal, 'arrayPalestrante' => $arrayPalestrante]);
         }
         $this->mensagens('success', 'Evento Atualizado', 'Evento atualizado com Sucesso');
         return $this->redirect(['evento/identidade', 'idevento' => $model->idevento]);
     } else {
         return $this->render('update', ['model' => $model, 'arrayTipo' => $arrayTipo, 'arrayLocal' => $arrayLocal, 'arrayPalestrante' => $arrayPalestrante]);
     }
 }