Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.
   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 evidence page output.
  19   *
  20   * @package    tool_lp
  21   * @copyright  2015 Frédéric Massart - FMCorz.net
  22   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  23   */
  24  namespace tool_lp\output;
  25  
  26  use moodle_url;
  27  use renderable;
  28  use templatable;
  29  use stdClass;
  30  use core_competency\api;
  31  use tool_lp\external\user_evidence_summary_exporter;
  32  
  33  /**
  34   * User evidence page class.
  35   *
  36   * @package    tool_lp
  37   * @copyright  2015 Frédéric Massart - FMCorz.net
  38   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  39   */
  40  class user_evidence_page implements renderable, templatable {
  41  
  42      /** @var context The context. */
  43      protected $context;
  44  
  45      /** @var userevidence The user evidence. */
  46      protected $userevidence;
  47  
  48      /**
  49       * Construct.
  50       *
  51       * @param user_evidence $userevidence
  52       */
  53      public function __construct($userevidence) {
  54          $this->userevidence = $userevidence;
  55          $this->context = $this->userevidence->get_context();
  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          $data = new stdClass();
  66  
  67          $userevidencesummaryexporter = new user_evidence_summary_exporter($this->userevidence, array(
  68              'context' => $this->context));
  69          $data->userevidence = $userevidencesummaryexporter->export($output);
  70          $data->pluginbaseurl = (new moodle_url('/admin/tool/lp'))->out(true);
  71  
  72          return $data;
  73      }
  74  }