コード例 #1
1
 public function tutoreditAction()
 {
     if (isset($_POST['addpeople'])) {
         # ADDING PERSON RECORD
         $peopleadd = new Peopleadd();
         $tutorid = $peopleadd->Peopleadd($_POST);
         /*
         			# ADDING ADDRESS RECORD
         			$query = "INSERT INTO addresses SET
         				address1 = '" . addslashes($_POST[address1]) . "',
         				address2 = '" . addslashes($_POST[address2]) . "',
         				city = '" . addslashes($_POST[zip]) . "',
         				postalcode = '" . addslashes($_POST[address1]) . "',
         				id_addresstype = '" . addslashes(1) . "',
         				id_geog1 = '" . addslashes($_POST[province_id] ? $_POST[province_id] : 0) . "',
         				id_geog2 = '" . addslashes($_POST[district_id] ? $_POST[district_id] : 0) . "',
         				id_geog3 = '" . addslashes($_POST[region_c_id] ? $_POST[region_c_id] : 0) . "'";
         die($query);
         			$db = $this->dbfunc()->query($query);
         			$id = $db->lastInsertId();
         			# ADDING ADDRESS RECORD
         			$query = "INSERT INTO link_tutor_addresses SET
         				id_address = '" . addslashes($id) . "',
         				id_tutor = '" . addslashes($tutorid) . "'";
         die($query);
         			$db = $this->dbfunc()->query($query);
         			$id = $db->lastInsertId();
         			# LINKING TO TUTOR RECORD
         			$db = $this->dbfunc(); 		 
         			$linkrec = array(
         				'id_address'		=>	$id,
         				'id_tutor'			=>	$tutorid,
         			);
         			$rowArray = $db->insert("link_tutor_addresses",$linkrec); 		
         			$id = $db->lastInsertId();
         */
         $this->_redirect(Settings::$COUNTRY_BASE_URL . "/tutoredit/tutoredit/id/" . $tutorid);
     }
     if (isset($_POST['update'])) {
         $tutoredit = new Tutoredit();
         $updateperson = $tutoredit->UpdatePerson($_POST);
         $updateperson = $tutoredit->UpdateTutor($_POST);
         # STORE LANGUAGES ON EDIT
         #			$updateperson=$tutoredit->UpdatePermanentAddress($_POST);
         #			$studentupdate = new Tutoredit();
         #			$update = $studentupdate->UpdatePerson($_POST);						# STORING PERSON RECORD
         #			$update = $studentupdate->UpdateStudent($_POST);					# STORING STUDENT RECORD
         #			$update = $studentupdate->UpdateStudentCohort($_POST);				# STORING COHORT LINK
         #			$update = $studentupdate->UpdatePermanentAddress($_POST);			# STORING PERMANENT ADDRESS
         $tutorid = $_POST['id'];
         $this->view->assign('newid', $tutorid);
     }
     $request = $this->getRequest();
     $tutorid = $request->getParam('id');
     $this->view->assign('id', $tutorid);
     $this->viewAssignEscaped('locations', Location::getAll());
     $Tutoredit = new Tutoredit();
     $details = $Tutoredit->EditTutor($tutorid);
     #print_r ($details);
     $date = $details['person'][0]['birthdate'];
     $dob = date("d-m-Y", strtotime($date));
     $this->view->assign('id', $tutorid);
     $this->view->assign('selid', $details['person'][0]['title_option_id']);
     $this->view->assign('firstname', $details['person'][0]['first_name']);
     $this->view->assign('middlename', $details['person'][0]['middle_name']);
     $this->view->assign('lastname', $details['person'][0]['last_name']);
     $this->view->assign('nationalid', $details['person'][0]['national_id']);
     $this->view->assign('gender', $details['person'][0]['gender']);
     $this->view->assign('dob', $dob);
     $helper = new Helper();
     $this->view->assign('lookupnationalities', $helper->getNationalities());
     $this->view->assign('lookupfacilities', $helper->getNationalities());
     $this->view->assign('lookupdegrees', $helper->getDegrees());
     $this->view->assign('tutorlanguages', $helper->getLanguages());
     $known = array();
     $tl = $helper->getTutorLanguages($details['tutor'][0]['id']);
     foreach ($tl as $_tl) {
         $known[] = $_tl['id_language'];
     }
     $this->view->assign('knownlanguages', $known);
     $this->view->assign('lookuptutortypes', $helper->getTutorTypes());
     $tt = array();
     $types = $helper->getLinkedTutorTypes($details['tutor'][0]['id']);
     foreach ($types as $type) {
         $tt[] = $type['id'];
     }
     $this->view->assign('tutortypes', $tt);
     $this->view->assign('students', $helper->getTutorStudents($tutorid));
     $this->view->assign('classes', $helper->getTutorClasses($tutorid));
     # GET ALL STUDENTS WHERE ADVISOR = THIS ID
     # GET ALL COURSES LINKED TO THIS ID
     /*
     		$this->view->assign('localgeo1',$details['student'][0]['geog1']);
     		$this->view->assign('localgeo2',$details['student'][0]['geog2']);
     		$this->view->assign('localgeo3',$details['student'][0]['geog3']);
     		$this->view->assign('address1',$details['person'][0]['home_address_1']);
     		$this->view->assign('address2',$details['person'][0]['home_address_2']);
     		$this->view->assign('city',$details['person'][0]['city']);
     		$this->view->assign('zip',$details['person'][0]['home_postal_code']);
     		$this->view->assign('enroll',$details['person'][0]['home_address_2']);
     		$this->view->assign('city',$details['person'][0]['city']);
     		$this->view->assign('email',$details['person'][0]['email']);
     		$this->view->assign('email2',$details['person'][0]['email_secondary']);
     		$this->view->assign('titid',$details['person'][0]['title_option_id']);
     		$this->view->assign('phone',$details['person'][0]['phone_work']);
     		$this->view->assign('cell',$details['person'][0]['phone_mobile']);
     		$this->view->assign('cadre',$details['person'][0]['cadre']);
     		$this->view->assign('graduated',$details['student'][0]['isgraduated']);
     		$this->view->assign('cohortid',$details['link_cohort'][0]['id_cohort']);
     */
     # FACILITY INFORMATION GEO
     $this->view->assign('localgeo1', $details['tutor'][0]['geog1']);
     $this->view->assign('localgeo2', $details['tutor'][0]['geog2']);
     $this->view->assign('localgeo3', $details['tutor'][0]['geog3']);
     $this->view->assign('facility', $details['tutor'][0]['facility']);
     $this->view->assign('cadre', $details['tutor'][0]['cadre']);
     $this->view->assign('tutorsince', $details['tutor'][0]['tutorsince']);
     $this->view->assign('tutortimehere', $details['tutor'][0]['tutortimehere']);
     $this->view->assign('cadre', $details['tutor'][0]['cadre']);
     $this->view->assign('degree', $details['tutor'][0]['degree']);
     $this->view->assign('degreeinst', $details['tutor'][0]['degreeinst']);
     $this->view->assign('degreeyear', $details['tutor'][0]['degreeyear']);
     $this->view->assign('languagesspoken', $details['tutor'][0]['languagesspoken']);
     $this->view->assign('positionsheld', $details['tutor'][0]['positionsheld']);
     $this->view->assign('comments', $details['tutor'][0]['comments']);
     $this->view->assign('nationality', $details['tutor'][0]['nationalityid']);
     # PERMANENT ADDRESS
     $this->view->assign('permanentgeo1', $details['permanent_address'][0]['id_geog1']);
     $this->view->assign('permanentgeo2', $details['permanent_address'][0]['id_geog2']);
     $this->view->assign('permanentgeo3', $details['permanent_address'][0]['id_geog3']);
     $this->view->assign('permanentaddress1', $details['permanent_address'][0]['address1']);
     $this->view->assign('permanentaddress2', $details['permanent_address'][0]['address2']);
     $this->view->assign('permanentcity', $details['permanent_address'][0]['city']);
     $this->view->assign('permanentzip', $details['permanent_address'][0]['postalcode']);
     /*
     		# STUDENT VIEW
     		$this->view->assign('studentid',$details['student'][0]['studentid']);
     		$this->view->assign('studenttype',$details['student'][0]['studenttype']);
     		if ($details['student'][0]['enrollmentdate'] == "0000-00-00"){
     			$enrolldate = "";
     		} else {
     			$enrolldate = date("d-m-Y", strtotime($details['student'][0]['enrollmentdate']));
     		}
     		$this->view->assign('enrollmentdate',$enrolldate);
     		$this->view->assign('enrollmentreason',$details['student'][0]['enrollmentreason']);
     		if ($details['student'][0]['separationdate'] == "0000-00-00"){
     			$separationdate = "";
     		} else {
     			$separationdate = date("d-m-Y", strtotime($details['student'][0]['separationdate']));
     		}
     		$this->view->assign('separationdate',$separationdate);
     		$this->view->assign('separationreason',$details['student'][0]['separationreason']);
     		$this->view->assign('cadre',$details['student'][0]['cadre']);
     		$this->view->assign('advisor',$details['student'][0]['advisorid']);
     		$this->view->assign('yearofstudy',($details['student'][0]['yearofstudy'] != 0 ? $details['student'][0]['yearofstudy'] : ""));
     */
     // For Title List
     $listtitle = $Tutoredit->ListTitle();
     $this->view->assign('gettitle', $listtitle);
     #
     #		# GETTING COHORTS
     #		$listcohort = $Tutoredit->ListCohort();
     #		$this->view->assign('getcohorts',$listcohort);
     #
     #		# GETTING CADRES
     #		$listcadre = $Tutoredit->listCadre();
     #		$this->view->assign('getcadres',$listcadre);
     #
     #		# GETTING TUTORS
     #		$listtutors = $Tutoredit->ListTutors();
     #		$this->view->assign('gettutors',$listtutors);
 }
