public static function addCategory4($application, $category4, $schoolIds, $yArray, $dArray, $guardianNic)
 {
     $db = Connection::getInstance();
     $mysqli = $db->getConnection();
     $mysqli->autocommit(FALSE);
     $applicantResult = DBApplicationController::addApplication($application);
     if ($applicantResult) {
         $resultSchoolSet = true;
         $isApplicanthasCSS = DBSchoolController::isApplicanthasCSS($application->getApplicant_id());
         if ($isApplicanthasCSS) {
             //do not need add school set
         } else {
             // return $schoolIds[1];
             $resultSchoolSet = DBSchoolController::addCloseSchoolSet($application->getApplicant_id(), $schoolIds);
         }
         if ($resultSchoolSet) {
             $resultEL = true;
             $isGuardianHasEL = DBGuardianController::isGuardianHasEL($guardianNic);
             if ($isGuardianHasEL) {
             } else {
                 $resultEL = DBElectrocalListController::addElectrocalListDetail($dArray, $yArray, $guardianNic);
             }
             if ($resultEL) {
                 $resultC = true;
                 $resultCD = DBGuardianController::hasCategory4Detail($guardianNic);
                 if ($resultCD == false) {
                     $resultC = DBCategory4Controller::addCategory4($category4);
                 }
                 if ($resultC) {
                     $mysqli->commit();
                     return true;
                 } else {
                     $mysqli->rollback();
                     $mysqli->commit();
                     return false;
                 }
             } else {
                 $mysqli->rollback();
                 $mysqli->commit();
                 return FALSE;
             }
         } else {
             $mysqli->rollback();
             $mysqli->commit();
             return FALSE;
         }
     } else {
         $mysqli->rollback();
         $mysqli->commit();
         return FALSE;
     }
 }
 public function postEditcategory4()
 {
     $nic = Input::get('nic');
     $schoolId = Input::get("schoolId");
     $permenentEmployeePost = Input::get("permenentEmployeePost");
     $distanceFromResidentToWork = Input::get("distanceFromResidentToWork");
     $nowInDifficultSchoolService = Input::get("nowInDifficultSchoolService");
     $periodOfDifficultSchoolService = Input::get("nowInDifficultSchoolService");
     $servingPeriodOfSchool = Input::get("servingPeriodOfSchool");
     $closeSchoolCount = Input::get("closeSchoolCount");
     $year1RemLeave = Input::get("year1RemLeave");
     $year2RemLeave = Input::get("year2RemLeave");
     $year3RemLeave = Input::get("year3RemLeave");
     $year4RemLeave = Input::get("year4RemLeave");
     $category4 = new EducationalServiceOfficer();
     $category4->setNic($nic);
     $category4->setPermenentEmployeePost($permenentEmployeePost);
     $category4->setCloseSchoolCount($closeSchoolCount);
     $category4->setDistanceFromResidentToWork($distanceFromResidentToWork);
     $category4->setNowInDifficultSchoolService($nowInDifficultSchoolService);
     $category4->setPeriodOfDifficultSchoolService($periodOfDifficultSchoolService);
     $category4->setServingSchoolId($schoolId);
     $category4->setServingPeriodOfSchool($servingPeriodOfSchool);
     $category4->setYear1RemLeave($year1RemLeave);
     $category4->setYear2RemLeave($year2RemLeave);
     $category4->setYear3RemLeave($year3RemLeave);
     $category4->setYear4RemLeave($year4RemLeave);
     $result = DBCategory4Controller::editCategory4($category4);
     if ($result) {
         return "category 4 editted well";
     } else {
         return "category 4 not editted well";
     }
 }
 public function postVerifytype4()
 {
     $application_id = Input::get('type');
     $schoolid = Input::get('school_id');
     $school = DBSchoolController::getSchool($schoolid);
     $application = DBApplicationController::getApplication($application_id);
     $applicant_id = $application->getApplicant_id();
     $applicant = DBStudentApplicantController::getApplicantById($applicant_id);
     $NIC = $applicant->getGuardianNIC();
     $guardian = DBGuardianController::getGuardianByNic($NIC);
     $category = DBCategory4Controller::getCategory4($NIC);
     $cur_sch_id = $category->getServingSchoolId();
     $cur_school = DBSchoolController::getSchool($cur_sch_id);
     return View::make('G1SAS/verifycategoryset/VerifyCategory4')->with('application_id', $application_id)->with('guardian', $guardian)->with('school', $school)->with('application', $application)->with('applicant', $applicant)->with('category', $category)->with('cur_school', $cur_school);
 }