Пример #1
0
 private function llaveExiste($llave)
 {
     $l = new Llave();
     $result = $l->find()->where(['llave', $llave]);
     if ($result != null && count($result) > 0) {
         return true;
     }
     return false;
 }
Пример #2
0
 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;
 }
Пример #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdLlave()
 {
     return $this->hasOne(Llave::className(), ['id' => 'id_llave']);
 }
Пример #4
0
 /**
  * Finds the Llave model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Llave the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Llave::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }