public function postAdd() { $divisions = DBGNDDivisionController::getAllDivision(); $divisionIdA = array(); foreach ($divisions as $division) { $divisionIdA[] = $division->getGrama_niladari_div_no(); } $first_name = Input::get("firstNameText"); $last_name = Input::get("lastNameText"); $email = Input::get("emailText"); $permanent_address = Input::get("addressText"); $password = Input::get("password"); $conform_password = Input::get("confirm_password"); $nic = Input::get("nicText"); $telephone_number = Input::get("telephoneText"); $relation_to_child = Input::get("relationshiptochild"); $religion = Input::get("religionText"); $nationality = Input::get("nationalityText"); $div_val = Input::get("gramaNiladariDivisionNumberText"); $grama_niladry_division_number = $divisionIdA[$div_val]; /*$rules=array('$conform_password' => 'same:$password', ); $validator=Validator::make(Input::all(),$rules); if($validator->fails()) return Redirect::to('/');*/ if (strcmp($conform_password, $password) != 0) { return Redirect::to('guardian')->withInput()->with('error', "Passwords dont match"); } elseif (validationhandler::checkNIC($nic) == false) { return Redirect::to('guardian')->withInput()->with('error', "NIC is invalid"); } elseif (!preg_match("/^[a-zA-Z'-]+\$/", $first_name)) { return Redirect::to('guardian')->withInput()->with('error', "First Name is invalid"); } elseif (!preg_match("/^[a-zA-Z'-]+\$/", $last_name)) { return Redirect::to('guardian')->withInput()->with('error', "Last Name is invalid"); } elseif (!preg_match("/^[a-zA-Z'-]+\$/", $religion)) { return Redirect::to('guardian')->withInput()->with('error', "Religion is invalid"); } elseif (!preg_match("/^[a-zA-Z'-]+\$/", $nationality)) { return Redirect::to('guardian')->withInput()->with('error', "Nationality is invalid"); } elseif (!preg_match("/^[0]{1}[0-9]{9}\$/", $telephone_number)) { return Redirect::to('guardian')->withInput()->with('error', "Telephone Number is invalid"); } else { $guardian = new Guardian(); $guardian->setNic($nic); $guardian->setFirstName($first_name); $guardian->setLastName($last_name); $guardian->setEmail($email); $guardian->setPermanent_address($permanent_address); // $guardian->setPassword(Hash::make($password)); $guardian->setPassword($password); $guardian->setContact_number($telephone_number); $guardian->setRelationship($relation_to_child); $guardian->setReligion($religion); $guardian->setNationality($nationality); $guardian->setGrama_nil_div_no($grama_niladry_division_number); $result = DBGuardianController::addGuardian($guardian); if ($result) { return View::make('G1SAS/AddGuardianSuccessfull'); } else { return "not added successfully"; } } }
public function postIndex() { $user_type = Input::get("userTypeA"); $user_name = Input::get("userNameText"); $password = Input::get("password"); //$deadline = Input::get("deadline"); if ($user_type == 2) { $guardian = DBGuardianController::getGuardian($user_name); if ($guardian->getPassword() == $password) { //if (Hash::check($password, $guardian->getPassword())){ return View::make('G1SAS/userpage')->with('guardian', $guardian)->with('username', $user_name)->with('labelText', 'Your Child-Your School'); } else { return View::make('G1SAS/login')->with('greet', 'Applications for this year is closed.')->with('message', 'Password you enttered is incorrect'); } } elseif ($user_type == 0) { $user = DBAdminController::getAdmin($user_name); if ($user->getPassword() == $password) { // if (Hash::check($password, $user->getPassword())){ return View::make('G1SAS/adminpage')->with('title', "You are logged in as:" . $user_name); } else { return View::make('G1SAS/login')->with('greet', 'Applications for this year is closed.')->with('message', 'Password you enttered is incorrect'); } } else { $school = DBSchoolController::getSchoolByEmail($user_name); if ($school->getPassword() == $password) { //if (Hash::check($password, $school->getPassword())){ return View::make('G1SAS/schoolpage')->with('school', $school)->with('notice', 'School information here'); } else { return View::make('G1SAS/login')->with('greet', 'Applications for this year is closed.')->with('message', 'Password you enttered is incorrect'); } } }
public function postAdd() { $g_email = Input::get('usernameText'); $guardian = DBGuardianController::getGuardian($g_email); $first_name = Input::get("firstNameText"); $last_name = Input::get("lastNameText"); $gender = Input::get("gender"); $religion = Input::get("religionText"); $year = Input::get("year"); $month = Input::get("month"); $date = Input::get("date"); $dob = $year . "/" . $month . "/" . $date; $nic = $guardian->getNic(); $applicantId = intval(DBStudentApplicantController::getLastApplicantId()) + 1; $pagename = 'userpage/studentadd?username='******'-]+\$/", $first_name)) { return Redirect::back()->withInput()->with('error', "First Name is invalid"); } elseif (!preg_match("/^[a-zA-Z'-]+\$/", $last_name)) { return Redirect::back()->withInput()->with('error', "Last Name is invalid"); } elseif (date("Y") - (int) $year < 6) { return Redirect::back()->withInput()->with('error', "Child should be at least 6 years old"); } elseif (!preg_match("/^[a-zA-Z'-]+\$/", $religion)) { return Redirect::back()->withInput()->with('error', "Religion is invalid"); } else { $applicant = new StudentApplicant(); $applicant->setApplicantId($applicantId); $applicant->setFirstname($first_name); $applicant->setLastName($last_name); $applicant->setGender($gender); $applicant->setReligion($religion); $applicant->setDateOfBirth($dob); $applicant->setSelectedSchool(null); $applicant->setGuardianNic($nic); $result = DBStudentApplicantController::addchild($applicant); if ($result) { return View::make('G1SAS/userpage')->with('guardian', $guardian)->with('username', $g_email)->with('labelText', 'Added successfully'); } else { return View::make('G1SAS/userpage')->with('guardian', $guardian)->with('username', $g_email)->with('labelText', 'Added successfully'); } } }
public function getHome() { $username = $_GET["username"]; $guardian = DBGuardianController::getGuardian($username); return View::make('G1SAS/userpage')->with('guardian', $guardian)->with('username', $username); }
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 postChangep() { $username = Input::get("username"); $guardian = DBGuardianController::getGuardian($username); $guardianNic = $guardian->getNic(); $available = DBGuardianController::hasApplicant($guardianNic); if ($available == false) { return "first you have to add your child to system"; } else { $applicants = DBStudentApplicantController::getApplicantOfGuardian($guardianNic); return View::make('G1SAS/changeSchoolPiorityB')->with('applicants', $applicants); } }
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 postVerifytype6() { $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 = DBCategory6Controller::getCategory6($NIC); return View::make('G1SAS/verifycategoryset/VerifyCategory6')->with('application_id', $application_id)->with('guardian', $guardian)->with('school', $school)->with('application', $application)->with('applicant', $applicant)->with('category', $category); }