title = get_string('messages','message'); $this->version = 2007101509; } function get_content() { global $USER, $CFG; if (!$CFG->messaging) { return ''; } if ($this->content !== NULL) { return $this->content; } $this->content = new stdClass; $this->content->text = ''; $this->content->footer = ''; if (empty($this->instance) or empty($USER->id) or isguest() or empty($CFG->messaging)) { return $this->content; } $this->content->footer = ''.get_string('messages', 'message').'...'; $users = get_records_sql("SELECT m.useridfrom as id, COUNT(m.useridfrom) as count, u.firstname, u.lastname, u.picture, u.imagealt, u.lastaccess FROM {$CFG->prefix}user u, {$CFG->prefix}message m WHERE m.useridto = '$USER->id' AND u.id = m.useridfrom GROUP BY m.useridfrom, u.firstname,u.lastname,u.picture,u.lastaccess,u.imagealt"); //Now, we have in users, the list of users to show //Because they are online if (!empty($users)) { $this->content->text .= ''; } else { $this->content->text .= '
'; $this->content->text .= get_string('nomessages', 'message'); $this->content->text .= '
'; } return $this->content; } } ?>