Example #1
0
 public function indicatorEditpart2($profID, $ref_id)
 {
     if (!$this->session->userdata('user_id')) {
         redirect('/users/login', 'location');
     }
     $indicator_model = new indicator_model();
     $this->validateAddIndicatorpart2();
     $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_editpart2', array('secondMotherIndicator' => $indicator_model->getSecondMotherIndicator(), 'secondIndicators' => $indicator_model->getSecondIndicators(), 'getFirstCategory' => $indicator_model->getCategoriesFromSI($lguTypes->lgu_type_id), 'getSecondCategory' => $indicator_model->getSecondCategoriesFromSI($lguTypes->lgu_type_id), 'getSecondCategoryLower' => $indicator_model->getSecondCategoriesLowerFromSI($lguTypes->lgu_type_id), 'getSecondCategoryLowerLower' => $indicator_model->getSecondCategoriesLowerLowerFromSI($lguTypes->lgu_type_id), 'getLSWDO' => $indicator_model->getLSWDOdata($profID, $ref_id), 'profileID' => $profID, 'refID' => $ref_id));
         $this->load->view('footer');
     } else {
         foreach ($indicator_model->getCategoriesFromSI($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->getSecondCategoriesFromSI($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;
             }
         }
         foreach ($indicator_model->getSecondCategoriesLowerFromSI($lguTypes->lgu_type_id) as $secondCatLower) {
             if ($secondCatLower->indicator_checklist_id != '0') {
                 $complianceBronze = $this->input->post('compliance' . $secondCatLower->indicator_id . 'Bronze');
                 $complianceSilver = $this->input->post('compliance' . $secondCatLower->indicator_id . 'Silver');
                 $complianceGold = $this->input->post('compliance' . $secondCatLower->indicator_id . 'Gold');
                 $profile = $this->input->post('profID');
                 $indicator = $secondCatLower->indicator_id;
                 $findings = $this->input->post('textArea' . $secondCatLower->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->getSecondCategoriesLowerLowerFromSI($lguTypes->lgu_type_id) as $secondCatLowerLower) {
             if ($secondCatLowerLower->indicator_checklist_id != '0') {
                 $complianceBronze = $this->input->post('compliance' . $secondCatLowerLower->indicator_id . 'Bronze');
                 $complianceSilver = $this->input->post('compliance' . $secondCatLowerLower->indicator_id . 'Silver');
                 $complianceGold = $this->input->post('compliance' . $secondCatLowerLower->indicator_id . 'Gold');
                 $profile = $this->input->post('profID');
                 $indicator = $secondCatLowerLower->indicator_id;
                 $findings = $this->input->post('textArea' . $secondCatLowerLower->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_viewpart2', array('secondMotherIndicator' => $indicator_model->getSecondMotherIndicator(), 'secondIndicators' => $indicator_model->getSecondIndicators(), 'getFirstCategory' => $indicator_model->getCategoriesFromSI($lguTypes->lgu_type_id), 'getSecondCategory' => $indicator_model->getSecondCategoriesFromSI($lguTypes->lgu_type_id), 'getSecondCategoryLower' => $indicator_model->getSecondCategoriesLowerFromSI($lguTypes->lgu_type_id), 'getSecondCategoryLowerLower' => $indicator_model->getSecondCategoriesLowerLowerFromSI($lguTypes->lgu_type_id), 'profileID' => $profID));
             $this->load->view('footer');
             $this->redirectIndexAdd($profID, $ref_id);
         }
     }
 }