]> git.mjollnir.org Git - moodle.git/commitdiff
New function dialogue_count_all_needing_replies_self($user) added to lib.php.
authorrkingdon <rkingdon>
Mon, 20 Oct 2003 19:09:31 +0000 (19:09 +0000)
committerrkingdon <rkingdon>
Mon, 20 Oct 2003 19:09:31 +0000 (19:09 +0000)
mod/dialogue/lib.php

index 2a381eb95d3903c0d59aa6bfd4f22b66527d5914..caac11ead292416f11e856414c9b3fe0b01ee3f5 100644 (file)
@@ -292,6 +292,22 @@ function dialogue_user_outline($course, $user, $mod, $dialogue) {
 
 // SQL FUNCTIONS ///////////////////////////////////////////////////////////////////
 
+//////////////////////////////////////////////////////////////////////////////////////
+function dialogue_count_all_needing_replies_self($user = '') {
+// count [conversations] needing replies [from] self for all dialogues
+// function requested by Williams Castillo 17 Oct 2003 
+    global $USER;
+    
+    if ($user) {       
+       return count_records_select("dialogue_conversations", "(userid = $user->id OR 
+            recipientid = $user->id) AND lastid != $user->id AND closed = 0");
+    } else {
+       return count_records_select("dialogue_conversations", "(userid = $USER->id OR 
+            recipientid = $USER->id) AND lastid != $USER->id AND closed = 0");
+       }
+}
+
+
 //////////////////////////////////////////////////////////////////////////////////////
 function dialogue_count_closed($dialogue, $user) {
        
@@ -318,7 +334,7 @@ function dialogue_count_open($dialogue, $user) {
        
        return count_records_select("dialogue_conversations", "dialogueid = $dialogue->id AND 
         (userid = $user->id OR recipientid = $user->id) AND closed = 0");
-       }
+}
 
 
 //////////////////////////////////////////////////////////////////////////////////////
@@ -326,7 +342,7 @@ function dialogue_count_needing_replies_other($dialogue, $user) {
 // count [conversations] needing replies [from] other [person] 
        return count_records_select("dialogue_conversations", "dialogueid = $dialogue->id AND 
         (userid = $user->id OR recipientid = $user->id) AND lastid = $user->id AND closed = 0");
-       }
+}
 
 
 //////////////////////////////////////////////////////////////////////////////////////
@@ -335,7 +351,7 @@ function dialogue_count_needing_replies_self($dialogue, $user) {
        
        return count_records_select("dialogue_conversations", "dialogueid = $dialogue->id AND 
         (userid = $user->id OR recipientid = $user->id) AND lastid != $user->id AND closed = 0");
-       }
+}
 
 
 //////////////////////////////////////////////////////////////////////////////////////