예제 #1
0
 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/');
     }
 }
예제 #2
0
 /**
  * @before _secure, _school
  */
 public function enrollments($classroom_id, $grade_id)
 {
     $classroom = \Classroom::first(array("id = ?" => $classroom_id), array("id", "organization_id", "grade_id", "educator_id"));
     if (!$classroom || $classroom->organization_id != $this->organization->id || $classroom->grade_id != $grade_id) {
         self::redirect("/school");
     }
     $this->setSEO(array("title" => "School | View students in section"));
     $view = $this->getActionView();
     $enrollments = \Enrollment::all(array("classroom_id = ?" => $classroom_id));
     $students = array();
     foreach ($enrollments as $e) {
         $student = \Scholar::first(array("id = ?" => $e->scholar_id), array("user_id", "dob", "parent_id"));
         $parent = \StudentParent::first(array("id = ?" => $student->parent_id), array("name", "relation"));
         $usr = \User::first(array("id = ?" => $student->user_id));
         $students[] = array("name" => $usr->name, "parent_name" => $parent->name, "parent_relation" => $parent->relation, "dob" => $student->dob, "username" => $usr->username);
     }
     $students = ArrayMethods::toObject($students);
     $view->set("students", $students);
 }
 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');
         }
     }
 }