コード例 #2
0
 public function peopleaddAction()
 {
     //locations
     if (count($_POST) > 0) {
         if (isset($_POST['addpeople'])) {
             $peopleadd = new PeopleAdd();
             # TRIGGERS ADDING PERSON
             $tutorid = $peopleadd->addTutor($_POST);
             switch ($_POST['type']) {
                 case "tutor":
                     $this->_redirect(Settings::$COUNTRY_BASE_URL . "/tutoredit/tutoredit/id/" . $tutorid);
                     break;
             }
         }
         exit;
     }
     $this->viewAssignEscaped('locations', Location::getAll());
     $this->view->assign('action', '../studentedit/studentedit/');
     $this->view->assign('title', $this->view->translation['Application Name']);
     $persontitle = new Peopleadd();
     $result = $persontitle->Peopletitle($fetchtitle);
     $this->view->assign('fetchtitle', $result);
     // FOr Facility
     $faclilityttitle = new Peopleadd();
     $result = $faclilityttitle->PeopleFacility($fetchfacility);
     $this->view->assign('fetchfacility', $result);
     $citylist = new Peopleadd();
     $result = $citylist->PeopleCity($citylist);
     $this->view->assign('fetchcity', $result);
     # CREATING HELPER
     $helper = new Helper();
     $this->view->assign('institutions', $helper->getInstitutions(false));
 }
