Ejemplo n.º 1
0
 /**
  * Displays a single Acddegreeenroll model.
  * @param integer $id
  * @return mixed
  */
 public function actionListaAva($degreeid)
 {
     $groupid = Yii::$app->session['groupid'];
     $avaliacao = Acdevaluation::find()->andwhere(['groupid' => $groupid])->andwhere(['degreeid' => $degreeid])->orderBy('description')->all();
     $str = "";
     foreach ($avaliacao as $item) {
         $str .= '<option value="' . $item->evaluationid . '">"' . $item->description . '"</option>';
     }
     echo $str;
     //  echo '<option value="3564">01 - 1ª AVALIACAO</option>
     // <option value="3565">02 - 2ª AVALIACAO</option>';
 }
Ejemplo n.º 2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Acdevaluation::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => '10']]);
     //  $this->groupid = (integer)Yii::$app->request->get('groupid');
     $query->where(['groupid' => (int) Yii::$app->session['groupid']]);
     $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, 'evaluationid' => $this->evaluationid, 'degreeid' => $this->degreeid, 'dateforecast' => $this->dateforecast, 'weight' => $this->weight, 'professorid' => $this->professorid, 'groupid' => $this->groupid, 'moodleevaluationid' => $this->moodleevaluationid, 'maxpoints' => $this->maxpoints, 'unitid' => $this->unitid, 'sectorid' => $this->sectorid]);
     $query->andFilterWhere(['like', 'username', $this->username])->andFilterWhere(['like', 'ipaddress', $this->ipaddress])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'podedigitar', $this->podedigitar]);
     //  ->andFilterWhere(['like', 'degree.degreeid', $this->degreeid]);
     return $dataProvider;
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getAcdevaluations()
 {
     return $this->hasMany(Acdevaluation::className(), ['professorid' => 'personid']);
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function objNota()
 {
     $groupid = (int) Yii::$app->session['groupid'];
     $degreeid = 975;
     $this->avaliacao = Acdevaluation::find()->andwhere(['groupid' => $groupid])->andwhere(['degreeid' => $degreeid])->all();
     $alunos = Acdenroll::find()->joinWith(['contract.person'])->where(['groupid' => $groupid])->all();
     // $vet = [];
     //$vet = [];
     $vetLabel = [];
     foreach ($alunos as $itemAluno) {
         $vet[$itemAluno->enrollid]['alunos'] = $itemAluno->contract->person->name;
         foreach ($this->avaliacao as $item) {
             //  $str = $itemAluno->enrollid.','.$item->degreeid.','.$item->evaluationid;
             $vetLabel[$item->evaluationid] = $item->description;
             $vet[$itemAluno->enrollid][$item->evaluationid] = 'nota';
         }
         //array_push($vet, $vetAux);
         //$vet[$str] = [$vetAux];
         //$vet = [$vetAux];
         //$vetAux = [];
     }
     //  print_r($vet);
     //  exit();
     $dataProvider = new ArrayDataProvider(['allModels' => $vet]);
     $coluna = [];
     if (!empty($vet)) {
         foreach ($vet as $linhas) {
             foreach ($linhas as $chave => $colunas) {
                 if ($chave == 'alunos') {
                     $coluna[$chave] = ['type' => TabularForm::INPUT_RAW, 'label' => 'Alunos', 'value' => function ($model, $key, $index, $widget) {
                         // return Html::label($model->scheduleprofessorcontentid);
                         return Html::label($model['alunos'], null, ['style' => 'min-width:200px;font-weight: lighter;']);
                         // return Html::label($model->timeid);
                     }];
                 } else {
                     $coluna[$chave] = ['type' => TabularForm::INPUT_RAW, 'options' => ['class' => 'form-control text-center', 'style' => 'min-width:80px'], 'value' => function ($model, $key, $index, $widget) {
                         if ($this->cont == count($this->avaliacao)) {
                             $this->cont = 0;
                         }
                         $ava = $this->avaliacao[$this->cont];
                         $ava->evaluationid;
                         $this->cont++;
                         return $model[$ava->evaluationid];
                         // return Html::label($model->scheduleprofessorcontentid);
                         // return Html::label($model['alunos'], null, ['style' => 'min-width:200px;font-weight: lighter;']);
                         // return Html::label($model->timeid);
                     }];
                     /*  $coluna[$chave] = ['type' => TabularForm::INPUT_TEXT,
                         //'type'=> $form->field($model, 'last_updated')->textInput(),
                         //'label'=>$vetLabel[$chave],
                         //'value'=> 'nota',
                         'options' => ['class' => 'form-control text-center', 'style' => 'min-width:80px']
                         ]; */
                 }
             }
         }
         $result = [];
         $result['coluna'] = $coluna;
         $result['dataProvider'] = $dataProvider;
         return $result;
     }
 }
Ejemplo n.º 5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getAcdevaluations()
 {
     return $this->hasMany(Acdevaluation::className(), ['groupid' => 'groupid']);
 }
Ejemplo n.º 6
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getEvaluation()
 {
     return $this->hasOne(Acdevaluation::className(), ['evaluationid' => 'evaluationid']);
 }
 public function objNota($params)
 {
     $groupid = (int) Yii::$app->session['groupid'];
     $degreeid = null;
     $vetAlunos = [];
     $vetAvaliacao = [];
     $whereAlunos = [];
     $whereAvaliacao = [];
     //  print_r($param);
     if (isset($params['grau'])) {
         $degreeid = $params['grau'];
     }
     if (isset($params['alunos']['item'])) {
         if (!empty($params['alunos']['item'])) {
             $vetAlunos = $params['alunos']['item'];
             if (!empty($vetAlunos)) {
                 $whereAlunos = ['in', 'enrollid', $vetAlunos];
             }
         }
     }
     if (isset($params['avaliacao']['item'])) {
         if (!empty($params['avaliacao']['item'])) {
             $vetAvaliacao = $params['avaliacao']['item'];
             if (!empty($vetAvaliacao)) {
                 $aux = [];
                 foreach ($vetAvaliacao as $i => $id) {
                     $aux[$i] = (int) $id;
                 }
                 $vetAvaliacao = $aux;
                 $whereAvaliacao = ['in', 'evaluationid', $vetAvaliacao];
             }
             // echo '>>>'.print_r($whereAvaliacao);
             // exit();
         }
     }
     if ($degreeid != null || $degreeid != "") {
         $this->avaliacao = Acdevaluation::find()->andwhere(['groupid' => $groupid])->andwhere(['degreeid' => $degreeid])->andwhere($whereAvaliacao)->all();
         $alunos = Acdenroll::find()->joinWith(['contract.person'])->where(['groupid' => $groupid])->andwhere($whereAlunos)->orderBy('name')->all();
         $vetEvaluation = [];
         $vetEnrollid = [];
         $vetLabel = [];
         foreach ($alunos as $itemAluno) {
             array_push($vetEnrollid, $itemAluno->enrollid);
             $vet[$itemAluno->enrollid]['alunos'] = $itemAluno->contract->person->name;
             foreach ($this->avaliacao as $item) {
                 //  $str = $itemAluno->enrollid.','.$item->degreeid.','.$item->evaluationid;
                 array_push($vetEvaluation, $item->evaluationid);
                 $vetLabel[$item->evaluationid] = $item->description;
                 $vet[$itemAluno->enrollid][$item->evaluationid] = 'nota';
             }
         }
         $result = array_unique($vetEvaluation);
         $vetEvaluation = $result;
         $this->nota = Acdevaluationenroll::find()->andwhere(['in', 'enrollid', $vetEnrollid])->andwhere(['in', 'evaluationid', $vetEvaluation])->orderBy(['recorddate' => SORT_DESC])->all();
         //  echo 'num>>>'.print_r($vetEnrollid);
         // exit();
         $dataProvider = new ArrayDataProvider(['allModels' => $vet]);
         $coluna = [];
         if (!empty($vet)) {
             foreach ($vet as $linhas) {
                 $this->cont = 0;
                 foreach ($linhas as $chave => $colunas) {
                     if ($chave == 'alunos') {
                         $coluna[$chave] = ['type' => TabularForm::INPUT_RAW, 'label' => 'Alunos', 'value' => function ($model, $key, $index, $widget) {
                             return Html::label($model['alunos'], null, ['style' => 'min-width:200px;font-weight: lighter;']);
                         }];
                     } else {
                         $coluna[$chave] = ['type' => TabularForm::INPUT_RAW, 'label' => $vetLabel[$chave], 'options' => ['class' => 'form-control text-center', 'style' => 'min-width:80px'], 'value' => function ($model, $key, $index, $widget) {
                             if ($this->cont == count($this->avaliacao)) {
                                 $this->cont = 0;
                             }
                             $ava = $this->avaliacao[$this->cont];
                             $ava->evaluationid;
                             $valorNota = [];
                             $valorNota['val'] = 0;
                             $valorNota['id'] = null;
                             foreach ($this->nota as $values) {
                                 if ($values->enrollid == $key && $values->evaluationid == $ava->evaluationid) {
                                     $valorNota['val'] = $values->note;
                                     $valorNota['id'] = $values->evaluationenrollid;
                                     break;
                                 }
                             }
                             $this->cont++;
                             return '<div class="form-group field-' . $key . '_' . $ava->evaluationid . ' required">' . Html::textInput($key . '_' . $ava->evaluationid . '_' . $valorNota['id'], $valorNota['val'], ['class' => 'form-control text-center nota-grid', 'style' => 'min-width:80px', "id" => $key . '_' . $ava->evaluationid]) . '<div class="help-block"></div>' . '</div>';
                         }];
                     }
                 }
             }
             $result = [];
             $result['coluna'] = $coluna;
             $result['dataProvider'] = $dataProvider;
             return $result;
         }
     } else {
         $result = [];
         $result['coluna'] = ['Pesquise as notas' => ['type' => TabularForm::INPUT_STATIC]];
         $result['dataProvider'] = $dataProvider = new ArrayDataProvider(['allModels' => []]);
         return $result;
     }
 }
Ejemplo n.º 8
0
 /**
  * Finds the Acdevaluation model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Acdevaluation the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Acdevaluation::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }