public function actionIndex2($id)
 {
     $searchModel = new FaerSearch();
     $dataProvider = $searchModel->searchfixed($id);
     //$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     $comite = Comite::findOne(['id' => $id]);
     return $this->render('index2', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'comite' => $comite]);
 }
 public function actionSinAprobar($id)
 {
     $comite = Comite::findOne(['id' => $id]);
     $proyectos = Faer::find()->where(['categoria' => $comite->tipo]);
     if (strtoupper($comite->getSubtipo0()->one()->nombre) != "GENERAL") {
         $proyectos = $proyectos->andWhere(['subcategoria' => $comite->subtipo]);
     }
     $proyectos = $proyectos->all();
     $html = $this->renderAjax('_por_aprobar', ['proyectos' => $proyectos]);
     return Json::encode($html);
 }
Exemple #3
0
 public function searchfixed($id)
 {
     $comite = Comite::findOne(['id' => $id]);
     $proyectos_ya_asignados = ArrayHelper::getColumn(ProyectosComite::find()->asArray()->all(), 'proyecto', false);
     $query = Faer::find()->where(['categoria' => $comite->tipo]);
     if (!empty($proyectos_ya_asignados)) {
         $query = $query->andWhere(['not in', 'numero', $proyectos_ya_asignados]);
     }
     if (strtoupper($comite->getSubtipo0()->one()->nombre) != "GENERAL") {
         $query = $query->andWhere(['subcategoria' => $comite->subtipo]);
     }
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     return $dataProvider;
 }
 /**
  * Finds the Comite model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Comite the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Comite::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }