]> git.mjollnir.org Git - moodle.git/commitdiff
Fixed index page
authormoodler <moodler>
Mon, 27 Mar 2006 05:28:26 +0000 (05:28 +0000)
committermoodler <moodler>
Mon, 27 Mar 2006 05:28:26 +0000 (05:28 +0000)
mod/data/index.php

index 8e9af0415a511dbcd3871d9cc7d0cf1610500218..88bb958ccfd52da5b1aafa41838059d3475d4764 100755 (executable)
@@ -61,8 +61,8 @@
         $table->head  = array ($strtopic, $strname, $strdescription, $strnumrecords, $strnumnotapproved);
         $table->align = array ('center', 'center', 'center', 'center', 'center');
     } else {
-        $table->head  = array ($strname);
-        $table->align = array ('center', 'center');
+        $table->head  = array ($strname, $strdescription, $strnumrecords, $strnumnotapproved);
+        $table->align = array ('center', 'center', 'center', 'center');
     }
 
     $currentgroup = get_current_group($course->id);
             //Show normal if the mod is visible
             $link = "<a href=\"view.php?id=$data->coursemodule\">".format_string($data->name,true)."</a>";
         }
+
+        $numrecords = count_records_sql('SELECT COUNT(r.id) FROM '.$CFG->prefix.
+                'data_records r WHERE r.dataid ='.$data->id);
+
+        if ($data->approval == 1) {
+            $numunapprovedrecords = count_records_sql('SELECT COUNT(r.id) FROM '.$CFG->prefix.
+                    'data_records r WHERE r.dataid ='.$data->id.
+                    ' AND r.approved <> 1');
+        } else {
+            $numunapprovedrecords = get_string('noapprovalrequired', 'data');
+        }
+
         if ($course->format == 'weeks' or $course->format == 'topics') {
-            
-            $numrecords = count_records_sql('SELECT COUNT(r.id) FROM '.$CFG->prefix.
-                                                'data_records r WHERE r.dataid ='.$data->id);
-            
-            if ($data->approval == 1) {
-                $numunapprovedrecords = count_records_sql('SELECT COUNT(r.id) FROM '.$CFG->prefix.
-                                                'data_records r WHERE r.dataid ='.$data->id.
-                                                ' AND r.approved <> 1');
-            } else {
-                $numunapprovedrecords = get_string('noapprovalrequired', 'data');
+            if ($data->section !== $currentsection) {
+                if ($data->section) {
+                    $printsection = $data->section;
+                }
+                if ($currentsection !== '') {
+                    $table->data[] = 'hr';
+                }
+                $currentsection = $data->section;
             }
-            
+    
             $table->data[] = array ($printsection, $link, $data->intro, $numrecords, $numunapprovedrecords);
         } else {
-            $table->data[] = array ($link);
+            $table->data[] = array ($link, $data->intro, $numrecords, $numunapprovedrecords);
         }
     }