/** * Specifies available report filters * (empty by default but can be implemented by child class) * * @param boolean $init_data If true, signal the report to load the * actual content of the filter objects * * @return array The list of available filters */ function get_filters($init_data = true) { global $CURMAN; //Get allowed curriculum list by capability $cms = array(); $contexts = get_contexts_by_capability_for_user('curriculum', $this->access_capability, $this->userid); $cms_objects = curriculum_get_listing_recordset('name', 'ASC', 0, 0, '', '', $contexts); if (!empty($cms_objects)) { while ($curriculum = rs_fetch_next_record($cms_objects)) { $cms[$curriculum->id] = $curriculum->name; } } $curricula_options = array('choices' => $cms, 'numeric' => false); //Create optional icon checkbox elements // 15 character name max length - with a 2 character field name - this is for any checkboxes filter $option_choices = array('tot_assignments' => get_string('option_tot_assignments', 'rlreport_course_usage_summary'), 'tot_crs_rscs' => get_string('option_tot_crs_rscs', 'rlreport_course_usage_summary'), 'tot_disc_posts' => get_string('option_tot_disc_posts', 'rlreport_course_usage_summary'), 'tot_quizzes' => get_string('option_tot_quizzes', 'rlreport_course_usage_summary'), 'avg_crs_grd' => get_string('option_avg_crs_grd', 'rlreport_course_usage_summary'), 'avg_hours_crs' => get_string('option_avg_hours_crs', 'rlreport_course_usage_summary'), 'avg_pretest' => get_string('option_avg_pretest', 'rlreport_course_usage_summary'), 'avg_posttest' => get_string('option_avg_posttest', 'rlreport_course_usage_summary')); $option_defaults = array('tot_assignments', 'tot_crs_rscs', 'tot_disc_posts', 'tot_quizzes', 'avg_crs_grd', 'avg_hours_crs', 'avg_pretest', 'avg_posttest'); $option_options = array('choices' => $option_choices, 'checked' => $option_defaults, 'heading' => get_string('filter_options_header', 'rlreport_course_usage_summary'), 'footer' => ''); $filter_entries = array(); $filter_entries[] = new generalized_filter_entry('cc', 'cc', 'id', get_string('filter_curricula', 'rlreport_course_usage_summary'), false, 'selectany', $curricula_options); $this->checkboxes_filter = new generalized_filter_entry('oe', 'oe', 'id', '', false, 'config_checkboxes', $option_options); $filter_entries[] = $this->checkboxes_filter; $filter_entries[] = new generalized_filter_entry('enrol', 'enrol', 'enrolmenttime', get_string('filter_course_date', 'rlreport_course_progress_summary'), false, 'date'); $filter_entries[] = new generalized_filter_entry('enrol', 'enrol', 'enrolmenttime', get_string('filter_course_date', 'rlreport_course_progress_summary'), false, 'date'); return $filter_entries; }
/** * Specifies available report filters * (empty by default but can be implemented by child class) * * @param boolean $init_data If true, signal the report to load the * actual content of the filter objects * * @return array The list of available filters */ function get_filters($init_data = true) { $cms = array(); $contexts = get_contexts_by_capability_for_user('curriculum', $this->access_capability, $this->userid); $cms_objects = curriculum_get_listing_recordset('name', 'ASC', 0, 0, '', '', $contexts); if (!empty($cms_objects)) { while ($curriculum = rs_fetch_next_record($cms_objects)) { $cms[$curriculum->id] = $curriculum->name; } } return array(new generalized_filter_entry('showc', 'cur', 'id', get_string('filter_curriculum', $this->lang_file), false, 'simpleselect', array('choices' => $cms, 'numeric' => true, 'anyvalue' => get_string('allcurricula', $this->lang_file), 'help' => array('registrants_by_course_curriculum_help', get_string('filter_curriculum', $this->lang_file), 'block_php_report'))), new generalized_filter_entry('showdr', 'clsenr', 'enrolmenttime', get_string('filter_date_range', $this->lang_file), false, 'date', array('help' => array('registrants_by_course_date_help', get_string('filter_date_range', $this->lang_file), 'block_php_report')))); }