Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Initial Declaration
- */
- /**
- * Class Module
- *
- * @author Arnold P. Orbista
- *
- */
- class clsStudInfo{
- var $conn;
- var $fieldMap_PData;
- var $fieldMap_Fbg;
- var $fieldMap_schHistory;
- var $fieldMap_hhistory;
- var $Data;
- var $otherInfo;
- var $otherFamInfo;
- var $familyMember;
- var $otherMember;
- var $schHistory;
- /**
- * Class Constructor
- *
- * @param object $dbconn_
- * @return clsStudInfo object
- */
- function clsStudInfo($dbconn_ = null){
- $this->conn =& $dbconn_;
- $this->fieldMap_PData = array(
- "ppd_lastname" => "ppd_lastname"
- ,"ppd_firstname" => "ppd_firstname"
- ,"ppd_mothers_maiden_name" => "ppd_mothers_maiden_name"
- ,"ppd_middlename" => "ppd_middlename"
- ,"ppd_nickname" => "ppd_nickname"
- ,"ppd_gender" => "ppd_gender"
- ,"ppd_bday_mm" => "ppd_bday_mm"
- ,"ppd_bday_dd" => "ppd_bday_dd"
- ,"ppd_bday_yy" => "ppd_bday_yy"
- ,"ppd_bday" => "ppd_bday"
- // ,"ppd_age" => "ppd_age"
- ,"ppd_caddress1" => "ppd_caddress1"
- ,"ppd_caddress2" => "ppd_caddress2"
- ,"ppd_caddress3" => "ppd_caddress3"
- ,"ppd_caddress4" => "ppd_caddress4"
- ,"ppd_caddress5" => "ppd_caddress5"
- ,"ppd_czipcode" => "ppd_czipcode"
- ,"ppd_paddress1" => "ppd_paddress1"
- ,"ppd_paddress2" => "ppd_paddress2"
- ,"ppd_paddress3" => "ppd_paddress3"
- ,"ppd_paddress4" => "ppd_paddress4"
- ,"ppd_paddress5" => "ppd_paddress5"
- ,"ppd_pzipcode" => "ppd_pzipcode"
- ,"ppd_citizenship" => "ppd_citizenship"
- ,"ppd_citizenshipoth" => "ppd_citizenshipoth"
- // ,"ppd_telcelno" => "ppd_telcelno"
- // ,"ppd_telcelno2" => "ppd_telcelno2"
- // ,"ppd_mobileno" => "ppd_mobileno"
- // ,"ppd_mobileno2" => "ppd_mobileno2"
- ,"ppd_email" => "ppd_email"
- ,"ppd_guardian" => "ppd_guardian"
- ,"ppd_guardian_address" => "ppd_guardian_address"
- ,"ppd_guardian_contact_num" => "ppd_guardian_contact_num"
- ,"ppd_guardian_email" => "ppd_guardian_email"
- ,"ppd_acrno" => "ppd_acrno"
- ,"ppd_dateofissue" => "ppd_dateofissue"
- ,"ppd_placeofissue" => "ppd_placeofissue"
- ,"ppd_passportno" => "ppd_passportno"
- ,"ppd_studno" => "ppd_studno"
- // ,"ppd_picture" => "ppd_picture"
- ,"stud_info_yearsinschool" => "stud_info_yearsinschool"
- );
- $this->fieldMap_Fbg = array(
- "studfambg_fathersname" => "studfambg_fathersname"
- ,"studfambg_fatherslastname" => "studfambg_fatherslastname"
- ,"studfambg_fathersbday" => "studfambg_fathersbday"
- ,"studfambg_fathersage" => "studfambg_fathersage"
- ,"studfambg_fathersplaceofbirth" => "studfambg_fathersplaceofbirth"
- ,"studfambg_fathersmaritalstatus" => "studfambg_fathersmaritalstatus"
- ,"studfambg_fathersaddress1" => "studfambg_fathersaddress1"
- ,"studfambg_fathersaddress2" => "studfambg_fathersaddress2"
- ,"studfambg_fathersaddress3" => "studfambg_fathersaddress3"
- ,"studfambg_fathersaddress4" => "studfambg_fathersaddress4"
- ,"studfambg_fathersaddress5" => "studfambg_fathersaddress5"
- ,"studfambg_fathershomeownership" => "studfambg_fathershomeownership"
- ,"studfambg_fatherscitizenship" => "studfambg_fatherscitizenship"
- ,"studfambg_fatherscontactnumber" => "studfambg_fatherscontactnumber"
- ,"studfambg_fathersemail" => "studfambg_fathersemail"
- ,"studfambg_fathersreligion" => "studfambg_fathersreligion"
- ,"studfambg_fatherslanguage" => "studfambg_fatherslanguage"
- ,"studfambg_fathersschool" => "studfambg_fathersschool"
- ,"studfambg_fathershighesteducattain" => "studfambg_fathershighesteducattain"
- ,"studfambg_fathersoccupation" => "studfambg_fathersoccupation"
- ,"studfambg_fatherscompany" => "studfambg_fatherscompany"
- ,"studfambg_fathersofw" => "studfambg_fathersofw"
- ,"studfambg_fathersbussadd" => "studfambg_fathersbussadd"
- ,"studfambg_fathersbusstelno" => "studfambg_fathersbusstelno"
- ,"studfambg_fathersannualincome" => "studfambg_fathersannualincome"
- ,"studfambg_mothersname" => "studfambg_mothersname"
- ,"studfambg_mothersmaidenname" => "studfambg_mothersmaidenname"
- ,"studfambg_mothersbday" => "studfambg_mothersbday"
- ,"studfambg_mothersage" => "studfambg_mothersage"
- ,"studfambg_mothersplaceofbirth" => "studfambg_mothersplaceofbirth"
- ,"studfambg_mothersmaritalstatus" => "studfambg_mothersmaritalstatus"
- ,"studfambg_mothersaddress1" => "studfambg_mothersaddress1"
- ,"studfambg_mothersaddress2" => "studfambg_mothersaddress2"
- ,"studfambg_mothersaddress3" => "studfambg_mothersaddress3"
- ,"studfambg_mothersaddress4" => "studfambg_mothersaddress4"
- ,"studfambg_mothersaddress5" => "studfambg_mothersaddress5"
- ,"studfambg_mothershomeownership" => "studfambg_mothershomeownership"
- ,"studfambg_motherscontactnumber" => "studfambg_motherscontactnumber"
- ,"studfambg_mothersemail" => "studfambg_mothersemail"
- ,"studfambg_mothersreligion" => "studfambg_mothersreligion"
- ,"studfambg_motherscitizenship" => "studfambg_motherscitizenship"
- ,"studfambg_motherslanguage" => "studfambg_motherslanguage"
- ,"studfambg_mothershighesteducattain" => "studfambg_mothershighesteducattain"
- ,"studfambg_mothersschool" => "studfambg_mothersschool"
- ,"studfambg_mothersoccupation" => "studfambg_mothersoccupation"
- ,"studfambg_motherscompany" => "studfambg_motherscompany"
- ,"studfambg_mothersofw" => "studfambg_mothersofw"
- ,"studfambg_mothersbussadd" => "studfambg_mothersbussadd"
- ,"studfambg_mothersbusstelno" => "studfambg_mothersbusstelno"
- ,"studfambg_mothersannualincome" => "studfambg_mothersannualincome"
- ,"studfambg_totalhouseholdincome" => "studfambg_totalhouseholdincome"
- ,"studfambg_sameascurrentadd_mother" => "studfambg_sameascurrentadd_mother"
- ,"studfambg_sameascurrentadd_father" => "studfambg_sameascurrentadd_father"
- );
- $this->fieldMap_schHistory = array(
- "schistory_lvl" => "schistory_lvl"
- ,"schistory_school" => "schistory_school"
- ,"schistory_schooladdress" => "schistory_schooladdress"
- ,"schistory_yrsFrom" => "schistory_yrsFrom"
- ,"schistory_yearsTo" => "schistory_yearsTo"
- ,"schistory_honors" => "schistory_honors"
- ,"schistory_honorsYear" => "schistory_honorsYear"
- ,"schistory_specialCourse" => "schistory_specialCourse"
- ,"schistory_specialCourseRadio" => "schistory_specialCourseRadio"
- ,"schistory_specialCourseYear" => "schistory_specialCourseYear"
- ,"schistory_summerClasses" => "schistory_summerClasses"
- ,"schistory_summerClassesRadio" => "schistory_summerClassesRadio"
- ,"schistory_summerClassesYear" => "schistory_summerClassesYear"
- ,"schistory_failedSubject" => "schistory_failedSubject"
- ,"schistory_failedSubjectRadio" => "schistory_failedSubjectRadio"
- ,"schistory_failedSubjectYear" => "schistory_failedSubjectYear"
- ,"schistory_repeated" => "schistory_repeated"
- ,"schistory_repeatedRadio" => "schistory_repeatedRadio"
- ,"schistory_repeatedYear" => "schistory_repeatedYear"
- ,"transferee_prev_school_from" => "transferee_prev_school_from"
- ,"transferee_prev_school_to" => "transferee_prev_school_to"
- ,"transferee_reason" => "transferee_reason"
- ,"transferee_prev_school_from1" => "transferee_prev_school_from1"
- ,"transferee_prev_school_to1" => "transferee_prev_school_to1"
- ,"transferee_disciplinary" => "transferee_disciplinary"
- );
- $this->fieldMap_hhistory = array(
- //"health_height" => "health_height"
- "health_weight" => "health_weight"
- ,"health_eyesight" => "health_eyesight"
- ,"health_hearing" => "health_hearing"
- ,"health_allergies" => "health_allergies"
- ,"health_immunizations" => "health_immunizations"
- ,"health_speech_difficulties" => "health_speech_difficulties"
- ,"health_childhood_diseases" => "health_childhood_diseases"
- ,"medicalcondition" => "medicalcondition"
- ,"health_handycap" => "health_handycap"
- ,"studhhis_insurance" => "studhhis_insurance"
- ,"studhhis_family_doctor" => "studhhis_family_doctor"
- ,"studhhis_hospitalclinic_telno" => "studhhis_hospitalclinic_telno"
- ,"studhhis_blood_type" => "studhhis_blood_type"
- );
- }
- function setOtherInfo($arr_= ''){
- // foreach($arr_ as $key => $value){
- //
- // $value = stripslashes($value);
- // $value = str_replace("'", "'",$value);
- //
- // $arr_[$key] = $value;
- // }
- $arr['birthplace'] = $arr_['ppd_bdayplace'];
- $arr['siblingcount'] = $arr_['ppd_numsiblingcount'];
- $arr['birthorder'] = $arr_['ppd_birthorder'];
- $arr['childstatus'] = $arr_['ppd_appchildstatus'];
- $arr['language'] = $arr_['ppd_dialect'];
- $arr['talent_skills'] = $arr_['ppd_talents'];
- $arr['hobbiesNinterest'] = $arr_['ppd_hobbies'];
- $this->otherInfo = serialize($arr);
- }
- function setFamilyMember($arr_=''){
- // foreach($arr_ as $key => $value){
- // if (is_array($arr_[$key])){
- // foreach ($arr_[$key] as $key2 => $valueX){
- // $valueX = stripslashes($valueX);
- // $valueX = str_replace("'", "'",$valueX);
- //
- // $arr_[$key][$key2] = $valueX;
- // }
- // }
- // }
- for($i=0;$i<count($arr_['sibling_name']);$i++){
- $newArr[$i]['name'] = $arr_['sibling_name'][$i];
- $newArr[$i]['bday'] = $arr_['sibling_birthday'][$i];
- $newArr[$i]['age'] = $arr_['sibling_age'][$i];
- $newArr[$i]['grd_yr_lvl'] = $arr_['sibling_grade_level'][$i];
- $newArr[$i]['school'] = $arr_['sibling_school_name'][$i];
- }
- for($i=0;$i<count($arr_['othfamily_name']);$i++){
- $newArr1[$i]['name'] = $arr_['othfamily_name'][$i];
- $newArr1[$i]['relationship'] = $arr_['othfamily_relationship'][$i];
- $newArr1[$i]['age'] = $arr_['othfamily_age'][$i];
- $newArr1[$i]['grd_yr_lvl'] = $arr_['othfamily_level'][$i];
- $newArr1[$i]['school'] = $arr_['othfamily_company'][$i];
- }
- $this->otherFamInfo = serialize($newArr1);
- $this->familyMember = serialize($newArr);
- }
- function setSchHistory($arr_=''){
- // foreach($arr_ as $key => $value){
- // if (is_array($arr_[$key])){
- // foreach ($arr_[$key] as $key2 => $valueX){
- // $valueX = stripslashes($valueX);
- // $valueX = str_replace("'", "'",$valueX);
- //
- // $arr_[$key][$key2] = $valueX;
- // }
- // }
- // }
- for($i=0;$i<count($arr_['schistory_lvl']);$i++){
- $newArr[$i]['lvl'] = $arr_['schistory_lvl'][$i];
- $newArr[$i]['school'] = $arr_['schistory_school'][$i];
- $newArr[$i]['schooladd'] = $arr_['schistory_schooladdress'][$i];
- $newArr[$i]['from'] = $arr_['schistory_yrsFrom'][$i];
- $newArr[$i]['to'] = $arr_['schistory_yearsTo'][$i];
- $newArr[$i]['honors'] = $arr_['schistory_honors'][$i];
- $newArr[$i]['honorsYr'] = $arr_['schistory_honorsYear'][$i];
- $newArr[$i]['sCOurse'] = $arr_['schistory_specialCourse'][$i];
- $newArr[$i]['sCOurseSwitch'] = $arr_['schistory_specialCourseRadio'][$i];
- $newArr[$i]['sCOurseYear'] = $arr_['schistory_specialCourseYear'][$i];
- $newArr[$i]['summerClass'] = $arr_['schistory_summerClasses'][$i];
- $newArr[$i]['summerClassSwitch'] = $arr_['schistory_summerClassesRadio'][$i];
- $newArr[$i]['summerClassYear'] = $arr_['schistory_summerClassesYear'][$i];
- $newArr[$i]['failedSubject'] = $arr_['schistory_failedSubject'][$i];
- $newArr[$i]['failedSubjectSwitch'] = $arr_['schistory_failedSubjectRadio'][$i];
- $newArr[$i]['failedSubjectYear'] = $arr_['schistory_failedSubjectYear'][$i];
- $newArr[$i]['repeated'] = $arr_['schistory_repeated'][$i];
- $newArr[$i]['repeatedSwitch'] = $arr_['schistory_repeatedRadio'][$i];
- $newArr[$i]['repeatedYear'] = $arr_['schistory_repeatedYear'][$i];
- $newArr[$i]['prevSchoolFrom'] = $arr_['transferee_prev_school_from'];
- $newArr[$i]['prevSchoolFrom1'] = $arr_['transferee_prev_school_from1'];
- $newArr[$i]['prevSchoolTo'] = $arr_['transferee_prev_school_to'];
- $newArr[$i]['prevSchoolTo1'] = $arr_['transferee_prev_school_to1'];
- $newArr[$i]['transfereeReason1'] = $arr_['transferee_reason1'];
- $newArr[$i]['transfereeReason2'] = $arr_['transferee_reason2'];
- $newArr[$i]['transferee_disciplinary'] = $arr_['transferee_disciplinary'];
- }
- $this->schHistory = serialize($newArr);
- }
- /**
- * Get the records from the database
- *
- * @param string $id_
- * @return array
- *
- */
- function dbFetch($id_ = "", $dbconn = null, $sy_id = null){
- //echo 'x';
- $selected_table = clsRegistrarMisc::getSelected_Table($dbconn,$sy_id);
- $flds = array();
- $flds[] = "sai.stud_applicant_id as sai";
- $flds[] = "sai.*";
- $flds[] = "DATE_FORMAT(sai.ppd_bday,'%m-%d-%Y') as ppd_bday";
- $flds[] = "DATE_FORMAT(sai.ppd_dateofissue,'%m-%d-%Y') as dof";
- $flds[] = "sfb.*";
- $flds[] = "DATE_FORMAT(sfb.studfambg_fathersbday,'%m-%d-%Y') as studfambg_fathersbday";
- $flds[] = "DATE_FORMAT(sfb.studfambg_mothersbday,'%m-%d-%Y') as studfambg_mothersbday";
- $flds[] = "shh.*";
- $flds[] = "ssh.*";
- $flds[] = "addmission.sai_id";
- $flds[] = "display.sequence_no as sai_id";
- $fields = implode(",",$flds);
- $sql = "SELECT $fields
- from dps_registrar_db.student_applicant_information sai
- left join dps_registrar_db.student_family_background sfb ON sai.stud_applicant_id = sfb.stud_applicant_id
- left join dps_registrar_db.student_health_history shh ON shh.stud_applicant_id = sai.stud_applicant_id
- left join dps_registrar_db.student_school_history ssh ON ssh.stud_applicant_id = sai.stud_applicant_id
- left join dps_registrar_db.student_admission_info_$selected_table addmission on (addmission.stud_applicant_id = sai.stud_applicant_id)
- left join dps_registrar_db.display_sequence display on display.table_id = addmission.sai_id
- where sai.stud_applicant_id = ?";
- $rsResult = $this->conn->Execute($sql,array($id_));
- if(!$rsResult->EOF){
- return $rsResult->fields;
- }
- }
- function getPhoto($id_ = ""){
- $sql = "SELECT sai.ppd_picture
- FROM student_applicant_photo sai
- WHERE sai.stud_applicant_id = ?";
- $rsResult = $this->conn->Execute($sql,array($id_));
- if(!$rsResult->EOF){
- if (strlen($rsResult->fields['ppd_picture'])>0){
- return $rsResult->fields['ppd_picture'];
- }else{
- return file_get_contents(SYSCONFIG_THEME_PATH.SYSCONFIG_THEME."/images/blank_photo.jpg");
- }
- }else{
- return file_get_contents(SYSCONFIG_THEME_PATH.SYSCONFIG_THEME."/images/blank_photo.jpg");
- }
- }
- /**
- * populate personal info fields
- *
- */
- function doPopulateData_Pdata($pData_ = array(),$isForm_ = false){
- if(count($pData_)>0){
- foreach ($this->fieldMap_PData as $key => $value) {
- if ($isForm_) {
- $this->Personal_Data[$value] = $pData_[$value];
- }else{
- $this->Personal_Data[$key] = $pData_[$value];
- }
- }
- return true;
- }
- return false;
- }
- /**
- * populate family background fields
- *
- */
- function doPopulateData_Fbg($pData_ = array(),$isForm_ = false){
- if(count($pData_)>0){
- foreach ($this->fieldMap_Fbg as $key => $value) {
- if ($isForm_) {
- $this->Family_Background[$value] = $pData_[$value];
- }else {
- $this->Family_Background[$key] = $pData_[$value];
- }
- }
- return true;
- }
- return false;
- }
- /**populate school history data
- *
- */
- function doPopulateData_schHis($pData_ = array(),$isForm_ = false){
- if(count($pData_)>0){
- foreach ($this->fieldMap_schHistory as $key => $value) {
- if ($isForm_) {
- $this->Data[$value] = $pData_[$value];
- }else{
- $this->Data[$key] = $pData_[$value];
- }
- }
- return true;
- }
- return false;
- }
- /**populate health history data
- *
- */
- function doPopulateData_hHis($pData_ = array(),$isForm_ = false){
- if(count($pData_)>0){
- foreach ($this->fieldMap_hhistory as $key => $value) {
- if ($isForm_) {
- $this->Data[$value] = $pData_[$value];
- }else{
- $this->Data[$key] = $pData_[$value];
- }
- }
- return true;
- }
- return false;
- }
- /**
- * Populate array parameters to Data Variable
- *
- * @param array $pData_
- * @param boolean $isForm_
- * @return bool
- */
- function doPopulateData($pData_ = array(),$isForm_ = false){
- if(count($pData_)>0){
- foreach ($this->fieldMap_PData as $key => $value) {
- if ($isForm_) {
- $this->Data[$value] = $pData_[$value];
- }else {
- $this->Data[$key] = $pData_[$value];
- }
- }
- return true;
- }
- return false;
- }
- /**
- * Validation function
- *
- * @param array $pData_
- * @return bool
- */
- function doValidateData_Image($pData_ = array()){
- $isValid = true;
- if($pData_['ppd_picture']['error']!=4){
- // allow jpeg file format only
- if ($pData_['ppd_picture']['type']!="image/jpeg") {
- $isValid=false;
- $_SESSION['eMsg'][]="Invalid image type.Use JPEG only.";
- }elseif ($pData_['ppd_picture']['size']>600000) {
- $isValid=false;
- $_SESSION['eMsg'][]="Uploaded image is grather than 600Kb ";
- }
- }
- return $isValid;
- }
- function doValidateData($pData_ = array()){
- $isValid = true;
- if (empty($pData_['ppd_lastname'])) {
- $_SESSION['eMsg'][] = "Enter Last Name";
- $isValid = false;
- }
- if (empty($pData_['ppd_firstname'])) {
- $_SESSION['eMsg'][] = "Enter First Name.";
- $isValid = false;
- }
- if (empty($pData_['ppd_guardian'])) {
- $isValid = false;
- $_SESSION['eMsg'][] = "Please fill in Person / Legal Guardian";
- }
- if (empty($pData_['ppd_guardian_contact_num'])) {
- $isValid = false;
- $_SESSION['eMsg'][] = "Please fill in Contact no.";
- }
- if (empty($pData_['ppd_gender'])) {
- $isValid = false;
- $_SESSION['eMsg'][] = "Select Gender";
- }
- if (empty($pData_['ppd_bday'])) {
- $isValid = false;
- $_SESSION['eMsg'][] = "Enter Birthday";
- }
- if (empty($pData_['ppd_guardian_address'])) {
- $isValid = false;
- $_SESSION['eMsg'][] = "Enter Guardian Address";
- }
- // Required Current Address ----> DPS-COD-T0019
- if ($pData_['ppd_paddress1'] == "") {
- $isValid = false;
- $_SESSION['eMsg'][] = "Please fill in Permanent Unit / House No.";
- }
- if ($pData_['ppd_paddress2'] == "") {
- $isValid = false;
- $_SESSION['eMsg'][] = "Please fill in Permanent Street";
- }
- if ($pData_['ppd_paddress3'] == "") {
- $isValid = false;
- $_SESSION['eMsg'][] = "Please fill in Permanent Brgy. / Subdivision";
- }
- if ($pData_['ppd_paddress4'] == "") {
- $isValid = false;
- $_SESSION['eMsg'][] = "Please fill in Permanent District Municipality";
- }
- if ($pData_['ppd_paddress5'] == "") {
- $isValid = false;
- $_SESSION['eMsg'][] = "Please fill in Permanent City / Province";
- }
- // if (empty($pData_['ppd_czipcode'])){
- // $isValid = false;
- // $_SESSION['eMsg'][]="Enter Current Zip Code";
- // }
- // Required in the student family background
- if (empty($pData_['studfambg_fathersname'])) {
- $isValid = false;
- $_SESSION['eMsg'][] = "Enter Father's First Name";
- }
- if (empty($pData_['studfambg_fatherslastname'])) {
- $isValid = false;
- $_SESSION['eMsg'][] = "Enter Father's Last Name";
- }
- if (empty($pData_['studfambg_mothersmaidenname'])) {
- $isValid = false;
- $_SESSION['eMsg'][] = "Enter Mother's Maiden Name";
- }
- if (empty($pData_['studfambg_mothersname'])) {
- $isValid = false;
- $_SESSION['eMsg'][] = "Enter Mother's First Name";
- }
- // if(!is_numeric($pData_['ppd_guardian_contact_num'])){
- // $isValid = false;
- // $_SESSION['eMsg'][]="Contact No. accepts numeric characters only.";
- // }
- // if (empty($pData_['studhhis_blood_type'])){
- // $isValid = false;
- // $_SESSION['eMsg'][]="Please fill in Blood Type";
- // }
- // if(is_numeric($pData_['studhhis_blood_type'])){
- // $isValid = false;
- // $_SESSION['eMsg'][]="Blood Type does not accept numeric characters.";
- // }
- // check student number
- // if(!empty($pData_['ppd_studno'])){
- //
- // $objClsPermits = new clsPermits($this->conn);
- // $permit = $objClsPermits->dbfetchStudentInfoPermittoEnroll($_GET['edit']);
- // if(!empty ($permit)){
- //
- // if(isset($_GET['edit'])){
- // $criteria = " and a.stud_applicant_id != '".$_GET['edit']."'";
- // }
- // $sql = "select * from dps_registrar_db.student_applicant_information a
- // where a.ppd_studno = '".$pData_['ppd_studno']."' $criteria
- // ";
- //
- // $rsResult = $this->conn->Execute($sql);
- //
- // if(!$rsResult->EOF){
- // $isValid = false;
- // $_SESSION['eMsg'][]="Student no. already exist.";
- // }
- // }else{
- // $isValid = false;
- // $_SESSION['eMsg'][]="Cannot save student number. No permit to enroll found for this student.";
- // }
- // }
- // check if has no uploaded file
- if ($pData_['ppd_picture']['error'] != 4) {
- // allow jpeg file format only
- if ($pData_['ppd_picture']['type'] != "image/jpeg") {
- $isValid = false;
- $_SESSION['eMsg'][] = "Invalid image type.Use JPEG or PNG only.";
- }
- }
- return $isValid;
- }
- function doValidateData_fetcher($pData_ = array()){
- $isValid = true;
- return $isValid;
- }
- /**
- * Save New personal data
- *
- */
- function doSaveAdd_Pdata($pData = array()){
- $flds = array();
- foreach ($this->Data as $keyData => $valData) {
- if($keyData == 'ppd_dateofissue'){
- $valData = dDate::parseDateTime($valData);
- $flds[] = "$keyData='$valData'";
- }elseif ($keyData=='ppd_bday'){
- $valData = dDate::explodeDate($valData);
- $flds[] = "$keyData='$valData'";
- }elseif ($keyData=='ppd_picture'){
- //check for error in uploading image
- if ($valData['error']!=4) {
- $valData=addslashes(file_get_contents($valData['tmp_name']));
- if ($valData==""){
- }else{
- $flds[] = "$keyData='$valData'";
- }
- }
- }else{
- $valData = trim($valData);
- $valData = addslashes($valData);
- $flds[] = "$keyData='$valData'";
- }
- }
- $this->setOtherInfo($pData);
- $edad=$this->CalcAge($pData['ppd_bday']);
- $flds[] ="ppd_age='".$edad."'";
- $flds[] = "ppd_otherinformation='$this->otherInfo'";
- $flds[] = "ppd_telcelno='".$pData['sai_telno']."-".$pData['ppd_telcelno']."'";
- $flds[] = "ppd_telcelno2='".$pData['sai_telno2']."-".$pData['ppd_telcelno2']."'";
- $flds[] = "ppd_mobileno='".$pData['ppd_optMobileno']."-".$pData['ppd_mobileno']."'";
- $flds[] = "ppd_mobileno2='".$pData['ppd_optMobileno2']."-".$pData['ppd_mobileno2']."'";
- $flds[] = "ppd_addwho='".AppUser::getdata('user_name')."'";
- $fields = implode(", ",$flds);
- $sql = "insert into student_applicant_information set $fields";
- $this->conn->Execute($sql);
- $id = $this->conn->Insert_ID();
- $_SESSION['eMsg']="Successfully Added.";
- return $id;
- }
- /**
- * Save New family background data
- *
- */
- function doSaveAdd_Fbg(){
- $flds = array();
- foreach ($this->Data as $keyData => $valData) {
- $valData = addslashes($valData);
- $flds[] = "$keyData='$valData'";
- }
- // set family members
- $this->setFamilyMember($_POST);
- $flds[] = "studfambg_familymember ='$this->familyMember'";
- $fields = implode(", ",$flds);
- $sql = "insert into student_family_background set $fields";
- $this->conn->Execute($sql);
- $_SESSION['eMsg']="Successfully Added.";
- }
- /**
- * save new school history
- *
- */
- function doSaveAdd_SchHis($student_id){
- $ser = $this->schHistory;
- $sql = "insert into student_school_history set `stud_applicant_id`={$student_id}, `studschhis_data`='{$ser}'";
- $this->conn->Execute($sql);
- $_SESSION['eMsg']="Successfully Added.";
- }
- function doSaveAdd_hHis($student_id){
- $ser= serialize($this->Data);
- $sql = "insert into student_health_history set `stud_applicant_id`={$student_id}, `studhhis_data`='{$ser}'";
- $this->conn->Execute($sql);
- $_SESSION['eMsg']="Successfully Added.";
- }
- function doSaveAdd1_hHis($pData = array()){
- $flds = array();
- $flds[] = "studhhis_insurance='".$pData['studhhis_insurance']."'";
- $flds[] = "studhhis_family_doctor='".$pData['studhhis_family_doctor']."'";
- $flds[] = "studhhis_hospitalclinic_telno='".$pData['studhhis_hospitalclinic_telno']."'";
- $flds[] = "studhhis_blood_type='".$pData['studhhis_blood_type']."'";
- $fields=implode(", ",$flds);
- $sql = "insert into student_health_history set $fields";
- $this->conn->Execute($sql);
- $_SESSION['eMsg']="Successfully Added.";
- }
- /**
- * Save Update
- *
- */
- function doSaveEdit(){
- $id = $_GET['edit'];
- $flds = array();
- foreach ($this->Data as $keyData => $valData) {
- $valData = trim($valData);
- $valData = addslashes($valData);
- $flds[] = "$keyData='$valData'";
- }
- $this->setOtherInfo($_POST);
- $flds[] = "ppd_otherinformation='$this->otherInfo'";
- $fields = implode(", ",$flds);
- $sql = "update student_applicant_information set $fields where stud_applicant_id=$id";
- $this->conn->Execute($sql);
- $_SESSION['eMsg']="Successfully Updated.";
- }
- /**
- * update personal data
- *
- */
- function doSaveEdit_Pdata($pData = array()){
- $id = $_GET['edit'];
- $flds = array();
- foreach ($this->Personal_Data as $keyData => $valData) {
- if($keyData == 'ppd_dateofissue' || $keyData == 'ppd_bday'){
- $valData = dDate::explodeDate($valData);
- $flds[] = "$keyData='$valData'";
- }else{
- $valData = trim($valData);
- $valData = addslashes($valData);
- $flds[] = "$keyData='$valData'";
- }
- }
- $this->setOtherInfo($_POST);
- $edad=$this->CalcAge($pData['ppd_bday']);
- $flds[] = "ppd_age='".$edad."'";
- $flds[] = "ppd_otherinformation='$this->otherInfo'";
- $flds[] = "ppd_telcelno='".$pData['sai_telno']."-".$pData['ppd_telcelno']."'";
- $flds[] = "ppd_telcelno2='".$pData['sai_telno2']."-".$pData['ppd_telcelno2']."'";
- $flds[] = "ppd_mobileno='".$pData['ppd_optMobileno']."-".$pData['ppd_mobileno']."'";
- $flds[] = "ppd_mobileno2='".$pData['ppd_optMobileno2']."-".$pData['ppd_mobileno2']."'";
- $flds[] = "ppd_updatewhen='".date('Y-m-d h:i:s')."'";
- $flds[] = "ppd_updatewho='".AppUser::getdata('user_name')."'";
- $fields = implode(", ",$flds);
- $sql = "update student_applicant_information set $fields where stud_applicant_id=$id";
- $this->conn->Execute($sql);
- $sql = "SELECT table_name
- FROM information_schema.tables
- WHERE lower(TABLE_NAME) like '%student_admission_info%'
- ORDER BY table_name DESC";
- $rsResult = $this->conn->Execute($sql);
- while(!$rsResult->EOF){
- $student_admission_info_table = $rsResult->fields['table_name'];
- $sai_lastname = addslashes($pData['ppd_lastname']);
- $sai_firstname = addslashes($pData['ppd_firstname']);
- $sai_middlename = addslashes($pData['ppd_middlename']);
- $sai_mothers_maiden_name = addslashes($pData['ppd_mothers_maiden_name']);
- $sai_nickname = addslashes($pData['ppd_nickname']);
- $sai_gender = addslashes($pData['ppd_gender']);
- $sai_birthday = dDate::explodeDate($pData['ppd_bday']);
- $sai_caddress1 = addslashes($pData['ppd_caddress1']);
- $sai_caddress2 = addslashes($pData['ppd_caddress2']);
- $sai_caddress3 = addslashes($pData['ppd_caddress3']);
- $sai_caddress4 = addslashes($pData['ppd_caddress4']);
- $sai_caddress5 = addslashes($pData['ppd_caddress5']);
- $sai_czipcode = addslashes($pData['ppd_czipcode']);
- $sai_paddress1 = addslashes($pData['ppd_paddress1']);
- $sai_paddress2 = addslashes($pData['ppd_paddress2']);
- $sai_paddress3 = addslashes($pData['ppd_paddress3']);
- $sai_paddress4 = addslashes($pData['ppd_paddress4']);
- $sai_paddress5 = addslashes($pData['ppd_paddress5']);
- $sai_pzipcode = addslashes($pData['ppd_pzipcode']);
- $sai_citizenship = addslashes($pData['ppd_citizenship']);
- $sai_citizenship_oth = addslashes($pData['ppd_citizenshipoth']);
- $sai_email = addslashes($pData['ppd_email']);
- $flds = array();
- $flds[] = "sai_lastname = '$sai_lastname'";
- $flds[] = "sai_firstname = '$sai_firstname'";
- $flds[] = "sai_middlename = '$sai_middlename'";
- $flds[] = "sai_mothers_maiden_name = '$sai_mothers_maiden_name'";
- $flds[] = "sai_nickname = '$sai_nickname'";
- $flds[] = "sai_gender = '$sai_gender'";
- $flds[] = "sai_birthday = '$sai_birthday'";
- $flds[] = "sai_age = '$edad'";
- $flds[] = "sai_caddress1 = '$sai_caddress1'";
- $flds[] = "sai_caddress2 = '$sai_caddress2'";
- $flds[] = "sai_caddress3 = '$sai_caddress3'";
- $flds[] = "sai_caddress4 = '$sai_caddress4'";
- $flds[] = "sai_caddress5 = '$sai_caddress5'";
- $flds[] = "sai_czipcode = '$sai_czipcode'";
- $flds[] = "sai_paddress1 = '$sai_paddress1'";
- $flds[] = "sai_paddress2 = '$sai_paddress2'";
- $flds[] = "sai_paddress3 = '$sai_paddress3'";
- $flds[] = "sai_paddress4 = '$sai_paddress4'";
- $flds[] = "sai_paddress5 = '$sai_paddress5'";
- $flds[] = "sai_pzipcode = '$sai_pzipcode'";
- $flds[] = "sai_citizenship = '$sai_citizenship'";
- $flds[] = "sai_citizenship_oth = '$sai_citizenship_oth'";
- $flds[] = "sai_email = '$sai_email'";
- $flds[] = "sai_homephone1 = '".$pData['sai_telno']."-".$pData['ppd_telcelno']."'";
- $flds[] = "sai_homephone1 = '".$pData['sai_telno2']."-".$pData['ppd_telcelno2']."'";
- $flds[] = "sai_mobilephone1 = '".$pData['ppd_optMobileno']."-".$pData['ppd_mobileno']."'";
- $flds[] = "sai_mobilephone2 = '".$pData['ppd_optMobileno2']."-".$pData['ppd_mobileno2']."'";
- $flds[] = "sai_mobilephone2 = '".$pData['ppd_optMobileno2']."-".$pData['ppd_mobileno2']."'";
- $fields = implode(",",$flds);
- $update = "update $student_admission_info_table set $fields where stud_applicant_id = '$id'";
- $this->conn->Execute($update);
- $rsResult->MoveNext();
- }
- $_SESSION['eMsg']="Successfully Updated.";
- }
- /**
- * update family background
- *
- */
- function doSaveEdit_fBg(){
- $id = $_GET['edit'];
- $sql_x = "select stud_applicant_id from student_school_history where stud_applicant_id = $id";
- $rsResult_x =$this->conn->Execute($sql_x);
- if($rsResult_x->EOF){
- $flds = array();
- $flds[] = "stud_applicant_id={$id}";
- $fields = implode(", ",$flds);
- $sql_2 = "insert into student_family_background set $fields";
- $this->conn->Execute($sql_2);
- }
- $flds = array();
- foreach ($this->Family_Background as $keyData => $valData) {
- if($keyData == 'studfambg_fathersbday' || $keyData == 'studfambg_mothersbday'){
- $valData = dDate::explodeDate($valData);
- $flds[] = "$keyData='$valData'";
- }else{
- $valData = addslashes($valData);
- $flds[] = "$keyData='$valData'";
- }
- }
- // set family members
- $this->setFamilyMember($_POST);
- $flds[] = "studfambg_familymember ='$this->familyMember'";
- $flds[] = "studfambg_othermembers ='$this->otherFamInfo'";
- $fields = implode(", ",$flds);
- $sql = "update student_family_background set $fields where stud_applicant_id=$id";
- $this->conn->Execute($sql);
- $_SESSION['eMsg']="Successfully Updated.";
- }
- /**
- * update required fields in family backgroud
- *
- */
- // function doSaveEdit1_fBg($pData_=array()){
- // $id = $_GET['edit'];
- //
- // $flds[] = "studfambg_fathersname ='{$pData_['studfambg_fathersname']}'";
- // $flds[] = "studfambg_fatherslastname ='{$pData_['studfambg_fatherslastname']}'";
- // $flds[] = "studfambg_mothersmaidenname ='{$pData_['studfambg_mothersmaidenname']}'";
- // $flds[] = "studfambg_mothersname ='{$pData_['studfambg_mothersname']}'";
- //
- // $fields = implode(", ",$flds);
- //
- // $sql = "update student_family_background set $fields where stud_applicant_id=$id";
- //
- // $this->conn->Execute($sql);
- //
- // $_SESSION['eMsg']="Successfully Updated.";
- //
- // }
- /**
- * update school background
- *
- */
- function doSaveEdit_schHis(){
- $id = $_GET['edit'];
- $sql_x = "select stud_applicant_id from student_school_history where stud_applicant_id = $id";
- $rsResult_x =$this->conn->Execute($sql_x);
- if ($rsResult_x->EOF){
- $sql_2 = "insert into student_school_history set `stud_applicant_id`={$id}";
- $this->conn->Execute($sql_2);
- }
- $ser = $this->schHistory;
- $sql = "update student_school_history set `studschhis_data`='{$ser}' where stud_applicant_id ={$id}";
- $this->conn->Execute($sql);
- $_SESSION['eMsg']="Successfully Updated.";
- }
- /**
- * update health history
- *
- */
- function doSaveEdit_hHis(){
- $id = $_GET['edit'];
- $sql_x = "select stud_applicant_id from student_health_history where stud_applicant_id = $id";
- $rsResult_x =$this->conn->Execute($sql_x);
- if ($rsResult_x->EOF){
- $flds = array();
- $flds[] = "stud_applicant_id={$id}";
- $fields=implode(", ",$flds);
- $sql_2 = "insert into student_health_history set $fields";
- $this->conn->Execute($sql_2);
- }
- $ser= serialize($this->Data);
- $sql = "update student_health_history set `studhhis_data`='{$ser}' where stud_applicant_id ={$id}";
- $this->conn->Execute($sql);
- $_SESSION['eMsg']="Successfully Updated.";
- }
- function doSaveEdit_Image($pData = array()){
- $id = $_GET['edit'];
- $flds = array();
- $valData=addslashes(file_get_contents($pData['ppd_picture']['tmp_name']));
- $flds[] = "ppd_picture='$valData'";
- if(!$this->isStudAppIDExistOnPhoto($id)){
- $flds[] = "stud_applicant_id=$id";
- $fields = implode(", ",$flds);
- $sql = "insert into student_applicant_photo set $fields ";
- }else{
- $fields = implode(", ",$flds);
- $sql = "update student_applicant_photo set $fields where stud_applicant_id=$id";
- }
- $this->conn->Execute($sql);
- $_SESSION['eMsg']="Successfully Updated.";
- }
- function isStudAppIDExistOnPhoto($stud_applicant_id_ = null) {
- if(is_null($stud_applicant_id_)) return false;
- $sql = "select stud_applicant_id from student_applicant_photo where stud_applicant_id=$stud_applicant_id_";
- $rsResult = $this->conn->Execute($sql);
- if(!$rsResult->EOF){
- return true;
- }
- return false;
- }
- /**
- * update1 health history
- *
- */
- function doSaveEdit1_hHis($pData = array()){
- $id = $_GET['edit'];
- $flds = array();
- $flds[] = "studhhis_height='".$pData['studhhis_height']."'";
- $flds[] = "studhhis_insurance='".$pData['studhhis_insurance']."'";
- $flds[] = "studhhis_family_doctor='".$pData['studhhis_family_doctor']."'";
- $flds[] = "studhhis_hospitalclinic_telno='".$pData['studhhis_hospitalclinic_telno']."'";
- $flds[] = "studhhis_blood_type='".$pData['studhhis_blood_type']."'";
- $fields=implode(", ",$flds);
- $sql = "update student_health_history set $fields where stud_applicant_id =$id";
- $this->conn->Execute($sql);
- $_SESSION['eMsg']="Successfully Updated.";
- }
- /**
- * Delete Record
- *
- * @param string $id_
- */
- function doDelete($id_ = ""){
- $sql = "delete from app_modules where mnu_id=?";
- $this->conn->Execute($sql,array($id_));
- $_SESSION['eMsg']="Successfully Deleted.";
- }
- /**
- * Get all the Table Listings
- *
- * @return array
- */
- function getTableList($sy_id = null, $level_id = null){
- // $sql = "select th_id
- // from dps_cashier_db.cashier_trans_detail
- // where td_desc like '%2013%'";
- //
- // $rsResult = $this->conn->Execute($sql);
- //
- // while(!$rsResult->EOF){
- // $sql_ = "update dps_cashier_db.cashier_trans_header set sy_id = '20' where th_id = '{$rsResult->fields['th_id']}'";
- // $this->conn->Execute($sql_);
- // $rsResult->MoveNext();
- // }
- // Process the query string and exclude querystring named "p"
- if (!empty($_SERVER['QUERY_STRING'])) {
- $qrystr = explode("&",$_SERVER['QUERY_STRING']);
- foreach ($qrystr as $value) {
- $qstr = explode("=",$value);
- if ($qstr[0]!="p") {
- $arrQryStr[] = implode("=",$qstr);
- }
- }
- $aQryStr = $arrQryStr;
- $aQryStr[] = "p=@@";
- $queryStr = implode("&",$aQryStr);
- }
- //bby: search module
- $qry = array();
- if (isset($_REQUEST['search_field'])) {
- // lets check if the search field has a value
- if (strlen($_REQUEST['search_field'])>0) {
- // lets assign the request value in a variable
- $search_field = $_REQUEST['search_field'];
- // create a custom criteria in an array
- $qry[] = "(ppd_studno like '%$search_field%' ||
- ppd_firstname like '%$search_field%' ||
- ppd_lastname like '%$search_field%' ||
- ppd_middlename like '%$search_field%' ||
- )
- ";
- }
- }
- if (isset($_GET['src_no']) || isset($_GET['src_lname']) || isset($_GET['src_fname'])) {
- // lets check if the search field has a value
- if ($_REQUEST['search_field']=="") {
- // lets assign the request value in a variable
- $src_sno = $_GET['src_sno'];
- $src_fname = $_GET['src_fname'];
- $src_lname = $_GET['src_lname'];
- // create a custom criteria in an array
- if ($src_sno!=""){
- $qry[] = "ppd_studno = '$src_sno'";
- }else{
- if(empty($src_lname) && empty($src_fname)){
- }
- elseif (empty($src_lname)){
- $qry[] = "
- ppd_firstname like '%$src_fname%'
- ";
- }
- elseif (empty($src_fname)){
- $qry[] = "
- ppd_lastname like '%$src_lname%'
- ";
- }else{
- $qry[] = "
- ppd_lastname like '%$src_lname%' &&
- ppd_firstname like '%$src_fname%'
- ";
- }
- }
- }
- }
- // put all query array into one criteria string
- if($_GET['male_'] == 1 and $_GET['female_'] != 1){
- $qry[] = "ppd_gender = 'M'";
- }else if($_GET['female_'] == 1 and $_GET['male_'] != 1){
- $qry[] = "ppd_gender = 'F'";
- }else{
- }
- // Sort field mapping
- $arrSortBy = array(
- "ppd_studno"=>"ppd_studno"
- ,"ppd_lastname"=>"ppd_lastname"
- ,"ppd_firstname"=>"ppd_firstname"
- ,"ppd_middlename"=>"ppd_middlename"
- ,"idlink"=>"idlink"
- );
- if(isset($_GET['sortby'])){
- $strOrderBy = " order by ".$arrSortBy[$_GET['sortby']]." ".$_GET['sortof'];
- }else{
- $strOrderBy = " order by am.ppd_lastname, am.ppd_firstname";
- }
- // Add Option for Image Links or Inline Form eg: Checkbox, Textbox, etc...
- $viewLink = "";
- $imgPhoto = "<img src=\"?statpos=studinfo&img=',am.stud_applicant_id,'\" border=0 width=\"53\" height=\"65.5\">";
- $editLink = "<a href=\"?statpos=studinfo&edit=',am.stud_applicant_id,'\"><img src=\"".SYSCONFIG_THEME_URLPATH.SYSCONFIG_THEME."/images/admin/edit.gif\" title=\"Edit\" hspace=\"2px\" border=0></a>";
- // $fetcherLink = "<a href=\"?statpos=studinfo&student_fetcher=',am.stud_applicant_id,'\"><img src=\"".SYSCONFIG_THEME_URLPATH.SYSCONFIG_THEME."/images/admin/info.png\" title=\"Edit\" hspace=\"2px\" border=0></a>";
- $idLinkF = "<a href=\"?statpos=studinfo&printid=',am.stud_applicant_id,'&f=1\"><img src=\"".SYSCONFIG_THEME_URLPATH.SYSCONFIG_THEME."/images/admin/print1.png\" title=\"Print ID Front\" hspace=\"2px\" border=0></a>";
- $idLinkB = "<a href=\"?statpos=studinfo&printid=',am.stud_applicant_id,'&f=0\"><img src=\"".SYSCONFIG_THEME_URLPATH.SYSCONFIG_THEME."/images/admin/print2.png\" title=\"Print ID Back\" hspace=\"2px\" border=0></a>";
- $IDinfoLink = "<a href=\"reports.php?statpos=printid&updateinfo=',am.stud_applicant_id,'\"><img src=\"".SYSCONFIG_THEME_URLPATH.SYSCONFIG_THEME."/images/admin/report_user.gif\" title=\"ID Info\" hspace=\"2px\" border=0></a>";
- // $delLink = "<a href=\"?statpos=studinfo&delete=',am.stud_applicant_id,'\" onclick=\"return confirm(\'Are you sure, you want to delete?\');\"><img src=\"".SYSCONFIG_THEME_URLPATH.SYSCONFIG_THEME."/images/admin/trash.gif\" title=\"Delete\" hspace=\"2px\" border=0></a>";
- // SqlAll Query
- $flds = array();
- $flds[] = "am.stud_applicant_id";
- $flds[] = "am.ppd_studno";
- $flds[] = "am.ppd_lastname";
- $flds[] = "am.ppd_firstname";
- $flds[] = "am.ppd_middlename";
- $flds[] = "am.ppd_guardian";
- $flds[] = "am.ppd_guardian_contact_num";
- $flds[] = "am.ppd_telcelno";
- $flds[] = "date_format(am.ppd_bday,'%m-%d-%Y') as ppd_bday";
- $flds[] = "am.ppd_guardian_contact_num";
- $flds[] = "am.ppd_gender";
- $flds[] = "am.rfid";
- $flds[] = "a1.studhhis_hospitalclinic_telno";
- $flds[] = "a1.studhhis_family_doctor";
- $flds[] = "a1.studhhis_insurance";
- $flds[] = "a1.studhhis_blood_type";
- $flds[] = "CONCAT('$idLinkF','$idLinkB') as idlink";
- $flds[] = "CONCAT('$imgPhoto') as imgphoto";
- $flds[] = "CONCAT('$editLink','$delLink', '$IDinfoLink', '$fetcherLink') as viewdata";
- $fields = implode(",", $flds);
- if($sy_id != null){
- // echo $sy_id;
- // echo 'may laman';
- $selected_table = clsRegistrarMisc::getSelected_Table($this->conn,$sy_id);
- $join_table = "inner join dps_registrar_db.file_permit_to_enroll_$selected_table c on c.stud_applicant_id = am.stud_applicant_id";
- if($level_id != null){
- // echo 'w';
- $qry[] = "c.stud_level_next = '$level_id'";
- }
- }
- $criteria = (count($qry)>0)?" where ".implode(" and ",$qry):"";
- // SqlAll Query
- $sql = "select $fields
- , CONCAT('$idLinkF','$idLinkB') as idlink
- , CONCAT('$imgPhoto') as imgphoto
- from dps_registrar_db.student_applicant_information am
- left join dps_registrar_db.student_health_history a1 on a1.stud_applicant_id = am.stud_applicant_id
- $join_table
- $criteria
- $strOrderBy";
- // Sql query for paginator list
- $sqlcount = "select count(*) as mycount from student_applicant_information $criteria";
- // Field and Table Header Mapping
- $arrFields = array(
- "imgphoto"=>" "
- ,"ppd_studno"=>"Student No."
- ,"ppd_lastname"=>"Last Name"
- ,"ppd_firstname"=>"First Name"
- ,"ppd_middlename"=>"M.I."
- ,"ppd_gender"=>"Gender"
- /*,"studhhis_blood_type"=>"Blood Type"
- ,"ppd_bday"=>"Birthday"
- ,"studhhis_hospitalclinic_telno"=>"HOSP./Clinic"
- ,"studhhis_family_doctor"=>"Fam. Doc."
- ,"studhhis_insurance"=>"Health Ins."
- ,"ppd_telcelno"=>"Tel/Cel No."
- */
- ,"ppd_guardian"=>"Parent/ Guardian"
- ,"ppd_guardian_contact_num"=>"P/G Contact No."
- ,"rfid"=>"RFID No"
- ,"idlink"=>"ID"
- ,"viewdata"=>" "
- );
- // Column (table data) User Defined Attributes
- $arrAttribs = array(
- "mnu_ord"=>" align='right'"
- ,"imgphoto"=>"width='55' align='center'"
- ,"idlink"=>"width='60' align='center'"
- ,"viewdata"=>"width='60' align='center'"
- );
- // Process the Table List
- $tblDisplayList = new clsTableList($this->conn);
- $tblDisplayList->tblBlock->templateFile = "table_nosearch.tpl.php";
- $tblDisplayList->arrFields = $arrFields;
- $tblDisplayList->paginator->linkPage = "?$queryStr";
- $tblDisplayList->sqlAll = $sql;
- $tblDisplayList->sqlCount = $sqlcount;
- return $tblDisplayList->getTableList($arrAttribs);
- }
- function doValidateData_Pdata($pData_ = array()){
- $isValid = true;
- // $isValid = false;
- return $isValid;
- }
- function CalcAge($birthday) { // YYYY-MM-DD
- $birthday = $birthday;
- list($BMonth, $BDay, $BYear)= explode('-', $birthday);
- $CYear = date('Y');
- $CMonth = date('m');
- $CDay = date('d');
- $age = 0;
- if (!empty($BYear) && $BYear < $CYear)
- {
- $age += $CYear - $BYear;
- }
- if (!empty($BMonth) && !empty($BDay))
- {
- $monthDiff = $CMonth - $BMonth;
- $dayDiff = $CDay - $BDay;
- if ($monthDiff < 0 || ($monthDiff == 0 && $dayDiff < 0))
- {
- $age -= 1;
- }
- }
- return $age;
- }
- // function CalcAge($birthday) {
- //
- // list($BMonth, $BDay, $BYear)= explode('-', $birthday);
- //
- //
- // $CYear = date('Y');
- // $CMonth = date('m');
- // $CDay = date('d');
- //
- // $age = 0;
- //
- // if (!empty($BYear) && $BYear < $CYear)
- // {
- // $age += $CYear - $BYear;
- // }
- //
- // if (!empty($BMonth) && !empty($BDay))
- // {
- // $monthDiff = $CMonth - $BMonth;
- // $dayDiff = $CDay - $BDay;
- //
- // if ($monthDiff < 0 || ($monthDiff == 0 && $dayDiff < 0))
- // {
- // $age -= 1;
- // }
- // }
- // return $age;
- // }
- function getTableList_AuditTrail($stud_id=null){
- // Process the query string and exclude querystring named "p"
- if (!empty($_SERVER['QUERY_STRING'])) {
- $qrystr = explode("&",$_SERVER['QUERY_STRING']);
- foreach ($qrystr as $value) {
- $qstr = explode("=",$value);
- if ($qstr[0]!="p") {
- $arrQryStr[] = implode("=",$qstr);
- }
- }
- $aQryStr = $arrQryStr;
- $aQryStr[] = "p=@@";
- $queryStr = implode("&",$aQryStr);
- }
- //bby: search module
- $qry = array();
- if (isset($_REQUEST['search_field'])) {
- // lets check if the search field has a value
- if (strlen($_REQUEST['search_field'])>0) {
- // lets assign the request value in a variable
- $search_field = $_REQUEST['search_field'];
- // create a custom criteria in an array
- $qry[] = "stud_applicant_id like '%$search_field%')";
- }
- }
- $qry[]="(a.trail_id=20 or a.trail_id = 80)";
- $qry[]="a.stud_applicant_id=$stud_id";
- // put all query array into one criteria string
- $criteria = (count($qry)>0)?" where ".implode(" and ",$qry):"";
- // Sort field mapping
- $arrSortBy = array(
- "fat_action_details"=>"fat_action_details"
- ,"modifier"=>"modifier"
- ,"fat_addwhen"=>"fat_addwhen"
- );
- if(isset($_GET['sortby'])){
- $strOrderBy = " order by ".$arrSortBy[$_GET['sortby']]." ".$_GET['sortof'];
- }else{
- $strOrderBy = " order by a.fat_id DESC";
- }
- //$viewLink = "<a href=\"?statpos=applicant_information&edit=',am.stud_applicant_id,'\"><img src=\"".SYSCONFIG_THEME_URLPATH.SYSCONFIG_THEME."/images/admin/zoom.gif\" title=\"view\" hspace=\"2px\" border=0></a>";
- //$editLink = "<a href=\"?statpos=applicant_information&edit=',am.sai_admission_id,'\"><img src=\"".SYSCONFIG_THEME_URLPATH.SYSCONFIG_THEME."/images/admin/edit.gif\" title=\"Edit\" hspace=\"2px\" border=0></a>";
- $editLink = "<a href=\"?statpos=applicant_information&addreturnee=',sappi.stud_applicant_id,'\"><img src=\"".SYSCONFIG_THEME_URLPATH.SYSCONFIG_THEME."/images/admin/edit.gif\" title=\"Edit\" hspace=\"2px\" border=0></a>";
- //$delLink = "<a href=\"?statpos=applicant_information&delete=',am.sai_id,'\" onclick=\"return confirm(\'Are you sure, you want to delete?\');\"><img src=\"".SYSCONFIG_THEME_URLPATH.SYSCONFIG_THEME."/images/admin/trash.gif\" title=\"Delete\" hspace=\"2px\" border=0></a>";
- // SqlAll Query
- $sql = "select a.fat_action_details,date_format(a.fat_addwhen,'%b. %d, %Y %h:%i %p') as fat_addwhen, CONCAT(hep.pi_firstname,' ',hep.pi_lastname) as fullname, b.user_fullname
- from file_admission_trailings a
- left join dps_hris_db.hris_emp_pinfo_master_rel hp
- on hp.emp_id=a.fat_modified_by
- left join dps_hris_db.hris_emp_personalinfo hep
- on hep.pi_id=hp.pi_id
- left join dps_hris_db.app_users b
- on b.user_name=a.fat_addwho
- $criteria
- $strOrderBy";
- // Sql query for paginator list
- // $sqlcount = "select count(*) as mycount from student_admission_info
- // $criteria";
- $sqlcount = "select count(*)
- from file_admission_trailings
- $criteria";
- // Field and Table Header Mapping
- $arrFields = array(
- "fat_action_details"=>"Action Details"
- ,"user_fullname"=>"Modified by"
- ,"fat_addwhen"=>"Date/Time"
- );
- // Column (table data) User Defined Attributes
- $arrAttribs = array(
- /*"mnu_ord"=>" align='right'",*/
- "viewdata"=>"width='50' align='center'"
- );
- // Process the Table List
- $tblDisplayList = new clsTableList($this->conn);
- $tblDisplayList->arrFields = $arrFields;
- $tblDisplayList->paginator->linkPage = "?$queryStr";
- $tblDisplayList->sqlAll = $sql;
- $tblDisplayList->sqlCount = $sqlcount;
- return $tblDisplayList->getTableList($arrAttribs);
- }
- function doValidate_Personal_Data($pData_ = array()){
- $isValid = true;
- if(empty($pData_['ppd_lastname'])) {
- $_SESSION['eMsg'][]="Enter Last Name";
- $isValid = false;
- }
- if(empty($pData_['ppd_firstname'])) {
- $_SESSION['eMsg'][]="Enter First Name.";
- $isValid = false;
- }
- if (empty($pData_['ppd_gender'])){
- $isValid = false;
- $_SESSION['eMsg'][]="Select Gender";
- }
- if (empty($pData_['ppd_bday'])){
- $isValid = false;
- $_SESSION['eMsg'][]="Enter Birthday";
- }
- // Required Current Address ----> DPS-COD-T0019
- if (empty($pData_['ppd_paddress1'])){
- $isValid = false;
- $_SESSION['eMsg'][]="Enter Permanent Unit / House No.";
- }
- if (empty($pData_['ppd_paddress2'])){
- $isValid = false;
- $_SESSION['eMsg'][]="Enter Permanent Street .";
- }
- if (empty($pData_['ppd_paddress3'])){
- $isValid = false;
- $_SESSION['eMsg'][]="Enter Permanent Brgy. / Subdivision";
- }
- if (empty($pData_['ppd_paddress4'])){
- $isValid = false;
- $_SESSION['eMsg'][]="Enter Permanent District Municipality";
- }
- if (empty($pData_['ppd_paddress5'])){
- $isValid = false;
- $_SESSION['eMsg'][]="Enter Permanent City / Province";
- }
- if (empty($pData_['ppd_guardian'])){
- $isValid = false;
- $_SESSION['eMsg'][]="Please fill in Person / Legal Guardian";
- }
- if (empty($pData_['ppd_guardian_address'])){
- $isValid = false;
- $_SESSION['eMsg'][]="Enter Guardian Address";
- }
- if (empty($pData_['ppd_guardian_contact_num'])){
- $isValid = false;
- $_SESSION['eMsg'][]="Please fill in Contact no.";
- }
- return $isValid;
- }
- function doValidate_Family_Background($pData_ = array()){
- $isValid = true;
- if (empty($pData_['studfambg_fathersname'])){
- $isValid = false;
- $_SESSION['eMsg'][]="Enter Father's First Name";
- }
- if (empty($pData_['studfambg_fatherslastname'])){
- $isValid = false;
- $_SESSION['eMsg'][]="Enter Father's Last Name";
- }
- if (empty($pData_['studfambg_mothersmaidenname'])){
- $isValid = false;
- $_SESSION['eMsg'][]="Enter Mother's Maiden Name";
- }
- if (empty($pData_['studfambg_mothersname'])){
- $isValid = false;
- $_SESSION['eMsg'][]="Enter Mother's First Name";
- }
- return $isValid;
- }
- function doValidate_School_History($pData_ = array()){
- $isValid = true;
- return $isValid;
- }
- function doValidate_Health_History($pData_ = array()){
- $isValid = true;
- return $isValid;
- }
- function Return_Data($pData_ = array()){
- //returns Personal Information Data
- if(count($pData_['sibling_name'])>0){
- end($pData_['sibling_name']);
- $key = key($pData_['sibling_name']) + 1;
- $y = 0;
- while($key > $y){
- $oData['familyMem'][$y]['name'] = $pData_['sibling_name'][$y];
- $oData['familyMem'][$y]['birthday'] = $pData_['sibling_birthday'][$y];
- $oData['familyMem'][$y]['age'] = $pData_['sibling_age'][$y];
- $oData['familyMem'][$y]['grd_yr_lvl'] = $pData_['sibling_grade_level'][$y];
- $oData['familyMem'][$y]['school'] = $pData_['sibling_school_name'][$y];
- $y++;
- }
- }
- //return Personal Data (Other Information)
- $oData['otherInfo']['birthplace'] = $pData_['ppd_bdayplace'];
- $oData['otherInfo']['siblingcount'] = $pData_['ppd_numsiblingcount'];
- $oData['otherInfo']['birthorder'] = $pData_['ppd_birthorder'];
- $oData['otherInfo']['childstatus'] = $pData_['ppd_appchildstatus'];
- $oData['otherInfo']['language'] = $pData_['ppd_dialect'];
- $oData['otherInfo']['talent_skills'] = $pData_['ppd_talents'];
- $oData['otherInfo']['hobbiesNinterest'] = $pData_['ppd_hobbies'];
- //return Other Family Data
- if(count($pData_['othfamily_name'])>0){
- end($pData_['othfamily_name']);
- $othfam = key($pData_['othfamily_name']) + 1;
- $y = 0;
- while($othfam > $y){
- $oData['otherMemb'][$y]['othfamily_name'] = $pData_['othfamily_name'][$y];
- $oData['otherMemb'][$y]['othfamily_relationship'] = $pData_['othfamily_relationship'][$y];
- $oData['otherMemb'][$y]['othfamily_age'] = $pData_['othfamily_age'][$y];
- $oData['otherMemb'][$y]['othfamily_level'] = $pData_['othfamily_level'][$y];
- $oData['otherMemb'][$y]['othfamily_company'] = $pData_['sibling_school_name'][$y];
- $y++;
- }
- }
- //Return School History Data
- if(count($pData_['schistory_lvl'])>0){
- end($pData_['schistory_lvl']);
- $sch_his = key($pData_['schistory_lvl']) + 1;
- $y = 0;
- while($sch_his > $y){
- $oData['schoolHis'][$y]['lvl'] = $pData_['schistory_lvl'][$y];
- $oData['schoolHis'][$y]['school'] = $pData_['schistory_school'][$y];
- $oData['schoolHis'][$y]['schooladd'] = $pData_['schistory_schooladdress'][$y];
- $oData['schoolHis'][$y]['from'] = $pData_['schistory_yrsFrom'][$y];
- $oData['schoolHis'][$y]['to'] = $pData_['schistory_yearsTo'][$y];
- $oData['schoolHis'][$y]['honors'] = $pData_['schistory_honors'][$y];
- $oData['schoolHis'][$y]['honorsYr'] = $pData_['schistory_honorsYear'][$y];
- $oData['schoolHis'][$y]['sCOurseSwitch'] = $pData_['schistory_specialCourseRadio'];
- $oData['schoolHis'][$y]['sCOurse'] = $pData_['schistory_specialCourse'][$y];
- $oData['schoolHis'][$y]['sCOurseYear'] = $pData_['schistory_specialCourseYear'][$y];
- $oData['schoolHis'][$y]['summerClassSwitch'] = $pData_['schistory_summerClassesRadio'];
- $oData['schoolHis'][$y]['summerClass'] = $pData_['schistory_summerClasses'][$y];
- $oData['schoolHis'][$y]['summerClassYear'] = $pData_['schistory_summerClassesYear'][$y];
- $oData['schoolHis'][$y]['failedSubjectSwitch'] = $pData_['schistory_failedSubjectRadio'];
- $oData['schoolHis'][$y]['failedSubject'] = $pData_['schistory_failedSubject'][$y];
- $oData['schoolHis'][$y]['failedSubject'] = $pData_['failedSubjectYear'][$y];
- $oData['schoolHis'][$y]['repeatedSwitch'] = $pData_['schistory_repeatedRadio'];
- $oData['schoolHis'][$y]['repeated'] = $pData_['schistory_repeated'][$y];
- $oData['schoolHis'][$y]['repeatedYear'] = $pData_['schistory_repeatedYear'][$y];
- $oData['schoolHis'][$y]['prevSchoolFrom'] = $pData_['transferee_prev_school_from'];
- $oData['schoolHis'][$y]['prevSchoolTo'] = $pData_['transferee_prev_school_to'];
- $oData['schoolHis'][$y]['transfereeReason1'] = $pData_['transferee_reason1'];
- $oData['schoolHis'][$y]['prevSchoolFrom1'] = $pData_['transferee_prev_school_from1'];
- $oData['schoolHis'][$y]['prevSchoolTo1'] = $pData_['transferee_prev_school_to1'];
- $oData['schoolHis'][$y]['transfereeReason2'] = $pData_['transferee_reason2'];
- $oData['schoolHis'][$y]['transferee_disciplinary'] = $pData_['transferee_disciplinary'];
- $y++;
- }
- }
- //Return Health History Data
- $oData['healthHis']['health_weight'] = $pData_['health_weight'];
- $oData['healthHis']['health_eyesight'] = $pData_['health_eyesight'];
- $oData['healthHis']['health_hearing'] = $pData_['health_hearing'];
- $oData['healthHis']['health_allergies'] = $pData_['health_allergies'];
- $oData['healthHis']['health_immunizations'] = $pData_['health_immunizations'];
- $oData['healthHis']['health_speech_difficulties'] = $pData_['health_speech_difficulties'];
- $oData['healthHis']['health_childhood_diseases'] = $pData_['health_childhood_diseases'];
- $oData['healthHis']['medicalcondition'] = $pData_['medicalcondition'];
- $oData['healthHis']['health_handycap'] = $pData_['health_handycap'];
- return $oData;
- }
- function doValidateData_Studno($pData_ = array()){
- $isValid = true;
- $sql_check = "select * from dps_registrar_db.student_applicant_information where ppd_studno = '{$pData_['ppd_studno']}'";
- $rsResult_check = $this->conn->Execute($sql_check);
- if (!$rsResult_check->EOF){
- $isValid = false;
- $_SESSION['eMsg'][]="Student Number Already been Used by Other Student";
- }
- return $isValid;
- }
- function doSaveEdit_Studno($pData_ = array(),$id = null){
- $sql = "update student_applicant_information set ppd_studno = '{$pData_['ppd_studno']}' where stud_applicant_id=$id";
- $this->conn->Execute($sql);
- $_SESSION['eMsg']="Successfully Updated.";
- }
- function getListReqSubmitted($dbconn = null, $sy_id = null, $id_ = null){
- $selected_table = clsRegistrarMisc::getSelected_Table($dbconn,$sy_id);
- $sql = "select *
- from file_applicant_submitted_reqt_header_$selected_table a
- inner join file_applicant_submitted_reqt_$selected_table b on (a.asubreqh_id = b.asubreqh_id)
- inner join file_requirements c on (b.requirements_id = c.requirements_id)
- where a.stud_applicant_id=?";
- $rsResult = $this->conn->Execute($sql,$id_);
- while(!$rsResult->EOF){
- $arrData[] = $rsResult->fields;
- $rsResult->MoveNext();
- }
- // printa($arrData);
- return $arrData;
- }
- function doSaveEdit_Req($dbconn = null, $sy_id = null, $arrData = array()){
- $selected_table = clsRegistrarMisc::getSelected_Table($dbconn,$sy_id);
- $qry = array();
- $qry[] = "a.stud_applicant_id = '{$arrData['stud_applicant_id']}'";
- $criteria = (count($qry)>0)?" where ".implode(" and ",$qry):"";
- $sql = "select *
- from dps_registrar_db.file_applicant_submitted_reqt_header_$selected_table a
- inner join dps_registrar_db.file_applicant_submitted_reqt_$selected_table b on b.asubreqh_id = a.asubreqh_id
- $criteria
- ";
- $rsResult = $this->conn->Execute($sql);
- while(!$rsResult->EOF){
- for($x = 0; count($arrData['asubreq_requirements'])>$x; $x++){
- $qry = array();
- $qry[] = "a.stud_applicant_id = '{$arrData['stud_applicant_id']}'";
- $qry[] = "b.requirements_id= '{$arrData['asubreq_requirements'][$x]['requirements_id']}'";
- $criteria = (count($qry)>0)?" where ".implode(" and ",$qry):"";
- $sql_ = "select *
- from dps_registrar_db.file_applicant_submitted_reqt_header_$selected_table a
- inner join dps_registrar_db.file_applicant_submitted_reqt_$selected_table b on b.asubreqh_id = a.asubreqh_id
- $criteria
- ";
- $rsResult_ = $this->conn->Execute($sql_);
- $flds = array();
- $flds[] = "asubreq_status = '20'";
- $flds[] = "requirements_id = '{$arrData['asubreq_requirements'][$x]['requirements_id']}'";
- if(!$rsResult_->EOF){
- $flds[] = "asubreq_updatewho = '{$_SESSION['admin_session_obj']['user_data']['user_fullname']}'";
- $flds[] = "asubreq_updatewhen = now()";
- $fields = implode(",",$flds);
- $update = "update dps_registrar_db.file_applicant_submitted_reqt_$selected_table set $fields
- where asubreqh_id = '{$rsResult->fields['asubreqh_id']}'
- and requirements_id = '{$arrData['asubreq_requirements'][$x]['requirements_id']}'";
- $this->conn->Execute($update);
- }else{
- $flds[] = "asubreqh_id = '{$rsResult->fields['asubreqh_id']}'";
- $flds[] = "asubreq_addwho = '{$_SESSION['admin_session_obj']['user_data']['user_fullname']}'";
- $fields = implode(",",$flds);
- $insert = "insert into dps_registrar_db.file_applicant_submitted_reqt_$selected_table set $fields";
- $this->conn->Execute($insert);
- }
- }
- $rsResult->MoveNext();
- }
- }
- function check_permit($dbconn = null, $sy_id = null, $stud_applicant_id = null){
- $selected_table = clsRegistrarMisc::getSelected_Table($dbconn,$sy_id);
- $prev_table = clsRegistrarMisc::getSelected_Table($dbconn, $_SESSION['admin_session_obj']['syprevinfo']['sy_id']);
- $sql = "select ga_fg from dps_grade_db.grd_gen_average_fg_$prev_table where stud_applicant_id = '$stud_applicant_id'";
- $rsResult = $this->conn->Execute($sql);
- if(!$rsResult->EOF){
- $stud_grade = $rsResult->fields['ga_fg'];
- }
- $flds = array();
- $flds[] = "a.stud_applicant_id";
- $flds[] = "b.pte_issueddate";
- $flds[] = "b.pte_noofchildren_enrolled";
- $flds[] = "b.stud_level_prev";
- $flds[] = "if(isnull(b.stud_level_next),concat(c.yl_id),concat(b.stud_level_next)) as stud_level_next";
- $flds[] = "if(isnull(b.pte_general_ave),concat('$stud_grade'),concat(b.pte_general_ave)) as stud_grade";
- $flds[] = "CONCAT(h.pi_firstname,' ',h.pi_lastname) as issuer";
- $flds[] = "b.pte_status";
- $fields = implode(",",$flds);
- $sql = "select $fields
- from dps_registrar_db.student_applicant_information a
- left join dps_registrar_db.file_permit_to_enroll_$selected_table b on b.stud_applicant_id = a.stud_applicant_id
- left join dps_registrar_db.student_admission_info_$selected_table c on c.stud_applicant_id = a.stud_applicant_id
- left join dps_registrar_db.file_gradeyearlevel_$selected_table d on d.yl_id = b.stud_level_next
- left join dps_registrar_db.file_schoolyear e on e.sy_id = b.sy_id
- /*to get info of issuer of permit*/
- left join dps_hris_db.hris_emp_masterfile f on (f.emp_id = b.pte_issuedby)
- left join dps_hris_db.hris_emp_pinfo_master_rel g on (g.emp_id = f.emp_id)
- left join dps_hris_db.hris_emp_personalinfo h on (h.pi_id = g.pi_id)
- where a.stud_applicant_id = '$stud_applicant_id'
- order by pte_id DESC
- ";
- $rsResult = $this->conn->Execute($sql);
- if(!$rsResult->EOF){
- return $rsResult = $rsResult->fields;
- }
- }
- function doSaveEdit_Permit($dbconn = null, $sy_id = null, $arrData = array()){
- $stud_applicant_id = $_GET['edit'];
- $selected_table = clsRegistrarMisc::getSelected_Table($dbconn,$sy_id);
- $sql = "select *
- from dps_registrar_db.file_permit_to_enroll_$selected_table
- where stud_applicant_id = '$stud_applicant_id'";
- $rsResult = $this->conn->Execute($sql);
- $flds = array();
- if(!$rsResult->EOF){
- $flds[] = "sy_id = '$sy_id'";
- $flds[] = "stud_level_prev = '{$arrData['stud_level_prev']}'";
- $flds[] = "stud_level_next = '{$arrData['stud_level_next']}'";
- $flds[] = "pte_general_ave = '{$arrData['stud_grade']}'";
- $flds[] = "pte_status = '{$arrData['pte_status']}'";
- $flds[] = "pte_updatewho = '".AppUser::getData('user_name')."'";
- $flds[] = "pte_issuedby_name = '".AppUser::getData('user_name')."'";
- $flds[] = "pte_updatewhen = now()";
- $fields = implode(", ",$flds);
- $sql = "update dps_registrar_db.file_permit_to_enroll_$selected_table set $fields where stud_applicant_id = '$stud_applicant_id'";
- $this->conn->Execute($sql);
- $this->Update_Permit($dbconn, $sy_id, $stud_applicant_id);
- $flds = array();
- $flds[] = "yl_id = '{$arrData['stud_level_next']}'";
- $flds[] = "sai_lastgyattended = '{$arrData['stud_level_prev']}'";
- $fields = implode(",",$flds);
- $sql = "update dps_registrar_db.student_admission_info_$selected_table set $fields where stud_applicant_id = '$stud_applicant_id'";
- $this->conn->Execute($sql);
- }else{
- $flds[] = "stud_applicant_id = '$stud_applicant_id'";
- $flds[] = "sy_id = '$sy_id'";
- $flds[] = "stud_level_prev = '{$arrData['stud_level_prev']}'";
- $flds[] = "stud_level_next = '{$arrData['stud_level_next']}'";
- $flds[] = "pte_general_ave = '{$arrData['stud_grade']}'";
- $flds[] = "pte_status = '{$arrData['pte_status']}'";
- $flds[] = "pte_issuedby = '".AppUser::getData('emp_id')."'";
- $flds[] = "pte_issuedby_name = '".AppUser::getData('user_name')."'";
- $flds[] = "pte_issueddate = '".date('Y-m-d')."'";
- $fields = implode(", ",$flds);
- $sql = "insert into dps_registrar_db.file_permit_to_enroll_$selected_table set $fields";
- $this->conn->Execute($sql);
- $this->Update_Permit($dbconn, $sy_id, $stud_applicant_id);
- }
- /// code for trailings added nov. 17 2009 : dps commonwealth DPS � COD � T0019
- if($arrData['pte_status']==20){
- $act=", Marked as final";
- }
- $action="Edited file permit to enroll $act";
- clsRegistrarMisc::doSaveTrails($dbconn,$stud_applicant_id,$action,20);
- }
- function Update_Permit($dbconn = null, $sy_id = null, $stud_applicant_id = null){
- $selected_table = clsRegistrarMisc::getSelected_Table($dbconn,$sy_id);
- $qry = array();
- if($stud_applicant_id != ''){
- $qry[] = "a.stud_applicant_id = '$stud_applicant_id'";
- }
- $criteria = (count($qry)>0)?" where ".implode(" and ",$qry):"";
- $sql = "select a.stud_applicant_id, b.studenrol_status
- from dps_registrar_db.file_permit_to_enroll_$selected_table a
- left join dps_registrar_db.file_student_enrolled_$selected_table b on b.stud_applicant_id = a.stud_applicant_id
- $criteria";
- $rsResult = $this->conn->Execute($sql);
- while(!$rsResult->EOF){
- $qry = array();
- $qry[] = "a.sy_id = $sy_id";
- $qry[] = "a.stud_applicant_id = {$rsResult->fields['stud_applicant_id']}";
- $qry[] = "(c.ori_name like '%Tuition Fee%' or c.ori_name like '%Reservation Fee%')";
- $criteria = (count($qry)>0)?" where ".implode(" and ",$qry):"";
- $sql_cashier = "select th_ornumber,th_or_amount,th_trandate,stud_applicant_id
- from dps_cashier_db.cashier_trans_header a
- inner join dps_cashier_db.cashier_trans_detail b on b.th_id = a.th_id
- inner join dps_cashier_db.cashier_or_items c on c.ori_id = b.ori_id
- $criteria
- ";
- $rsResult_cashier = $this->conn->Execute($sql_cashier);
- if(!$rsResult_cashier->EOF){
- $flds = array();
- $flds[] = "yl_id = {$rsResult->fields['stud_level_next']}";
- $flds[] = "stud_applicant_id = '{$rsResult->fields['stud_applicant_id']}'";
- $flds[] = "studenrol_orno = '{$rsResult_cashier->fields['th_ornumber']}'";
- $flds[] = "studenrol_amount = {$rsResult_cashier->fields['th_or_amount']}";
- $flds[] = "studenrol_datepaid = '{$rsResult_cashier->fields['th_trandate']}'";
- $flds[] = "studenrol_addwho = '{$_SESSION['admin_session_obj']['user_name']}'";
- $flds[] = "studenrol_status = 20";
- $flds[] = "fse_remarks = 'Automate Tagging - Backend'";
- $fields = implode(",",$flds);
- }
- if($rsResult->fields['studenrol_status'] == null){
- $insert_permit = "insert into dps_registrar_db.file_student_enrolled_$selected_table set $fields";
- $this->conn->Execute($insert_permit);
- }else if ($rsResult->fields['studenrol_status'] != 20){
- $update_permit = "update dps_registrar_db.file_student_enrolled_$selected_table set $fields where stud_applicant_id = '{$rsResult->fields['stud_applicant_id']}'";
- $this->conn->Execute($update_permit);
- }
- $rsResult->MoveNext();
- }
- }
- function generate_studno($dbconn = null, $sy_id = null, $stud_applicant_id = null){
- $selected_table = clsRegistrarMisc::getSelected_Table($dbconn,$sy_id);
- $sql = "select ppd_studno
- from dps_registrar_db.student_applicant_information
- where stud_applicant_id = '$stud_applicant_id'";
- $rsResult = $this->conn->Execute($sql);
- if(!$rsResult->EOF){
- if(is_null($rsResult->fields['ppd_studno'])){
- $flds = array();
- $flds[] = "stud_applicant_id = '$stud_applicant_id'";
- $flds[] = "ab_id = '{$_SESSION['admin_session_obj']['ab_id']}'";
- $flds[] = "sy_id = '$sy_id'";
- $flds[] = "sn_addwho = '".AppUser::getData('user_name')."'";
- $flds[] = "sn_status = 10";
- $fields = implode(",",$flds);
- $insert = "insert into file_student_no_$selected_table set $fields";
- $this->conn->Execute($insert);
- $id = $this->conn->Insert_ID();
- $sql_ = "select sy_abbr from dps_registrar_db.file_schoolyear where sy_id = '$sy_id'";
- $rsResult_ = $this->conn->Execute($sql_);
- if(!$rsResult_->EOF){
- $year_code = $rsResult_->fields['sy_abbr'];
- }
- $strpadded = str_pad($id,4,0,STR_PAD_LEFT);
- $ppd_studno = "$year_code$strpadded";
- $ppd_studno_printid = "$year_code-$strpadded";
- $sql = "update file_student_no_$selected_table set sn_no = '$ppd_studno' where stud_applicant_id = '$stud_applicant_id' and sn_status = 10";
- $this->conn->Execute($sql);
- $sql = "update student_applicant_information set ppd_studno = '$ppd_studno',ppd_studno_printid = '$ppd_studno_printid' where stud_applicant_id = '$stud_applicant_id'";
- $this->conn->Execute($sql);
- }
- }
- }
- function generate_user(){
- $sql = "select a.stud_applicant_id,a.ppd_studno, concat(a.ppd_lastname,' ',a.ppd_firstname) as student_name, c.yl_name, d.section_name
- from dps_registrar_db.student_applicant_information a
- inner join dps_registrar_db.file_sectioning_details_{$this->getCurrentSy()} b on b.fs_stud_applicant_id = a.stud_applicant_id
- inner join dps_registrar_db.file_gradeyearlevel_{$this->getCurrentSy()} c on c.yl_id = b.fs_yl_id
- inner join dps_registrar_db.file_section_{$this->getCurrentSy()} d on d.section_id = b.fs_sec_id
- where b.fs_yl_id in (1,2,3,4,5,6)
- order by b.fs_yl_id,d.section_name,a.ppd_lastname, a.ppd_firstname
- ";
- $rsResult = $this->conn->Execute($sql);
- $arrResult = array();
- while(!$rsResult->EOF){
- $arrResult[] = $rsResult->fields;
- $rsResult->MoveNext();
- }
- return $arrResult;
- }
- function getStud_Info($dbconn = null, $sy_id = null, $stud_applicant_id = null){
- $selected_table = clsRegistrarMisc::getSelected_Table($dbconn,$sy_id);
- $flds = array();
- $flds[] = "a.stud_applicant_id";
- $flds[] = "a.ppd_studno";
- $flds[] = "a.ppd_lastname";
- $flds[] = "a.ppd_firstname";
- $flds[] = "a.ppd_middlename";
- // $flds[] = "fetcher_lname";
- // $flds[] = "fetcher_fname";
- $fields = implode(",", $flds);
- $qry = array();
- $qry[] = "a.stud_applicant_id = '$stud_applicant_id'";
- if(isset($_GET['fetcher_id'])){
- // $qry[] = "f.id = '{$_GET['fetcher_id']}'";
- }
- $criteria = (count($qry)>0)?" where ".implode(" and ",$qry):"";
- $sql = "select $fields
- from dps_registrar_db.student_applicant_information a
- left join dps_registrar_db.student_health_history a1 on a1.stud_applicant_id = a.stud_applicant_id
- left join dps_registrar_db.file_sectioning_details_$selected_table b on a.stud_applicant_id = b.fs_stud_applicant_id
- left join dps_registrar_db.file_gradeyearlevel_$selected_table c on c.yl_id = b.fs_yl_id
- left join dps_registrar_db.file_section_$selected_table d on d.section_id = b.fs_sec_id
- left join dps_registrar_db.file_schoolyear e on e.sy_id = c.sy_id
- /*left join dps_registrar_db.fetcher_info f on f.stud_applicant_id = a.stud_applicant_id*/
- $criteria";
- $rsResult = $this->conn->Execute($sql);
- if (!$rsResult->EOF){
- return $rsResult = $rsResult->fields;
- }
- }
- function doSave_fetcher($pData = null){
- $flds = array();
- foreach ($pData as $key => $value){
- $value = trim($value);
- $value = addslashes($value);
- if($key == 'save' or $key == 'saveaddnew'){
- }else{
- $flds[] = "$key = '$value'";
- }
- }
- $flds[] = "stud_applicant_id = {$_GET['student_fetcher']}";
- $fields = implode(",",$flds);
- if(isset($_GET['fetcher_id'])){
- $command = "update dps_registrar_db.fetcher_info set $fields where id = {$_GET['fetcher_id']}";
- }else{
- $command = "insert into dps_registrar_db.fetcher_info set $fields";
- }
- $this->conn->Execute($command);
- $_SESSION['eMsg'] = "Fetcher Information Successfully Saved";
- }
- function getFetcher_info($id = null){
- $sql = "select b.*
- from dps_registrar_db.student_applicant_information a
- inner join dps_registrar_db.fetcher_info b on b.stud_applicant_id = a.stud_applicant_id
- where id = '$id'
- ";
- $rsResult = $this->conn->Execute($sql);
- if(!$rsResult->EOF){
- $rsResult = $rsResult->fields;
- }
- return $rsResult;
- }
- function getFetcher_List($id = null){
- $sql = "select b.*
- from dps_registrar_db.student_applicant_information a
- inner join dps_registrar_db.fetcher_info b on b.stud_applicant_id = a.stud_applicant_id
- ";
- $rsResult = $this->conn->Execute($sql);
- $arrResult = array();
- while(!$rsResult->EOF){
- $arrResult[] = $rsResult->fields;
- $rsResult->MoveNext();
- }
- return $arrResult;
- }
- function delete_fetcher($id = null){
- $command = "delete from dps_registrar_db.fetcher_info where id = '$id'";
- $this->conn->Execute($command);
- $_SESSION['eMsg'] = "Fetcher Successfully Deleted";
- }
- function getCurrentSy () {
- $str_date = str_replace("-", "_", $_SESSION['current_sy']);
- return $str_date;
- }
- //TODO get the student if details if his/her college | done
- //TODO get student course
- //TODO get semester
- //TODO get student by year
- //TODO get block by semester and by course
- //TODO store block in to databse student id, course, sem year
- function determineIfcollegeIsValid($college_student_id){
- $isValid = true;
- $sql = "SELECT cc_student_id FROM college_student_course_headers WHERE cc_student_id = '$college_student_id'";
- $collegeArrayDetails = $this->conn->Execute($sql);
- foreach ($collegeArrayDetails as $value){
- $is_college_data = $value['cc_student_id'];
- }
- if(empty($is_college_data)){
- $isValid = false;
- }
- return $isValid;
- }
- function getStudentCourse($college_student_id) {
- $sql = "SELECT * FROM college_student_course_headers WHERE cc_student_id='$college_student_id'";
- $dataArray = $this->conn->Execute($sql);
- foreach ($dataArray as $value){
- //$course_details[] = array(
- /*'student_id'=>$value['cc_student_id'],*/
- //'student_course'=>$value['cc_student_course'],
- //'student_track'=>$value['cc_student_track'],
- //'student_strand'=>$value['cc_student_strand']
- //);
- $course_details = $value['cc_student_course'];
- }
- return $course_details;
- }
- function getSemDetails(){
- $sql = "SELECT * FROM college_semester";
- $dataArray = $this->conn->Execute($sql);
- foreach ($dataArray as $value){
- $semester_details[] = array(
- 'semester_name'=>$value['cs_name'],
- 'semester_id'=>$value['cs_id']
- );
- }
- return $semester_details;
- }
- function getBlockPerSemesterAndCourse($course_id, $year_level_id, $semester_id){
- //noted get the profer year level id
- $sql = "SELECT * FROM college_course_block WHERE cc_id = '$course_id' AND yl_id = '$year_level_id' AND csm_id ='$semester_id'";
- $dataArray = $this->conn->Execute($sql);
- foreach ($dataArray as $value){
- $block_details[] = array(
- 'college_block_id'=>$value['ccb_id'],
- 'college_block_shortname'=>$value['ccb_shortname'],
- 'college_block_name'=>$value['ccb_name']
- );
- }
- return $block_details;
- }
- function getYearLevelId($college_student_id){
- $sql = "SELECT * FROM college_student_course_headers WHERE cc_student_id=$college_student_id";
- $dataArray = $this->conn->Execute($sql);
- foreach ($dataArray as $value){
- $year_level_id_details =$value['yl_id'];
- }
- return $year_level_id_details;
- }
- //get all subjects base asign
- function getSubjectData(){
- //cs_id is to get the schedule
- $sql = "SELECT subjname_shortname,subjname_name,cs_unit,cs_id,cs_subject_id FROM college_subjects cs
- INNER JOIN dps_registrar_db.file_subject_name fsn on fsn.subjname_id = cs.cs_subject_id";
- $rsResult = $this->conn->Execute($sql);
- foreach ($rsResult as $value){
- $subjectDetails[] = array(
- 'cs_id' => $value['cs_id'],
- 'cs_subject_id' => $value['cs_subject_id'],
- 'subjname_shortname'=> $value['subjname_shortname'],
- 'subjname_name'=> $value['subjname_name'],
- 'cs_unit'=> $value['cs_unit'],
- 'sched'=> $this->getScheduleAll($value['cs_id'])
- );
- }
- return $subjectDetails;
- }
- function getScheduleAll($college_subject_id){
- $sql = "SELECT * FROM college_subject_schedule css
- INNER JOIN dps_hris_db.hris_emp_personalinfo hep on hep.pi_id = css.college_professor_id
- INNER JOIN file_building fb on fb.bldg_id = css.college_room_id
- WHERE college_subject_id =$college_subject_id";
- $rsResult = $this->conn->Execute($sql);
- foreach ($rsResult as $value) {
- $temp = json_decode($value['college_day'],true);
- if($temp[0]['sunday']==0){
- $temp_days_sunday = $temp[0]['sunday']='';
- } else {
- $temp_days_sunday = $temp[0]['sunday']='Sun';
- }
- if($temp[0]['monday']==0){
- $temp_days_monday = $temp[0]['monday']='';
- } else {
- $temp_days_monday = $temp[0]['monday']='M';
- }
- if($temp[0]['tuesday']==0){
- $temp_days_tuesday = $temp[0]['tuesday']='';
- } else {
- $temp_days_tuesday = $temp[0]['tuesday']='T';
- }
- if($temp[0]['wednesday']==0){
- $temp_days_wendsday = $temp[0]['wednesday']='';
- } else {
- $temp_days_wendsday = $temp[0]['wednesday']='W';
- }
- if($temp[0]['thursday']==0){
- $temp_days_thursday = $temp[0]['thursday']='';
- } else {
- $temp_days_thursday = $temp[0]['thursday']='TH';
- }
- if($temp[0]['friday']==0){
- $temp_days_friday = $temp[0]['friday']='';
- } else {
- $temp_days_friday = $temp[0]['friday']='F';
- }
- if($temp[0]['saturday']==0){
- $temp_days_saturday = $temp[0]['saturday']='';
- } else {
- $temp_days_saturday = $temp[0]['saturday']='Sat';
- }
- $temp_days = $temp_days_monday." ".$temp_days_tuesday." ".$temp_days_wendsday." ".$temp_days_thursday." ".$temp_days_friday." ".$temp_days_saturday." ".$temp_days_sunday." ";
- $subjectDetailsSchedule[] = array(
- 'college_subject_schedule_id'=>$value['college_subject_schedule_id'],
- 'college_day'=>$value['college_day'],
- 'professor'=>$value['pi_lastname']." ".$value['pi_firstname'],
- 'college_time_in'=>$value['college_time_in'],
- 'college_time_out'=>$value['college_time_out'],
- 'combine_time' => $value['college_time_in'].'|'.$value['college_time_out'],
- 'extracteddays'=> $temp_days,
- 'bldg_name'=> $value['bldg_name'],
- 'schedsummary'=> $temp_days." | ".$value['college_time_in'].' | '.$value['college_time_out']." | ".$value['bldg_name'] ." | ".$value['pi_firstname']." ".$value['pi_lastname']
- );
- }
- return $subjectDetailsSchedule;
- }
- function addAnotherSubjectRow($data = array()) {
- $count = count($_SESSION['custom_short_name']);
- foreach ($data as $value){
- $_SESSION['custom_short_name'] = $value['subjname_shortname'];
- }
- }
- function getAdditionalSubjects(){
- $sql = "SELECT * FROM college_subject_schedule css
- INNER JOIN dps_hris_db.hris_emp_personalinfo hep on hep.pi_id = css.college_professor_id
- INNER JOIN file_building fb on fb.bldg_id = css.college_room_id";
- $rsResult = $this->conn->Execute($sql);
- return $rsResult;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement