mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
MDL-53700 competency: Use URL resolver in events
This commit is contained in:
parent
07fc0ec380
commit
899f46d6de
@ -36,6 +36,34 @@ use moodle_url;
|
||||
*/
|
||||
class url_resolver {
|
||||
|
||||
/**
|
||||
* The URL where the competency can be found.
|
||||
*
|
||||
* @param int $competencyid The competency ID.
|
||||
* @param int $pagecontextid The ID of the context we are in.
|
||||
* @return moodle_url
|
||||
*/
|
||||
public function competency($competencyid, $pagecontextid) {
|
||||
return new moodle_url('/admin/tool/lp/editcompetency.php', array(
|
||||
'id' => $competencyid,
|
||||
'pagecontextid' => $pagecontextid
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* The URL where the framework can be found.
|
||||
*
|
||||
* @param int $frameworkid The framework ID.
|
||||
* @param int $pagecontextid The ID of the context we are in.
|
||||
* @return moodle_url
|
||||
*/
|
||||
public function framework($frameworkid, $pagecontextid) {
|
||||
return new moodle_url('/admin/tool/lp/competencies.php', array(
|
||||
'competencyframeworkid' => $frameworkid,
|
||||
'pagecontextid' => $pagecontextid
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* The URL where the frameworks can be found.
|
||||
*
|
||||
@ -66,16 +94,56 @@ class url_resolver {
|
||||
return new moodle_url('/admin/tool/lp/plans.php', array('userid' => $userid));
|
||||
}
|
||||
|
||||
/**
|
||||
* The URL where the template can be found.
|
||||
*
|
||||
* @param int $templateid The template ID.
|
||||
* @param int $pagecontextid The ID of the context we are in.
|
||||
* @return moodle_url
|
||||
*/
|
||||
public function template($templateid, $pagecontextid) {
|
||||
return new moodle_url('/admin/tool/lp/templatecompetencies.php', array(
|
||||
'templateid' => $templateid,
|
||||
'pagecontextid' => $pagecontextid
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* The URL where the templates can be found.
|
||||
*
|
||||
* @param int $pagecontextid The ID of the context that we are browsing.
|
||||
* @return moodle_url
|
||||
*/
|
||||
public function templates($pagecontextid) {
|
||||
return new moodle_url('/admin/tool/lp/learningplans.php', array('pagecontextid' => $pagecontextid));
|
||||
}
|
||||
|
||||
/**
|
||||
* The URL where the user competency can be found.
|
||||
*
|
||||
* @param int $usercompetency The user competency ID
|
||||
* @param int $usercompetencyid The user competency ID
|
||||
* @return moodle_url
|
||||
*/
|
||||
public function user_competency($usercompetencyid) {
|
||||
return new moodle_url('/admin/tool/lp/user_competency.php', array('id' => $usercompetencyid));
|
||||
}
|
||||
|
||||
/**
|
||||
* The URL where the user competency can be found in the context of a course.
|
||||
*
|
||||
* @param int $userid The user ID
|
||||
* @param int $competencyid The competency ID.
|
||||
* @param int $courseid The course ID.
|
||||
* @return moodle_url
|
||||
*/
|
||||
public function user_competency_in_course($userid, $competencyid, $courseid) {
|
||||
return new moodle_url('/admin/tool/lp/user_competency_in_course.php', array(
|
||||
'userid' => $userid,
|
||||
'competencyid' => $competencyid,
|
||||
'courseid' => $courseid
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* The URL where the user competency can be found in the context of a plan.
|
||||
*
|
||||
@ -95,7 +163,7 @@ class url_resolver {
|
||||
/**
|
||||
* The URL where the user evidence (of prior learning) can be found.
|
||||
*
|
||||
* @param int $usercompetency The user evidence ID
|
||||
* @param int $userevidenceid The user evidence ID
|
||||
* @return moodle_url
|
||||
*/
|
||||
public function user_evidence($userevidenceid) {
|
||||
|
@ -72,6 +72,28 @@ class url {
|
||||
return call_user_func_array([static::$resolver, $resource], $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* The URL where the competency can be found.
|
||||
*
|
||||
* @param int $competencyid The competency ID.
|
||||
* @param int $pagecontextid The ID of the context we are in.
|
||||
* @return moodle_url
|
||||
*/
|
||||
public static function competency($competencyid, $pagecontextid) {
|
||||
return static::get(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* The URL where the framework can be found.
|
||||
*
|
||||
* @param int $frameworkid The framework ID.
|
||||
* @param int $pagecontextid The ID of the context we are in.
|
||||
* @return moodle_url
|
||||
*/
|
||||
public static function framework($frameworkid, $pagecontextid) {
|
||||
return static::get(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* The URL where the frameworks can be found.
|
||||
*
|
||||
@ -102,16 +124,49 @@ class url {
|
||||
return static::get(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* The URL where the template can be found.
|
||||
*
|
||||
* @param int $templateid The template ID.
|
||||
* @param int $pagecontextid The ID of the context we are in.
|
||||
* @return moodle_url
|
||||
*/
|
||||
public static function template($templateid, $pagecontextid) {
|
||||
return static::get(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* The URL where the templates can be found.
|
||||
*
|
||||
* @param int $pagecontextid The ID of the context that we are browsing.
|
||||
* @return moodle_url
|
||||
*/
|
||||
public function templates($pagecontextid) {
|
||||
return static::get(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* The URL where the user competency can be found.
|
||||
*
|
||||
* @param int $usercompetency The user competency ID
|
||||
* @param int $usercompetencyid The user competency ID
|
||||
* @return moodle_url
|
||||
*/
|
||||
public static function user_competency($usercompetencyid) {
|
||||
return static::get(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* The URL where the user competency can be found in the context of a course.
|
||||
*
|
||||
* @param int $userid The user ID
|
||||
* @param int $competencyid The competency ID.
|
||||
* @param int $courseid The course ID.
|
||||
* @return moodle_url
|
||||
*/
|
||||
public static function user_competency_in_course($userid, $competencyid, $courseid) {
|
||||
return static::get(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* The URL where the user competency can be found in the context of a plan.
|
||||
*
|
||||
@ -127,7 +182,7 @@ class url {
|
||||
/**
|
||||
* The URL where the user evidence (of prior learning) can be found.
|
||||
*
|
||||
* @param int $usercompetency The user evidence ID
|
||||
* @param int $userevidenceid The user evidence ID
|
||||
* @return moodle_url
|
||||
*/
|
||||
public static function user_evidence($userevidenceid) {
|
||||
|
@ -82,10 +82,7 @@ class competency_created extends base {
|
||||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
return new \moodle_url('/admin/tool/lp/editcompetency.php', array(
|
||||
'id' => $this->objectid,
|
||||
'pagecontextid' => $this->contextid
|
||||
));
|
||||
return \core_competency\url::competency($this->objectid, $this->contextid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -119,10 +119,7 @@ class competency_evidence_created extends base {
|
||||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
$urlparams = [
|
||||
'id' => $this->other['usercompetencyid']
|
||||
];
|
||||
return new \moodle_url('/admin/tool/lp/user_competency.php', $urlparams);
|
||||
return \core_competency\url::user_competency($this->other['usercompetencyid']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,8 +84,7 @@ class competency_framework_created extends base {
|
||||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
return new \moodle_url('/admin/tool/lp/editcompetencyframework.php', array(
|
||||
'id' => $this->objectid, 'pagecontextid' => $this->contextid));
|
||||
return \core_competency\url::framework($this->objectid, $this->contextid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -85,8 +85,7 @@ class competency_framework_updated extends base {
|
||||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
return new \moodle_url('/admin/tool/lp/editcompetencyframework.php',
|
||||
array('id' => $this->objectid, 'pagecontextid' => $this->contextid));
|
||||
return \core_competency\url::framework($this->objectid, $this->contextid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -81,10 +81,7 @@ class competency_framework_viewed extends base {
|
||||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
return new \moodle_url('/admin/tool/lp/competencies.php', array(
|
||||
'competencyframeworkid' => $this->objectid,
|
||||
'pagecontextid' => $this->contextid
|
||||
));
|
||||
return \core_competency\url::framework($this->objectid, $this->contextid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -87,8 +87,7 @@ class competency_plan_approved extends base {
|
||||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
return new \moodle_url('/admin/tool/lp/plan.php',
|
||||
array('id' => $this->objectid, 'pagecontextid' => $this->contextid));
|
||||
return \core_competency\url::plan($this->objectid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -87,8 +87,7 @@ class competency_plan_completed extends base {
|
||||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
return new \moodle_url('/admin/tool/lp/plan.php',
|
||||
array('id' => $this->objectid, 'pagecontextid' => $this->contextid));
|
||||
return \core_competency\url::plan($this->objectid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,8 +84,7 @@ class competency_plan_created extends base {
|
||||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
return new \moodle_url('/admin/tool/lp/plan.php',
|
||||
array('id' => $this->objectid, 'pagecontextid' => $this->contextid));
|
||||
return \core_competency\url::plan($this->objectid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -87,8 +87,7 @@ class competency_plan_reopened extends base {
|
||||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
return new \moodle_url('/admin/tool/lp/plan.php',
|
||||
array('id' => $this->objectid, 'pagecontextid' => $this->contextid));
|
||||
return \core_competency\url::plan($this->objectid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -87,8 +87,7 @@ class competency_plan_review_request_cancelled extends base {
|
||||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
return new \moodle_url('/admin/tool/lp/plan.php',
|
||||
array('id' => $this->objectid, 'pagecontextid' => $this->contextid));
|
||||
return \core_competency\url::plan($this->objectid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -87,8 +87,7 @@ class competency_plan_review_requested extends base {
|
||||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
return new \moodle_url('/admin/tool/lp/plan.php',
|
||||
array('id' => $this->objectid, 'pagecontextid' => $this->contextid));
|
||||
return \core_competency\url::plan($this->objectid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -87,8 +87,7 @@ class competency_plan_review_started extends base {
|
||||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
return new \moodle_url('/admin/tool/lp/plan.php',
|
||||
array('id' => $this->objectid, 'pagecontextid' => $this->contextid));
|
||||
return \core_competency\url::plan($this->objectid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -87,8 +87,7 @@ class competency_plan_review_stopped extends base {
|
||||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
return new \moodle_url('/admin/tool/lp/plan.php',
|
||||
array('id' => $this->objectid, 'pagecontextid' => $this->contextid));
|
||||
return \core_competency\url::plan($this->objectid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -87,8 +87,7 @@ class competency_plan_unapproved extends base {
|
||||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
return new \moodle_url('/admin/tool/lp/plan.php',
|
||||
array('id' => $this->objectid, 'pagecontextid' => $this->contextid));
|
||||
return \core_competency\url::plan($this->objectid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,8 +84,7 @@ class competency_plan_unlinked extends base {
|
||||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
return new \moodle_url('/admin/tool/lp/plan.php',
|
||||
array('id' => $this->objectid, 'pagecontextid' => $this->contextid));
|
||||
return \core_competency\url::plan($this->objectid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -87,8 +87,7 @@ class competency_plan_updated extends base {
|
||||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
return new \moodle_url('/admin/tool/lp/plan.php',
|
||||
array('id' => $this->objectid, 'pagecontextid' => $this->contextid));
|
||||
return \core_competency\url::plan($this->objectid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,8 +84,7 @@ class competency_plan_viewed extends base {
|
||||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
return new \moodle_url('/admin/tool/lp/plan.php',
|
||||
array('id' => $this->objectid, 'pagecontextid' => $this->contextid));
|
||||
return \core_competency\url::plan($this->objectid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,8 +84,7 @@ class competency_template_created extends base {
|
||||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
return new \moodle_url('/admin/tool/lp/edittemplate.php',
|
||||
array('id' => $this->objectid, 'pagecontextid' => $this->contextid));
|
||||
return \core_competency\url::template($this->objectid, $this->contextid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -87,8 +87,7 @@ class competency_template_updated extends base {
|
||||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
return new \moodle_url('/admin/tool/lp/edittemplate.php',
|
||||
array('id' => $this->objectid, 'pagecontextid' => $this->contextid));
|
||||
return \core_competency\url::template($this->objectid, $this->contextid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,8 +84,7 @@ class competency_template_viewed extends base {
|
||||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
return new \moodle_url('/admin/tool/lp/templatecompetencies.php',
|
||||
array('templateid' => $this->objectid, 'pagecontextid' => $this->contextid));
|
||||
return \core_competency\url::template($this->objectid, $this->contextid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -82,10 +82,7 @@ class competency_updated extends base {
|
||||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
return new \moodle_url('/admin/tool/lp/editcompetency.php', array(
|
||||
'id' => $this->objectid,
|
||||
'pagecontextid' => $this->contextid
|
||||
));
|
||||
return \core_competency\url::competency($this->objectid, $this->contextid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -93,11 +93,8 @@ class competency_user_competency_plan_viewed extends base {
|
||||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
return new \moodle_url('/admin/tool/lp/user_competency_in_plan.php', array(
|
||||
'competencyid' => $this->other['competencyid'],
|
||||
'userid' => $this->relateduserid,
|
||||
'planid' => $this->other['planid']
|
||||
));
|
||||
return \core_competency\url::user_competency_in_plan($this->relateduserid, $this->other['competencyid'],
|
||||
$this->other['planid']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -94,9 +94,7 @@ class competency_user_competency_rated extends base {
|
||||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
return new \moodle_url('/admin/tool/lp/user_competency.php', array(
|
||||
'id' => $this->objectid
|
||||
));
|
||||
return \core_competency\url::user_competency($this->objectid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -100,11 +100,8 @@ class competency_user_competency_rated_in_course extends base {
|
||||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
return new \moodle_url('/admin/tool/lp/user_competency_in_course.php', array(
|
||||
'competencyid' => $this->other['competencyid'],
|
||||
'userid' => $this->relateduserid,
|
||||
'courseid' => $this->courseid
|
||||
));
|
||||
return \core_competency\url::user_competency_in_course($this->relateduserid, $this->other['competencyid'],
|
||||
$this->courseid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -100,11 +100,8 @@ class competency_user_competency_rated_in_plan extends base {
|
||||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
return new \moodle_url('/admin/tool/lp/user_competency_in_plan.php', array(
|
||||
'competencyid' => $this->other['competencyid'],
|
||||
'userid' => $this->relateduserid,
|
||||
'planid' => $this->other['planid']
|
||||
));
|
||||
return \core_competency\url::user_competency_in_plan($this->relateduserid, $this->other['competencyid'],
|
||||
$this->other['planid']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,9 +84,7 @@ class competency_user_competency_review_request_cancelled extends base {
|
||||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
return new \moodle_url('/admin/tool/lp/user_competency.php', array(
|
||||
'id' => $this->objectid
|
||||
));
|
||||
return \core_competency\url::user_competency($this->objectid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,9 +84,7 @@ class competency_user_competency_review_requested extends base {
|
||||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
return new \moodle_url('/admin/tool/lp/user_competency.php', array(
|
||||
'id' => $this->objectid
|
||||
));
|
||||
return \core_competency\url::user_competency($this->objectid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,9 +84,7 @@ class competency_user_competency_review_started extends base {
|
||||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
return new \moodle_url('/admin/tool/lp/user_competency.php', array(
|
||||
'id' => $this->objectid
|
||||
));
|
||||
return \core_competency\url::user_competency($this->objectid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,9 +84,7 @@ class competency_user_competency_review_stopped extends base {
|
||||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
return new \moodle_url('/admin/tool/lp/user_competency.php', array(
|
||||
'id' => $this->objectid
|
||||
));
|
||||
return \core_competency\url::user_competency($this->objectid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -93,9 +93,7 @@ class competency_user_competency_viewed extends base {
|
||||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
return new \moodle_url('/admin/tool/lp/user_competency.php', array(
|
||||
'id' => $this->objectid
|
||||
));
|
||||
return \core_competency\url::user_competency($this->objectid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -96,11 +96,8 @@ class competency_user_competency_viewed_in_course extends base {
|
||||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
return new \moodle_url('/admin/tool/lp/user_competency_in_course.php', array(
|
||||
'competencyid' => $this->other['competencyid'],
|
||||
'userid' => $this->relateduserid,
|
||||
'courseid' => $this->courseid
|
||||
));
|
||||
return \core_competency\url::user_competency_in_course($this->relateduserid, $this->other['competencyid'],
|
||||
$this->courseid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -97,11 +97,8 @@ class competency_user_competency_viewed_in_plan extends base {
|
||||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
return new \moodle_url('/admin/tool/lp/user_competency_in_plan.php', array(
|
||||
'competencyid' => $this->other['competencyid'],
|
||||
'userid' => $this->relateduserid,
|
||||
'planid' => $this->other['planid']
|
||||
));
|
||||
return \core_competency\url::user_competency_in_plan($this->relateduserid, $this->other['competencyid'],
|
||||
$this->other['planid']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -85,8 +85,7 @@ class competency_user_evidence_created extends base {
|
||||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
return new \moodle_url('/admin/tool/lp/user_evidence.php',
|
||||
array('id' => $this->objectid));
|
||||
return \core_competency\url::user_evidence($this->objectid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -85,8 +85,7 @@ class competency_user_evidence_updated extends base {
|
||||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
return new \moodle_url('/admin/tool/lp/user_evidence.php',
|
||||
array('id' => $this->objectid));
|
||||
return \core_competency\url::user_evidence($this->objectid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -82,10 +82,7 @@ class competency_viewed extends base {
|
||||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
return new \moodle_url('/admin/tool/lp/editcompetency.php', array(
|
||||
'id' => $this->objectid,
|
||||
'pagecontextid' => $this->contextid
|
||||
));
|
||||
return \core_competency\url::competency($this->objectid, $this->contextid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user