$discovery->referrals = $_POST['e_referrals'];
        $discovery->others = $_POST['e_others'];
        $discovery->update();
        //----------------------------------------------------------------------------------------------------------------------------------//
        $enrollmentDetail = EnrollmentDetail::get_by_id($student->enrollment_detail_id);
        $enrollmentDetail->status = $_POST['f_status'];
        $enrollmentDetail->program = $_POST['f_program'];
        $enrollmentDetail->schedule = $_POST['f_schedule'];
        $enrollmentDetail->payment = $_POST['f_payment'];
        $enrollmentDetail->studentcontactnumber = $_POST['f_studentcontactnumber'];
        $enrollmentDetail->update();
        //----------------------------------------------------------------------------------------------------------------------------------//
        $appointmentDetail = AppointmentDetail::get_by_id($student->appointment_detail_id);
        $appointmentDetail->visitschedule = strtotime($_POST['g_visitschedule']);
        $appointmentDetail->visitpurpose = $_POST['g_visitpurpose'];
        $appointmentDetail->officer = $_POST['g_officer'];
        $appointmentDetail->update();
        //----------------------------------------------------------------------------------------------------------------------------------//
    } else {
        if ($_POST['oper'] == 'del') {
            $student = Student::get_by_id($_POST['id']);
            $student->delete();
            AppointmentDetail::get_by_id($student->appointment_detail_id)->delete();
            EnrollmentDetail::get_by_id($student->enrollment_detail_id)->delete();
            StiDiscovery::get_by_id($student->sti_discovery_id)->delete();
            SchoolConsidered::get_by_id($student->school_considered_id)->delete();
            SchoolLastAttended::get_by_id($student->school_last_attended_id)->delete();
            PersonalInformation::get_by_id($student->personal_information_id)->delete();
        }
    }
}
 /**
  * Create an associative array of object properties from XML
  * @static
  * @param SimpleXMLElement $parsedResponse - XML of registrant
  * @return
  */
 public static function createStruct($parsedResponse)
 {
     $reg['title'] = (string) $parsedResponse->title;
     $reg['updated'] = (string) $parsedResponse->updated;
     $reg['link'] = (string) $parsedResponse->link->Attributes()->href;
     $reg['id'] = (string) $parsedResponse->id;
     $content = $parsedResponse->content->children();
     $reg['lastName'] = (string) $content->Registrant->LastName;
     $reg['firstName'] = (string) $content->Registrant->FirstName;
     $reg['email'] = (string) $content->Registrant->EmailAddress;
     $reg['registrationStatus'] = (string) $content->Registrant->RegistrationStatus;
     $reg['registrationDate'] = (string) $content->Registrant->RegistrationDate;
     $reg['guestCount'] = (string) $content->Registrant->GuestCount;
     $reg['paymentStatus'] = (string) $content->Registrant->PaymentStatus;
     $reg['personalInformation'] = new PersonalInformation(PersonalInformation::createStruct($content->Registrant->PersonalInformation));
     $reg['businessInformation'] = new BusinessInformation(BusinessInformation::createStruct($content->Registrant->BusinessInformation));
     $reg['customInformation1'] = array();
     $reg['customInformation2'] = array();
     $reg['costs'] = array();
     if (isset($content->Registrant->CustomInformation1->CustomField)) {
         foreach ($content->Registrant->CustomInformation1->CustomField as $customInfo) {
             $reg['customInformation1'][] = CustomField::createFromXml($customInfo);
         }
     }
     if (isset($content->Registrant->CustomInformation2->CustomField)) {
         foreach ($content->Registrant->CustomInformation2->CustomField as $customInfo) {
             $reg['customInformation2'][] = CustomField::createFromXml($customInfo);
         }
     }
     if (isset($content->Registrant->Costs->Cost)) {
         foreach ($content->Registrant->Costs->Cost as $cost) {
             $reg['costs'] = new Cost(Cost::createStruct($cost));
         }
     }
     return $reg;
 }
    //$students = Student::get_by_sql("SELECT * FROM ".T_STUDENTS." INNER JOIN ".T_PERSONAL_INFORMATIONS." ON ".T_PERSONAL_INFORMATIONS.".student_id=".T_STUDENTS.".id ORDER BY ".T_STUDENTS.".id $sord LIMIT $start , $limit");
    $students = Student::get_by_sql("SELECT * FROM " . T_STUDENTS . " ORDER BY {$sidx} {$sord} LIMIT {$start} , {$limit}");
}
header("Content-type: text/xml;charset=utf-8");
$s = "<?xml version='1.0' encoding='utf-8'?>";
$s .= "<rows>";
$s .= "<page>" . $page . "</page>";
$s .= "<total>" . $total_pages . "</total>";
$s .= "<records>" . $count . "</records>";
foreach ($students as $student) {
    $s .= "<row id='" . $student->id . "'>";
    $s .= "<cell></cell>";
    $s .= "<cell>" . $student->id . "</cell>";
    $s .= "<cell>" . $student->studentid . "</cell>";
    //----------------------------------------------------------------------------------------------------------------------------------//
    $personInfo = PersonalInformation::get_by_id($student->personal_information_id);
    if (!$personInfo) {
        $personInfo = new PersonalInformation();
    }
    $s .= "<cell>" . $personInfo->firstname . "</cell>";
    $s .= "<cell>" . $personInfo->lastname . "</cell>";
    $s .= "<cell>" . $personInfo->middlename . "</cell>";
    $s .= "<cell>" . $personInfo->address . "</cell>";
    $s .= "<cell>" . $personInfo->father . "</cell>";
    $s .= "<cell>" . $personInfo->mother . "</cell>";
    $s .= "<cell>" . $personInfo->guardian . "</cell>";
    $s .= "<cell>" . $personInfo->gender . "</cell>";
    $s .= "<cell>" . $personInfo->civilstatus . "</cell>";
    $s .= "<cell>" . $personInfo->citizenship . "</cell>";
    $s .= "<cell>" . $personInfo->birthday . "</cell>";
    $s .= "<cell>" . $personInfo->email . "</cell>";