public function info_students() { $session = new session_supervisor(); $id = $session->Get_id_user(); $db = new data_base(tpl_students::students(), array(tpl_students::id(), tpl_students::first_name(), tpl_students::last_name(), data_base::select_multiple_table(tpl_college::college(), tpl_college::college() . '.' . tpl_college::id(), tpl_students::students() . '.' . tpl_students::id_college(), tpl_college::name(), tpl_college::college() . '_' . tpl_college::name()), data_base::select_multiple_table(tpl_university::university(), tpl_university::university() . '.' . tpl_university::id(), tpl_students::students() . '.' . tpl_students::id_college(), tpl_university::name(), tpl_university::university() . '_' . tpl_university::name()), data_base::select_multiple_table(tpl_specialty::specialty(), tpl_specialty::specialty() . '.' . tpl_specialty::id(), tpl_students::students() . '.' . tpl_students::id_college(), tpl_specialty::name(), tpl_specialty::specialty() . '_' . tpl_specialty::name())), array(tpl_students::id_supervisor() => $id, tpl_students::status() => 1)); return $db->get_where(); }
public function login_student() { if (isset($_POST['username_stu']) && isset($_POST[tpl_students::password() . '_stu'])) { $username = $_POST[tpl_students::username() . '_stu']; $password = $_POST[tpl_students::password() . '_stu']; if (!empty($username) && !empty($password)) { $db = new data_base(tpl_students::students(), array(tpl_students::id(), tpl_students::first_name()), array(tpl_students::username() => $username, tpl_students::password() => $this->hash_password($password), tpl_students::status() => 1)); $data = $db->get_where(); if (!empty($data)) { $session = new session_students(); $session->new_login_students(); $session->set_id_user($data[0][tpl_students::id()]); if ($session->get_login_students()) { echo json_encode(array('valid' => true, 'title' => 'Welcome !!', 'massage' => $data[0][tpl_students::first_name()])); } else { echo json_encode(array('valid' => false, 'title' => 'Oops !!', 'massage' => 'Was not username & password, please try again')); } } else { echo json_encode(array('valid' => false, 'title' => 'Oops !!', 'massage' => 'Was not username & password, please try again')); } } else { echo json_encode(array('valid' => false, 'title' => 'Oops !!', 'massage' => 'Was not username & password, please try again')); } } else { echo json_encode(array('valid' => false, 'title' => 'Oops !!', 'massage' => 'Was not username & password, please try again')); } }
public function find_supervisor() { if (isset($_POST[tpl_students::id() . '_' . tpl_students::students()])) { $id = $_POST[tpl_students::id() . '_' . tpl_students::students()]; if (!empty($id)) { $db = new data_base(tpl_students::students(), array(tpl_students::id(), tpl_students::id_supervisor(), data_base::select_multiple_table(tpl_supervisor::supervisor(), tpl_supervisor::supervisor() . '.' . tpl_supervisor::id(), tpl_students::students() . '.' . tpl_students::id_supervisor(), tpl_supervisor::name(), tpl_supervisor::supervisor() . '_' . tpl_supervisor::name())), array(tpl_students::status() => 1, tpl_students::id() => $id)); $data = $db->get_where(); $w = '<option></option>'; foreach ($data as $row) { $w = $w . '<option value="' . $row[tpl_students::id_supervisor()] . '">' . $row[tpl_supervisor::supervisor() . '_' . tpl_supervisor::name()] . '</option>'; } echo $w; } else { echo 'error empty'; die; } } else { echo 'error isset'; exit; } }
public function update_status() { $id = $_POST[tpl_students::students() . '_' . tpl_students::id()]; $status = $_POST[tpl_students::students() . '_' . tpl_students::status()]; $db = new data_base(tpl_students::students(), array(tpl_students::status() => $status), array(tpl_students::id() => $id)); $results = $db->change(); $status_data = $status == 1 ? 'active' : 'dative'; if ($results) { echo json_encode(array('valid' => 1, 'title' => 'Successfully !!', 'massage' => 'I\'ve been Update ' . $status_data)); } else { echo json_encode(array('valid' => 0, 'title' => 'Oops !!', 'massage' => 'Was not Update ' . $status_data . ', please try again')); } }