mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 00:16:46 +02:00
Merge branch 'MDL-25708' of git://github.com/stronk7/moodle
This commit is contained in:
commit
8afc38bd39
53 changed files with 514 additions and 526 deletions
|
@ -269,24 +269,21 @@ function message_get_contacts($user1=null, &$user2=null) {
|
|||
GROUP BY $userfields
|
||||
ORDER BY u.firstname ASC";
|
||||
|
||||
if ($rs = $DB->get_recordset_sql($contactsql, array($user1->id, $user1->id))){
|
||||
foreach($rs as $rd){
|
||||
$rs = $DB->get_recordset_sql($contactsql, array($user1->id, $user1->id));
|
||||
foreach ($rs as $rd) {
|
||||
if ($rd->lastaccess >= $timefrom) {
|
||||
// they have been active recently, so are counted online
|
||||
$onlinecontacts[] = $rd;
|
||||
|
||||
if($rd->lastaccess >= $timefrom){
|
||||
// they have been active recently, so are counted online
|
||||
$onlinecontacts[] = $rd;
|
||||
|
||||
}else{
|
||||
$offlinecontacts[] = $rd;
|
||||
}
|
||||
|
||||
if (!empty($user2) && $user2->id==$rd->id) {
|
||||
$user2->iscontact = true;
|
||||
}
|
||||
} else {
|
||||
$offlinecontacts[] = $rd;
|
||||
}
|
||||
|
||||
if (!empty($user2) && $user2->id==$rd->id) {
|
||||
$user2->iscontact = true;
|
||||
}
|
||||
unset($rd);
|
||||
$rs->close();
|
||||
}
|
||||
$rs->close();
|
||||
|
||||
// get messages from anyone who isn't in our contact list and count the number
|
||||
// of messages we have from each of them
|
||||
|
@ -298,13 +295,11 @@ function message_get_contacts($user1=null, &$user2=null) {
|
|||
GROUP BY $userfields
|
||||
ORDER BY u.firstname ASC";
|
||||
|
||||
if($rs = $DB->get_recordset_sql($strangersql, array($USER->id))){
|
||||
foreach($rs as $rd){
|
||||
$strangers[] = $rd;
|
||||
}
|
||||
unset($rd);
|
||||
$rs->close();
|
||||
$rs = $DB->get_recordset_sql($strangersql, array($USER->id));
|
||||
foreach ($rs as $rd) {
|
||||
$strangers[] = $rd;
|
||||
}
|
||||
$rs->close();
|
||||
|
||||
return array($onlinecontacts, $offlinecontacts, $strangers);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue