~ubuntu-branches/ubuntu/jaunty/moodle/jaunty

« back to all changes in this revision

Viewing changes to blocks/messages/block_messages.php

  • Committer: Bazaar Package Importer
  • Author(s): Jordan Mantha, Matt Oquist
  • Date: 2009-02-25 15:16:22 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20090225151622-0ekt1liwhv2obfza
Tags: 1.9.4.dfsg-0ubuntu1
* Merge with Debian git (Closes LP: #322961, #239481, #334611):
  - use Ubuntu's smarty lib directory for linking
  - use internal yui library 
  - add update-notifier support back in

[Matt Oquist]
  * renamed prerm script
  * significantly rewrote postinst and other maintainer scripts to improve
    user experience and package maintainability
    (Closes LP: #225662, #325450, #327843, #303078, #234609)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?PHP //$Id: block_messages.php,v 1.13 2007/01/09 23:45:28 skodak Exp $
 
1
<?PHP //$Id: block_messages.php,v 1.13.4.4 2008/03/03 11:41:03 moodler Exp $
2
2
 
3
3
class block_messages extends block_base {
4
4
    function init() {
5
5
        $this->title = get_string('messages','message');
6
 
        $this->version = 2004122800;
 
6
        $this->version = 2007101509;
7
7
    }
8
8
 
9
9
    function get_content() {
10
10
        global $USER, $CFG;
11
11
 
 
12
        if (!$CFG->messaging) {
 
13
            return ''; 
 
14
        }
 
15
 
12
16
        if ($this->content !== NULL) {
13
17
            return $this->content;
14
18
        }
24
28
        $this->content->footer = '<a href="'.$CFG->wwwroot.'/message/index.php" onclick="this.target=\'message\'; return openpopup(\'/message/index.php\', \'message\', \'menubar=0,location=0,scrollbars,status,resizable,width=400,height=500\', 0);">'.get_string('messages', 'message').'</a>...';
25
29
 
26
30
        $users = get_records_sql("SELECT m.useridfrom as id, COUNT(m.useridfrom) as count,
27
 
                                         u.firstname, u.lastname, u.picture, u.lastaccess
 
31
                                         u.firstname, u.lastname, u.picture, u.imagealt, u.lastaccess
28
32
                                       FROM {$CFG->prefix}user u, 
29
33
                                            {$CFG->prefix}message m 
30
34
                                       WHERE m.useridto = '$USER->id' 
31
35
                                         AND u.id = m.useridfrom
32
 
                                    GROUP BY m.useridfrom, u.firstname,u.lastname,u.picture,u.lastaccess");
 
36
                                    GROUP BY m.useridfrom, u.firstname,u.lastname,u.picture,u.lastaccess,u.imagealt");
33
37
 
34
38
 
35
39
        //Now, we have in users, the list of users to show
39
43
            foreach ($users as $user) {
40
44
                $timeago = format_time(time() - $user->lastaccess);
41
45
                $this->content->text .= '<li class="listentry"><div class="user"><a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&amp;course='.$this->instance->pageid.'" title="'.$timeago.'">';
42
 
                $this->content->text .= print_user_picture($user->id, $this->instance->pageid, $user->picture, 0, true, false, '', false);
 
46
                $this->content->text .= print_user_picture($user, $this->instance->pageid, $user->picture, 0, true, false, '', false);
43
47
                $this->content->text .= fullname($user).'</a></div>';
44
48
                $this->content->text .= '<div class="message"><a href="'.$CFG->wwwroot.'/message/discussion.php?id='.$user->id.'" onclick="this.target=\'message_'.$user->id.'\'; return openpopup(\'/message/discussion.php?id='.$user->id.'\', \'message_'.$user->id.'\', \'menubar=0,location=0,scrollbars,status,resizable,width=400,height=500\', 0);"><img class="iconsmall" src="'.$CFG->pixpath.'/t/message.gif" alt="" />&nbsp;'.$user->count.'</a>';
45
49
                $this->content->text .= '</div></li>';