function attributeNote($id_Station, $id_Etudiant, array $inputs, $id_Enseignant) { $id_Examen = Station::whereIdStation($id_Station)->first()->id_Examen; $id_Session = Examen::whereIdExamen($id_Examen)->first()->id_Session; $id_Note_Examen = $this->createNoteExamen($id_Examen, $id_Session, $id_Etudiant); $arrayStatus = $this->createNoteStation($id_Note_Examen, $id_Station, $id_Enseignant); $id_Banque = Station::whereIdStation($id_Station)->first()->id_Banque; $items = Item::whereIdBanque($id_Banque)->get(); if (count($items) != count($inputs)) { return response()->json(['status' => 0], 200); } else { if ($arrayStatus['status'] == 1) { $id_Note_Station = $arrayStatus['id_Note_Station']; $i = 0; foreach ($items as $item) { $this->createItemNote($item->id_Item, $id_Note_Station, $inputs[$i]); $i++; } return 1; } else { return 2; //Note Station existe } } }
public function getPreguntasExamen($id) { $preguntas = null; $examen = Examen::findOne($id); if ($examen != null) { $preguntas = $examen->preguntas; } return $preguntas; }
public function excel($params) { $query = Examen::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => array('pageSize' => 10000)]); $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(['id' => $this->id, 'monto' => $this->monto]); $query->andFilterWhere(['like', 'descripcion', $this->descripcion])->andFilterWhere(['like', 'observaciones', $this->observaciones]); return $dataProvider; }
public function inscripcionPorLlave($model) { $llave = Llave::find()->where(['llave' => $model->llave])->one(); if ($llave != null && !empty($llave)) { $examen = \app\models\Examen::findOne($model->id_examen); $inscripcion = new InscripcionExamen(); $persona = Yii::$app->user->identity->idPersona; if ($persona->id_colegio == $llave->id_colegio) { $inscripcion->fecha_inscripcion = date('Y-m-d H:i:s'); $inscripcion->eliminado = 0; if ($inscripcion->save(false)) { $inscripcion->link('idAlumno', $persona); $inscripcion->link('idExamen', $examen); $inscripcion->link('idLlave', $llave); return true; } return false; } return false; } return false; }
/** * @return \yii\db\ActiveQuery */ public function getIdExamen() { return $this->hasOne(Examen::className(), ['id' => 'id_examen']); }
public function getDescripcionExamen() { $examen = Examen::find()->where(['id' => $this->examen_id])->one(); return $examen->descripcion; }
public function actionGetDatosExamen($reservaId) { // find the zip code from the locations table $reserva = Reserva::findOne($reservaId); $hora = Hora::findOne($reserva->hora_medica_id); $exSolicitados = HoraExamenSolicitado::find()->where(['hora_id' => $hora->id])->all(); foreach ($exSolicitados as $i => $exSolicitado) { $examen = Examen::findOne($exSolicitado->examen_id); $examenes[$i] = $examen; } echo Json::encode($examenes); }
<button type="button" class="remove-item btn btn-danger btn-xs"><i class="glyphicon glyphicon-minus"></i></button> </div> <div class="clearfix"></div> </div> <div class="panel-body"> <?php // necessary for update action. if (!$modelExamen->isNewRecord) { echo Html::activeHiddenInput($modelExamen, "[{$i}]id"); } ?> <div class="row"> <div class="col-sm-6"> <?php $data = ArrayHelper::map(Examen::find()->all(), 'id', 'InfoExamen'); ?> <?php echo $form->field($modelExamen, "[{$i}]examen_id")->widget(Select2::classname(), ['data' => $data, 'options' => ['placeholder' => 'Seleccionar Examen...'], 'pluginOptions' => ['width' => '300px', 'disabled' => !$model->isNewRecord]]); ?> </div> </div><!-- .row --> </div> </div> <?php } ?> </div> <?php DynamicFormWidget::end();
<div class="pregunta-form"> <?php $form = ActiveForm::begin(['id' => 'dynamic-form', 'options' => ['enctype' => 'multipart/form-data']]); ?> <?php echo $form->field($model, 'nro_pregunta')->textInput(); ?> <?php echo $form->field($model, 'descripcion_pregunta')->textarea(['rows' => 6]); ?> <?php echo $form->field($model, 'id_examen')->dropDownList(ArrayHelper::map(Examen::find()->where(['eliminado' => 0])->all(), 'id', 'nombre'), ['prompt' => 'seleccione el examen']); ?> <?php echo $form->field($model, 'file')->fileInput(); ?> <?php echo $form->field($model, 'id_area')->dropDownList(ArrayHelper::map(Area::find()->where(['eliminado' => 0])->all(), 'id', 'nombre'), ['prompt' => 'Seleccione el area']); ?> <?php echo $form->field($model, 'id_tipo')->radioList(ArrayHelper::map(\app\models\Tipo::find()->all(), 'id', 'nombre'))->label(false); ?> <div class="row">
/** * Updates an existing RceExamen 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); $modelsPago = $model->pagos; $modelsBitacora = $model->bitacoras; $modelsExamenes = $model->rceExamenExamens; foreach ($modelsExamenes as $modelExamen) { $examen = Examen::find()->where(['id' => $modelExamen->examen_id])->one(); $modelExamen->descripcion = $examen->descripcion; $modelExamen->observaciones = $examen->observaciones; } if ($model->load(Yii::$app->request->post())) { $oldIDsPago = ArrayHelper::map($modelsPago, 'id', 'id'); $modelsPago = Model::createMultiple(Pago::classname(), $modelsPago); Model::loadMultiple($modelsPago, Yii::$app->request->post()); $deletedIDsPago = array_diff($oldIDsPago, array_filter(ArrayHelper::map($modelsPago, 'id', 'id'))); $oldIDsExamen = ArrayHelper::map($modelsExamenes, 'id', 'id'); $modelsExamenes = Model::createMultiple(Examen::classname(), $modelsExamenes); Model::loadMultiple($modelsExamenes, Yii::$app->request->post()); $deletedIDsExamen = array_diff($oldIDsExamen, array_filter(ArrayHelper::map($modelsExamenes, 'id', 'id'))); // validate all models $valid = $model->validate(); $valid = Model::validateMultiple($modelsPago) && $valid; $valid = Model::validateMultiple($modelsBitacora) && $valid; $valid = Model::validateMultiple($modelsExamenes) && $valid; if ($valid) { $transaction = \Yii::$app->db->beginTransaction(); try { if ($flag = $model->save(false)) { if (!empty($deletedIDsPago)) { Pago::deleteAll(['id' => $deletedIDsPago]); } else { if (!empty($deletedIDsBitacora)) { Bitacora::deleteAll(['id' => $deletedIDsBitacora]); } else { if (!empty($deletedIDsREE)) { RceExamenExamen::deleteAll(['id' => $deletedIDsREE]); } } } foreach ($modelsPago as $modelPago) { $modelPago->rce_examen_id = $model->id; if (!($flag = $modelPago->save(false))) { $transaction->rollBack(); break; } } foreach ($modelsBitacora as $modelBitacora) { $modelBitacora->rce_examen_id = $model->id; if (!($flag = $modelBitacora->save(false))) { $transaction->rollBack(); break; } } $reserva = Reserva::find()->where(['id' => $model->reserva_id])->one(); $hora = Hora::find()->where(['id' => $reserva->hora_medica_id])->one(); $examenes = HoraExamenSolicitado::find()->where(['hora_id' => $hora->id])->all(); for ($i = 0; $i < count($examenes); ++$i) { $examen = Examen::find()->where(['id' => $examenes[$i]->examen_id])->one(); $modelsExamenes[$i] = new RceExamenExamen(); $modelsExamenes[$i]->rce_examen_id = $model->id; $modelsExamenes[$i]->examen_id = $examenes[$i]->examen_id; $modelsExamenes[$i]->monto_a_pagar = $examen->monto; if (!($flag = $modelsExamenes[$i]->save(false))) { $transaction->rollBack(); break; } } } if ($flag) { $transaction->commit(); return $this->redirect(['view', 'id' => $model->id]); } } catch (Exception $e) { $transaction->rollBack(); } } } return $this->render('update', ['model' => $model, 'modelsPago' => empty($modelsPago) ? [new Pago()] : $modelsPago, 'modelsBitacora' => empty($modelsBitacora) ? [new Bitacora()] : $modelsBitacora, 'modelsExamenes' => empty($modelsExamenes) ? [new RceExamenExamen()] : $modelsExamenes]); }
public function getInfoExamen($examenId) { return Examen::where('id_Examen', '=', $examenId)->first(); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($sessionId = null) { $examens = Examen::join('Stage', 'Examen.id_Stage', '=', 'Stage.id_Stage')->where('id_Session', '=', $sessionId)->get(); return view('examenViewPublic')->with('sessionId', $sessionId)->with('examens', $examens); }
/** * Finds the Examen model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Examen the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Examen::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/* @var $model app\models\RceExamenExamen */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="rce-examen-examen-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'rce_examen_id')->dropDownList(ArrayHelper::map(RceExamen::find()->all(), 'id', 'DatosRce'), ['prompt' => 'Seleccionar RCE Examen', 'style' => 'width:300px']); ?> <?php echo $form->field($model, 'examen_id')->dropDownList(ArrayHelper::map(Examen::find()->all(), 'id', 'descripcion'), ['prompt' => 'Seleccionar Examen', 'style' => 'width:300px']); ?> <?php echo $form->field($model, 'monto_a_pagar')->textInput(['style' => 'width:300px']); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Ingresar RCE Examen Examen' : 'Actualizar', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?>
<button type="button" class="add-item btn btn-success btn-xs"><i class="glyphicon glyphicon-plus"></i></button> <button type="button" class="remove-item btn btn-danger btn-xs"><i class="glyphicon glyphicon-minus"></i></button> </div> <div class="clearfix"></div> </div> <div class="panel-body"> <?php // necessary for update action. if (!$modelsInscripcion->isNewRecord) { echo Html::activeHiddenInput($modelsInscripcion, "[{$i}]id"); } ?> <div class="row"> <div class="col-sm-6"> <?php echo $form->field($modelsInscripcion, "[{$i}]id_examen")->dropDownList(ArrayHelper::map(Examen::find()->all(), 'id', 'nombre'), ['prompt' => 'seleccione el examen']); ?> </div> </div> <div class="row"> <div class="col-sm-6"> <?php echo $form->field($modelsInscripcion, "[{$i}]costo")->textInput(); ?> </div> </div><!-- .row --> </div> </div>