/**
  * 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 $id the ID of the model to be loaded
  * @return EconomicMethods the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = EconomicMethods::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
示例#2
0
 /**
  * actionEvaSummary
  */
 public function actionEvaSummary()
 {
     $this->setPageTitle('Evaluation Summary');
     $evaDetails = $this->getEvaDetails();
     $evaAssMethods = ModelToArray::convertModelToArray(EvaAssessmentMethods::model()->with('evaluationAttributes', 'evaAttrAssMethods')->findAll('evaluationId=:evaId', [':evaId' => $this->evaContextId]));
     //print_r($evaAssMethods); die;
     $econEvaMethods = [];
     $evaAttributes = [];
     $rsEvaHeader = ModelToArray::convertModelToArray(EvaluationHeader::model()->findByPk($this->evaContextId, ['select' => 'econEvaMethods, evaAttributes']));
     if (isset($rsEvaHeader['econEvaMethods'])) {
         $selectedEconEvaMethods = json_decode($rsEvaHeader['econEvaMethods']);
         $econEvaMethodsCriteria = new CDbCriteria();
         $econEvaMethodsCriteria->addInCondition('t.id', $selectedEconEvaMethods);
         $econEvaMethodsCriteria->with = 'econMethodGroup';
         $econEvaMethods = ModelToArray::convertModelToArray(EconomicMethods::model()->findAll($econEvaMethodsCriteria));
     }
     if (isset($rsEvaHeader['evaAttributes'])) {
         $selectedEvaAttributes = json_decode($rsEvaHeader['evaAttributes'], true);
         $evaAttributesCriteria = new CDbCriteria();
         $evaAttributesCriteria->addInCondition('attributeId', $selectedEvaAttributes);
         $evaAttributesCriteria->with = 'attributeTypes';
         $evaAttributes = ModelToArray::convertModelToArray(EvaAttributes::model()->findAll($evaAttributesCriteria));
     }
     $this->docName = 'evaSummary';
     if (isset($_POST['pageId'])) {
         SystemController::savePage('evaSummary');
     }
     $page = SystemController::getPageContent($this->docName);
     //print_r(json_encode($evaAttributes)); die;
     $this->render('evaSummary', ['evaDetails' => $evaDetails, 'evaAssMethods' => $evaAssMethods, 'econEvaMethods' => $econEvaMethods, 'evaAttributes' => $evaAttributes, 'page' => $page]);
 }