/**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['EvaAttributesMatrix'])) {
         $model->attributes = $_POST['EvaAttributesMatrix'];
         if ($model->save()) {
             $this->redirect(['index']);
         }
     }
     $dropDownData = [];
     $survObjCriteria = new CDbCriteria();
     $survObjCriteria->with = ['options'];
     $survObjCriteria->select = 'inputName';
     $survObjCriteria->condition = "inputName='survObj' AND options.frameworkFieldId=t.id";
     $rsSurveillanceObjective = FrameworkFields::model()->find($survObjCriteria);
     $dropDownData['objectives'] = CHtml::listData($rsSurveillanceObjective->options, 'optionId', 'label');
     $rsQuestionGrp = EvaQuestionGroups::model()->find(['select' => 'questions']);
     $questionsArray = array_keys((array) json_decode($rsQuestionGrp->questions));
     $dropDownData['groups'] = array_combine($questionsArray, range(1, count($questionsArray)));
     //print_r($dropDownData['groups']); die;
     $dropDownData['attributes'] = CHtml::listData(EvaAttributes::model()->findAll(), 'attributeId', 'name');
     $this->menu = [['label' => 'Add Attribute Relevance', 'url' => $this->createUrl('create')], ['label' => 'List Attribute Relevance', 'url' => $this->createUrl('index')]];
     $this->render('update', ['model' => $model, 'dropDownData' => $dropDownData]);
 }
Ejemplo n.º 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]);
 }
Ejemplo n.º 3
0
 /**
  * actionAddRelation
  * @access public
  * @return void
  */
 public function actionAddRelation()
 {
     Yii::log("actionaddRelation AttributeController called", "trace", self::LOG_CAT);
     $formRelationModel = new AttributeFormRelation();
     $attributeModel = new EvaAttributes();
     $surFormDetailsModel = new SurFormDetails();
     if (isset($_POST['AttributeFormRelation'])) {
         $formRelationModel->attributes = $_POST['AttributeFormRelation'];
         if ($formRelationModel->validate()) {
             $formRelationModel->save();
             Yii::app()->user->setFlash('success', "Relation successfully created.");
             $this->redirect(array('attribute/listRelations'));
         }
     }
     // QUERY FOR ALL ATTRIBUTES
     $queryAttributes = $attributeModel->findAll(array('select' => 'attributeId, name'));
     // QUERY FOR ALL SURFORM DETAILS
     $querySurformDetails = $surFormDetailsModel->findAll(array('select' => 'subFormId, inputName'));
     $attributesArray = array();
     $surformDetailsArray = array();
     // Pack data to send to view
     foreach ($queryAttributes as $key => $value) {
         $attributesArray[$value['attributeId']] = $value['name'];
     }
     foreach ($querySurformDetails as $key => $value) {
         $surformDetailsArray[$value['subFormId']] = $value['inputName'];
     }
     $this->render('addRelation', array('attributeModel' => $attributeModel, 'formRelationModel' => $formRelationModel, 'surFormDetailsModel' => $surFormDetailsModel, 'attributesArray' => $attributesArray, 'surformDetailsArray' => $surformDetailsArray));
 }
Ejemplo n.º 4
0
$rsQuestionGrp = EvaQuestionGroups::model()->find(['select' => 'questions']);
$questionsArray = array_keys((array) json_decode($rsQuestionGrp->questions));
$groups = array_combine($questionsArray, range(1, count($questionsArray)));
$groups[6] = 'Risk based';
//Group 6
?>
	<?php 
echo CHtml::activeDropDownList($model, "[{$index}]evaQuestionGroup", $groups, ['empty' => 'Select one']);
?>
	<?php 
echo CHtml::error($model, "[{$index}]evaQuestionGroup");
?>
</td>
<td>
	<?php 
$attributes = CHtml::listData(EvaAttributes::model()->findAll(), 'attributeId', 'name');
?>
	<?php 
echo CHtml::activeDropDownList($model, "[{$index}]attributeId", $attributes, ['empty' => 'Select one']);
?>
	<?php 
echo CHtml::error($model, "[{$index}]attributeId");
?>
</td>
<td>
	<?php 
echo CHtml::activeDropDownList($model, "[{$index}]relevance", ['Do not include', 'Low', 'Medium', 'High'], ['empty' => 'Select one']);
?>
	<?php 
echo CHtml::error($model, "[{$index}]relevance");
?>
 /**
  * @return array
  */
 public static function getEvaAttributes()
 {
     return CHtml::listData(EvaAttributes::model()->findAll(['select' => 'attributeId, name']), 'attributeId', 'name');
 }