/**
  * 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 = Specialityquotes::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Exemplo n.º 2
0
 /**
  * Формування рейтингів конкретної спеціальності у стилі ВступІнфо
  */
 public function actionRatinginfo()
 {
     $reqPersonspeciality = Yii::app()->request->getParam('Personspeciality', null);
     $model = new Personspeciality();
     $model->SepcialityID = $reqPersonspeciality['SepcialityID'];
     $spec_quota_models = Specialityquotes::model()->findAll('SpecialityID=' . $model->SepcialityID);
     $Speciality = Specialities::model()->findByPk($model->SepcialityID);
     $Faculty = $Speciality->facultet->FacultetFullName;
     $license = array();
     $budget = intval($Speciality->SpecialityBudgetCount);
     $license[3] = array(intval($Speciality->Quota1), 1);
     $license[2] = array($budget, 1);
     $license[1] = array(intval($Speciality->SpecialityContractCount), 1);
     $license_info[0] = array('=====================', -1);
     $license_info[1] = array('За кошти фізичних або юридичних осіб', $license[1][0]);
     $license_info[2] = array('За кошти державного бюджету', $budget);
     $license_info[3] = array('Поза конкурсом', $license[3][0]);
     //var_dump($license_info);exit();
     $rating_data = array();
     $general_count = 0;
     foreach ($spec_quota_models as $sqm) {
         $model->quota_budget_places = intval($sqm->BudgetPlaces);
         $license[$sqm->QuotaID] = array($model->quota_budget_places, 0);
         $license_info[$sqm->QuotaID] = array($sqm->quota->QuotaName, $license[$sqm->QuotaID][0]);
         $model->param_quotaID = $sqm->QuotaID;
         $rating_data[$license_info[$sqm->QuotaID][0]] = $this->CreateRatingData($model->rating_search(0));
         $general_count += count($rating_data[$license_info[$sqm->QuotaID][0]]);
     }
     $rating_data[$license_info[3][0]] = $this->CreateRatingData($model->rating_search(1));
     $general_count += count($rating_data[$license_info[3][0]]);
     $rating_data[$license_info[2][0]] = $this->CreateRatingData($model->rating_search(2));
     $general_count += count($rating_data[$license_info[2][0]]);
     $rating_data[$license_info[1][0]] = $this->CreateRatingData($model->rating_search(3));
     $general_count += count($rating_data[$license_info[1][0]]);
     $rating_data[$license_info[0][0]] = $this->CreateRatingData($model->rating_search(4));
     $general_count += count($rating_data[$license_info[0][0]]);
     // var_dump($rating_data);exit();
     // var_dump($Speciality);exit();
     // var_dump($model->qualification->QualificationID);exit();
     // var_dump($model);exit();
     $_data = array('data' => $general_count > 0 ? $rating_data : array(), 'specialitymodel' => $Speciality, 'Speciality' => implode(' ', array($Speciality->SpecialityClasifierCode, mb_substr($Speciality->SpecialityClasifierCode, 0, 1) == '6' ? $Speciality->SpecialityDirectionName : $Speciality->SpecialityName, empty($Speciality->SpecialitySpecializationName) ? "" : '(' . $Speciality->SpecialitySpecializationName . ')', ', форма: ' . $Speciality->eduform->PersonEducationFormName)), 'Faculty' => $Faculty, 'license_info' => $license_info);
     $this->layout = '//layouts/clear';
     $this->renderPartial('/personspeciality/ratinginfo', $_data);
 }