mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
Merge branch 'MDL-34456-master-integration' of git://github.com/FMCorz/moodle
This commit is contained in:
commit
5237103a99
31 changed files with 45 additions and 46 deletions
|
@ -61,7 +61,7 @@ class block_admin_bookmarks extends block_base {
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function applicable_formats() {
|
function applicable_formats() {
|
||||||
if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
|
if (has_capability('moodle/site:config', context_system::instance())) {
|
||||||
return array('all' => true);
|
return array('all' => true);
|
||||||
} else {
|
} else {
|
||||||
return array('site' => true);
|
return array('site' => true);
|
||||||
|
|
|
@ -4,7 +4,7 @@ require('../../config.php');
|
||||||
|
|
||||||
require_once($CFG->libdir.'/adminlib.php');
|
require_once($CFG->libdir.'/adminlib.php');
|
||||||
require_login();
|
require_login();
|
||||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
$context = context_system::instance();
|
||||||
$PAGE->set_context($context);
|
$PAGE->set_context($context);
|
||||||
$adminroot = admin_get_root(false, false); // settings not required - only pages
|
$adminroot = admin_get_root(false, false); // settings not required - only pages
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ require('../../config.php');
|
||||||
require_once($CFG->libdir.'/adminlib.php');
|
require_once($CFG->libdir.'/adminlib.php');
|
||||||
|
|
||||||
require_login();
|
require_login();
|
||||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
$context = context_system::instance();
|
||||||
$PAGE->set_context($context);
|
$PAGE->set_context($context);
|
||||||
$adminroot = admin_get_root(false, false); // settings not required - only pages
|
$adminroot = admin_get_root(false, false); // settings not required - only pages
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ class block_blog_menu extends block_base {
|
||||||
$this->content->text = html_writer::alist($menulist, array('class'=>'list'));
|
$this->content->text = html_writer::alist($menulist, array('class'=>'list'));
|
||||||
|
|
||||||
// Prepare the footer for this block
|
// Prepare the footer for this block
|
||||||
if (has_capability('moodle/blog:search', get_context_instance(CONTEXT_SYSTEM))) {
|
if (has_capability('moodle/blog:search', context_system::instance())) {
|
||||||
// Full-text search field
|
// Full-text search field
|
||||||
$form = html_writer::tag('label', get_string('search', 'admin'), array('for'=>'blogsearchquery', 'class'=>'accesshide'));
|
$form = html_writer::tag('label', get_string('search', 'admin'), array('for'=>'blogsearchquery', 'class'=>'accesshide'));
|
||||||
$form .= html_writer::empty_tag('input', array('id'=>'blogsearchquery', 'type'=>'text', 'name'=>'search'));
|
$form .= html_writer::empty_tag('input', array('id'=>'blogsearchquery', 'type'=>'text', 'name'=>'search'));
|
||||||
|
|
|
@ -118,7 +118,7 @@ class block_blog_tags extends block_base {
|
||||||
|
|
||||||
// admins should be able to read all tags
|
// admins should be able to read all tags
|
||||||
$type = '';
|
$type = '';
|
||||||
if (!has_capability('moodle/user:readuserblogs', get_context_instance(CONTEXT_SYSTEM))) {
|
if (!has_capability('moodle/user:readuserblogs', context_system::instance())) {
|
||||||
$type = " AND (p.publishstate = 'site' or p.publishstate='public')";
|
$type = " AND (p.publishstate = 'site' or p.publishstate='public')";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ class block_calendar_upcoming extends block_base {
|
||||||
$this->content->footer = '<div class="gotocal"><a href="'.$CFG->wwwroot.
|
$this->content->footer = '<div class="gotocal"><a href="'.$CFG->wwwroot.
|
||||||
'/calendar/view.php?view=upcoming&course='.$courseshown.'">'.
|
'/calendar/view.php?view=upcoming&course='.$courseshown.'">'.
|
||||||
get_string('gotocalendar', 'calendar').'</a>...</div>';
|
get_string('gotocalendar', 'calendar').'</a>...</div>';
|
||||||
$context = get_context_instance(CONTEXT_COURSE, $courseshown);
|
$context = context_course::instance($courseshown);
|
||||||
if (has_any_capability(array('moodle/calendar:manageentries', 'moodle/calendar:manageownentries'), $context)) {
|
if (has_any_capability(array('moodle/calendar:manageentries', 'moodle/calendar:manageownentries'), $context)) {
|
||||||
$this->content->footer .= '<div class="newevent"><a href="'.$CFG->wwwroot.
|
$this->content->footer .= '<div class="newevent"><a href="'.$CFG->wwwroot.
|
||||||
'/calendar/event.php?action=new&course='.$courseshown.'">'.
|
'/calendar/event.php?action=new&course='.$courseshown.'">'.
|
||||||
|
|
|
@ -36,7 +36,7 @@ require_login();
|
||||||
$courseid = required_param('courseid', PARAM_INT); //if no courseid is given
|
$courseid = required_param('courseid', PARAM_INT); //if no courseid is given
|
||||||
$parentcourse = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
|
$parentcourse = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
|
||||||
|
|
||||||
$context = get_context_instance(CONTEXT_COURSE, $courseid);
|
$context = context_course::instance($courseid);
|
||||||
$PAGE->set_course($parentcourse);
|
$PAGE->set_course($parentcourse);
|
||||||
$PAGE->set_url('/blocks/community/communitycourse.php');
|
$PAGE->set_url('/blocks/community/communitycourse.php');
|
||||||
$PAGE->set_heading($SITE->fullname);
|
$PAGE->set_heading($SITE->fullname);
|
||||||
|
|
|
@ -191,7 +191,7 @@ class community_hub_search_form extends moodleform {
|
||||||
|
|
||||||
//display enrol/download select box if the USER has the download capability on the course
|
//display enrol/download select box if the USER has the download capability on the course
|
||||||
if (has_capability('moodle/community:download',
|
if (has_capability('moodle/community:download',
|
||||||
get_context_instance(CONTEXT_COURSE, $this->_customdata['courseid']))) {
|
context_course::instance($this->_customdata['courseid']))) {
|
||||||
$options = array(0 => get_string('enrollable', 'block_community'),
|
$options = array(0 => get_string('enrollable', 'block_community'),
|
||||||
1 => get_string('downloadable', 'block_community'));
|
1 => get_string('downloadable', 'block_community'));
|
||||||
$mform->addElement('select', 'downloadable', get_string('enroldownload', 'block_community'),
|
$mform->addElement('select', 'downloadable', get_string('enroldownload', 'block_community'),
|
||||||
|
|
|
@ -113,7 +113,7 @@ class block_community_manager {
|
||||||
|
|
||||||
$fs = get_file_storage();
|
$fs = get_file_storage();
|
||||||
$record = new stdClass();
|
$record = new stdClass();
|
||||||
$record->contextid = get_context_instance(CONTEXT_USER, $USER->id)->id;
|
$record->contextid = context_user::instance($USER->id)->id;
|
||||||
$record->component = 'user';
|
$record->component = 'user';
|
||||||
$record->filearea = 'private';
|
$record->filearea = 'private';
|
||||||
$record->itemid = 0;
|
$record->itemid = 0;
|
||||||
|
|
|
@ -51,7 +51,7 @@ class block_completionstatus extends block_base {
|
||||||
$this->content = new stdClass;
|
$this->content = new stdClass;
|
||||||
|
|
||||||
// Can edit settings?
|
// Can edit settings?
|
||||||
$can_edit = has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $this->page->course->id));
|
$can_edit = has_capability('moodle/course:update', context_course::instance($this->page->course->id));
|
||||||
|
|
||||||
// Get course completion data
|
// Get course completion data
|
||||||
$info = new completion_info($this->page->course);
|
$info = new completion_info($this->page->course);
|
||||||
|
@ -84,7 +84,7 @@ class block_completionstatus extends block_base {
|
||||||
// Check this user is enroled
|
// Check this user is enroled
|
||||||
if (!$info->is_tracked_user($USER->id)) {
|
if (!$info->is_tracked_user($USER->id)) {
|
||||||
// If not enrolled, but are can view the report:
|
// If not enrolled, but are can view the report:
|
||||||
if (has_capability('report/completion:view', get_context_instance(CONTEXT_COURSE, $COURSE->id))) {
|
if (has_capability('report/completion:view', context_course::instance($COURSE->id))) {
|
||||||
$this->content->text = '<a href="'.$CFG->wwwroot.'/report/completion/index.php?course='.$COURSE->id.
|
$this->content->text = '<a href="'.$CFG->wwwroot.'/report/completion/index.php?course='.$COURSE->id.
|
||||||
'">'.get_string('viewcoursereport', 'completion').'</a>';
|
'">'.get_string('viewcoursereport', 'completion').'</a>';
|
||||||
return $this->content;
|
return $this->content;
|
||||||
|
|
|
@ -52,8 +52,8 @@ if ($userid) {
|
||||||
// Check permissions
|
// Check permissions
|
||||||
require_login($course);
|
require_login($course);
|
||||||
|
|
||||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
$coursecontext = context_course::instance($course->id);
|
||||||
$personalcontext = get_context_instance(CONTEXT_USER, $user->id);
|
$personalcontext = context_user::instance($user->id);
|
||||||
|
|
||||||
$can_view = false;
|
$can_view = false;
|
||||||
|
|
||||||
|
|
|
@ -33,17 +33,17 @@ class block_course_list extends block_list {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($CFG->disablemycourses) and isloggedin() and !isguestuser() and
|
if (empty($CFG->disablemycourses) and isloggedin() and !isguestuser() and
|
||||||
!(has_capability('moodle/course:update', get_context_instance(CONTEXT_SYSTEM)) and $adminseesall)) { // Just print My Courses
|
!(has_capability('moodle/course:update', context_system::instance()) and $adminseesall)) { // Just print My Courses
|
||||||
if ($courses = enrol_get_my_courses(NULL, 'visible DESC, fullname ASC')) {
|
if ($courses = enrol_get_my_courses(NULL, 'visible DESC, fullname ASC')) {
|
||||||
foreach ($courses as $course) {
|
foreach ($courses as $course) {
|
||||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
$coursecontext = context_course::instance($course->id);
|
||||||
$linkcss = $course->visible ? "" : " class=\"dimmed\" ";
|
$linkcss = $course->visible ? "" : " class=\"dimmed\" ";
|
||||||
$this->content->items[]="<a $linkcss title=\"" . format_string($course->shortname, true, array('context' => $coursecontext)) . "\" ".
|
$this->content->items[]="<a $linkcss title=\"" . format_string($course->shortname, true, array('context' => $coursecontext)) . "\" ".
|
||||||
"href=\"$CFG->wwwroot/course/view.php?id=$course->id\">".$icon.format_string($course->fullname). "</a>";
|
"href=\"$CFG->wwwroot/course/view.php?id=$course->id\">".$icon.format_string($course->fullname). "</a>";
|
||||||
}
|
}
|
||||||
$this->title = get_string('mycourses');
|
$this->title = get_string('mycourses');
|
||||||
/// If we can update any course of the view all isn't hidden, show the view all courses link
|
/// If we can update any course of the view all isn't hidden, show the view all courses link
|
||||||
if (has_capability('moodle/course:update', get_context_instance(CONTEXT_SYSTEM)) || empty($CFG->block_course_list_hideallcourseslink)) {
|
if (has_capability('moodle/course:update', context_system::instance()) || empty($CFG->block_course_list_hideallcourseslink)) {
|
||||||
$this->content->footer = "<a href=\"$CFG->wwwroot/course/index.php\">".get_string("fulllistofcourses")."</a> ...";
|
$this->content->footer = "<a href=\"$CFG->wwwroot/course/index.php\">".get_string("fulllistofcourses")."</a> ...";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,12 +57,12 @@ class block_course_list extends block_list {
|
||||||
if ($categories) { //Check we have categories
|
if ($categories) { //Check we have categories
|
||||||
if (count($categories) > 1 || (count($categories) == 1 && $DB->count_records('course') > 200)) { // Just print top level category links
|
if (count($categories) > 1 || (count($categories) == 1 && $DB->count_records('course') > 200)) { // Just print top level category links
|
||||||
foreach ($categories as $category) {
|
foreach ($categories as $category) {
|
||||||
$categoryname = format_string($category->name, true, array('context' => get_context_instance(CONTEXT_COURSECAT, $category->id)));
|
$categoryname = format_string($category->name, true, array('context' => context_coursecat::instance($category->id)));
|
||||||
$linkcss = $category->visible ? "" : " class=\"dimmed\" ";
|
$linkcss = $category->visible ? "" : " class=\"dimmed\" ";
|
||||||
$this->content->items[]="<a $linkcss href=\"$CFG->wwwroot/course/category.php?id=$category->id\">".$icon . $categoryname . "</a>";
|
$this->content->items[]="<a $linkcss href=\"$CFG->wwwroot/course/category.php?id=$category->id\">".$icon . $categoryname . "</a>";
|
||||||
}
|
}
|
||||||
/// If we can update any course of the view all isn't hidden, show the view all courses link
|
/// If we can update any course of the view all isn't hidden, show the view all courses link
|
||||||
if (has_capability('moodle/course:update', get_context_instance(CONTEXT_SYSTEM)) || empty($CFG->block_course_list_hideallcourseslink)) {
|
if (has_capability('moodle/course:update', context_system::instance()) || empty($CFG->block_course_list_hideallcourseslink)) {
|
||||||
$this->content->footer .= "<a href=\"$CFG->wwwroot/course/index.php\">".get_string('fulllistofcourses').'</a> ...';
|
$this->content->footer .= "<a href=\"$CFG->wwwroot/course/index.php\">".get_string('fulllistofcourses').'</a> ...';
|
||||||
}
|
}
|
||||||
$this->title = get_string('categories');
|
$this->title = get_string('categories');
|
||||||
|
@ -72,16 +72,16 @@ class block_course_list extends block_list {
|
||||||
|
|
||||||
if ($courses) {
|
if ($courses) {
|
||||||
foreach ($courses as $course) {
|
foreach ($courses as $course) {
|
||||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
$coursecontext = context_course::instance($course->id);
|
||||||
$linkcss = $course->visible ? "" : " class=\"dimmed\" ";
|
$linkcss = $course->visible ? "" : " class=\"dimmed\" ";
|
||||||
|
|
||||||
$this->content->items[]="<a $linkcss title=\""
|
$this->content->items[]="<a $linkcss title=\""
|
||||||
. format_string($course->shortname, true, array('context' => $coursecontext))."\" ".
|
. format_string($course->shortname, true, array('context' => $coursecontext))."\" ".
|
||||||
"href=\"$CFG->wwwroot/course/view.php?id=$course->id\">"
|
"href=\"$CFG->wwwroot/course/view.php?id=$course->id\">"
|
||||||
.$icon. format_string($course->fullname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id))) . "</a>";
|
.$icon. format_string($course->fullname, true, array('context' => context_course::instance($course->id))) . "</a>";
|
||||||
}
|
}
|
||||||
/// If we can update any course of the view all isn't hidden, show the view all courses link
|
/// If we can update any course of the view all isn't hidden, show the view all courses link
|
||||||
if (has_capability('moodle/course:update', get_context_instance(CONTEXT_SYSTEM)) || empty($CFG->block_course_list_hideallcourseslink)) {
|
if (has_capability('moodle/course:update', context_system::instance()) || empty($CFG->block_course_list_hideallcourseslink)) {
|
||||||
$this->content->footer .= "<a href=\"$CFG->wwwroot/course/index.php\">".get_string('fulllistofcourses').'</a> ...';
|
$this->content->footer .= "<a href=\"$CFG->wwwroot/course/index.php\">".get_string('fulllistofcourses').'</a> ...';
|
||||||
}
|
}
|
||||||
$this->get_remote_courses();
|
$this->get_remote_courses();
|
||||||
|
@ -89,7 +89,7 @@ class block_course_list extends block_list {
|
||||||
|
|
||||||
$this->content->icons[] = '';
|
$this->content->icons[] = '';
|
||||||
$this->content->items[] = get_string('nocoursesyet');
|
$this->content->items[] = get_string('nocoursesyet');
|
||||||
if (has_capability('moodle/course:create', get_context_instance(CONTEXT_COURSECAT, $category->id))) {
|
if (has_capability('moodle/course:create', context_coursecat::instance($category->id))) {
|
||||||
$this->content->footer = '<a href="'.$CFG->wwwroot.'/course/edit.php?category='.$category->id.'">'.get_string("addnewcourse").'</a> ...';
|
$this->content->footer = '<a href="'.$CFG->wwwroot.'/course/edit.php?category='.$category->id.'">'.get_string("addnewcourse").'</a> ...';
|
||||||
}
|
}
|
||||||
$this->get_remote_courses();
|
$this->get_remote_courses();
|
||||||
|
@ -120,7 +120,7 @@ class block_course_list extends block_list {
|
||||||
$this->content->items[] = get_string('remotecourses','mnet');
|
$this->content->items[] = get_string('remotecourses','mnet');
|
||||||
$this->content->icons[] = '';
|
$this->content->icons[] = '';
|
||||||
foreach ($courses as $course) {
|
foreach ($courses as $course) {
|
||||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
$coursecontext = context_course::instance($course->id);
|
||||||
$this->content->items[]="<a title=\"" . format_string($course->shortname, true, array('context' => $coursecontext)) . "\" ".
|
$this->content->items[]="<a title=\"" . format_string($course->shortname, true, array('context' => $coursecontext)) . "\" ".
|
||||||
"href=\"{$CFG->wwwroot}/auth/mnet/jump.php?hostid={$course->hostid}&wantsurl=/course/view.php?id={$course->remoteid}\">"
|
"href=\"{$CFG->wwwroot}/auth/mnet/jump.php?hostid={$course->hostid}&wantsurl=/course/view.php?id={$course->remoteid}\">"
|
||||||
.$icon. format_string($course->fullname) . "</a>";
|
.$icon. format_string($course->fullname) . "</a>";
|
||||||
|
|
|
@ -28,7 +28,7 @@ class block_course_summary extends block_base {
|
||||||
$options = new stdClass();
|
$options = new stdClass();
|
||||||
$options->noclean = true; // Don't clean Javascripts etc
|
$options->noclean = true; // Don't clean Javascripts etc
|
||||||
$options->overflowdiv = true;
|
$options->overflowdiv = true;
|
||||||
$context = get_context_instance(CONTEXT_COURSE, $this->page->course->id);
|
$context = context_course::instance($this->page->course->id);
|
||||||
$this->page->course->summary = file_rewrite_pluginfile_urls($this->page->course->summary, 'pluginfile.php', $context->id, 'course', 'summary', NULL);
|
$this->page->course->summary = file_rewrite_pluginfile_urls($this->page->course->summary, 'pluginfile.php', $context->id, 'course', 'summary', NULL);
|
||||||
$this->content->text = format_text($this->page->course->summary, $this->page->course->summaryformat, $options);
|
$this->content->text = format_text($this->page->course->summary, $this->page->course->summaryformat, $options);
|
||||||
if ($this->page->user_is_editing()) {
|
if ($this->page->user_is_editing()) {
|
||||||
|
|
|
@ -265,7 +265,7 @@ class block_edit_form extends moodleform {
|
||||||
$defaults->bui_subpagepattern = '%@NULL@%';
|
$defaults->bui_subpagepattern = '%@NULL@%';
|
||||||
}
|
}
|
||||||
|
|
||||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
$systemcontext = context_system::instance();
|
||||||
if ($defaults->parentcontextid == $systemcontext->id) {
|
if ($defaults->parentcontextid == $systemcontext->id) {
|
||||||
$defaults->bui_contexts = BUI_CONTEXTS_ENTIRE_SITE; // System-wide and sticky
|
$defaults->bui_contexts = BUI_CONTEXTS_ENTIRE_SITE; // System-wide and sticky
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -45,7 +45,7 @@ class block_glossary_random extends block_base {
|
||||||
if (! $cm = get_coursemodule_from_instance("glossary", $this->config->glossary, $this->course->id)) {
|
if (! $cm = get_coursemodule_from_instance("glossary", $this->config->glossary, $this->course->id)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$glossaryctx = get_context_instance(CONTEXT_MODULE, $cm->id);
|
$glossaryctx = context_module::instance($cm->id);
|
||||||
|
|
||||||
$limitfrom = 0;
|
$limitfrom = 0;
|
||||||
$limitnum = 1;
|
$limitnum = 1;
|
||||||
|
@ -131,7 +131,7 @@ class block_glossary_random extends block_base {
|
||||||
$glossaryid = $this->config->glossary;
|
$glossaryid = $this->config->glossary;
|
||||||
$cm = $modinfo->instances['glossary'][$glossaryid];
|
$cm = $modinfo->instances['glossary'][$glossaryid];
|
||||||
|
|
||||||
if (!has_capability('mod/glossary:view', get_context_instance(CONTEXT_MODULE, $cm->id))) {
|
if (!has_capability('mod/glossary:view', context_module::instance($cm->id))) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ class block_glossary_random extends block_base {
|
||||||
|
|
||||||
//Obtain the visible property from the instance
|
//Obtain the visible property from the instance
|
||||||
if ($cm->uservisible) {
|
if ($cm->uservisible) {
|
||||||
if (has_capability('mod/glossary:write', get_context_instance(CONTEXT_MODULE, $cm->id))) {
|
if (has_capability('mod/glossary:write', context_module::instance($cm->id))) {
|
||||||
$this->content->footer = '<a href="'.$CFG->wwwroot.'/mod/glossary/edit.php?cmid='.$cm->id
|
$this->content->footer = '<a href="'.$CFG->wwwroot.'/mod/glossary/edit.php?cmid='.$cm->id
|
||||||
.'" title="'.$this->config->addentry.'">'.$this->config->addentry.'</a><br />';
|
.'" title="'.$this->config->addentry.'">'.$this->config->addentry.'</a><br />';
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -10,7 +10,7 @@ class block_mnet_hosts extends block_list {
|
||||||
}
|
}
|
||||||
|
|
||||||
function applicable_formats() {
|
function applicable_formats() {
|
||||||
if (has_capability('moodle/site:mnetlogintoremote', get_context_instance(CONTEXT_SYSTEM), NULL, false)) {
|
if (has_capability('moodle/site:mnetlogintoremote', context_system::instance(), NULL, false)) {
|
||||||
return array('all' => true, 'mod' => false, 'tag' => false);
|
return array('all' => true, 'mod' => false, 'tag' => false);
|
||||||
} else {
|
} else {
|
||||||
return array('site' => true);
|
return array('site' => true);
|
||||||
|
@ -59,7 +59,7 @@ class block_mnet_hosts extends block_list {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!has_capability('moodle/site:mnetlogintoremote', get_context_instance(CONTEXT_SYSTEM), NULL, false)) {
|
if (!has_capability('moodle/site:mnetlogintoremote', context_system::instance(), NULL, false)) {
|
||||||
if (debugging() and !empty($CFG->debugdisplay)) {
|
if (debugging() and !empty($CFG->debugdisplay)) {
|
||||||
$this->content = new stdClass();
|
$this->content = new stdClass();
|
||||||
$this->content->footer = html_writer::tag('span',
|
$this->content->footer = html_writer::tag('span',
|
||||||
|
|
|
@ -418,7 +418,7 @@ class block_base {
|
||||||
$this->config = unserialize(base64_decode($instance->configdata));
|
$this->config = unserialize(base64_decode($instance->configdata));
|
||||||
}
|
}
|
||||||
$this->instance = $instance;
|
$this->instance = $instance;
|
||||||
$this->context = get_context_instance(CONTEXT_BLOCK, $instance->id);
|
$this->context = context_block::instance($instance->id);
|
||||||
$this->page = $page;
|
$this->page = $page;
|
||||||
$this->specialization();
|
$this->specialization();
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ class block_news_items extends block_base {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
$context = context_module::instance($cm->id);
|
||||||
|
|
||||||
/// User must have perms to view discussions in that forum
|
/// User must have perms to view discussions in that forum
|
||||||
if (!has_capability('mod/forum:viewdiscussion', $context)) {
|
if (!has_capability('mod/forum:viewdiscussion', $context)) {
|
||||||
|
|
|
@ -26,7 +26,7 @@ class block_participants extends block_list {
|
||||||
$this->content = '';
|
$this->content = '';
|
||||||
return $this->content;
|
return $this->content;
|
||||||
} else if ($this->page->course->id == SITEID) {
|
} else if ($this->page->course->id == SITEID) {
|
||||||
if (!has_capability('moodle/site:viewparticipants', get_context_instance(CONTEXT_SYSTEM))) {
|
if (!has_capability('moodle/site:viewparticipants', context_system::instance())) {
|
||||||
$this->content = '';
|
$this->content = '';
|
||||||
return $this->content;
|
return $this->content;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ if (isguestuser()) {
|
||||||
}
|
}
|
||||||
//TODO: add capability check here!
|
//TODO: add capability check here!
|
||||||
|
|
||||||
$context = get_context_instance(CONTEXT_USER, $USER->id);
|
$context = context_user::instance($USER->id);
|
||||||
$title = get_string('privatefiles', 'block_private_files');
|
$title = get_string('privatefiles', 'block_private_files');
|
||||||
$struser = get_string('user');
|
$struser = get_string('user');
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ class private_files_tree implements renderable {
|
||||||
public $dir;
|
public $dir;
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
global $USER;
|
global $USER;
|
||||||
$this->context = get_context_instance(CONTEXT_USER, $USER->id);
|
$this->context = context_user::instance($USER->id);
|
||||||
$fs = get_file_storage();
|
$fs = get_file_storage();
|
||||||
$this->dir = $fs->get_area_tree($this->context->id, 'user', 'private', 0);
|
$this->dir = $fs->get_area_tree($this->context->id, 'user', 'private', 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,7 +151,7 @@ class block_quiz_results extends block_base {
|
||||||
$context = $this->page->context;
|
$context = $this->page->context;
|
||||||
} else {
|
} else {
|
||||||
$cm = get_coursemodule_from_instance('quiz', $quizid, $courseid);
|
$cm = get_coursemodule_from_instance('quiz', $quizid, $courseid);
|
||||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
$context = context_module::instance($cm->id);
|
||||||
}
|
}
|
||||||
$groupmode = groups_get_activity_groupmode($cm);
|
$groupmode = groups_get_activity_groupmode($cm);
|
||||||
|
|
||||||
|
|
|
@ -158,7 +158,7 @@ if ($courseid) {
|
||||||
$PAGE->set_course($course);
|
$PAGE->set_course($course);
|
||||||
$context = $PAGE->context;
|
$context = $PAGE->context;
|
||||||
} else {
|
} else {
|
||||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
$context = context_system::instance();
|
||||||
$PAGE->set_context($context);
|
$PAGE->set_context($context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ if ($courseid) {
|
||||||
$PAGE->set_course($course);
|
$PAGE->set_course($course);
|
||||||
$context = $PAGE->context;
|
$context = $PAGE->context;
|
||||||
} else {
|
} else {
|
||||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
$context = context_system::instance();
|
||||||
$PAGE->set_context($context);
|
$PAGE->set_context($context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ if ($courseid) {
|
||||||
$PAGE->set_course($course);
|
$PAGE->set_course($course);
|
||||||
$context = $PAGE->context;
|
$context = $PAGE->context;
|
||||||
} else {
|
} else {
|
||||||
$context = get_context_instance(CONTEXT_SYSTEM);
|
$context = context_system::instance();
|
||||||
$PAGE->set_context($context);
|
$PAGE->set_context($context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ class block_section_links extends block_base {
|
||||||
}
|
}
|
||||||
|
|
||||||
$course = $this->page->course;
|
$course = $this->page->course;
|
||||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
$context = context_course::instance($course->id);
|
||||||
|
|
||||||
if ($course->format == 'weeks' or $course->format == 'weekscss') {
|
if ($course->format == 'weeks' or $course->format == 'weekscss') {
|
||||||
$highlight = ceil((time()-$course->startdate)/604800);
|
$highlight = ceil((time()-$course->startdate)/604800);
|
||||||
|
|
|
@ -51,7 +51,7 @@ class block_selfcompletion extends block_base {
|
||||||
$this->content = new stdClass;
|
$this->content = new stdClass;
|
||||||
|
|
||||||
// Can edit settings?
|
// Can edit settings?
|
||||||
$can_edit = has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $this->page->course->id));
|
$can_edit = has_capability('moodle/course:update', context_course::instance($this->page->course->id));
|
||||||
|
|
||||||
// Get course completion data
|
// Get course completion data
|
||||||
$info = new completion_info($this->page->course);
|
$info = new completion_info($this->page->course);
|
||||||
|
|
|
@ -134,7 +134,7 @@ class block_settings extends block_base {
|
||||||
|
|
||||||
// only do search if you have moodle/site:config
|
// only do search if you have moodle/site:config
|
||||||
if (!empty($this->content->text)) {
|
if (!empty($this->content->text)) {
|
||||||
if (has_capability('moodle/site:config',get_context_instance(CONTEXT_SYSTEM)) ) {
|
if (has_capability('moodle/site:config',context_system::instance()) ) {
|
||||||
$this->content->footer = $renderer->search_form(new moodle_url("$CFG->wwwroot/$CFG->admin/search.php"), optional_param('query', '', PARAM_RAW));
|
$this->content->footer = $renderer->search_form(new moodle_url("$CFG->wwwroot/$CFG->admin/search.php"), optional_param('query', '', PARAM_RAW));
|
||||||
} else {
|
} else {
|
||||||
$this->content->footer = '';
|
$this->content->footer = '';
|
||||||
|
|
|
@ -27,7 +27,7 @@ class block_site_main_menu extends block_list {
|
||||||
|
|
||||||
$course = $this->page->course;
|
$course = $this->page->course;
|
||||||
require_once($CFG->dirroot.'/course/lib.php');
|
require_once($CFG->dirroot.'/course/lib.php');
|
||||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
$context = context_course::instance($course->id);
|
||||||
$isediting = $this->page->user_is_editing() && has_capability('moodle/course:manageactivities', $context);
|
$isediting = $this->page->user_is_editing() && has_capability('moodle/course:manageactivities', $context);
|
||||||
$modinfo = get_fast_modinfo($course);
|
$modinfo = get_fast_modinfo($course);
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ class block_social_activities extends block_list {
|
||||||
|
|
||||||
require_once($CFG->dirroot.'/course/lib.php');
|
require_once($CFG->dirroot.'/course/lib.php');
|
||||||
|
|
||||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
$context = context_course::instance($course->id);
|
||||||
$isediting = $this->page->user_is_editing() && has_capability('moodle/course:manageactivities', $context);
|
$isediting = $this->page->user_is_editing() && has_capability('moodle/course:manageactivities', $context);
|
||||||
$modinfo = get_fast_modinfo($course);
|
$modinfo = get_fast_modinfo($course);
|
||||||
|
|
||||||
|
|
|
@ -81,13 +81,12 @@ class block_tags extends block_base {
|
||||||
require_once($CFG->dirroot.'/tag/coursetagslib.php');
|
require_once($CFG->dirroot.'/tag/coursetagslib.php');
|
||||||
|
|
||||||
// Permissions and page awareness
|
// Permissions and page awareness
|
||||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
$systemcontext = context_system::instance();
|
||||||
$loggedin = isloggedin() && !isguestuser();
|
$loggedin = isloggedin() && !isguestuser();
|
||||||
$coursepage = $canedit = false;
|
$coursepage = $canedit = false;
|
||||||
$coursepage = (isset($this->page->course->id) && $this->page->course->id != SITEID);
|
$coursepage = (isset($this->page->course->id) && $this->page->course->id != SITEID);
|
||||||
$mymoodlepage = ($SCRIPT == '/my/index.php') ? true : false;
|
$mymoodlepage = ($SCRIPT == '/my/index.php') ? true : false;
|
||||||
$sitepage = (isset($this->page->course->id) && $this->page->course->id == SITEID && !$mymoodlepage);
|
$sitepage = (isset($this->page->course->id) && $this->page->course->id == SITEID && !$mymoodlepage);
|
||||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $this->page->course->id);
|
|
||||||
if ($coursepage) {
|
if ($coursepage) {
|
||||||
$canedit = has_capability('moodle/tag:create', $systemcontext);
|
$canedit = has_capability('moodle/tag:create', $systemcontext);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue