Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403] [Versions 400 and 403] [Versions 401 and 403]
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 defined('MOODLE_INTERNAL') || die(); 26 27 use renderable; 28 use templatable; 29 use core_competency\api; 30 use tool_lp\external\user_competency_summary_in_plan_exporter; 31 32 /** 33 * User competency page class. 34 * 35 * @package tool_lp 36 * @copyright 2015 Damyon Wiese 37 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 38 */ 39 class user_competency_summary_in_plan implements renderable, templatable { 40 41 /** @var int competencyid */ 42 protected $competencyid; 43 44 /** @var int planid */ 45 protected $planid; 46 47 /** 48 * Construct. 49 * 50 * @param int $competencyid 51 * @param int $planid 52 */ 53 public function __construct($competencyid, $planid) { 54 $this->competencyid = $competencyid; 55 $this->planid = $planid; 56 } 57 58 /** 59 * Export the data. 60 * 61 * @param \renderer_base $output 62 * @return \stdClass 63 */ 64 public function export_for_template(\renderer_base $output) { 65 global $DB; 66 67 $plan = api::read_plan($this->planid); 68 $pc = api::get_plan_competency($plan, $this->competencyid); 69 $competency = $pc->competency; 70 $usercompetency = $pc->usercompetency; 71 $usercompetencyplan = $pc->usercompetencyplan; 72 73 if (empty($competency)) { 74 throw new \invalid_parameter_exception('Invalid params. The competency does not belong to the plan.'); 75 } 76 77 $relatedcompetencies = api::list_related_competencies($competency->get('id')); 78 $userid = $plan->get('userid'); 79 $user = $DB->get_record('user', array('id' => $userid)); 80 $evidence = api::list_evidence($userid, $this->competencyid, $plan->get('id')); 81 82 $params = array( 83 'competency' => $competency, 84 'usercompetency' => $usercompetency, 85 'usercompetencyplan' => $usercompetencyplan, 86 'evidence' => $evidence, 87 'user' => $user, 88 'plan' => $plan, 89 'relatedcompetencies' => $relatedcompetencies 90 ); 91 $exporter = new user_competency_summary_in_plan_exporter(null, $params); 92 $data = $exporter->export($output); 93 94 return $data; 95 } 96 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body