public static function addCategory3($application, $schoolIds, $yArray, $dArray, $guardianNic, $ppo, $achievements, $donations, $siblings) { $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) { for ($i = 0; $i < 3; $i++) { $resultC = true; $resultEA = true; $resultD = true; $resultS = true; $resultCD = DBGuardianController::hasCategory3Detail($ppo[$i]->getAdmissionNumber(), $application->getSchool_id()); if ($resultCD == false) { $resultC = DBCategory3Controller::addCategory3($ppo[$i]); $resultEA = DBCPAchievementController::addCPAchievement($achievements[$i]); $resultD = DBCurPupilDonationController::addCPDonation($donations[$i]); $resultS = DBSiblingController::addSibling($siblings[$i]); } if ($resultD and $resultEA and $resultC and $resultS) { } else { $mysqli->rollback(); $mysqli->commit(); return false; } } $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; } }
public function postAddcategory() { //return "erer"; //$application=Input::get("application"); $type = Input::get("typeOfApplication"); $orderOfPreference = Input::get("orderOfPreference"); $schoolId = Input::get("schoolId"); $distance = Input::get("distance"); $medium = Input::get("medium"); $applicationId = DBApplicationController::getNextApplicationId(); $applicantId = Input::get("applicantId"); $guardianNic = Input::get("guardianNic"); $application = new Application(); $application->setSchool_id($schoolId); $application->setApplication_id($applicationId); $application->setApplicant_id($applicantId); $application->setType($type); $application->setMedium($medium); $application->setOrderOfPreference($orderOfPreference); $application->setDistance($distance); $application->setMark(0); $schoolIds = array(Input::get("schoolId1"), Input::get("schoolId2"), Input::get("schoolId3"), Input::get("schoolId4"), Input::get("schoolId5"), Input::get("schoolId6"), Input::get("schoolId7"), Input::get("schoolId8"), Input::get("schoolId9"), Input::get("schoolId10")); $yArray = array(Input::get("year1"), Input::get("year2"), Input::get("year3"), Input::get("year4"), Input::get("year5"), Input::get("year6")); $dArray = array(Input::get("division1"), Input::get("division2"), Input::get("division3"), Input::get("division4"), Input::get("division5"), Input::get("division6")); $db = Connection::getInstance(); $mysqli = $db->getConnection(); if ($type == 0) { $isStudentApplySchoolFromThisCategory = DBApplicationController::isStudentApplySchoolFromThisCategory($applicantId, $schoolId, 0); if ($isStudentApplySchoolFromThisCategory) { return "you have allready added this type of application to this school"; } $noOfYearsInElectrocalRegister = Input::get('noOfYearsInElectrocalRegister'); $noOfYearsSpouseInElectrocalRegister = Input::get('noOfYearsSpouseInElectrocalRegister'); $typeOfTitleDeed = Input::get('typeOfTitleDeed'); $noOfAditionalDocumentForResident = Input::get('noOfAditionalDocumentForResident'); $closeSchoolCount = Input::get('closeSchoolCount'); $category = new Resident_in_closeProximity(); $category->setNoOfAditionalDocumentForResident($noOfAditionalDocumentForResident); $category->setCloseSchoolCount($closeSchoolCount); $category->setTypeOfTitleDeed($typeOfTitleDeed); $category->setNoOfYearsSpouseInElectrocalRegister($noOfYearsSpouseInElectrocalRegister); $category->setNoOfYearsInElectrocalRegister($noOfYearsInElectrocalRegister); $category->setNic($guardianNic); $resultC1 = DBApplicationController::addCategory1($application, $category, $schoolIds, $yArray, $dArray, $guardianNic); if ($resultC1) { return "application addded successfully"; } else { return "application not added successfully"; } } elseif ($type == 1) { $isStudentApplySchoolFromThisCategory = DBApplicationController::isStudentApplySchoolFromThisCategory($applicantId, $schoolId, 1); if ($isStudentApplySchoolFromThisCategory) { return "you have allready added this type of application to this school"; } $gradeOfAdmission = Input::get("gradeOfAdmission"); $gradeOfLeaving = Input::get("gradeOfLeaving"); $pastPupilOrganizationMembership = Input::get("pastPupilOrganizationMembership"); $eAchievementDetail = Input::get("eAchievementDetail"); $cAchievementDetail = Input::get("cAchievementDetail"); $eAchievementId = DBPPAchievementController::getNexPastPupilAId($guardianNic); $cAchievementId = $eAchievementId + 1; $guardian = DBGuardianController::getGuardianByNic($guardianNic); $category2 = new PastPupil(); $category2->setSchoolId($schoolId); $category2->setNIC($guardianNic); $category2->setGradeOfAdmission($gradeOfAdmission); $category2->setGradeOfLeaving($gradeOfLeaving); $category2->setPastPupilOrganizationMembership($pastPupilOrganizationMembership); $eAchievement = new PastPupil_achievement(); $eAchievement->setSchoolId($schoolId); $eAchievement->setNIC($guardianNic); $eAchievement->setAchievementID($eAchievementId); $eType = 'Education'; $eAchievement->setType($eType); $eAchievement->setAchievementDetail($eAchievementDetail); $cAchievement = new PastPupil_achievement(); $cAchievement->setSchoolId($schoolId); $cAchievement->setNIC($guardianNic); $cAchievement->setAchievementID($cAchievementId); $cType = 'Co_curricular'; $cAchievement->setType($cType); $cAchievement->setAchievementDetail($eAchievementDetail); $resultC1 = DBApplicationController::addCategory2($application, $category2, $schoolIds, $yArray, $dArray, $guardianNic, $eAchievement, $cAchievement); if ($resultC1) { return "type 2 application addded successfully"; } else { return "type 2 application not addded successfully"; } } elseif ($type == 2) { $isStudentApplySchoolFromThisCategory = DBApplicationController::isStudentApplySchoolFromThisCategory($applicantId, $schoolId, 2); if ($isStudentApplySchoolFromThisCategory) { return "you have allready added this type of application to this school"; } $firstName1 = Input::get("firstName1"); $lastName1 = Input::get("lastName1"); $admissionNumber1 = Input::get("admissionNumber1"); $gradeAdmission1 = Input::get("gradeAdmission1"); $dateOfAdmission1 = Input::get("dateOfAdmision1"); $category31 = new Currentstudent(); $category31->setSchoolId($schoolId); $category31->setFirstName($firstName1); $category31->setLastName($lastName1); $category31->setAdmissionNumber($admissionNumber1); $category31->setGradeOfAdmission($gradeAdmission1); $category31->setDateOfAdmission($dateOfAdmission1); $eAchievementDetail1 = Input::get("eAchiement1"); $eAchievementId1 = DBCPAchievementController::getNexCurrentPupilAId($admissionNumber1); $achievementObject1 = new Cur_pupil_educationalachievement(); $achievementObject1->setAdmissionNumber($admissionNumber1); $achievementObject1->setAchievementID($eAchievementId1); $achievementObject1->setSchoolId($schoolId); $achievementObject1->setAchievementDetail($eAchievementDetail1); $donationDetail1 = Input::get("donationDetail1"); $donationId1 = DBCurPupilDonationController::getNexCurrentPupilDId($admissionNumber1); $donationObject1 = new Cur_pupil_donation(); $donationObject1->setSchoolId($schoolId); $donationObject1->setAdmissionNumber($admissionNumber1); $donationObject1->setDonationId($donationId1); $donationObject1->setDonationDetail($donationDetail1); $sibling1 = new Sibling(); $sibling1->setAdmissionNumber($admissionNumber1); $sibling1->setApplicantId($applicantId); $sibling1->setSchoolId($schoolId); $firstName2 = Input::get("firstName2"); $lastName2 = Input::get("lastName2"); $admissionNumber2 = Input::get("admissionNumber2"); $gradeAdmission2 = Input::get("gradeAdmission2"); $dateOfAdmission2 = Input::get("dateOfAdmision2"); $category32 = new Currentstudent(); $category32->setSchoolId($schoolId); $category32->setFirstName($firstName2); $category32->setLastName($lastName2); $category32->setAdmissionNumber($admissionNumber2); $category32->setGradeOfAdmission($gradeAdmission2); $category32->setDateOfAdmission($dateOfAdmission2); $eAchievementDetail2 = Input::get("eAchiement2"); $eAchievementId2 = DBCPAchievementController::getNexCurrentPupilAId($admissionNumber2); $achievementObject2 = new Cur_pupil_educationalachievement(); $achievementObject2->setAdmissionNumber($admissionNumber2); $achievementObject2->setAchievementID($eAchievementId2); $achievementObject2->setSchoolId($schoolId); $achievementObject2->setAchievementDetail($eAchievementDetail2); $donationDetail2 = Input::get("donationDetail2"); $donationId2 = DBCurPupilDonationController::getNexCurrentPupilDId($admissionNumber2); $donationObject2 = new Cur_pupil_donation(); $donationObject2->setSchoolId($schoolId); $donationObject2->setAdmissionNumber($admissionNumber2); $donationObject2->setDonationId($donationId2); $donationObject2->setDonationDetail($donationDetail2); $sibling2 = new Sibling(); $sibling2->setAdmissionNumber($admissionNumber2); $sibling2->setApplicantId($applicantId); $sibling2->setSchoolId($schoolId); $firstName3 = Input::get("firstName3"); $lastName3 = Input::get("lastName3"); $admissionNumber3 = Input::get("admissionNumber3"); $gradeAdmission3 = Input::get("gradeAdmission3"); $dateOfAdmission3 = Input::get("dateOfAdmision3"); $category33 = new Currentstudent(); $category33->setSchoolId($schoolId); $category33->setFirstName($firstName3); $category33->setLastName($lastName3); $category33->setAdmissionNumber($admissionNumber3); $category33->setGradeOfAdmission($gradeAdmission3); $category33->setDateOfAdmission($dateOfAdmission3); $eAchievementDetail3 = Input::get("eAchiement3"); $eAchievementId3 = DBCPAchievementController::getNexCurrentPupilAId($admissionNumber3); $achievementObject3 = new Cur_pupil_educationalachievement(); $achievementObject3->setAdmissionNumber($admissionNumber3); $achievementObject3->setAchievementID($eAchievementId3); $achievementObject3->setSchoolId($schoolId); $achievementObject3->setAchievementDetail($eAchievementDetail3); $donationDetail3 = Input::get("donationDetail3"); $donationId3 = DBCurPupilDonationController::getNexCurrentPupilDId($admissionNumber3); $donationObject3 = new Cur_pupil_donation(); $donationObject3->setSchoolId($schoolId); $donationObject3->setAdmissionNumber($admissionNumber3); $donationObject3->setDonationId($donationId3); $donationObject3->setDonationDetail($donationDetail3); $sibling3 = new Sibling(); $sibling3->setAdmissionNumber($admissionNumber3); $sibling3->setApplicantId($applicantId); $sibling3->setSchoolId($schoolId); $ppo = array($category31, $category32, $category33); $achievements = array($achievementObject1, $achievementObject2, $achievementObject3); $donations = array($donationObject1, $donationObject2, $donationObject3); $siblings = array($sibling1, $sibling2, $sibling3); $resultC1 = DBApplicationController::addCategory3($application, $schoolIds, $yArray, $dArray, $guardianNic, $ppo, $achievements, $donations, $siblings); if ($resultC1) { return "type 3 application addded successfully"; } else { return "type 3 application not addded successfully"; } } elseif ($type == 3) { $isStudentApplySchoolFromThisCategory = DBApplicationController::isStudentApplySchoolFromThisCategory($applicantId, $schoolId, 3); if ($isStudentApplySchoolFromThisCategory) { return "you have allready added this type of application to this school"; } $permenentEmployeePost = Input::get("permenentEmployeePost"); $distanceFromResidentToWork = Input::get("distanceFromResidentToWork"); $nowInDifficultSchoolService = Input::get("nowInDifficultSchoolService"); $periodOfDifficultSchoolService = Input::get("periodOfDifficultSchoolService"); $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($guardianNic); $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); $resultC1 = DBApplicationController::addCategory4($application, $category4, $schoolIds, $yArray, $dArray, $guardianNic); if ($resultC1) { return "type 4 application addded successfully"; } else { return "type 4 application not addded successfully"; } } elseif ($type == 4) { $isStudentApplySchoolFromThisCategory = DBApplicationController::isStudentApplySchoolFromThisCategory($applicantId, $schoolId, 4); if ($isStudentApplySchoolFromThisCategory) { return "you have allready added this type of application to this school"; } $year = Input::get("year"); $month = Input::get("month"); $date = Input::get("date"); $dateOfTransferReceived = $year . "/" . $month . "/" . $date; $beforeWorkedPlace = Input::get("beforeWorkedPlace"); $afterWorkedPlace = Input::get("afterWorkedPlace"); $distanceOfTransfer = Input::get("distanceOfTransfer"); $year1RemLeave = Input::get("year1RemLeave"); $year2RemLeave = Input::get("year2RemLeave"); $year3RemLeave = Input::get("year3RemLeave"); $year4RemLeave = Input::get("year4RemLeave"); $servicePeriod = Input::get("servicePeriod"); $category5 = new OfficerOnTransfer(); $category5->setNic($guardianNic); $category5->setDateOfTransferReceived($dateOfTransferReceived); $category5->setBeforeWorkedPlace($beforeWorkedPlace); $category5->setAfterWorkedPlace($afterWorkedPlace); $category5->setDistanceOfTransfer($distanceOfTransfer); $category5->setYear1RemLeave($year1RemLeave); $category5->setYear2RemLeave($year2RemLeave); $category5->setYear3RemLeave($year3RemLeave); $category5->setYear4RemLeave($year4RemLeave); $category5->setServicePeriod($servicePeriod); $resultC1 = DBApplicationController::addCategory5($application, $category5, $schoolIds, $yArray, $dArray, $guardianNic); if ($resultC1) { return "type 5 application addded successfully"; } else { return "type 5 application not addded successfully"; } } elseif ($type == 5) { $isStudentApplySchoolFromThisCategory = DBApplicationController::isStudentApplySchoolFromThisCategory($applicantId, $schoolId, 5); if ($isStudentApplySchoolFromThisCategory) { return "you have allready added this type of application to this school"; } $dateOfReturned = Input::get("dateOfReturned"); $periodAboardStay = Input::get("PeriodOfStayAbroad"); $reason = Input::get("reason"); $category6 = new PersonComingFromAbroad(); $category6->setNic($guardianNic); $category6->setDateOfReturned($dateOfReturned); $category6->setPerioadAbroadStay($periodAboardStay); $category6->setReasonsForStay($reason); $resultC1 = DBApplicationController::addCategory6($application, $category6, $schoolIds, $yArray, $dArray, $guardianNic); if ($resultC1) { return "type 6 application addded successfully"; } else { return "type 6 application not addded successfully"; } } //application eka add wen ona/////gurdian waguwata sambanda wela add wen on catogary 1 }
public function postVerifytype3() { $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); $siblings = DBSiblingController::getSiblings($applicant_id); foreach ($siblings as $sibling) { $schoolId = $sibling->getSchoolId(); $admissionNumber = $sibling->getAdmissionNumber(); $category = DBCategory3Controller::getCategory3($schoolId, $admissionNumber); $cur_ach_set = DBCPAchievementController::getCPAchievements($schoolId, $admissionNumber); $category->setCur_pup_ach_set($cur_ach_set); $cur_don_set = DBCurPupilDonationController::getCPDonations($schoolId, $admissionNumber); $category->setCur_pup_donation_set($cur_don_set); $sibling->setCur_pupil($category); } return View::make('G1SAS/verifycategoryset/VerifyCategory3')->with('application_id', $application_id)->with('guardian', $guardian)->with('school', $school)->with('application', $application)->with('applicant', $applicant)->with('siblings', $siblings); }