Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.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   * URL resolver.
  19   *
  20   * @package    tool_lp
  21   * @copyright  2016 Frédéric Massart - FMCorz.net
  22   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  23   */
  24  
  25  namespace tool_lp;
  26  defined('MOODLE_INTERNAL') || die();
  27  
  28  use moodle_url;
  29  
  30  /**
  31   * URL resolver class.
  32   *
  33   * @package    tool_lp
  34   * @copyright  2016 Frédéric Massart - FMCorz.net
  35   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  36   */
  37  class url_resolver {
  38  
  39      /**
  40       * The URL where the competency can be found.
  41       *
  42       * @param int $competencyid The competency ID.
  43       * @param int $pagecontextid The ID of the context we are in.
  44       * @return moodle_url
  45       */
  46      public function competency($competencyid, $pagecontextid) {
  47          return new moodle_url('/admin/tool/lp/editcompetency.php', array(
  48              'id' => $competencyid,
  49              'pagecontextid' => $pagecontextid
  50          ));
  51      }
  52  
  53      /**
  54       * The URL where the framework can be found.
  55       *
  56       * @param int $frameworkid The framework ID.
  57       * @param int $pagecontextid The ID of the context we are in.
  58       * @return moodle_url
  59       */
  60      public function framework($frameworkid, $pagecontextid) {
  61          return new moodle_url('/admin/tool/lp/competencies.php', array(
  62              'competencyframeworkid' => $frameworkid,
  63              'pagecontextid' => $pagecontextid
  64          ));
  65      }
  66  
  67      /**
  68       * The URL where the frameworks can be found.
  69       *
  70       * @param int $pagecontextid The ID of the context that we are browsing.
  71       * @return moodle_url
  72       */
  73      public function frameworks($pagecontextid) {
  74          return new moodle_url('/admin/tool/lp/competencyframeworks.php', array('pagecontextid' => $pagecontextid));
  75      }
  76  
  77      /**
  78       * The URL where the plan can be found.
  79       *
  80       * @param int $planid The plan ID.
  81       * @return moodle_url
  82       */
  83      public function plan($planid) {
  84          return new moodle_url('/admin/tool/lp/plan.php', array('id' => $planid));
  85      }
  86  
  87      /**
  88       * The URL where the plans of a user can be found.
  89       *
  90       * @param int $userid The user ID.
  91       * @return moodle_url
  92       */
  93      public function plans($userid) {
  94          return new moodle_url('/admin/tool/lp/plans.php', array('userid' => $userid));
  95      }
  96  
  97      /**
  98       * The URL where the template can be found.
  99       *
 100       * @param int $templateid The template ID.
 101       * @param int $pagecontextid The ID of the context we are in.
 102       * @return moodle_url
 103       */
 104      public function template($templateid, $pagecontextid) {
 105          return new moodle_url('/admin/tool/lp/templatecompetencies.php', array(
 106              'templateid' => $templateid,
 107              'pagecontextid' => $pagecontextid
 108          ));
 109      }
 110  
 111      /**
 112       * The URL where the templates can be found.
 113       *
 114       * @param int $pagecontextid The ID of the context that we are browsing.
 115       * @return moodle_url
 116       */
 117      public function templates($pagecontextid) {
 118          return new moodle_url('/admin/tool/lp/learningplans.php', array('pagecontextid' => $pagecontextid));
 119      }
 120  
 121      /**
 122       * The URL where the user competency can be found.
 123       *
 124       * @param int $usercompetencyid The user competency ID
 125       * @return moodle_url
 126       */
 127      public function user_competency($usercompetencyid) {
 128          return new moodle_url('/admin/tool/lp/user_competency.php', array('id' => $usercompetencyid));
 129      }
 130  
 131      /**
 132       * The URL where the user competency can be found in the context of a course.
 133       *
 134       * @param int $userid The user ID
 135       * @param int $competencyid The competency ID.
 136       * @param int $courseid The course ID.
 137       * @return moodle_url
 138       */
 139      public function user_competency_in_course($userid, $competencyid, $courseid) {
 140          return new moodle_url('/admin/tool/lp/user_competency_in_course.php', array(
 141              'userid' => $userid,
 142              'competencyid' => $competencyid,
 143              'courseid' => $courseid
 144          ));
 145      }
 146  
 147      /**
 148       * The URL where the user competency can be found in the context of a plan.
 149       *
 150       * @param int $userid The user ID
 151       * @param int $competencyid The competency ID.
 152       * @param int $planid The plan ID.
 153       * @return moodle_url
 154       */
 155      public function user_competency_in_plan($userid, $competencyid, $planid) {
 156          return new moodle_url('/admin/tool/lp/user_competency_in_plan.php', array(
 157              'userid' => $userid,
 158              'competencyid' => $competencyid,
 159              'planid' => $planid
 160          ));
 161      }
 162  
 163      /**
 164       * The URL where the user evidence (of prior learning) can be found.
 165       *
 166       * @param int $userevidenceid The user evidence ID
 167       * @return moodle_url
 168       */
 169      public function user_evidence($userevidenceid) {
 170          return new moodle_url('/admin/tool/lp/user_evidence.php', array('id' => $userevidenceid));
 171      }
 172  
 173  }