Beispiel #1
0
 public function monitoring_add($profID)
 {
     if (!$this->session->userdata('user_id')) {
         redirect('/users/login', 'location');
     }
     $validity_model = new Validity_model();
     $visit_model = new Visit_model();
     $monitoring_model = new Monitoring_Model();
     $this->validateAddMonitoring();
     if ($this->form_validation->run() == FALSE) {
         //if ($this->input->post('insert') <> "") {
         $form_message = '';
         $this->load->view('header');
         $this->load->view('nav');
         $this->load->view('sidebar');
         $this->load->view('monitoring_add', array('getVisitCount' => $visit_model->getVisitCount(), 'getValidity' => $validity_model->getValidity(), 'monitoring_model' => $monitoring_model, 'visit_model' => $visit_model, 'validity_model' => $validity_model, 'getStatus' => $monitoring_model->getStatus(), 'countVisits' => $monitoring_model->countVisits($profID)));
         $this->load->view('footer');
     } else {
         //$certfication_model = new Certification_Model();
         /*$validity_model = new Validity_model();
           $visit_model = new Visit_model();
           $monitoring_model = new Monitoring_Model();*/
         //$profile_id ='9';
         $profile_id = $this->input->post('profile_id');
         //mglv
         $ref_cert_id = '0';
         $visit_count = $this->input->post('visit_count');
         $visit_status = $this->input->post('visit_status');
         //date
         $strVisitDate = $this->input->post('visit_date');
         $visitDateToDate = date_create($strVisitDate);
         $visit_date = date_format($visitDateToDate, "Y-m-d");
         //date
         $remarks = $this->input->post('remarks');
         $created_by = $this->session->userdata('user_id');
         $date_created = 'NOW()';
         $modified_by = $this->session->userdata('user_id');
         $date_modified = '0000-00-00';
         $deleted = '0';
         $addResult = $monitoring_model->insertLswdoMonitoring($profile_id, $ref_cert_id, $visit_count, $visit_date, $visit_status, $remarks, $created_by, $date_created, $modified_by, $date_modified, $deleted);
         if ($addResult) {
             $indicator_model = new indicator_model();
             /*$form_message = 'Add Success!';
               $this->load->view('header');
               $this->load->view('nav');
               $this->load->view('sidebar');
               $this->load->view('monitoring_list', array(
                   'getDataByProfileID' => $monitoring_model->getDataByProfileID(),
                   'getVisitCount' => $visit_model->getVisitCount(),
                   'getValidity' => $validity_model->getValidity(),
                   'monitoring_model' => $monitoring_model,
                   'visit_model' => $visit_model,
                   'validity_model' => $validity_model,
               ));
               $this->load->view('footer');*/
             $form_message = '';
             $this->load->view('header');
             $this->load->view('nav');
             $this->load->view('sidebar');
             $this->load->view('indicator_add', array('firstMotherIndicator' => $indicator_model->getFirstMotherIndicator(), 'firstIndicators' => $indicator_model->getFirstIndicators()));
             $this->load->view('footer');
             $this->redirectIndex($profile_id, $addResult);
         }
     }
 }
Beispiel #2
0
 public function indicatorEdit($profID, $ref_id)
 {
     if (!$this->session->userdata('user_id')) {
         redirect('/users/login', 'location');
     }
     $indicator_model = new indicator_model();
     $this->validateAddIndicator();
     $lguTypes = $indicator_model->getLGUtype($profID);
     if (!$this->form_validation->run()) {
         $form_message = '';
         $this->load->view('header');
         $this->load->view('nav');
         $this->load->view('sidebar');
         $this->load->view('indicator_edit', array('firstMotherIndicator' => $indicator_model->getFirstMotherIndicator(), 'firstIndicators' => $indicator_model->getFirstIndicators(), 'getFirstCategory' => $indicator_model->getCategoriesFromFI($lguTypes->lgu_type_id), 'getSecondCategory' => $indicator_model->getSecondCategoriesFromFI($lguTypes->lgu_type_id), 'getLSWDO' => $indicator_model->getLSWDOdata($profID, $ref_id), 'profileID' => $profID, 'refID' => $ref_id));
         $this->load->view('footer');
     } else {
         foreach ($indicator_model->getCategoriesFromFI($lguTypes->lgu_type_id) as $firstCatBronze) {
             if ($firstCatBronze->indicator_checklist_id != '0') {
                 $complianceBronze = $this->input->post('compliance' . $firstCatBronze->indicator_id . 'Bronze');
                 $complianceSilver = $this->input->post('compliance' . $firstCatBronze->indicator_id . 'Silver');
                 $complianceGold = $this->input->post('compliance' . $firstCatBronze->indicator_id . 'Gold');
                 $profile = $this->input->post('profID');
                 $indicator = $firstCatBronze->indicator_id;
                 $findings = $this->input->post('textArea' . $firstCatBronze->indicator_id);
                 if ($complianceBronze != "") {
                     $updateResultBronze = $indicator_model->updateIndicator($profile, $indicator, $complianceBronze, $findings, $ref_id);
                 }
                 if ($complianceSilver != "") {
                     $updateResultSilver = $indicator_model->updateIndicator($profile, $indicator, $complianceSilver, $findings, $ref_id);
                 }
                 if ($complianceGold != "") {
                     $updateResultGold = $indicator_model->updateIndicator($profile, $indicator, $complianceGold, $findings, $ref_id);
                 }
             } else {
                 continue;
             }
         }
         foreach ($indicator_model->getSecondCategoriesFromFI($lguTypes->lgu_type_id) as $secondCat) {
             if ($secondCat->indicator_checklist_id != '0') {
                 $complianceBronze = $this->input->post('compliance' . $secondCat->indicator_id . 'Bronze');
                 $complianceSilver = $this->input->post('compliance' . $secondCat->indicator_id . 'Silver');
                 $complianceGold = $this->input->post('compliance' . $secondCat->indicator_id . 'Gold');
                 $profile = $profile = $this->input->post('profID');
                 $indicator = $secondCat->indicator_id;
                 $findings = $this->input->post('textArea' . $secondCat->indicator_id);
                 if ($complianceBronze != "") {
                     $updateResultBronze = $indicator_model->updateIndicator($profile, $indicator, $complianceBronze, $findings, $ref_id);
                 }
                 if ($complianceSilver != "") {
                     $updateResultSilver = $indicator_model->updateIndicator($profile, $indicator, $complianceSilver, $findings, $ref_id);
                 }
                 if ($complianceGold != "") {
                     $updateResultGold = $indicator_model->updateIndicator($profile, $indicator, $complianceGold, $findings, $ref_id);
                 }
             } else {
                 continue;
             }
         }
         if ($updateResultBronze || $updateResultSilver || $updateResultGold) {
             $form_message = 'Add Success!';
             $this->load->view('header');
             $this->load->view('nav');
             $this->load->view('sidebar');
             $this->load->view('indicator_view', array('firstMotherIndicator' => $indicator_model->getFirstMotherIndicator(), 'firstIndicators' => $indicator_model->getFirstIndicators(), 'getFirstCategory' => $indicator_model->getCategoriesFromFI($lguTypes->lgu_type_id), 'getSecondCategory' => $indicator_model->getSecondCategoriesFromFI($lguTypes->lgu_type_id)));
             $this->load->view('footer');
             $this->redirectIndex($profID, $ref_id);
         }
     }
 }