]> git.mjollnir.org Git - moodle.git/commitdiff
xhtml fixing in logs and reports, code cleanup MDL-8187
authorskodak <skodak>
Mon, 15 Jan 2007 21:28:25 +0000 (21:28 +0000)
committerskodak <skodak>
Mon, 15 Jan 2007 21:28:25 +0000 (21:28 +0000)
course/lib.php
course/report/log/lib.php
course/report/log/mod.php
course/report/outline/mod.php
course/report/participation/index.php
course/report/participation/mod.php
course/report/stats/mod.php
lib/adminlib.php
theme/standard/styles_layout.css

index fa3dd4d4159aee90c17a47a3d25db2f23a3ba729..fa2973d7a10bb08edc5359ff1a3858a9876ef67c 100644 (file)
@@ -466,13 +466,13 @@ function print_log($course, $user=0, $date=0, $order="l.time ASC", $page=0, $per
 
     $strftimedatetime = get_string("strftimedatetime");
 
-    echo "<p align=\"center\">\n";
+    echo "<div class=\"info\">\n";
     print_string("displayingrecords", "", $totalcount);
-    echo "</p>\n";
+    echo "</div>\n";
 
     print_paging_bar($totalcount, $page, $perpage, "$url&amp;perpage=$perpage&amp;");
 
-    echo "<table class=\"logtable\" align=\"center\" cellpadding=\"3\" cellspacing=\"0\">\n";
+    echo "<table class=\"logtable\" cellpadding=\"3\" cellspacing=\"0\" summary=\"\">\n";
     echo "<tr>";
     if ($course->id == SITEID) {
         echo "<th class=\"c0 header\" scope=\"col\">".get_string('course')."</th>\n";
@@ -518,23 +518,23 @@ function print_log($course, $user=0, $date=0, $order="l.time ASC", $page=0, $per
 
         echo '<tr class="r'.$row.'">';
         if ($course->id == SITEID) {
-            echo "<td class=\"r$row c0\" nowrap=\"nowrap\">\n";
+            echo "<td class=\"r$row c0\">\n";
             echo "    <a href=\"{$CFG->wwwroot}/course/view.php?id={$log->course}\">".$courses[$log->course]."</a>\n";
             echo "</td>\n";
         }
-        echo "<td class=\"r$row c1\" nowrap=\"nowrap\" align=\"right\">".userdate($log->time, '%a').
+        echo "<td class=\"r$row c1\" align=\"right\">".userdate($log->time, '%a').
              ' '.userdate($log->time, $strftimedatetime)."</td>\n";
-        echo "<td class=\"r$row c2\" nowrap=\"nowrap\">\n";
+        echo "<td class=\"r$row c2\">\n";
         link_to_popup_window("/iplookup/index.php?ip=$log->ip&amp;user=$log->userid", 'iplookup',$log->ip, 400, 700);
         echo "</td>\n";
         $fullname = fullname($log, has_capability('moodle/site:viewfullnames', get_context_instance(CONTEXT_COURSE, $course->id)));
-        echo "<td class=\"r$row c3\" nowrap=\"nowrap\">\n";
+        echo "<td class=\"r$row c3\">\n";
         echo "    <a href=\"$CFG->wwwroot/user/view.php?id={$log->userid}&amp;course={$log->course}\">$fullname</a>\n";
         echo "</td>\n";
-        echo "<td class=\"r$row c4\" nowrap=\"nowrap\">\n";
+        echo "<td class=\"r$row c4\">\n";
         link_to_popup_window( make_log_url($log->module,$log->url), 'fromloglive',"$log->module $log->action", 400, 600);
         echo "</td>\n";;
-        echo "<td class=\"r$row c5\" nowrap=\"nowrap\">{$log->info}</td>\n";
+        echo "<td class=\"r$row c5\">{$log->info}</td>\n";
         echo "</tr>\n";
     }
     echo "</table>\n";
@@ -572,13 +572,13 @@ function print_mnet_log($hostid, $course, $user=0, $date=0, $order="l.time ASC",
 
     $strftimedatetime = get_string("strftimedatetime");
 
-    echo "<p align=\"center\">\n";
+    echo "<div class=\"info\">\n";
     print_string("displayingrecords", "", $totalcount);
-    echo "</p>\n";
+    echo "</div>\n";
 
     print_paging_bar($totalcount, $page, $perpage, "$url&amp;perpage=$perpage&amp;");
 
-    echo "<table class=\"logtable\" align=\"center\" cellpadding=\"3\" cellspacing=\"0\">\n";
+    echo "<table class=\"logtable\" cellpadding=\"3\" cellspacing=\"0\">\n";
     echo "<tr>";
     if ($course->id == SITEID) {
         echo "<th class=\"c0 header\">".get_string('course')."</th>\n";
@@ -625,23 +625,23 @@ function print_mnet_log($hostid, $course, $user=0, $date=0, $order="l.time ASC",
 
         echo '<tr class="r'.$row.'">';
         if ($course->id == SITEID) {
-            echo "<td class=\"r$row c0\" nowrap=\"nowrap\">\n";
+            echo "<td class=\"r$row c0\" >\n";
             echo "    <a href=\"{$CFG->wwwroot}/course/view.php?id={$log->course}\">".$courses[$log->course]."</a>\n";
             echo "</td>\n";
         }
-        echo "<td class=\"r$row c1\" nowrap=\"nowrap\" align=\"right\">".userdate($log->time, '%a').
+        echo "<td class=\"r$row c1\" align=\"right\">".userdate($log->time, '%a').
              ' '.userdate($log->time, $strftimedatetime)."</td>\n";
-        echo "<td class=\"r$row c2\" nowrap=\"nowrap\">\n";
+        echo "<td class=\"r$row c2\" >\n";
         link_to_popup_window("/iplookup/index.php?ip=$log->ip&amp;user=$log->userid", 'iplookup',$log->ip, 400, 700);
         echo "</td>\n";
         $fullname = fullname($log, has_capability('moodle/site:viewfullnames', get_context_instance(CONTEXT_COURSE, $course->id)));
-        echo "<td class=\"r$row c3\" nowrap=\"nowrap\">\n";
+        echo "<td class=\"r$row c3\" >\n";
         echo "    <a href=\"$CFG->wwwroot/user/view.php?id={$log->userid}\">$fullname</a>\n";
         echo "</td>\n";
-        echo "<td class=\"r$row c4\" nowrap=\"nowrap\">\n";
+        echo "<td class=\"r$row c4\">\n";
         echo $log->action .': '.$log->module;
         echo "</td>\n";;
-        echo "<td class=\"r$row c5\" nowrap=\"nowrap\">{$log->info}</td>\n";
+        echo "<td class=\"r$row c5\">{$log->info}</td>\n";
         echo "</tr>\n";
     }
     echo "</table>\n";
index 17b267c22b99e37d6029bff38938e15379133f9b..9bcdb90c0c4cc712a032e5c5e77cc129a3aa9db1 100644 (file)
@@ -101,10 +101,10 @@ function print_mnet_log_selector_form($hostid, $course, $selecteduser=0, $select
             if (has_capability('moodle/site:viewreports', $sitecontext) && $showcourses) {
                 if ($ccc = get_records("course", "", "", "fullname","id,fullname,category")) {
                     foreach ($ccc as $cc) {
-                        if ($cc->category) {
-                            $courses["$hostid/$cc->id"] = "- $cc->fullname";
+                        if ($cc->id == SITEID) {
+                            $sites["$hostid/$cc->id"]   = $cc->fullname.' ('.get_string('site').')';
                         } else {
-                            $sites["$hostid/$cc->id"]   = "$cc->fullname Site";
+                            $courses["$hostid/$cc->id"] = $cc->fullname;
                         }
                     }
                 }
@@ -114,10 +114,10 @@ function print_mnet_log_selector_form($hostid, $course, $selecteduser=0, $select
                 $sql = "select distinct course, coursename from mdl_mnet_log where hostid = '$hostid'";
                 if ($ccc = get_records_sql($sql)) {
                     foreach ($ccc as $cc) {
-                        if (1 == $cc->course) {
-                            $sites["$hostid/$cc->course"]   = "$cc->coursename Site";
+                        if (1 == $cc->course) { // TODO: this might be wrong - site course may have another id
+                            $sites["$hostid/$cc->course"]   = $cc->coursename.' ('.get_string('site').')';
                         } else {
-                            $courses["$hostid/$cc->course"] = "- $cc->coursename";
+                            $courses["$hostid/$cc->course"] = $cc->coursename;
                         }
                     }
                 }
@@ -212,9 +212,8 @@ function print_mnet_log_selector_form($hostid, $course, $selecteduser=0, $select
         $selecteddate = $today;
     }
 
-    $cid = empty($course->id)? '1' : $course->id;
-    echo "<form class=\"mform\" action=\"$CFG->wwwroot/course/report/log/index.php\" method=\"get\">\n";
-    echo "<fieldset class=\"invisiblefieldset boxaligncenter\">\n";
+    echo "<form class=\"logselectform\" action=\"$CFG->wwwroot/course/report/log/index.php\" method=\"get\">\n";
+    echo "<div>\n";//invisible fieldset here breaks wrapping
     echo "<input type=\"hidden\" name=\"chooselog\" value=\"1\" />\n";
     echo "<input type=\"hidden\" name=\"showusers\" value=\"$showusers\" />\n";
     echo "<input type=\"hidden\" name=\"showcourses\" value=\"$showcourses\" />\n";
@@ -223,9 +222,10 @@ function print_mnet_log_selector_form($hostid, $course, $selecteduser=0, $select
         choose_from_menu_nested($dropdown, "host_course", $hostid.'/'.$cid, "");
     } else {
         $courses = array();
-        $courses[$course->id] = $course->fullname . ((empty($course->category)) ? ' (Site) ' : '');
+        $courses[$course->id] = $course->fullname . ((empty($course->category)) ? ' ('.get_string('site').') ' : '');
         choose_from_menu($courses,"id",$course->id,false);
         if (has_capability('moodle/site:viewreports', $sitecontext)) {
+            $a = new object();
             $a->url = "$CFG->wwwroot/course/report/log/index.php?chooselog=0&group=$selectedgroup&user=$selecteduser"
                 ."&id=$course->id&date=$selecteddate&modid=$selectedactivity&showcourses=1&showusers=$showusers";
             print_string('logtoomanycourses','moodle',$a);
@@ -262,23 +262,17 @@ function print_mnet_log_selector_form($hostid, $course, $selecteduser=0, $select
         print_string('logtoomanyusers','moodle',$a);
     }
     choose_from_menu ($dates, "date", $selecteddate, get_string("alldays"));
-    echo '<br />';
     choose_from_menu ($activities, "modid", $selectedactivity, get_string("allactivities"), "", "");
     choose_from_menu ($actions, 'modaction', $modaction, get_string("allactions"));
     
     $logformats = array('showashtml' => get_string('displayonpage'),
                         'downloadascsv' => get_string('downloadtext'),
+                        'downloadasods' => get_string('downloadods'),
                         'downloadasexcel' => get_string('downloadexcel'));
-    /*
-    $logformats = array('showashtml' => get_string('displayonpage'),
-                        'downloadascsv' => get_string('downloadtext'),
-                        'downloadasexcel' => get_string('downloadexcel'),
-                        'downloadasooo' => get_string('downloadasooo'));
-    */
     choose_from_menu ($logformats, 'logformat', $logformat, false);
     echo '<input type="submit" value="'.get_string('gettheselogs').'" />';
-    echo '</fieldset>';
-    echo "</form>";
+    echo '</div>';
+    echo '</form>';
 }
 
 function print_log_selector_form($course, $selecteduser=0, $selecteddate='today',
@@ -433,8 +427,8 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate='today'
         $selecteddate = $today;
     }
 
-    echo "<center>\n";
-    echo "<form action=\"$CFG->wwwroot/course/report/log/index.php\" method=\"get\">\n";
+    echo "<form class=\"logselectform\" action=\"$CFG->wwwroot/course/report/log/index.php\" method=\"get\">\n";
+    echo "<div>\n";
     echo "<input type=\"hidden\" name=\"chooselog\" value=\"1\" />\n";
     echo "<input type=\"hidden\" name=\"showusers\" value=\"$showusers\" />\n";
     echo "<input type=\"hidden\" name=\"showcourses\" value=\"$showcourses\" />\n";
@@ -443,9 +437,10 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate='today'
     } else {
         //        echo '<input type="hidden" name="id" value="'.$course->id.'" />';
         $courses = array();
-        $courses[$course->id] = $course->fullname . (($course->id == SITEID) ? ' (Site) ' : '');
+        $courses[$course->id] = $course->fullname . (($course->id == SITEID) ? ' ('.get_string('site').') ' : '');
         choose_from_menu($courses,"id",$course->id,false);
         if (has_capability('moodle/site:viewreports', $sitecontext)) {
+            $a = new object();
             $a->url = "$CFG->wwwroot/course/report/log/index.php?chooselog=0&group=$selectedgroup&user=$selecteduser"
                 ."&id=$course->id&date=$selecteddate&modid=$selectedactivity&showcourses=1&showusers=$showusers";
             print_string('logtoomanycourses','moodle',$a);
@@ -477,6 +472,7 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate='today'
             $users[0] = get_string('allparticipants');
         }
         choose_from_menu($users, 'user', $selecteduser, false);
+        $a = new object();
         $a->url = "$CFG->wwwroot/course/report/log/index.php?chooselog=0&group=$selectedgroup&user=$selecteduser"
             ."&id=$course->id&date=$selecteddate&modid=$selectedactivity&showusers=1&showcourses=$showcourses";
         print_string('logtoomanyusers','moodle',$a);
@@ -491,8 +487,8 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate='today'
                         'downloadasexcel' => get_string('downloadexcel'));
     choose_from_menu ($logformats, 'logformat', $logformat, false);
     echo '<input type="submit" value="'.get_string('gettheselogs').'" />';
-    echo "</form>";
-    echo "</center>";
+    echo '</div>';
+    echo '</form>';
 }
 
 ?>
index 92c7eaa26c5904cec4d3df28d93029ecac978bcf..6673a1c307f98a774cc61687b3f2d9372afe367b 100644 (file)
 
     print_log_selector_form($course); 
 
-    echo '<br />';
-    echo '<div style="text-align:center;">';
     print_heading(get_string('chooselivelogs') .':');
+    echo '<p>';
     link_to_popup_window('/course/report/log/live.php?id='. $course->id,'livelog', get_string('livelogs'), 500, 800);
-    echo '</div>';
-    echo '<br />';
+    echo '</p>';
 ?>
\ No newline at end of file
index fd43012cc6ebb19ba4e8718c698ca1e0117f2cb1..4dfc569fcf494a803ecfe096f221f1f8f6dd812b 100644 (file)
@@ -4,7 +4,7 @@
         die('Direct access to this script is forbidden.');    ///  It must be included from a Moodle page
     }
 
-    echo '<p style="text-align:center;">';
+    echo '<p>';
     $activityreport = get_string( 'activityreport' );
     echo "<a href=\"{$CFG->wwwroot}/course/report/outline/index.php?id={$course->id}\">";
     echo "$activityreport</a>\n";
index e17e0266520abd0be1a88ab17123cbbd1b454e09..b72c770eea9ac6026d62d5c1592dc951315a4d51 100644 (file)
             $useroptions[$r->id] = $r->name;
         }
     }
+    $guestrole = get_guest_role();
+    if (empty($useroptions[$gusetrole->id])) {
+            $useroptions[$guestrole->id] = $guestrole->name;
+    }
     $actionoptions = array('' => $strallactions,
                            'view' => $strview,
                            'post' => $strpost,
     
     
     // print first controls.
-    echo '<form action="index.php" method="get">'."\n".
-        '<input type="hidden" name="id" value="'.$course->id.'" />'."\n".
-        '<input type="hidden" name="oldmod" value="'.$moduleid.'" />'."\n".
-        '<input type="hidden" name="instanceid" value="'.$instanceid.'" />'."\n".
-        '<table align="center" cellpadding="10"><tr>'."\n".
-        "<td>\n".
-        get_string('activitymodule').'&nbsp;';
+    echo '<form class="participationselectform" action="index.php" method="get"><div>'."\n".
+         '<input type="hidden" name="id" value="'.$course->id.'" />'."\n".
+         '<input type="hidden" name="oldmod" value="'.$moduleid.'" />'."\n".
+         '<input type="hidden" name="instanceid" value="'.$instanceid.'" />';
+    echo '<label for="menumoduleid">'.get_string('activitymodule').'</label>';
     choose_from_menu($modoptions,'moduleid',$moduleid);
-    echo "</td><td>\n".
-        get_string('lookback').'&nbsp;';
+    echo '<label for="menutimefrom">'.get_string('lookback').'</label>';
     choose_from_menu($timeoptions,'timefrom',$timefrom);
-    echo "</td><td>".
-        get_string('showonly').'&nbsp;';
+    echo '<label for="menuroleid">'.get_string('showonly').'</label>';
     choose_from_menu($useroptions,'roleid',$roleid,'');
-    echo "</td><td>\n".
-        get_string('showactions'),'&nbsp;';
+    echo '<label for="menuaction">'.get_string('showactions').'</label>';
     choose_from_menu($actionoptions,'action',$action,'');
-    echo '</td><td>';
     helpbutton('participationreport',get_string('participationreport'));
-    echo 
-        '<input type="submit" value="'.get_string('go').'" />'."\n".
-        "</td></tr></table>\n".
-        "</form>\n";
+    echo '<input type="submit" value="'.get_string('go').'" />'."\n</div></form>\n";
 
     if (empty($moduleid)) {
         notify(get_string('selectamodule'));
index a240034ed4e9bc885776622ecfa69bee11c6af79..9e15b80f3d4deee3a400385fa36231a8f31851ae 100644 (file)
             $useroptions[$role->id] = $role->name;
         }
     }
+    $guestrole = get_guest_role();
+    if (empty($useroptions[$gusetrole->id])) {
+            $useroptions[$guestrole->id] = $guestrole->name;
+    }
     $actionoptions = array('' => $strallactions,
                            'view' => $strview,
                            'post' => $strpost,
     
     
     // print first controls.
-    echo '<form action="'.$CFG->wwwroot.'/course/report/participation/index.php" method="get">'."\n".
-        '<input type="hidden" name="id" value="'.$course->id.'" />'."\n".
-        '<table align="center" cellpadding="10"><tr>'."\n".
-        "<td>\n".
-        get_string('activitymodule').'&nbsp;';
+    echo '<form class="participationselectform" action="'.$CFG->wwwroot.'/course/report/participation/index.php" method="get"><div>'."\n".
+         '<input type="hidden" name="id" value="'.$course->id.'" />'."\n";
+    echo '<label for="menumoduleid">'.get_string('activitymodule').'</label>';
     choose_from_menu($modoptions,'moduleid',0);
-    echo "</td><td>\n".
-        get_string('lookback').'&nbsp;';
+    echo '<label for="menutimefrom">'.get_string('lookback').'</label>';
     choose_from_menu($timeoptions,'timefrom',0);
-    echo "</td><td>".
-        get_string('showonly').'&nbsp;';
+    echo '<label for="menuroleid">'.get_string('showonly').'</label>';
     choose_from_menu($useroptions,'roleid',0,'');
-    echo "</td><td>\n".
-        get_string('showactions'),'&nbsp;';
+    echo '<label for="menuaction">'.get_string('showactions').'</label>';
     choose_from_menu($actionoptions,'action',0,'');
-    echo '</td><td>';
     helpbutton('participationreport',get_string('participationreport'));
-    echo 
-        '<input type="submit" value="'.get_string('go').'" />'."\n".
-        "</td></tr></table>\n".
-        "</form>\n";
+    echo '<input type="submit" value="'.get_string('go').'" />'."\n</div></form>\n";
 
 
 ?>
index e012363a335549d63e7ed4e7863adf2831ea9687..1f305d42c464af64ce34e0dec44b75a7a1fc4ba0 100644 (file)
@@ -5,8 +5,12 @@
     }
     
     if (!empty($CFG->enablestats)) {
-        echo '<p style="text-align:center;">';
+        echo '<p>';
         echo '<a href="'.$CFG->wwwroot.'/course/report/stats/index.php?course='.$course->id.'">'.get_string('stats').'</a>';
         echo '</p>';
+    } else {
+        echo '<p>';
+        echo get_string('statsoff');
+        echo '</p>';
     }
 ?>
index 5466009c73ce0972b25f5048d594462e61a45b01..e8c4966b23119fce18e054e78c16a236dbba8128 100644 (file)
@@ -2600,7 +2600,7 @@ function admin_externalpage_print_header($adminroot) {
                                                blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]),
                                                BLOCK_L_MAX_WIDTH);
         $PAGE->print_header();
-        echo '<table id="layout-table"><tr>';
+        echo '<table id="layout-table" summary=""><tr>';
         echo '<td style="width: ' . $preferred_width_left . 'px;" id="left-column">';
         blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
         echo '</td>';
index 8215797a0d0b60d2fc69d8f5e270957f20fb036c..665824f5c2aec598f9ee1e68954bc178e8ad665d 100644 (file)
@@ -1551,6 +1551,46 @@ body#course-index .singlebutton {
 }
 
 
+#course-report #content {
+  padding-top:15px;
+  padding-bottom:15px;
+}
+
+#course-report p {
+  text-align:center;
+}
+
+#course-report .logselectform,
+#course-report .participationselectform,
+#course-report-log-index .logselectform,
+#course-report-participation-index .participationselectform {
+  margin-left:auto;
+  margin-right:auto;
+  text-align:center;
+  margin-top:10px;
+  margin-bottom:10px;
+}
+
+#course-report .participationselectform label,
+#course-report-participation-index .participationselectform label {
+  margin-left:15px;
+  margin-right:5px;
+}
+
+#course-report-log-index .info {
+  margin-left:auto;
+  margin-right:auto;
+  text-align:center;
+  margin:10px;
+}
+
+#course-report-log-index .logtable {
+  margin-left:auto;
+  margin-right:auto;
+}
+
+
+
 /***
  *** Doc
  ***/