protected function getstudent() { global $user; global $objPDO; $student = new student($objPDO, $user->getuserId()); $headMenu = array("username" => $student->getName()); if ($user->checkAdmin() == true || $student->checkTeacher()) { $search = ""; if (isset($_POST['search'])) { $search = $_POST['search']; } else { if (isset($_GET['uid'])) { $search = $_GET['uid']; } } $page = NULL; if (isset($_GET['ref'])) { $page = $_GET['ref']; } if ($search != "") { include $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/student_profile_class.php'; include $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/attendence_class.php'; $stu = new StudentProfile($objPDO); $att = new Attendence($objPDO); $roll_match = $stu->searchByRollNo($search, $page); $name_match = $stu->searchByName($search, $page); $num_result = count($name_match) > count($roll_match) ? count($name_match) : count($roll_match); include $_SERVER['DOCUMENT_ROOT'] . '/cloud/view/search_student_attendance_view.php'; } } else { header('Location:http://localhost/cloud'); } }
protected function ajaxsearch() { global $objPDO; $search = NULL; if (isset($_GET['uid'])) { $search = $_GET['uid']; } if ($search == NULL) { return false; } require_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/student_profile_class.php'; $stu = new StudentProfile($objPDO); $res1 = array(); $res2 = array(); $res1 = $stu->searchByRollNo($search); $res2 = $stu->searchByName($search); foreach ($res1 as $key => $value) { echo '<div class="ajax_search_elem" id="<' . $value['email'] . '>">' . $value['roll_no'] . '</div>'; } foreach ($res2 as $key => $value) { echo '<div class="ajax_search_elem" id="<' . $value['email'] . '>">' . $value['name'] . '</div>'; } }