Merge branch 'wip-MDL-40429-master' of git://github.com/abgreeve/moodle

This commit is contained in:
Dan Poltawski 2013-07-09 16:52:52 +08:00
commit f6455e63dd
5 changed files with 17 additions and 13 deletions

View File

@ -61,7 +61,7 @@ if ($action === 'delete') {
//show confirmation
echo $OUTPUT->header();
$yesurl = new moodle_url($PAGE->url, array('roleid'=>$roleid, 'contextlevel'=>$contextlevel, 'action'=>'delete', 'confirm'=>1, 'sesskey'=>sesskey()));
$levelname = get_contextlevel_name($contextlevel);
$levelname = context_helper::get_level_name($contextlevel);
$rolename = format_string($role->name);
$message = get_string('confirmdelete', 'tool_unsuproles', array('level'=>$levelname, 'role'=>$rolename));
echo $OUTPUT->confirm($message, $yesurl, $PAGE->url);
@ -96,7 +96,7 @@ if (!$problems) {
$roles = get_all_roles();
$data = array();
foreach ($problems as $problem) {
$levelname = get_contextlevel_name($problem->contextlevel);
$levelname = context_helper::get_level_name($problem->contextlevel);
$rolename = role_get_name($roles[$problem->roleid]);
//TODO: show list of users if count low
$count = $problem->racount;

View File

@ -7302,17 +7302,6 @@ function delete_context($contextlevel, $instanceid, $deleterecord = true) {
return true;
}
/**
* Returns context level name
*
* @deprecated since 2.2
* @param integer $contextlevel $context->context level. One of the CONTEXT_... constants.
* @return string the name for this type of context.
*/
function get_contextlevel_name($contextlevel) {
return context_helper::get_level_name($contextlevel);
}
/**
* Prints human readable context identifier.
*

View File

@ -5093,3 +5093,16 @@ function context_instance_preload(stdClass $rec) {
debugging('context_instance_preload() is deprecated, please use context_helper::preload_from_record() instead.', DEBUG_DEVELOPER);
context_helper::preload_from_record($rec);
}
/**
* Returns context level name
*
* @deprecated since 2.2
* @see context_helper::get_level_name()
* @param integer $contextlevel $context->context level. One of the CONTEXT_... constants.
* @return string the name for this type of context.
*/
function get_contextlevel_name($contextlevel) {
debugging('get_contextlevel_name() is deprecated, please use context_helper::get_level_name() instead.', DEBUG_DEVELOPER);
return context_helper::get_level_name($contextlevel);
}

View File

@ -2464,6 +2464,7 @@ class accesslib_testcase extends advanced_testcase {
$this->assertFalse($DB->record_exists('context', array('contextlevel'=>CONTEXT_COURSE, 'instanceid'=>$testcourses[2])));
$name = get_contextlevel_name(CONTEXT_COURSE);
$this->assertDebuggingCalled('get_contextlevel_name() is deprecated, please use context_helper::get_level_name() instead.', DEBUG_DEVELOPER);
$this->assertFalse(empty($name));
$context = context_course::instance($testcourses[2]);

View File

@ -20,6 +20,7 @@ information provided here is intended especially for developers.
* preload_course_contexts() is deprecated, please use context_helper::preload_course().
* context_moved() is deprecated, please use context::update_moved().
* context_instance_preload() is deprecated, please use context_helper::preload_from_record().
* get_contextlevel_name() is deprecated, please use context_helper::get_level_name().
=== 2.5.1 ===