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 postBack() { $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"); $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"); $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"); $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); } $guardian = DBGuardianController::getGuardian($username); $guardianNic = $guardian->getNic(); $available = DBGuardianController::hasApplicant($guardianNic); if ($available == false) { return Redirect::back()->withInput()->with('error', 'first you have to add your child to system'); } else { $appplicants = DBStudentApplicantController::getApplicantOfGuardian($guardianNic); $schools = DBSchoolController::getAllSchool(); $divisions = DBGNDDivisionController::getAllDivision(); return View::make('G1SAS/selection')->with('username', $username)->with('divisions', $divisions)->with('schools', $schools)->with('applicants', $appplicants)->with('guardian', $guardian)->with('schools', $schools)->with('dArray', $dArray)->with('yArray', $yArray)->with('guardian', $guardian)->with('applicant', $applicant); } }