Beispiel #1
0
 public function actionHome()
 {
     $this->docName = 'optionsHome';
     if (isset($_POST['pageId'])) {
         SystemController::savePage('home');
     }
     $page = SystemController::getPageContent($this->docName);
     $this->render('home', ['page' => $page]);
 }
 public function actionIndex()
 {
     $this->docName = 'adminEvaHome';
     if (isset($_POST['pageId'])) {
         SystemController::savePage('index');
     }
     $page = SystemController::getPageContent($this->docName);
     $this->render('index', compact('page'));
 }
Beispiel #3
0
 /**
  * actionIndex
  */
 public function actionIndex()
 {
     //$this->setPageTitle($this->id . 'Introduction');
     Yii::log("actionIndex ContextController called", "trace", self::LOG_CAT);
     $this->docName = 'survIndex';
     if (isset($_POST['pageId'])) {
         SystemController::savePage($this->createUrl('index'));
     }
     $page = SystemController::getPageContent($this->docName);
     if (empty($page)) {
         throw new CHttpException(404, 'The page requested does not exist');
     }
     $this->render('index', ['content' => $page['content'], 'editAccess' => $page['editAccess'], 'editMode' => $page['editMode']]);
 }
 /**
  * actionReport
  */
 public function actionReport()
 {
     $this->docName = 'evaluationReport';
     if (isset($_POST['pageId'])) {
         SystemController::savePage('reports');
     }
     $page = SystemController::getPageContent($this->docName);
     $this->render('//system/_page', ['content' => $page['content'], 'editAccess' => $page['editAccess'], 'editMode' => $page['editMode']]);
     return;
 }
Beispiel #5
0
 public function actionReports($system = null)
 {
     $systemDropdown = CHtml::listData(FrameworkContext::model()->findAll('userId=:userId', [':userId' => Yii::app()->user->id]), 'frameworkId', 'name');
     //		$model = new DesignForm();
     //		$model->setPropertyName('systemSelect', '');
     //		$model->setAttributeLabels(['systemsSelect' => 'Surveillance system']);
     //		$model->setRules([['systemSelect', 'required']]);
     //		$form = new CForm($elements, $model);
     $reportData = [];
     if ($system !== null) {
         $rsFramework = FrameworkContext::model()->with(['fields' => ['condition' => "inputName='hazardName' OR inputName='survObj'"]])->findByPk($system);
         if ($rsFramework !== null) {
             $reportData[] = ['Surveillance system', $rsFramework->name, 'Surveillance System'];
             $specialInputTypes = array_flip(['dropdownlist', 'checkboxlist', 'radiolist']);
             foreach ($rsFramework->fields as $surField) {
                 foreach ($rsFramework->data as $surData) {
                     if ($surData->frameworkFieldId == $surField->id) {
                         $fieldValue = $surData->value;
                         $fieldLabel = 'Hazard name';
                         if (isset($specialInputTypes[$surField->inputType])) {
                             $fieldLabel = 'Surveillance objective';
                             $fieldValue = Options::model()->findByPk($surData->value, ['select' => 'optionId, label'])->label;
                         }
                         $reportData[] = [$fieldLabel, $fieldValue, 'Surveillance System'];
                         break;
                     }
                 }
             }
             $rsDesign = ComponentHead::model()->with('compData', 'compDetails')->findAll('frameworkId=:framework', [':framework' => $system]);
             if ($rsDesign !== null) {
                 foreach ($rsDesign as $design) {
                     $reportData[] = ['Component name', $design->componentName, $design->componentName];
                     foreach ($design->compData as $designField) {
                         foreach ($design->compDetails as $designData) {
                             if ($designField->subFormId == $designData->subFormId) {
                                 $fieldValue = $designData->value;
                                 $fieldLabel = isset($designField->label) ? $designField->label : ComponentHead::model()->generateAttributeLabel($designField->inputName);
                                 if (isset($specialInputTypes[$designField->inputType])) {
                                     //										$fieldLabel = 'Surveillance objective';
                                     $option = Options::model()->findByPk($designData->value, ['select' => 'optionId, label']);
                                     //print_r($option); echo "\n";
                                     $fieldValue = isset($option) ? $option->label : '';
                                 }
                                 $reportData[] = [$fieldLabel, $fieldValue, $design->componentName];
                                 break;
                             }
                         }
                     }
                 }
             }
         }
         echo json_encode(['aaData' => $reportData], JSON_PRETTY_PRINT);
         return;
     }
     $this->docName = 'detDesign';
     if (isset($_POST['pageId'])) {
         SystemController::savePage($this->createUrl('reports'));
     }
     $page = SystemController::getPageContent($this->docName);
     $this->render('reports', ['systemDropdown' => $systemDropdown, 'page' => $page]);
 }