protected function validate() { global $user; if ($user->checkAdmin()) { echo 'Saving...'; global $objPDO; $parent = new StudentParent($objPDO); $parent->loadByStudentId($_GET['uid']); $parent->setByArray($_POST); echo '<meta http-equiv="Refresh" content="0;url=http://localhost/cloud/studentprofile/confirm/' . $_GET['uid'] . '"/>'; } else { header('Location:http://localhost/cloud/'); } }
protected function view() { global $user; global $objPDO; $student = new student($objPDO, $user->getuserId()); $headMenu = array("username" => $student->getName()); if ($user->checkAdmin() == true || $student->checkTeacher()) { $role = $student->getacctType(); require_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/student_profile_class.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/parent_class.php'; $studentProfile = new StudentProfile($objPDO); $parent = new StudentParent($objPDO); $parent->loadByStudentId($_GET['uid']); $studentProfile->loadByUserId($_GET['uid']); include $_SERVER['DOCUMENT_ROOT'] . '/cloud/view/viewstudent.php'; } else { if ($student->checkStudent()) { $role = $student->getacctType(); require_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/student_profile_class.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/parent_class.php'; $studentProfile = new StudentProfile($objPDO); $parent = new StudentParent($objPDO); $student_id = $student->getID(); $parent->loadByStudentId($student_id); $studentProfile->loadByUserId($student_id); include $_SERVER['DOCUMENT_ROOT'] . '/cloud/view/viewstudent.php'; } else { header('Location:http://localhost/cloud'); } } }