コード例 #3
0
 public function studenteditAction()
 {
     $this->view->assign('title', $this->view->translation['Application Name']);
     if (isset($_POST['addpeople'])) {
         $peopleadd = new Peopleadd();
         $pupiladd = $peopleadd->Peopleadd($_POST);
         echo "<script language=\"JavaScript\">location.replace('../personview/id/" . $pupiladd . "');</script>";
         exit;
         //print_r($pupiladd);
         $this->viewAssignEscaped('locations', Location::getAll());
         $studentedit = new Studentedit();
         $details = $studentedit->EditStudent($pupiladd);
         // For Geo Listing
         $listgeo = $studentedit->ViewStudent($pupiladd);
         $this->view->assign('getgeo', $listgeo);
         //print_r($listgeo);
         $geo1 = $listgeo[0]['geog1'];
         $geo2 = $listgeo[0]['geog2'];
         $geo3 = $listgeo[0]['geog3'];
         $this->view->assign('selgeo1', $geo1);
         $this->view->assign('selgeo2', $geo2);
         $this->view->assign('selgeo3', $geo3);
         $this->view->assign('enrolldate', $listgeo[0]['enrollmentdate']);
         $this->view->assign('enrollreason', $listgeo[0]['enrollmentreason']);
         $this->view->assign('seprationreason', $listgeo[0]['separationdate']);
         $this->view->assign('sepration', $listgeo[0]['separationreason']);
         $this->view->assign('study', $listgeo[0]['yearofstudy']);
         //For Title List
         $listtitle = $studentedit->ListTitle();
         $this->view->assign('gettitle', $listtitle);
         //For city List
         $listcity = $studentedit->ListCity();
         $this->view->assign('getcity', $listcity);
         //For Selected Title
         $titleid = $details[0]['title_option_id'];
         $fetchtitle = $studentedit->EditTitle($titleid);
         $title = $fetchtitle[0]['title_phrase'];
         $this->view->assign('selid', $fetchtitle[0]['id']);
         $this->view->assign('seltitle', $title);
         //For Selected City
         $cityid = $details[0]['home_location_id'];
         $fetchcity = $studentedit->EditCity($cityid);
         $city = $fetchcity[0]['city_name'];
         $this->view->assign('selcity', $city);
         $date = $details[0]['birthdate'];
         $dob = date("d-m-Y", strtotime($date));
         $this->view->assign('id', $pupiladd);
         $this->view->assign('firstname', $details[0]['first_name']);
         $this->view->assign('lastname', $details[0]['last_name']);
         $this->view->assign('gender', $details[0]['gender']);
         $this->view->assign('dob', $dob);
         $this->view->assign('address1', $details[0]['home_address_1']);
         $this->view->assign('address2', $details[0]['home_address_2']);
         $this->view->assign('city', $details[0]['city']);
         $this->view->assign('zip', $details[0]['home_postal_code']);
         //$this->view->assign('action','../../studentedit/studentupdate/'.$pupiladd);
     }
     if (isset($_POST['update'])) {
         $studentupdate = new Studentedit();
         $update = $studentupdate->UpdatePerson($_POST);
         $pupiladd = $_POST['id'];
         $this->viewAssignEscaped('locations', Location::getAll());
         $studentedit = new Studentedit();
         $details = $studentedit->EditStudent($pupiladd);
         // For Geo Listing
         $listgeo = $studentedit->ViewStudent($pupiladd);
         $this->view->assign('getgeo', $listgeo);
         #			$sid = $studentedit->addfunding($_POST);
         $studid = $listgeo[0]['id'];
         $this->view->assign('stdid', $studid);
         $date = $update['birthdate'];
         $dob = date("d-m-Y", strtotime($date));
         $this->view->assign('newid', $pupiladd);
         $this->view->assign('firstname', $update['first_name']);
         $this->view->assign('lastname', $update['last_name']);
         $this->view->assign('gender', $update['gender']);
         $this->view->assign('dob', $dob);
         $this->view->assign('address1', $update['home_address_1']);
         $this->view->assign('address2', $update['home_address_2']);
         $this->view->assign('city', $update['city']);
         $this->view->assign('zip', $update['home_postal_code']);
         $this->view->assign('enroll', $update['home_address_2']);
         $this->view->assign('city', $update['city']);
         $this->view->assign('email', $update['email']);
         $this->view->assign('email2', $update['email_secondary']);
         $this->view->assign('titid', $update['title_option_id']);
         $this->view->assign('phone', $update['phone_work']);
         $this->view->assign('cell', $update['phone_mobile']);
         $this->view->assign('cadre', $update['cadre']);
         $geo1 = $listgeo[0]['geog1'];
         $geo2 = $listgeo[0]['geog2'];
         $geo3 = $listgeo[0]['geog3'];
         $this->view->assign('selgeo1', $geo1);
         $this->view->assign('selgeo2', $geo2);
         $this->view->assign('selgeo3', $geo3);
         $this->view->assign('enrolldate', $listgeo[0]['enrollmentdate']);
         $this->view->assign('enrollreason', $listgeo[0]['enrollmentreason']);
         $this->view->assign('seprationreason', $listgeo[0]['separationdate']);
         $this->view->assign('sepration', $listgeo[0]['separationreason']);
         $this->view->assign('study', $listgeo[0]['yearofstudy']);
         //For Title List
         $listtitle = $studentedit->ListTitle();
         $this->view->assign('gettitle', $listtitle);
         //For city List
         $listcity = $studentedit->ListCity();
         $this->view->assign('getcity', $listcity);
         //For Selected Title
         /*$titleid =  $details[0]['title_option_id'];
         		$fetchtitle=$studentedit->EditTitle($titleid);*/
         $title = $fetchtitle[0]['title_phrase'];
         $this->view->assign('selid', $fetchtitle[0]['id']);
         $this->view->assign('seltitle', $title);
         //For Selected City
         $cityid = $details[0]['home_location_id'];
         $fetchcity = $studentedit->EditCity($cityid);
         $city = $fetchcity[0]['city_name'];
         $this->view->assign('selcity', $city);
         $cadre = $listgeo[0]['cadre'];
         #		if($cadre=="0"){
         #			$cadreid = $studentupdate->AddCadre($_POST);
         #		}else{
         #
         #		$cid = $_POST['cadreid'];
         #		//$updatecare=$studentupdate->ViewCadre($cid);
         #		//$this->view->assign('cadrename',$updatecare[0]['cadrename']);
         #		}
         #		$this->view->assign('cadreid',$cadreid);
         $updatestud = $studentupdate->UpdateStudent($_POST);
         $enroll = $updatestud['enrollmentdate'];
         $enrolldate = date("d-m-Y", strtotime($enroll));
         $seprate = $updatestud['separationdate'];
         $seprationdate = date("d-m-Y", strtotime($seprate));
         $this->view->assign('grade', $updatestud['isgraduated']);
         $this->view->assign('enrollmentdate', $enrolldate);
         $this->view->assign('enrollmentreason', $updatestud['enrollmentreason']);
         $this->view->assign('separation', $seprationdate);
         $this->view->assign('separationreason', $updatestud['separationreason']);
         $this->view->assign('study', $updatestud['yearofstudy']);
         $this->view->assign('comments', $updatestud['comments']);
         $this->view->assign('cadre', $updatestud['cadre']);
         //print_r($updatestud);
         $updatecadre = $studentupdate->UpdateCadre($_POST);
         $this->view->assign('id', $pupiladd);
         $this->view->assign('cadrename', $updatecadre['cadrename']);
         $this->view->assign('success', 'Update succesfully');
     }
 }