/** * Loads the data required to render the report. * * @param int $courseid The course id * @param int $userid The user id * @return \stdClass */ public static function data_for_report($courseid, $userid) { global $PAGE; $params = self::validate_parameters(self::data_for_report_parameters(), array('courseid' => $courseid, 'userid' => $userid)); $context = context_course::instance($params['courseid']); self::validate_context($context); if (!is_enrolled($context, $params['userid'], 'moodle/competency:coursecompetencygradable')) { throw new coding_exception('invaliduser'); } $renderable = new output\report($params['courseid'], $params['userid']); $renderer = $PAGE->get_renderer('report_competency'); $data = $renderable->export_for_template($renderer); return $data; }
/** * Defer to template. * * @param report $page * @return string html for the page */ public function render_report(report $page) { $data = $page->export_for_template($this); return parent::render_from_template('report_competency/report', $data); }