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 getDescripcionExamen() { $examen = Examen::find()->where(['id' => $this->examen_id])->one(); return $examen->descripcion; }
<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 inscrireEtudiantExamen($examenId, $etudiantId) { $Etudiant_Examen = new Etudiant_Examen(); $examen = Examen::find($examenId); $examen->nbre_Places++; $examen->save(); $Etudiant_Examen->id_Etudiant = $etudiantId; $Etudiant_Examen->id_Examen = $examenId; $Etudiant_Examen->save(); }
/** * Lists all Examen models. * @return mixed */ public function actionIndex() { $dataProvider = new ActiveDataProvider(['query' => Examen::find()->where(['eliminado' => 0])]); return $this->render('index', ['dataProvider' => $dataProvider]); }
/* @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>