Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.
   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   * Renderer class for learning plans
  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  
  25  namespace tool_lp\output;
  26  
  27  defined('MOODLE_INTERNAL') || die();
  28  
  29  use plugin_renderer_base;
  30  use renderable;
  31  
  32  /**
  33   * Renderer class for learning plans
  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 renderer extends plugin_renderer_base {
  40  
  41      /**
  42       * Defer to template.
  43       *
  44       * @param manage_competency_frameworks_page $page
  45       *
  46       * @return string html for the page
  47       */
  48      public function render_manage_competency_frameworks_page(manage_competency_frameworks_page $page) {
  49          $data = $page->export_for_template($this);
  50          return parent::render_from_template('tool_lp/manage_competency_frameworks_page', $data);
  51      }
  52  
  53      /**
  54       * Defer to template.
  55       *
  56       * @param manage_competencies_page $page
  57       *
  58       * @return string html for the page
  59       */
  60      public function render_manage_competencies_page(manage_competencies_page $page) {
  61          $data = $page->export_for_template($this);
  62          return parent::render_from_template('tool_lp/manage_competencies_page', $data);
  63      }
  64  
  65      /**
  66       * Defer to template.
  67       *
  68       * @param course_competencies_page $page
  69       *
  70       * @return string html for the page
  71       */
  72      public function render_course_competencies_page(course_competencies_page $page) {
  73          $data = $page->export_for_template($this);
  74          return parent::render_from_template('tool_lp/course_competencies_page', $data);
  75      }
  76  
  77      /**
  78       * Defer to template.
  79       *
  80       * @param template_competencies_page $page
  81       *
  82       * @return string html for the page
  83       */
  84      public function render_template_competencies_page(template_competencies_page $page) {
  85          $data = $page->export_for_template($this);
  86          return parent::render_from_template('tool_lp/template_competencies_page', $data);
  87      }
  88  
  89      /**
  90       * Defer to template.
  91       *
  92       * @param manage_templates_page $page
  93       *
  94       * @return string html for the page
  95       */
  96      public function render_manage_templates_page(manage_templates_page $page) {
  97          $data = $page->export_for_template($this);
  98          return parent::render_from_template('tool_lp/manage_templates_page', $data);
  99      }
 100  
 101      /**
 102       * Defer to template.
 103       *
 104       * @param plan_page $page
 105       * @return bool|string
 106       */
 107      public function render_plan_page(plan_page $page) {
 108          $data = $page->export_for_template($this);
 109          return parent::render_from_template('tool_lp/plan_page', $data);
 110      }
 111  
 112      /**
 113       * Defer to template.
 114       *
 115       * @param plans_page $page
 116       * @return bool|string
 117       */
 118      public function render_plans_page(plans_page $page) {
 119          $data = $page->export_for_template($this);
 120          return parent::render_from_template('tool_lp/plans_page', $data);
 121      }
 122  
 123      /**
 124       * Defer to template.
 125       *
 126       * @param renderable $page
 127       * @return string
 128       */
 129      public function render_related_competencies_section(renderable $page) {
 130          $data = $page->export_for_template($this);
 131          return parent::render_from_template('tool_lp/related_competencies', $data);
 132      }
 133  
 134      /**
 135       * Defer to template.
 136       *
 137       * @param user_competency_summary_in_course $page
 138       * @return string
 139       */
 140      public function render_user_competency_summary_in_course(user_competency_summary_in_course $page) {
 141          $data = $page->export_for_template($this);
 142          return parent::render_from_template('tool_lp/user_competency_summary_in_course', $data);
 143      }
 144  
 145      /**
 146       * Defer to template.
 147       *
 148       * @param user_competency_summary_in_plan $page
 149       * @return string
 150       */
 151      public function render_user_competency_summary_in_plan(user_competency_summary_in_plan $page) {
 152          $data = $page->export_for_template($this);
 153          return parent::render_from_template('tool_lp/user_competency_summary_in_plan', $data);
 154      }
 155  
 156      /**
 157       * Render the template plans page.
 158       *
 159       * @param  renderable $page
 160       * @return string
 161       */
 162      public function render_template_plans_page(renderable $page) {
 163          return $page->table->out(50, true);
 164      }
 165  
 166      /**
 167       * Render the template cohorts page.
 168       *
 169       * @param  renderable $page
 170       * @return string
 171       */
 172      public function render_template_cohorts_page(renderable $page) {
 173          return $page->table->out(50, true);
 174      }
 175  
 176      /**
 177       * Defer to template.
 178       *
 179       * @param user_evidence_page $page
 180       * @return string
 181       */
 182      public function render_user_evidence_page(user_evidence_page $page) {
 183          $data = $page->export_for_template($this);
 184          return parent::render_from_template('tool_lp/user_evidence_page', $data);
 185      }
 186  
 187      /**
 188       * Defer to template.
 189       *
 190       * @param user_evidence_list_page $page
 191       * @return string
 192       */
 193      public function render_user_evidence_list_page(user_evidence_list_page $page) {
 194          $data = $page->export_for_template($this);
 195          return parent::render_from_template('tool_lp/user_evidence_list_page', $data);
 196      }
 197  
 198      /**
 199       * Defer to template.
 200       *
 201       * @param user_competency_course_navigation $nav
 202       * @return string
 203       */
 204      public function render_user_competency_course_navigation(user_competency_course_navigation $nav) {
 205          $data = $nav->export_for_template($this);
 206          return parent::render_from_template('tool_lp/user_competency_course_navigation', $data);
 207      }
 208  
 209      /**
 210       * Defer to template.
 211       *
 212       * @param competency_plan_navigation $nav
 213       * @return string
 214       */
 215      public function render_competency_plan_navigation(competency_plan_navigation $nav) {
 216          $data = $nav->export_for_template($this);
 217          return parent::render_from_template('tool_lp/competency_plan_navigation', $data);
 218      }
 219  
 220      /**
 221       * Defer to template.
 222       *
 223       * @param user_competency_summary $page
 224       * @return string
 225       */
 226      public function render_user_competency_summary(user_competency_summary $page) {
 227          $data = $page->export_for_template($this);
 228          return parent::render_from_template('tool_lp/user_competency_summary', $data);
 229      }
 230  
 231      /**
 232       * Output a nofication.
 233       *
 234       * @param string $message the message to print out
 235       * @return string HTML fragment.
 236       * @see \core\output\notification
 237       */
 238      public function notify_message($message) {
 239          $n = new \core\output\notification($message, \core\output\notification::NOTIFY_INFO);
 240          return $this->render($n);
 241      }
 242  
 243      /**
 244       * Output an error notification.
 245       *
 246       * @param string $message the message to print out
 247       * @return string HTML fragment.
 248       * @see \core\output\notification
 249       */
 250      public function notify_problem($message) {
 251          $n = new \core\output\notification($message, \core\output\notification::NOTIFY_ERROR);
 252          return $this->render($n);
 253      }
 254  
 255      /**
 256       * Output a success notification.
 257       *
 258       * @param string $message the message to print out
 259       * @return string HTML fragment.
 260       * @see \core\output\notification
 261       */
 262      public function notify_success($message) {
 263          $n = new \core\output\notification($message, \core\output\notification::NOTIFY_SUCCESS);
 264          return $this->render($n);
 265      }
 266  
 267      /**
 268       * Defer to template.
 269       *
 270       * @param module_navigation $nav
 271       * @return string
 272       */
 273      public function render_module_navigation(module_navigation $nav) {
 274          $data = $nav->export_for_template($this);
 275          return parent::render_from_template('tool_lp/module_navigation', $data);
 276      }
 277  
 278  }