* @return string html string for welcome area.
*/
public function welcome_area($msgcount) {
- global $USER;
+ global $CFG, $USER;
$output = $this->output->box_start('welcome_area');
$picture = $this->output->user_picture($USER, array('size' => 75, 'class' => 'welcome_userpicture'));
$output .= $this->output->box_start('welcome_message');
$output .= $this->output->heading(get_string('welcome', 'block_course_overview', $USER->firstname));
- $plural = 's';
- if ($msgcount > 0) {
- $output .= get_string('youhavemessages', 'block_course_overview', $msgcount);
- if ($msgcount == 1) {
- $plural = '';
+ if (!empty($CFG->messaging)) {
+ $plural = 's';
+ if ($msgcount > 0) {
+ $output .= get_string('youhavemessages', 'block_course_overview', $msgcount);
+ if ($msgcount == 1) {
+ $plural = '';
+ }
+ } else {
+ $output .= get_string('youhavenomessages', 'block_course_overview');
}
- } else {
- $output .= get_string('youhavenomessages', 'block_course_overview');
+ $output .= html_writer::link(new moodle_url('/message/index.php'),
+ get_string('message'.$plural, 'block_course_overview'));
}
- $output .= html_writer::link(new moodle_url('/message/index.php'), get_string('message'.$plural, 'block_course_overview'));
$output .= $this->output->box_end();
$output .= $this->output->box('', 'flush');
$output .= $this->output->box_end();