Exemplo n.º 1
0
 /**
  * Given a user and semester, fetch all students (excel friendly)
  * @param array $accommodations The accommodations to filter by
  * @param int $faculty_user_id The faculty user ID
  * @param string $semester
  * @return array
  */
 public function fetchAllStudentsExcel(array $accommodations, $faculty_user_id, $semester)
 {
     $semester = $this->db->clean($semester);
     $sql = "SELECT v.student_num AS column0, CONCAT(s.first_name, ' ', s.last_name) AS column1,\n                       s.email AS column2, c.code AS column3, c.section AS column4,\n                       GROUP_CONCAT(CONCAT(cc.professor_first_name, ' ', cc.professor_last_name) SEPARATOR ', ') AS column5,\n                       cc.professor_email AS column6, cc.teaching_method AS column7\n                  FROM org_student_course_classes y\n                  JOIN ventus_students v\n                    ON y.student_id = v.student_num\n                  JOIN org_students s\n                    ON v.student_num = s.student_id\n                  JOIN org_course_classes cc\n                    ON y.class_id = cc.class_id\n                  JOIN org_courses c\n                    ON c.course_id = cc.course_id\n                  JOIN ventus_student_accommodations vsa\n                    ON v.student_num = vsa.student_num\n             LEFT JOIN ventus_student_accommodations_exceptions vsae\n                    ON v.student_num = vsae.student_num\n                   AND vsae.course_code = c.code\n                   AND vsae.course_section = c.section\n                   AND vsae.session = c.session\n             LEFT JOIN ventus_students_courses_no_accommodations vscna\n                    ON v.student_num = vscna.student_num\n                  JOIN ventus_accommodations va \n                    ON vsa.accommodation_id = va.accommodation_id \n                    OR vsae.accommodation_id = va.accommodation_id \n                  JOIN ventus_accommodation_types vat \n                    ON va.type_id = vat.type_id\n                 WHERE v.access_profile_status='active'\n                   AND c.session = '{$semester}'\n                   AND (CURDATE() BETWEEN vsa.effective_on AND vsa.expires_on \n                    OR CURDATE() BETWEEN vsae.effective_on AND vsae.expires_on)\n                   AND vscna.opt_out_id IS NULL \n                   AND vat.category IN ('" . implode("','", $accommodations) . "')\n              GROUP BY v.student_num, c.code, c.section, c.session, cc.teaching_method";
     $students = $this->db->query($sql);
     return $this->facultyUserModel->filterByPermissions($faculty_user_id, $students, 'column3', 'column4');
 }
Exemplo n.º 2
0
Arquivo: NOE.php Projeto: hughnguy/php
 /**
  * For a given user, fetch all NOEs (Excel friendly)
  * @param int $faculty_user_id The faculty user ID
  * @param string $start The start of the date range
  * @param string $end The end of the date range
  * @return array
  */
 public function fetchNoticeDetailsForExport($faculty_user_id, $start, $end)
 {
     if (!ctype_digit($faculty_user_id) && !is_int($faculty_user_id)) {
         throw new \InvalidArgumentException('Invalid user ID');
     }
     $exams = parent::fetchNoticeDetailsForExport($start, $end);
     return $this->facultyUserModel->filterByPermissions($faculty_user_id, $exams, 'column0', 'column1');
 }