public function getSchoolapplicantsfind()
 {
     $schoolid = Input::get("schoolid");
     $school = DBSchoolController::getSchool($schoolid);
     $schools = DBSchoolController::getAllSchool();
     $selected = Input::get("school");
     $selectedSchool = DBSchoolController::getSchool($selected);
     $pieces = explode("-", $selected);
     $schoolId = $pieces[0];
     $applicants = DBStudentApplicantController::getSelectedApplicantsForSchool($schoolId);
     return View::make('G1SAS/showSchoolApplicants')->with('selectedSchool', $selectedSchool)->with('schools', $schools)->with('school', $school)->with('selected', $selected)->with('applicants', $applicants);
 }
 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 getStudentadd()
 {
     $username = $_GET["username"];
     $applicantId = intval(DBStudentApplicantController::getLastApplicantId()) + 1;
     return View::make('G1SAS/AddNewChild')->with('username', $username)->with('applicantId', $applicantId);
 }
 public function getNext()
 {
     $applicant_id = Input::get("applicant_id");
     $username = Input::get("username");
     $school1 = Input::get("school_name1");
     $school2 = Input::get("school_name2");
     $school3 = Input::get("school_name3");
     $school4 = Input::get("school_name4");
     $school5 = Input::get("school_name5");
     $school6 = Input::get("school_name6");
     $ar = array($school1, $school2, $school3, $school4, $school5, $school6);
     $uni_ar = array_unique($ar);
     if (sizeof($uni_ar) != 6) {
         return Redirect::back()->withInput()->with('error', 'please select diffrent 6 schools');
     }
     $school7 = Input::get("school_name7");
     $school8 = Input::get("school_name8");
     $school9 = Input::get("school_name9");
     $school10 = Input::get("school_name10");
     $school11 = Input::get("school_name11");
     $school12 = Input::get("school_name12");
     $school13 = Input::get("school_name13");
     $school14 = Input::get("school_name14");
     $school15 = Input::get("school_name15");
     $school16 = Input::get("school_name16");
     $ar = array($school7, $school8, $school9, $school10, $school11, $school12, $school13, $school14, $school5, $school6);
     $uni_ar = array_unique($ar);
     if (sizeof($uni_ar) != 10) {
         return Redirect::back()->withInput()->with('error', 'please select diffrent 10 schools for close school set');
     }
     $division1 = Input::get("Year1d");
     $division2 = Input::get("Year2d");
     $division3 = Input::get("Year3d");
     $division4 = Input::get("Year4d");
     $division5 = Input::get("Year5d");
     $division6 = Input::get("Year6d");
     $year1 = Input::get("year1");
     $year2 = Input::get("year2");
     $year3 = Input::get("year3");
     $year4 = Input::get("year4");
     $year5 = Input::get("year5");
     $year6 = Input::get("year6");
     $ar = array($year1, $year2, $year3, $year4, $year5, $year6);
     $uni_ar = array_unique($ar);
     if (sizeof($uni_ar) != 6) {
         return Redirect::back()->withInput()->with('error', 'please select diffrent 6 years');
     }
     $dArray = array($division1, $division2, $division3, $division4, $division5, $division6);
     $yArray = array($year1, $year2, $year3, $year4, $year5, $year6);
     $schoolid_array = array($school1, $school2, $school3, $school4, $school5, $school6, $school7, $school8, $school9, $school10, $school11, $school12, $school13, $school14, $school15, $school16);
     $schools = array();
     $guardian = DBGuardianController::getGuardian($username);
     $applicant = DBStudentApplicantController::getApplicantById($applicant_id);
     foreach ($schoolid_array as $schoolid) {
         $schools[] = DBSchoolController::getSchool($schoolid);
     }
     return View::make('G1SAS/SelectionType')->with('username', $username)->with('schools', $schools)->with('dArray', $dArray)->with('yArray', $yArray)->with('guardian', $guardian)->with('applicant', $applicant);
 }
 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 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);
 }