See Release Notes
Long Term Support Release
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * User competency page class. 19 * 20 * @package tool_lp 21 * @copyright 2015 Damyon Wiese 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 namespace tool_lp\output; 25 26 use renderable; 27 use renderer_base; 28 use templatable; 29 use core_competency\api; 30 use core_competency\user_competency; 31 use tool_lp\external\user_competency_summary_in_course_exporter; 32 33 /** 34 * User competency page class. 35 * 36 * @package tool_lp 37 * @copyright 2015 Damyon Wiese 38 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 39 */ 40 class user_competency_summary_in_course implements renderable, templatable { 41 42 /** @var userid */ 43 protected $userid; 44 45 /** @var competencyid */ 46 protected $competencyid; 47 48 /** @var courseid */ 49 protected $courseid; 50 51 /** 52 * Construct. 53 * 54 * @param int $userid 55 * @param int $competencyid 56 * @param int $courseid 57 */ 58 public function __construct($userid, $competencyid, $courseid) { 59 $this->userid = $userid; 60 $this->competencyid = $competencyid; 61 $this->courseid = $courseid; 62 } 63 64 /** 65 * Export the data. 66 * 67 * @param renderer_base $output 68 * @return stdClass 69 */ 70 public function export_for_template(renderer_base $output) { 71 global $DB; 72 73 $usercompetencycourse = api::get_user_competency_in_course($this->courseid, $this->userid, $this->competencyid); 74 $competency = $usercompetencycourse->get_competency(); 75 if (empty($usercompetencycourse) || empty($competency)) { 76 throw new \invalid_parameter_exception('Invalid params. The competency does not belong to the course.'); 77 } 78 79 $relatedcompetencies = api::list_related_competencies($competency->get('id')); 80 $user = $DB->get_record('user', array('id' => $this->userid)); 81 $evidence = api::list_evidence_in_course($this->userid, $this->courseid, $this->competencyid); 82 $course = $DB->get_record('course', array('id' => $this->courseid)); 83 84 $params = array( 85 'competency' => $competency, 86 'usercompetencycourse' => $usercompetencycourse, 87 'evidence' => $evidence, 88 'user' => $user, 89 'course' => $course, 90 'scale' => $competency->get_scale(), 91 'relatedcompetencies' => $relatedcompetencies 92 ); 93 $exporter = new user_competency_summary_in_course_exporter(null, $params); 94 $data = $exporter->export($output); 95 96 return $data; 97 } 98 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body