]> git.mjollnir.org Git - moodle.git/commitdiff
fixed some small bugs
authorgustav_delius <gustav_delius>
Fri, 31 Dec 2004 20:02:45 +0000 (20:02 +0000)
committergustav_delius <gustav_delius>
Fri, 31 Dec 2004 20:02:45 +0000 (20:02 +0000)
message/lib.php
message/search.html
message/user.php

index 44547c64fa4ad748f196a527a6280c0853bf52cc..cbb051f6b37ef3d04b68fd42467180752e3a3c16 100644 (file)
@@ -17,13 +17,13 @@ function message_print_contacts() {
 
     
     /// get lists of contacts and unread messages
-    $onlinecontacts = get_records_sql("SELECT u.id, u.firstname, u.lastname, u.picture
+    $onlinecontacts = get_records_sql("SELECT u.id, u.firstname, u.lastname, u.picture, mc.blocked
                                        FROM {$CFG->prefix}user u, {$CFG->prefix}message_contacts mc
                                        WHERE mc.userid='$USER->id' AND u.id=mc.contactid AND u.lastaccess>=$timefrom 
                                          AND mc.blocked='0' 
                                        ORDER BY u.lastaccess DESC");
 
-    $offlinecontacts = get_records_sql("SELECT u.id, u.firstname, u.lastname, u.picture
+    $offlinecontacts = get_records_sql("SELECT u.id, u.firstname, u.lastname, u.picture, mc.blocked
                                        FROM {$CFG->prefix}user u, {$CFG->prefix}message_contacts mc
                                        WHERE mc.userid='$USER->id' AND u.id=mc.contactid AND u.lastaccess<$timefrom
                                          AND mc.blocked='0' 
@@ -157,7 +157,7 @@ function message_print_contacts() {
         /// link to add to contact list
             
             $strcontact .= message_contact_link($messageuser->useridfrom, 'add', true);
-            $strblock   .= message_contact_link($messageuser->useridfrom, 'block', true);
+            $strblock   = message_contact_link($messageuser->useridfrom, 'block', true);
             
             echo '<tr><td class="message_pic">';
             print_user_picture($messageuser->useridfrom, SITEID, $messageuser->picture, 20, false, false);
@@ -197,7 +197,7 @@ function message_count_messages($messagearray, $field='', $value='') {
 
 
 function message_print_search() {
-    global $USER;
+    global $ME, $USER;
     
     if ($frm = data_submitted()) {
     
@@ -307,7 +307,7 @@ function message_get_contact($contactid) {
 
 
 function message_print_search_results($frm) {
-    global $USER;
+    global $ME, $USER;
 
     echo '<div align="center">';
 
@@ -591,9 +591,10 @@ function message_search_users($courseid, $searchtext, $sort='', $exceptions='')
     }
 
     $select = 'u.deleted = \'0\' AND u.confirmed = \'1\'';
+    $fields = 'u.id, u.firstname, u.lastname, u.picture';
 
     if (!$courseid or $courseid == SITEID) {
-        return get_records_sql("SELECT u.id, u.firstname, u.lastname
+        return get_records_sql("SELECT $fields
                       FROM {$CFG->prefix}user u
                       WHERE $select
                           AND ($fullname $LIKE '%$searchtext%')
@@ -601,7 +602,7 @@ function message_search_users($courseid, $searchtext, $sort='', $exceptions='')
     } else {
 
 
-        if (!$teachers = get_records_sql("SELECT u.id, u.firstname, u.lastname
+        if (!$teachers = get_records_sql("SELECT $fields
                       FROM {$CFG->prefix}user u,
                            {$CFG->prefix}user_teachers s
                       WHERE $select AND s.course = '$courseid' AND s.userid = u.id
@@ -609,7 +610,7 @@ function message_search_users($courseid, $searchtext, $sort='', $exceptions='')
                           $except $order")) {
             $teachers = array();
         }
-        if (!$students = get_records_sql("SELECT u.id, u.firstname, u.lastname
+        if (!$students = get_records_sql("SELECT $fields
                       FROM {$CFG->prefix}user u,
                            {$CFG->prefix}user_students s
                       WHERE $select AND s.course = '$courseid' AND s.userid = u.id
index 2edb85051d8ada67abe730967b94071e0ddb896b..404f6c7944be9fd9c47d00bc430862143dc8e0f1 100644 (file)
@@ -15,7 +15,9 @@
     </tr>
     <tr>
         <td>&nbsp;</td>
-        <td colspan="2"><input type="checkbox" name="mycourses" alt="<?php print_string('onlymycourses', 'message') ?>" /><?php print_string('onlymycourses', 'message') ?></td>
+        <td colspan="2">
+            <input type="hidden" name="mycourses" value="0" />
+            <input type="checkbox" name="mycourses" alt="<?php print_string('onlymycourses', 'message') ?>" /><?php print_string('onlymycourses', 'message') ?></td>
     </tr>
     
     <tr><td colspan="3"><hr /></td></tr>
@@ -32,7 +34,9 @@
     
     <tr>
         <td>&nbsp;</td>
-        <td colspan="2"><input type="checkbox" name="includeblocked" alt="<?php print_string('includeblockedusers', 'message') ?>" /><?php print_string('includeblockedusers', 'message') ?></td>
+        <td colspan="2">
+            <input type="hidden" name="includeblocked" value="0" />
+            <input type="checkbox" name="includeblocked" alt="<?php print_string('includeblockedusers', 'message') ?>" /><?php print_string('includeblockedusers', 'message') ?></td>
     </tr>
     
     <tr><td colspan="3"><input type="radio" name="keywordsoption" alt="<?php print_string('onlytome', 'message') ?>" value="tome" checked="checked" /><?php print_string('onlytome', 'message') ?></td></tr>
index 528c728639762a786584c25e2902897938d0f543..4fd2839e228288210adbb0518d1e7230a8c30b1b 100644 (file)
         case 'edit':      /// Print the bottom frame with the text editor
 
             /// Check that the user is not blocking us!!
-            if ($contact = get_record('message_contacts', 'userid', $user->id, 'contact', $USER->id)) {
+            if ($contact = get_record('message_contacts', 'userid', $user->id, 'contactid', $USER->id)) {
                 if ($contact->blocked) {
                     print_heading(get_string('userisblockingyou', 'message'));
                     exit;