Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added logic for a normal view and advanced view for the filter

  • Loading branch information...
commit 08e2111bf892f528d9613572a6be57f027783513 1 parent 5d31e5a
authored February 20, 2004

Showing 1 changed file with 65 additions and 41 deletions. Show diff stats Hide diff stats

  1. 106  course/recent.php
106  course/recent.php
@@ -21,6 +21,7 @@
21 21
 
22 22
     $loggedinas = "<p class=\"logininfo\">".user_login_string($course, $USER)."</p>";
23 23
 
  24
+
24 25
     if (!empty($_GET['chooserecent'])) {
25 26
 
26 27
         $userinfo = get_string("allparticipants");
@@ -46,7 +47,8 @@
46 47
         }
47 48
 
48 49
         print_heading("$course->fullname: $userinfo, $dateinfo (".usertimezone().")");
49  
-        print_recent_selector_form($course, $user, $date, $modname, $modid, $modaction, $selectedgroup, $sortby);
  50
+$advancedfilter = 1;
  51
+        print_recent_selector_form($course, $advancedfilter, $user, $date, $modname, $modid, $modaction, $selectedgroup, $sortby);
50 52
 
51 53
     } else {
52 54
 
@@ -64,7 +66,7 @@
64 66
 
65 67
         print_heading(get_string("choosereportfilter").":");
66 68
 
67  
-        print_recent_selector_form($course);
  69
+        print_recent_selector_form($course, $advancedfilter);
68 70
 
69 71
     }
70 72
 
@@ -88,6 +90,12 @@
88 90
     $activities = array();
89 91
     $sections = array();
90 92
 
  93
+    switch ($course->format) {
  94
+        case "weeks": $sectiontitle = get_string("week"); break;
  95
+        case "topics": $sectiontitle = get_string("topic"); break;
  96
+        default: $sectiontitle = get_string("section"); break;
  97
+    }
  98
+
91 99
     $index = 0;
92 100
 
