Exemplo n.º 1
0
 protected function findModelPalestrante($id)
 {
     if (($model = Palestrante::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemplo n.º 2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Palestrante::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(['idPalestrante' => $this->idPalestrante]);
     $query->andFilterWhere(['like', 'nome', $this->nome])->andFilterWhere(['like', 'email', $this->email]);
     return $dataProvider;
 }
Exemplo n.º 3
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]);
     }
 }
Exemplo n.º 4
0
 public function getPalestrante()
 {
     return $this->hasOne(Palestrante::className(), ['idPalestrante' => 'palestrante_idPalestrante']);
 }
Exemplo n.º 5
0
 public function searchPalestrantes()
 {
     $id_evento = Yii::$app->request->post('evento_idevento');
     if (!Yii::$app->user->isGuest) {
         $query = Palestrante::find()->where(['evento_idevento' => $id_evento])->joinWith('itemProgramacao');
         $query2 = Palestrante::find()->where(['idevento' => $id_evento])->joinWith('evento');
         $query->union($query2);
         $query->orderBy('palestrante.nome');
     } else {
         return Yii::$app->getResponse()->redirect(array('/evento/', NULL));
         // é redirecionado a tela de eventos, se não estiver logado
     }
     $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;
     }
     return $dataProvider;
 }
Exemplo n.º 6
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]);
     }
 }