public function processInstructor() { $this->results['instPath'] = iclicker_service::block_url('instructor.php'); // admin/instructor check if (!iclicker_service::is_admin() && !iclicker_service::is_instructor()) { throw new ClickerSecurityException("Current user is not an instructor and cannot access the instructor view"); } $course_id = optional_param('courseId', false, PARAM_INT); $this->results['course_id'] = $course_id; $courses = array(); if ($course_id) { $course = iclicker_service::get_course($course_id); $courses[] = $course; } else { $courses = iclicker_service::get_courses_for_instructor(); } $this->results['courses'] = $courses; $this->results['courses_count'] = count($courses); $this->results['show_students'] = false; if ($course_id && count($courses) == 1) { $course = $courses[0]; $this->results['show_students'] = true; $this->results['course'] = $course; $students = iclicker_service::get_students_for_course_with_regs($course_id); $this->results['students'] = $students; $this->results['students_count'] = count($students); } $this->results['sso_enabled'] = iclicker_service::$block_iclicker_sso_enabled; }