]> git.mjollnir.org Git - moodle.git/commitdiff
Fixed some issues with course overview report
authormoodler <moodler>
Mon, 29 May 2006 09:10:33 +0000 (09:10 +0000)
committermoodler <moodler>
Mon, 29 May 2006 09:10:33 +0000 (09:10 +0000)
admin/report/courseoverview/index.php
admin/report/courseoverview/mod.php
theme/standard/styles_color.css

index f97a72dfbfddbe0cf0dedb7fcc14570d008b6bd0..2ecc794832ab790153a7972f861069548f3cdeb8 100644 (file)
         foreach  ($courses as $c) {
             $a = array();
             $a[] = '<a href="'.$CFG->wwwroot.'/course/view.php?id='.$c->courseid.'">'.get_field('course','shortname','id',$c->courseid).'</a>';
-            $a[] = print_numeric_value($c->line1);
+
+            $a[] = $c->line1;
             if (isset($c->line2)) {
-                $a[] = print_numeric_value($c->line2);
+                $a[] = $c->line2;
             }
             if (isset($c->line3)) {
-                $a[] = print_numeric_value($c->line3);
+                $a[] = $c->line3;
             }
             $table->data[] = $a;
         }
     
     print_footer();
 
-function print_numeric_value($value) {
-    list($whole, $decimals) = split ('[.,]', $value, 2);
-    if (intval($decimals) > 0)
-        return number_format($value,2,".",",");
-    else
-        return $value;
-}
-
 ?>
index 93df6234843ba34d429f5eee6e7370fa3208bf9a..1350aa2dadfb58698572dde4688f77bf6fe18960 100644 (file)
@@ -5,7 +5,50 @@
     }
 
     if (!empty($CFG->enablestats)) {
-        echo '<a href="'.$CFG->wwwroot.'/admin/report/courseoverview/index.php">'.get_string('courseoverview').'</a>';
+   
+        $strreports = get_string('reports');
+        $strcourseoverview = get_string('courseoverview');
+
+        print_heading("$strcourseoverview:");
+
+        require_once($CFG->dirroot.'/lib/statslib.php');
+
+        $report     = optional_param('report', STATS_REPORT_ACTIVE_COURSES, PARAM_INT);
+        $time       = optional_param('time', 0, PARAM_INT);
+        $numcourses = optional_param('numcourses', 20, PARAM_INT);
+
+        $course = get_site();
+        stats_check_uptodate($course->id);
+
+
+        $reportoptions = stats_get_report_options($course->id,STATS_MODE_RANKED);
+
+        $tableprefix = $CFG->prefix.'stats_';
+
+        $earliestday = get_field_sql('SELECT timeend FROM '.$tableprefix.'daily ORDER BY timeend LIMIT 1');
+        $earliestweek = get_field_sql('SELECT timeend FROM '.$tableprefix.'weekly ORDER BY timeend LIMIT 1');
+        $earliestmonth = get_field_sql('SELECT timeend FROM '.$tableprefix.'monthly ORDER BY timeend LIMIT 1');
+
+        if (empty($earliestday)) $earliestday = time();
+        if (empty($earliestweek)) $earliestweek = time();
+        if (empty($earliestmonth)) $earliestmonth = time();
+
+        $now = stats_get_base_daily();
+        $lastweekend = stats_get_base_weekly();
+        $lastmonthend = stats_get_base_monthly();
+
+        $timeoptions = stats_get_time_options($now,$lastweekend,$lastmonthend,$earliestday,$earliestweek,$earliestmonth);
+
+        $table->width = '*';
+        $table->align = array('left','left','left','left','left','left');
+        $table->data[] = array(get_string('statsreporttype'),choose_from_menu($reportoptions,'report',$report,'','','',true),
+                get_string('statstimeperiod'),choose_from_menu($timeoptions,'time',$time,'','','',true),
+                '<input type="text" name="numcourses" size="3" maxlength="2" value="'.$numcourses.'" />',
+                '<input type="submit" value="'.get_string('view').'" />') ;
+
+        echo '<form action="report/courseoverview/index.php" method="post">'."\n";
+        print_table($table);
+        echo '</form>';
     }
 ?>
 
index d72a0a5bfa9906ec6d41bd2e2adf3213c81e3161..1f3b3ae648ca67232a5580a79bd03804a4f8bdf2 100644 (file)
@@ -520,6 +520,7 @@ body#course-user .section {
   border-color:#AAAAAA;
 }
 
+#admin-report .plugin,
 #course-report .plugin,
 #course-import .plugin {
   margin-bottom: 20px;