"MDL-11371, The View past chat sessions should not appear if there haven't been any."
authordongsheng <dongsheng>
Wed, 15 Oct 2008 09:03:30 +0000 (09:03 +0000)
committerdongsheng <dongsheng>
Wed, 15 Oct 2008 09:03:30 +0000 (09:03 +0000)
mod/chat/view.php

index 2d834325aa8b90e9c9659de50d97ae8d5de66bab..4d1dfdf972d6f2c73ac2d734f505a04393cd7150 100644 (file)
                 groups_print_activity_menu($cm, "view.php?id=$cm->id");
 
                 if ($currentgroup) {
+                    $groupselect = " AND groupid = '$currentgroup'";
                     $groupparam = "&amp;groupid=$currentgroup";
                 } else {
+                    $groupselect = "";
                     $groupparam = "";
                 }
 
                 if ($chat->studentlogs or has_capability('mod/chat:readlog',$context)) {
-                    if ($msg = get_records_select('chat_messages', "chatid = '$chat->id' $groupselect", '', 'id', '', 1)) {
+                    if ($msg = $DB->get_records_select('chat_messages', "chatid = ? $groupselect", array($chat->id))) {
                         echo '<div class="reportlink">';
                         echo "<a href=\"report.php?id=$cm->id\">".
                             get_string('viewreport', 'chat').'</a>';