/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { //echo 'ola>>>'.$id; // exit(); $query = Acdgroup::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => '10']]); //$this->idProfessor = (integer)Yii::$app->request->get('id'); $this->idProfessor = (int) Yii::$app->session['idprofessor']; $query->joinWith(['curriculum.course.course.course', 'curriculum.curricularcomponent', 'learningperiod', 'acdschedules.acdscheduleprofessors.professor' => function ($q) { $q->where(['personid' => $this->idProfessor]); }])->orderBy(['acdlearningperiod.periodid' => SORT_DESC]); ////)->andFilterWhere(['acdschedule.acdscheduleprofessor.professorid'=>$id]); // } $dataProvider->sort->attributes['curso'] = ['asc' => ['acdcourse.name' => SORT_ASC], 'desc' => ['acdcourse.name' => SORT_DESC]]; // $query->joinWith(['acdschedules.acdscheduleprofessors.professor']); //echo 'id>>>'.$id; //exit(); $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(['datetime' => $this->datetime, 'acdgroup.groupid' => $this->groupid, 'vacant' => $this->vacant, 'iscancellation' => $this->iscancellation, 'regimenid' => $this->regimenid, 'isusewebdaily' => $this->isusewebdaily, 'isclosed' => $this->isclosed, 'totalenrolled' => $this->totalenrolled, 'iscontentprogrammarian' => $this->iscontentprogrammarian, 'useconcept' => $this->useconcept, 'leaderid' => $this->leaderid, 'subleaderid' => $this->subleaderid, 'financecredits' => $this->financecredits, 'professorresponsible' => $this->professorresponsible, 'evaluationtypeid' => $this->evaluationtypeid, 'frequenceregisternotification' => $this->frequenceregisternotification, 'conceptgroupid' => $this->conceptgroupid, 'gradestypingfinished' => $this->gradestypingfinished, 'unitid' => $this->unitid, 'sectorid' => $this->sectorid, 'centerid' => $this->centerid]); $query->andFilterWhere(['like', 'username', $this->username])->andFilterWhere(['like', 'ipaddress', $this->ipaddress])->andFilterWhere(['like', 'complement', $this->complement])->andFilterWhere(['like', 'objectives', $this->objectives])->andFilterWhere(['like', 'content', $this->content])->andFilterWhere(['like', 'methodology', $this->methodology])->andFilterWhere(['like', 'evaluation', $this->evaluation])->andFilterWhere(['like', 'basicbibliography', $this->basicbibliography])->andFilterWhere(['like', 'complementarybibliography', $this->complementarybibliography])->andFilterWhere(['like', 'observation', $this->observation])->andFilterWhere(['like', 'basicbibliographydescription', $this->basicbibliographydescription])->andFilterWhere(['like', 'classid', strtoupper($this->classid)])->andFilterWhere(['like', 'complementarybibliographydescription', $this->complementarybibliographydescription])->andFilterWhere(['like', 'acdlearningperiod.periodid', strtoupper($this->learningperiodid)])->andFilterWhere(['like', 'acdcurricularcomponent.name', strtoupper($this->curriculumid)])->andFilterWhere(['like', 'acdcourse.name', strtoupper($this->curso)]); return $dataProvider; }
/** * Finds the Acdgroup model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Acdgroup the loaded model * @throws NotFoundHttpException if the model cannot be found */ public function findModel($id) { if (($model = Acdgroup::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getAcdgroups0() { return $this->hasMany(Acdgroup::className(), ['subleaderid' => 'personid']); }
/** * @return \yii\db\ActiveQuery */ public function getAcdgroups() { return $this->hasMany(Acdgroup::className(), ['professorresponsible' => 'personid']); }
/** * @return \yii\db\ActiveQuery */ public function getGroup() { return $this->hasOne(Acdgroup::className(), ['groupid' => 'groupid']); }
/** * @return \yii\db\ActiveQuery */ public function getGroups() { return $this->hasMany(Acdgroup::className(), ['groupid' => 'groupid'])->viaTable('acdmoodlesubscription', ['personid' => 'personid']); }
/** * @return \yii\db\ActiveQuery */ public function getAcdgroups() { return $this->hasMany(Acdgroup::className(), ['centerid' => 'centerid']); }
public function salvaFrequenciaMuitoCara($objSave) { $transaction = Yii::$app->db->beginTransaction(); try { $objGrupo = Acdgroup::findOne(['groupid' => Yii::$app->session['groupid']]); foreach ($objSave['Acdfrequenceenroll'] as $i => $schedule) { foreach ($schedule as $j => $matricula) { foreach ($matricula as $l => $data) { foreach ($data as $k => $horas) { $model = Acdfrequenceenroll::findOne(['enrollid' => $j, 'scheduleid' => $i, 'frequencydate' => $l, 'timeid' => $k]); if ($model == null) { $model = new Acdfrequenceenroll(); } if (!($model->frequency == $horas['presenca'])) { $model->datetime = Yii::$app->DadosServidor->getDateNow(); // $model->username = '******'; $model->frequency = floatval($horas['presenca']); $model->ipaddress = $_SERVER['REMOTE_ADDR']; $model->enrollid = $j; $model->scheduleid = $i; $model->frequencydate = $l; $model->timeid = $k; $model->centerid = $objGrupo->centerid; //adicionar o centro $model->save(); } } } } } $transaction->commit(); echo 1; } catch (\Exception $e) { $transaction->rollback(); echo 0; throw $e; } // exit(); }
/** * @return \yii\db\ActiveQuery */ public function getAcdgroups() { return $this->hasMany(Acdgroup::className(), ['learningperiodid' => 'learningperiodid']); }