93 101
     if (is_numeric($modid)) { // you chose a single activity
@@ -96,22 +104,40 @@
96 104
 
97 105
     } else { // you chose a group of activities
98 106
 
99  
-        $sections = get_records_sql("SELECT cs.id, cs.section, cs.sequence
  107
+        $sections = get_records_sql("SELECT cs.id, cs.section, cs.sequence, cs.summary
100 108
                                        FROM {$CFG->prefix}course_sections cs
101 109
                                        WHERE course = '$course->id'
102 110
                                         AND cs.visible = '1'
103  
-                                        AND sequence != '' 
104 111
                                       ORDER by section");
105 112
     }
106 113
 
  114
+    get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused);
  115
+
107 116
     if (!empty($sections)) {
108 117
 
109 118
         echo "<hr>";
  119
+        $i = 0;
110 120
 
111 121
         foreach ($sections as $section) {
  122
+
  123
+            if ($i < $course->numsections) {
  124
+                $activity->type = "section";
  125
+                $activity->name = $sectiontitle . " $i";
  126
+                $activities[$index] = $activity;
  127
+            }
  128
+            $index++;
  129
+            $i++;
  130
+
112 131
             $sectionmods = explode(",", $section->sequence);
113 132
 
114 133
             foreach ($sectionmods as $sectionmod) {
  134
+
  135
+                if (empty($mods[$sectionmod])) {
  136
+                    continue;
  137
+                }
  138
+                $mod = $mods[$sectionmod];
  139
+                $instance = get_record("$mod->modname", "id", "$mod->instance");
  140
+
115 141
                 $coursemod = get_record_sql("SELECT m.id, m.name, cm.groupmode
116 142
                                                FROM {$CFG->prefix}course_modules cm,
117 143
                                                     {$CFG->prefix}modules m
@@ -140,6 +166,14 @@
140 166
                     $get_recent_mod_activity = $coursemod->name."_get_recent_mod_activity";
141 167
 
142 168
                     if (function_exists($get_recent_mod_activity)) {
  169
+                        $activity->type = "activity";
  170
+                        $activity->name = $instance->name;
  171
+                        $activity->content->fullname = $mod->modfullname;
  172
+                        $activity->content->modname = $mod->modname;
  173
+                        $activity->content->modid =$mod->id;
  174
+                        $activities[$index] = $activity;
  175
+                        $index++;
  176
+
143 177
                         $get_recent_mod_activity($activities, $index, $date, $course->id, $sectionmod, $user, $groupid);
144 178
                     }
145 179
                 }
@@ -165,51 +199,41 @@
165 199
         $newinstance = true;
166 200
         $lastinstance = "";
167 201
 
168  
-        switch ($course->format) {
169  
-            case "weeks": $sectiontitle = get_string("week"); break;
170  
-            case "topics": $sectiontitle = get_string("topic"); break;
171  
-            default: $sectiontitle = get_string("section"); break;
172  
-        }
173  
-
  202
+        $section = 0;
174 203
         foreach ($activities as $activity) {
175  
-             
176  
-            if ($sortby == "default") {
177  
-                if ($lastsection != $activity->section) {
178  
-                    $lastsection = $activity->section;
179  
-                    $newsection = true;
180  
-                }
181  
-                if ($newsection) {
182  
-//                    echo "<h2>$sectiontitle: $activity->section</h2>";
183  
-                    $newsection = false;
184  
-                }
185  
-
186  
-                if ($lastinstance != $activity->instance) {
187  
-                    $lastinstance = $activity->instance;
188  
-                    $newinstance = true;
  204
+            
  205
+            if (($activity->type == "section") && ($sortby == "default")) {
  206
+                echo "<h1>$activity->name</h1>";
  207
+            } else if ($activity->type == "activity") {
  208
+
  209
+               if ($sortby == "default") {
  210
+                   $image = "<img src=\"$CFG->modpixpath/" . $activity->content->modname . "/icon.gif\"" .
  211
+                            "height=16 width=16 alt=\"" . $activity->content->modfullname . "\">";
  212
+                   echo "<ul><h4>$image " . $activity->content->modfullname . 
  213
+                        "<a href=\"$CFG->wwwroot/mod/" . $activity->content->activity->modname . "/view.php?" . 
  214
+                        "id=" . $activity->content->modid . "\">" .
  215
+                        $activity->name . "</a></h4></ul>";
  216
+               }
  217
+
  218
+            } else {
  219
+    
  220
+                $print_recent_mod_activity = $activity->type."_print_recent_mod_activity";
  221
+    
  222
+                if (function_exists($print_recent_mod_activity)) {
  223
+                    echo "<ul><ul>";
  224
+                    $print_recent_mod_activity($activity, $course->id, $detail);
  225
+                    echo "</ul></ul>";
189 226
                 }
190  
-                if ($newinstance) {
191  
-                    $image = "<img src=\"$CFG->modpixpath/$activity->type/icon.gif\" ".
192  
-                             "height=16 width=16 alt=\"$activity->type\">";
193  
-                    echo "<h4>$image " . $activity->name . "</h4>";
194  
-  
195  
-                    $newinstance = false;
196  
-                } 
197  
-
198  
-            }
199  
-
200  
-            $print_recent_mod_activity = $activity->type."_print_recent_mod_activity";
201  
-
202  
-            if (function_exists($print_recent_mod_activity)) {
203  
-                echo "<ul>";
204  
-                $print_recent_mod_activity($activity, $course->id, $detail);
205  
-                echo "</ul>";
206 227
             }
207 228
         }
  229
+
208 230
         echo "</ul>";
  231
+
209 232
     } else {
  233
+
210 234
         echo "<h4><center>" . get_string("norecentactivity") . "</center></h2>";
211  
-    }
212 235
 
  236
+    }
213 237
 // fix modid for selection form
214 238
     $modid =$tmpmodid;
215 239
 

0 notes on commit 08e2111

Please sign in to comment.
Something went wrong with that request. Please try again.