Exemplo n.º 1
0
 public static function ZNODropDown($PersonID, $SepcialityID = 0, $Level = 0)
 {
     $res = array("" => "");
     $model = Documents::model()->findAll("PersonID = :PersonID and TypeID = 4", array(":PersonID" => $PersonID));
     if ($SepcialityID != 0) {
         $ssubj = Specialitysubjects::model()->findAll("SpecialityID=:SpecialityID and LevelID = :LevelID", array(":SpecialityID" => $SepcialityID, ":LevelID" => $Level));
         //debug(print_r($ssubj,true));
         if (!empty($model)) {
             foreach ($model as $zno) {
                 //$res[$zno->idDocuments] = $zno->Numbers;
                 if (!empty($zno->subjects)) {
                     foreach ($zno->subjects as $subject) {
                         if (!empty($ssubj)) {
                             //debug('$ssubj->SubjectID='.$ssubj->SubjectID);
                             foreach ($ssubj as $rec) {
                                 if ($subject->subject->idSubjects == $rec->SubjectID) {
                                     //debug('$ssubj->SubjectID='.$ssubj->SubjectID);
                                     $res[$subject->idDocumentSubject] = $subject->subject->SubjectName . ": " . $subject->SubjectValue . " (№" . $zno->Numbers . " от " . $subject->DateGet . ", пін: " . $zno->ZNOPin . ")";
                                 }
                             }
                         } else {
                             $res[$subject->idDocumentSubject] = $subject->subject->SubjectName . ": " . $subject->SubjectValue . " (№" . $zno->Numbers . " от " . $subject->DateGet . ", пін: " . $zno->ZNOPin . ")";
                         }
                     }
                 }
             }
         }
     } else {
         if (!empty($model)) {
             foreach ($model as $zno) {
                 //$res[$zno->idDocuments] = $zno->Numbers;
                 if (!empty($zno->subjects)) {
                     foreach ($zno->subjects as $subject) {
                         $res[$subject->idDocumentSubject] = $subject->subject->SubjectName . ": " . $subject->SubjectValue . " (№" . $zno->Numbers . " от " . $subject->DateGet . ", пін: " . $zno->ZNOPin . ")";
                     }
                 }
             }
         }
     }
     if (count($res) == 2) {
         unset($res[""]);
     }
     return $res;
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Specialitysubjects::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Exemplo n.º 3
0
 public function valididateDocumentSubject($attributes)
 {
     if (Yii::app()->user->checkAccess("validateZnoBall")) {
         if ($this->EntranceTypeID == 1) {
             $s1 = Documentsubject::model()->findByPk($this->DocumentSubject1);
             $s2 = Documentsubject::model()->findByPk($this->DocumentSubject2);
             $s3 = Documentsubject::model()->findByPk($this->DocumentSubject3);
             $profball = 0;
             $nprof1 = 0;
             $nprof2 = 0;
             if (!empty($s1) && !empty($s2) && !empty($s3)) {
                 $ss1 = Specialitysubjects::model()->find("SpecialityID = {$this->SepcialityID} and SubjectID = {$s1->SubjectID}");
                 $ss2 = Specialitysubjects::model()->find("SpecialityID = {$this->SepcialityID} and SubjectID = {$s2->SubjectID}");
                 $ss3 = Specialitysubjects::model()->find("SpecialityID = {$this->SepcialityID} and SubjectID = {$s3->SubjectID}");
                 $profball = $s2->SubjectValue;
                 $nprof1 = $s1->SubjectValue;
                 $nprof2 = $s3->SubjectValue;
                 if (!empty($ss1) && $ss1->isProfile) {
                     $profball = $s1->SubjectValue;
                     $nprof1 = $s2->SubjectValue;
                     $nprof2 = $s3->SubjectValue;
                 }
                 if (!empty($ss2) && $ss2->isProfile) {
                     $profball = $s2->SubjectValue;
                     $nprof1 = $s1->SubjectValue;
                     $nprof2 = $s3->SubjectValue;
                 }
                 if (!empty($ss3) && $ss3->isProfile) {
                     $profball = $s3->SubjectValue;
                     $nprof1 = $s1->SubjectValue;
                     $nprof2 = $s2->SubjectValue;
                 }
                 if ($profball < 100) {
                     $this->addError($attributes, "Профільний предмет не може бути нижчім за 140 балів!");
                     return false;
                 }
                 /* if (($profball >= 140 && $profball < 170) && ($nprof1 < 124 || $nprof2 < 124 )) {
                    $this->addError($attributes, "Недопустимі для вступу бали непрофільних предметів!");
                    return false;
                    } */
             }
         }
     }
     return true;
 }