mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
Merge branch 'MDL-40431_master' of https://github.com/markn86/moodle
This commit is contained in:
commit
ed9e492087
7 changed files with 27 additions and 20 deletions
|
@ -67,7 +67,7 @@ if ($roleid && !isset($assignableroles[$roleid])) {
|
|||
$a = new stdClass;
|
||||
$a->roleid = $roleid;
|
||||
$a->context = $contextname;
|
||||
print_error('cannotassignrolehere', '', get_context_url($context), $a);
|
||||
print_error('cannotassignrolehere', '', $context->get_url(), $a);
|
||||
}
|
||||
|
||||
// Work out an appropriate page title.
|
||||
|
|
|
@ -212,7 +212,7 @@ if (empty($availablefilters)) {
|
|||
/// Appropriate back link.
|
||||
if (!$isfrontpage) {
|
||||
echo html_writer::start_tag('div', array('class'=>'backlink'));
|
||||
echo html_writer::tag('a', get_string('backto', '', $contextname), array('href'=>get_context_url($context)));
|
||||
echo html_writer::tag('a', get_string('backto', '', $contextname), array('href' => $context->get_url()));
|
||||
echo html_writer::end_tag('div');
|
||||
}
|
||||
|
||||
|
|
|
@ -7247,19 +7247,6 @@ function context_instance_preload_sql($joinon, $contextlevel, $tablealias) {
|
|||
return array($select, $join);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a URL for a context, if there is a natural one. For example, for
|
||||
* CONTEXT_COURSE, this is the course page. For CONTEXT_USER it is the
|
||||
* user profile page.
|
||||
*
|
||||
* @deprecated since 2.2
|
||||
* @param context $context the context.
|
||||
* @return moodle_url
|
||||
*/
|
||||
function get_context_url(context $context) {
|
||||
return $context->get_url();
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this context part of any course? if yes return course context,
|
||||
* if not return null or throw exception.
|
||||
|
|
|
@ -4137,3 +4137,19 @@ function delete_context($contextlevel, $instanceid, $deleterecord = true) {
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a URL for a context, if there is a natural one. For example, for
|
||||
* CONTEXT_COURSE, this is the course page. For CONTEXT_USER it is the
|
||||
* user profile page.
|
||||
*
|
||||
* @deprecated since 2.2
|
||||
* @see context::get_url()
|
||||
* @param context $context the context
|
||||
* @return moodle_url
|
||||
*/
|
||||
function get_context_url(context $context) {
|
||||
debugging('get_context_url() is deprecated, please use $context->get_url() instead.', DEBUG_DEVELOPER);
|
||||
return $context->get_url();
|
||||
}
|
||||
|
||||
|
|
|
@ -215,10 +215,10 @@ class required_capability_exception extends moodle_exception {
|
|||
$capabilityname = get_capability_string($capability);
|
||||
if ($context->contextlevel == CONTEXT_MODULE and preg_match('/:view$/', $capability)) {
|
||||
// we can not go to mod/xx/view.php because we most probably do not have cap to view it, let's go to course instead
|
||||
$paranetcontext = $context->get_parent_context();
|
||||
$link = get_context_url($paranetcontext);
|
||||
$parentcontext = $context->get_parent_context();
|
||||
$link = $parentcontext->get_url();
|
||||
} else {
|
||||
$link = get_context_url($context);
|
||||
$link = $context->get_url();
|
||||
}
|
||||
parent::__construct($errormessage, $stringfile, $link, $capabilityname);
|
||||
}
|
||||
|
|
|
@ -2476,8 +2476,11 @@ class accesslib_testcase extends advanced_testcase {
|
|||
$this->assertDebuggingCalled('print_context_name() is deprecated, please use $context->get_context_name() instead.', DEBUG_DEVELOPER);
|
||||
$this->assertFalse(empty($name));
|
||||
|
||||
$url = get_context_url($coursecontext);
|
||||
$this->assertFalse($url instanceof modole_url);
|
||||
$url1 = get_context_url($coursecontext);
|
||||
$this->assertDebuggingCalled('get_context_url() is deprecated, please use $context->get_url() instead.', DEBUG_DEVELOPER);
|
||||
$url2 = $coursecontext->get_url();
|
||||
$this->assertEquals($url1, $url2);
|
||||
$this->assertFalse($url2 instanceof modole_url);
|
||||
|
||||
$pagecm = get_coursemodule_from_instance('page', $testpages[7]);
|
||||
$context = context_module::instance($pagecm->id);
|
||||
|
|
|
@ -24,6 +24,7 @@ information provided here is intended especially for developers.
|
|||
* print_context_name() is deprecated, please use $context->get_context_name().
|
||||
* mark_context_dirty($context->path) is deprecated, please use $context->mark_dirty().
|
||||
* delete_context() is deprecated, please use $context->delete_content() or context_helper::delete_instance().
|
||||
* get_context_url() is deprecated, please use $context->get_url().
|
||||
|
||||
=== 2.5.1 ===
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue