$this->content->icons = array();
$this->content->footer = '';
- if($this->course->id == 1) {
+ if (empty($course)) {
+ $this->content = '';
+ } else if ($this->course->category == 0) {
$this->load_content_for_site();
- }
- else {
+ } else {
$this->load_content_for_course();
}
$this->content->text = '';
$this->content->footer = '';
- if ($this->course === NULL) {
- // Overrides: use no course at all
+ if (empty($this->course)) { // Overrides: use no course at all
$courseshown = false;
$filtercourse = array();
-
} else {
$courseshown = $this->course->id;
$filtercourse = array($courseshown => 1);
require_once($CFG->dirroot.'/calendar/lib.php');
- if($this->content !== NULL) {
+ if ($this->content !== NULL) {
return $this->content;
}
$this->content = New object;
$this->content->text = '';
- $this->content->footer = '<br /><a href="'.$CFG->wwwroot.'/calendar/view.php?view=upcoming&course='.$this->course->id.'">'.get_string('gotocalendar', 'calendar').'</a>...';
- $this->content->footer .= '<br /><a href="'.$CFG->wwwroot.'/calendar/event.php?action=new&course='.$this->course->id.'">'.get_string('newevent', 'calendar').'</a>...';
- if($this->course === NULL) {
- // Overrides: use no course at all
+ if (empty($this->course)) { // Overrides: use no course at all
$courseshown = false;
$filtercourse = array();
- }
- else {
+ $this->content->footer = '';
+ } else {
$courseshown = $this->course->id;
$filtercourse = array($courseshown => 1);
+ $this->content->footer = '<br /><a href="'.$CFG->wwwroot.
+ '/calendar/view.php?view=upcoming&course='.$this->course->id.'">'.
+ get_string('gotocalendar', 'calendar').'</a>...';
+ $this->content->footer .= '<br /><a href="'.$CFG->wwwroot.
+ '/calendar/event.php?action=new&course='.$this->course->id.'">'.
+ get_string('newevent', 'calendar').'</a>...';
}
// We 'll need this later
return $this->content;
}
+ if (empty($this->course)) {
+ return '';
+ }
+
$this->content = New stdClass;
$this->content->text = format_text($this->course->summary, FORMAT_HTML);
if (isediting($this->course->id)) {
function get_content() {
global $CFG;
- if($this->content !== NULL) {
+ if ($this->content !== NULL) {
+ return $this->content;
+ }
+
+ if (empty($this->course)) {
+ $this->content = '';
return $this->content;
}
$timetoshowusers = $CFG->block_online_users_timetosee * 60;
}
- if($this->content !== NULL) {
+ if ($this->content !== NULL) {
return $this->content;
}
+ if (empty($this->course)) {
+ $this->content = '';
+ return $this->content;
+ }
+
$this->content = New object;
$this->content->text = '';
$this->content->footer = '';
function get_content() {
global $USER, $CFG;
- if($this->content !== NULL) {
+ if ($this->content !== NULL) {
+ return $this->content;
+ }
+ if (empty($this->course)) {
+ $this->content = '';
return $this->content;
}
function get_content() {
- if($this->content !== NULL) {
+ if ($this->content !== NULL) {
+ return $this->content;
+ }
+
+ if (empty($this->course)) {
+ $this->content = '';
return $this->content;
}
return $this->content;
}
+ if (empty($this->course)) {
+ $this->content = '';
+ return $this->content;
+ }
+
$this->content = New object;
$this->content->text = '';
$this->content->footer = '';
$highlight = 0;
- if($this->content !== NULL) {
+ if ($this->content !== NULL) {
+ return $this->content;
+ }
+
+ if (empty($this->course)) {
+ $this->content = '';
return $this->content;
}