}
function get_content() {
- global $CFG, $COURSE, $DB;
+ global $CFG, $DB;
if($this->content !== NULL) {
return $this->content;
function get_content() {
- global $CFG, $USER, $PAGE;
+ global $CFG, $USER;
if ($this->content !== NULL) {
return $this->content;
$bookmarks = array();
}
- if (isset($PAGE->section) and $PAGE->section == 'search'){
+ // TODO
+ if (isset($this->page->section) and $this->page->section == 'search'){
// the search page can't be properly bookmarked at present
$this->content->footer = '';
- } else if (($section = (isset($PAGE->section) ? $PAGE->section : '')) && (in_array($section, $bookmarks))) {
+ } else if (($section = (isset($this->page->section) ? $this->page->section : '')) && (in_array($section, $bookmarks))) {
$this->content->footer = '<a href="' . $CFG->wwwroot . '/blocks/admin_bookmarks/delete.php?section=' . $section . '&sesskey='.sesskey().'">' . get_string('unbookmarkthispage','admin') . '</a>';
- } else if ($section = (isset($PAGE->section) ? $PAGE->section : '')) {
+ } else if ($section = (isset($this->page->section) ? $this->page->section : '')) {
$this->content->footer = '<a href="' . $CFG->wwwroot . '/blocks/admin_bookmarks/create.php?section=' . $section . '&sesskey='.sesskey().'">' . get_string('bookmarkthispage','admin') . '</a>';
} else {
$this->content->footer = '';
var $destination;
function init() {
- global $PAGE;
$this->title = get_string('administrationsite');
$this->version = 2007101509;
$this->currentdepth = 0;
$this->divcounter = 1;
$this->tempcontent = '';
- $this->section = (isset($PAGE->section) ? $PAGE->section : '');
+ // TODO
+ $this->section = (isset($this->page->section) ? $this->page->section : '');
$this->pathtosection = array();
$this->expandnodes = array();
}
}
function get_content() {
- global $CFG, $USER, $COURSE;
+ global $CFG, $USER;
if (empty($CFG->bloglevel)) {
$this->content->text = '';
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
- if ($COURSE->id != SITEID) {
+ if ($this->page->course->id != SITEID) {
$incoursecontext = true;
- $curcontext = get_context_instance(CONTEXT_COURSE, $COURSE->id);
+ $curcontext = get_context_instance(CONTEXT_COURSE, $this->page->course->id);
} else {
$incoursecontext = false;
$curcontext = $sitecontext;
if ( (isloggedin() && !isguest()) && $incoursecontext
&& $CFG->bloglevel >= BLOG_COURSE_LEVEL && $canviewblogs) {
- $coursearg = '&courseid='.$COURSE->id;
+ $coursearg = '&courseid='.$this->page->course->id;
// a course is specified
- $courseviewlink = '<li><a href="'. $CFG->wwwroot .'/blog/index.php?filtertype=course&filterselect='. $COURSE->id .'">';
+ $courseviewlink = '<li><a href="'. $CFG->wwwroot .'/blog/index.php?filtertype=course&filterselect='. $this->page->course->id .'">';
$courseviewlink .= get_string('viewcourseentries', 'blog') ."</a></li>\n";
}
}
function get_content() {
- global $CFG, $SITE, $COURSE, $USER, $DB;
+ global $CFG, $SITE, $USER, $DB;
if (empty($CFG->usetags) || empty($CFG->bloglevel)) {
$this->content->text = '';
case BLOG_GROUP_LEVEL:
$filtertype = 'group';
- $filterselect = groups_get_course_group($COURSE);
+ $filterselect = groups_get_course_group($this->page->course);
break;
case BLOG_COURSE_LEVEL:
$filtertype = 'course';
- $filterselect = $COURSE->id;
+ $filterselect = $this->page->course->id;
break;
default:
- if (isset($COURSE->id) && $COURSE->id != SITEID) {
+ if ($this->page->course->id != SITEID) {
$filtertype = 'course';
- $filterselect = $COURSE->id;
+ $filterselect = $this->page->course->id;
} else {
$filtertype = 'site';
$filterselect = SITEID;
}
function get_content() {
- global $USER, $CFG, $SESSION, $COURSE;
+ global $USER, $CFG, $SESSION;
$cal_m = optional_param( 'cal_m', 0, PARAM_INT );
$cal_y = optional_param( 'cal_y', 0, PARAM_INT );
return $this->content;
}
// Reset the session variables
- calendar_session_vars($COURSE);
+ calendar_session_vars($this->page->course);
$this->content = new stdClass;
$this->content->text = '';
// [pj] To me it looks like this if would never be needed, but Penny added it
// when committing the /my/ stuff. Reminder to discuss and learn what it's about.
// It definitely needs SOME comment here!
- $courseshown = $COURSE->id;
+ $courseshown = $this->page->course->id;
if ($courseshown == SITEID) {
// Being displayed at site level. This will cause the filter to fall back to auto-detecting
} else {
//MDL-14693: fix calendar on resource page
- $courseshown = optional_param( 'id', $COURSE->id, PARAM_INT );
+ $courseshown = optional_param( 'id', $this->page->course->id, PARAM_INT );
// Forcibly filter events to include only those from the particular course we are in.
- $filtercourse = array($courseshown => $COURSE);
+ $filtercourse = array($courseshown => $this->page->course);
$groupeventsfrom = array($courseshown => 1);
}
calendar_set_referring_course($courseshown);
// MDL-9059, set to show this course when admins go into a course, then unset it.
- if ($COURSE->id != SITEID && !isset($SESSION->cal_courses_shown[$COURSE->id]) && has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_SYSTEM))) {
+ if ($this->page->course->id != SITEID && !isset($SESSION->cal_courses_shown[$this->page->course->id]) && has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_SYSTEM))) {
$courseset = true;
- $SESSION->cal_courses_shown[$COURSE->id] = $COURSE;
+ $SESSION->cal_courses_shown[$this->page->course->id] = $this->page->course;
}
// Be VERY careful with the format for default courses arguments!
$this->content->text .= calendar_top_controls('course', array('id' => $courseshown, 'm' => $cal_m, 'y' => $cal_y));
$this->content->text .= calendar_get_mini($courses, $group, $user, $cal_m, $cal_y);
$this->content->text .= '<h3 class="eventskey">'.get_string('eventskey', 'calendar').'</h3>';
- $this->content->text .= '<div class="filters">'.calendar_filter_controls('course', '', $COURSE).'</div>';
+ $this->content->text .= '<div class="filters">'.calendar_filter_controls('course', '', $this->page->course).'</div>';
}
// MDL-9059, unset this so that it doesn't stay in session
if (!empty($courseset)) {
- unset($SESSION->cal_courses_shown[$COURSE->id]);
+ unset($SESSION->cal_courses_shown[$this->page->course->id]);
}
return $this->content;
}
function get_content() {
- global $USER, $CFG, $SESSION, $COURSE;
+ global $USER, $CFG, $SESSION;
$cal_m = optional_param( 'cal_m', 0, PARAM_INT );
$cal_y = optional_param( 'cal_y', 0, PARAM_INT );
return $this->content;
}
// Reset the session variables
- calendar_session_vars($COURSE);
+ calendar_session_vars($this->page->course);
$this->content = new stdClass;
$this->content->text = '';
$this->content->footer = '';
} else {
- $courseshown = $COURSE->id;
+ $courseshown = $this->page->course->id;
$this->content->footer = '<br /><a href="'.$CFG->wwwroot.
'/calendar/view.php?view=upcoming&course='.$courseshown.'">'.
get_string('gotocalendar', 'calendar').'</a>...';
calendar_set_referring_course(0);
} else {
// Forcibly filter events to include only those from the particular course we are in.
- $filtercourse = array($courseshown => $COURSE);
+ $filtercourse = array($courseshown => $this->page->course);
$groupeventsfrom = array($courseshown => 1);
}
}
}
function specialization() {
- if($this->page->pagetype == PAGE_COURSE_VIEW && $PAGE->course->id != SITEID) {
+ if($this->page->pagetype == PAGE_COURSE_VIEW && $this->page->course->id != SITEID) {
$this->title = get_string('coursesummary', 'block_course_summary');
}
}
function get_content() {
- global $CFG, $COURSE, $PAGE;
+ global $CFG;
if($this->content !== NULL) {
return $this->content;
$this->content = new object();
$options = new object();
$options->noclean = true; // Don't clean Javascripts etc
- $this->content->text = format_text($COURSE->summary, FORMAT_HTML, $options);
- if ($PAGE->user_is_editing()) {
- if($COURSE->id == SITEID) {
+ $this->content->text = format_text($this->page->course->summary, FORMAT_HTML, $options);
+ if ($this->page->user_is_editing()) {
+ if($this->page->course->id == SITEID) {
$editpage = $CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section=frontpagesettings';
} else {
- $editpage = $CFG->wwwroot.'/course/edit.php?id='.$COURSE->id;
+ $editpage = $CFG->wwwroot.'/course/edit.php?id='.$this->page->course->id;
}
$this->content->text .= "<div class=\"editbutton\"><a href=\"$editpage\"><img src=\"$CFG->pixpath/t/edit.gif\" alt=\"".get_string('edit')."\" /></a></div>";
}
}
function specialization() {
- global $CFG, $COURSE, $DB;
- $this->course = $COURSE;
+ global $CFG, $DB;
+ $this->course = $this->page->course;
// load userdefined title and make sure it's never empty
if (empty($this->config->title)) {
}
function get_content() {
- global $USER, $CFG, $COURSE, $DB;
+ global $USER, $CFG, $DB;
if (empty($this->config->glossary)) {
$this->content->text = get_string('notyetconfigured','block_glossary_random');
$glossaryid = $this->config->glossary;
- if ($this->course->id == $COURSE->id) {
- $course = $COURSE;
- } else {
- $course = $DB->get_record('course', array('id'=>$this->course->id));
- }
+ $course = $this->page->course;
require_once($CFG->dirroot.'/course/lib.php');
$modinfo = get_fast_modinfo($course);
* @todo complete documenting this function. Define $options.
*/
function _add_edit_controls($options) {
- global $CFG, $USER, $PAGE;
+ global $CFG, $USER;
// TODO
if (empty($this->instance->pinned)) {
}
function get_content() {
- global $CFG, $USER, $COURSE;
+ global $CFG, $USER;
if ($this->content !== NULL) {
return $this->content;
}
- if ($COURSE->newsitems) { // Create a nice listing of recent postings
+ if ($this->page->course->newsitems) { // Create a nice listing of recent postings
require_once($CFG->dirroot.'/mod/forum/lib.php'); // We'll need this
$text = '';
- if (!$forum = forum_get_course_forum($COURSE->id, 'news')) {
+ if (!$forum = forum_get_course_forum($this->page->course->id, 'news')) {
return '';
}
- $modinfo = get_fast_modinfo($COURSE);
+ $modinfo = get_fast_modinfo($this->page->course);
if (empty($modinfo->instances['forum'][$forum->id])) {
return '';
}
/// Get all the recent discussions we're allowed to see
if (! $discussions = forum_get_discussions($cm, 'p.modified DESC', false,
- $currentgroup, $COURSE->newsitems) ) {
+ $currentgroup, $this->page->course->newsitems) ) {
$text .= '('.get_string('nonews', 'forum').')';
$this->content->text = $text;
return $this->content;
} else {
$userid = $USER->id;
}
- $this->content->footer .= '<br />'.rss_get_link($COURSE->id, $userid, 'forum', $forum->id, $tooltiptext);
+ $this->content->footer .= '<br />'.rss_get_link($this->page->course->id, $userid, 'forum', $forum->id, $tooltiptext);
}
}
function has_config() {return true;}
function get_content() {
- global $USER, $CFG, $COURSE, $DB;
+ global $USER, $CFG, $DB;
if ($this->content !== NULL) {
return $this->content;
$timefrom = 100 * floor((time()-$timetoshowusers) / 100); // Round to nearest 100 seconds for better query cache
// Get context so we can check capabilities.
- $context = get_context_instance(CONTEXT_COURSE, $COURSE->id);
+ $context = $this->page->context;
// TODO
if (empty($this->instance->pinned)) {
}
//Calculate if we are in separate groups
- $isseparategroups = ($COURSE->groupmode == SEPARATEGROUPS
- && $COURSE->groupmodeforce
+ $isseparategroups = ($this->page->course->groupmode == SEPARATEGROUPS
+ && $this->page->course->groupmodeforce
&& !has_capability('moodle/site:accessallgroups', $context));
//Get the user current group
- $currentgroup = $isseparategroups ? groups_get_course_group($COURSE) : NULL;
+ $currentgroup = $isseparategroups ? groups_get_course_group($this->page->course) : NULL;
$groupmembers = "";
$groupselect = "";
$params['currentgroup'] = $currentgroup;
}
- if ($COURSE->id == SITEID) { // Site-level
+ if ($this->page->course->id == SITEID) { // Site-level
$sql = "SELECT u.id, u.username, u.firstname, u.lastname, u.picture, MAX(u.lastaccess) AS lastaccess
FROM {user} u $groupmembers
WHERE u.lastaccess > $timefrom
$groupselect $rawhere
GROUP BY u.id";
- $params['courseid'] = $COURSE->id;
+ $params['courseid'] = $this->page->course->id;
}
//Calculate minutes
$this->content->text .= '<li class="listentry">';
$timeago = format_time(time() - $user->lastaccess); //bruno to calculate correctly on frontpage
if ($user->username == 'guest') {
- $this->content->text .= '<div class="user">'.print_user_picture($user->id, $COURSE->id, $user->picture, 16, true, false, '', false);
+ $this->content->text .= '<div class="user">'.print_user_picture($user->id, $this->page->course->id, $user->picture, 16, true, false, '', false);
$this->content->text .= get_string('guestuser').'</div>';
} else {
- $this->content->text .= '<div class="user"><a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&course='.$COURSE->id.'" title="'.$timeago.'">';
- $this->content->text .= print_user_picture($user->id, $COURSE->id, $user->picture, 16, true, false, '', false);
+ $this->content->text .= '<div class="user"><a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&course='.$this->page->course->id.'" title="'.$timeago.'">';
+ $this->content->text .= print_user_picture($user->id, $this->page->course->id, $user->picture, 16, true, false, '', false);
$this->content->text .= $user->fullname.'</a></div>';
}
if ($canshowicon and ($USER->id != $user->id) and $user->username != 'guest') { // Only when logged in and messaging active etc
function get_content() {
- global $CFG, $COURSE;
+ global $CFG;
if (empty($this->instance)) {
$this->content = '';
/// MDL-13252 Always get the course context or else the context may be incorrect in the user/index.php
$currentcontext = $this->page->context;
- if ($COURSE->id == SITEID) {
+ if ($this->page->course->id == SITEID) {
if (!has_capability('moodle/site:viewparticipants', get_context_instance(CONTEXT_SYSTEM))) {
$this->content = '';
return $this->content;
}
function get_content() {
- global $COURSE;
-
if ($this->content !== NULL) {
return $this->content;
}
// Slightly hacky way to do it but...
ob_start();
- print_recent_activity($COURSE);
+ print_recent_activity($this->page->course);
$this->content->text = ob_get_contents();
ob_end_clean();
}
function get_content() {
- global $CFG, $editing, $COURSE, $USER;
+ global $CFG, $editing, $USER;
- if (!empty($COURSE)) {
- $this->courseid = $COURSE->id;
+ if (!empty($this->page->course)) {
+ $this->courseid = $this->page->course->id;
}
/// When displaying feeds in block, we double $CFG->block_rss_client_timeout
}
function get_content() {
- global $CFG, $USER, $COURSE, $DB;
+ global $CFG, $USER, $DB;
$highlight = 0;
}
function get_content() {
- global $USER, $CFG, $COURSE, $DB, $PAGE;
+ global $USER, $CFG, $DB;
if ($this->content !== NULL) {
return $this->content;
$course = $this->page->course;
require_once($CFG->dirroot.'/course/lib.php');
$context = get_context_instance(CONTEXT_COURSE, $course->id);
- $isediting = $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);
/// extra fast view mode
}
function get_content() {
- global $USER, $CFG, $COURSE, $DB, $PAGE;
+ global $USER, $CFG, $DB;
if ($this->content !== NULL) {
return $this->content;
require_once($CFG->dirroot.'/course/lib.php');
$context = get_context_instance(CONTEXT_COURSE, $course->id);
- $isediting = $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);
/// extra fast view mode
function get_content() {
- global $CFG, $SITE, $COURSE, $USER, $SCRIPT;
+ global $CFG, $SITE, $USER, $SCRIPT;
if (empty($CFG->usetags)) {
$this->content->text = '';
$isguest = has_capability('moodle/legacy:guest', $systemcontext, $USER->id, false);
$loggedin = isloggedin() && !$isguest;
$coursepage = $canedit = false;
- $coursepage = (isset($COURSE->id) && $COURSE->id != SITEID);
+ $coursepage = (isset($this->page->course->id) && $this->page->course->id != SITEID);
$mymoodlepage = ($SCRIPT == '/my/index.php') ? true : false;
- $sitepage = (isset($COURSE->id) && $COURSE->id == SITEID && !$mymoodlepage);
- $coursecontext = get_context_instance(CONTEXT_COURSE, $COURSE->id);
+ $sitepage = (isset($this->page->course->id) && $this->page->course->id == SITEID && !$mymoodlepage);
+ $coursecontext = get_context_instance(CONTEXT_COURSE, $this->page->course->id);
if ($coursepage) {
$canedit = has_capability('moodle/tag:create', $systemcontext);
}
}
}
if ($coursepage) {
- $coursetags = coursetag_print_cloud(coursetag_get_tags($COURSE->id, 0, '', $numoftags, $sort), true);
+ $coursetags = coursetag_print_cloud(coursetag_get_tags($this->page->course->id, 0, '', $numoftags, $sort), true);
if (!$coursetags) $coursetags = get_string('notagsyet', $tagslang);
- $courseflag = '&courseid='.$COURSE->id;
+ $courseflag = '&courseid='.$this->page->course->id;
}
if ($mymoodlepage) {
$mytags = coursetag_print_cloud(coursetag_get_tags(0, $USER->id, 'default', $numoftags, $sort), true);
<form action="{$CFG->wwwroot}/tag/coursetags_add.php" method="post" id="coursetag"
onsubmit="return ctags_checkinput(this.coursetag_new_tag.value)">
<div style="display: none;">
- <input type="hidden" name="entryid" value="$COURSE->id" />
+ <input type="hidden" name="entryid" value="$this->page->course->id" />
<input type="hidden" name="userid" value="$USER->id" />
<input type="hidden" name="sesskey" value="$sesskey" />
</div>
// add the edit link
$this->content->footer .= '
<div>
- <a href="'.$CFG->wwwroot.'/tag/coursetags_edit.php?courseid='.$COURSE->id.'"
+ <a href="'.$CFG->wwwroot.'/tag/coursetags_edit.php?courseid='.$this->page->course->id.'"
title="'.get_string('edittags', $tagslang).'">'.get_string('edittags', $tagslang).'</a>
</div>';
}