From 5577ceb354b33117a523069b78daa425697bee78 Mon Sep 17 00:00:00 2001 From: skodak Date: Mon, 15 Jan 2007 21:28:25 +0000 Subject: [PATCH] xhtml fixing in logs and reports, code cleanup MDL-8187 --- course/lib.php | 36 +++++++++++----------- course/report/log/lib.php | 44 ++++++++++++--------------- course/report/log/mod.php | 6 ++-- course/report/outline/mod.php | 2 +- course/report/participation/index.php | 31 ++++++++----------- course/report/participation/mod.php | 27 +++++++--------- course/report/stats/mod.php | 6 +++- lib/adminlib.php | 2 +- theme/standard/styles_layout.css | 40 ++++++++++++++++++++++++ 9 files changed, 111 insertions(+), 83 deletions(-) diff --git a/course/lib.php b/course/lib.php index fa3dd4d415..fa2973d7a1 100644 --- a/course/lib.php +++ b/course/lib.php @@ -466,13 +466,13 @@ function print_log($course, $user=0, $date=0, $order="l.time ASC", $page=0, $per $strftimedatetime = get_string("strftimedatetime"); - echo "

\n"; + echo "

\n"; print_string("displayingrecords", "", $totalcount); - echo "

\n"; + echo "
\n"; print_paging_bar($totalcount, $page, $perpage, "$url&perpage=$perpage&"); - echo "\n"; + echo "
\n"; echo ""; if ($course->id == SITEID) { echo "\n"; @@ -518,23 +518,23 @@ function print_log($course, $user=0, $date=0, $order="l.time ASC", $page=0, $per echo ''; if ($course->id == SITEID) { - echo "\n"; } - echo "\n"; - echo "\n"; $fullname = fullname($log, has_capability('moodle/site:viewfullnames', get_context_instance(CONTEXT_COURSE, $course->id))); - echo "\n"; - echo "\n";; - echo "\n"; + echo "\n"; echo "\n"; } echo "
".get_string('course')."
\n"; + echo "\n"; echo " wwwroot}/course/view.php?id={$log->course}\">".$courses[$log->course]."\n"; echo "".userdate($log->time, '%a'). + echo "".userdate($log->time, '%a'). ' '.userdate($log->time, $strftimedatetime)."\n"; + echo "\n"; link_to_popup_window("/iplookup/index.php?ip=$log->ip&user=$log->userid", 'iplookup',$log->ip, 400, 700); echo "\n"; + echo "\n"; echo " wwwroot/user/view.php?id={$log->userid}&course={$log->course}\">$fullname\n"; echo "\n"; + echo "\n"; link_to_popup_window( make_log_url($log->module,$log->url), 'fromloglive',"$log->module $log->action", 400, 600); echo "{$log->info}{$log->info}
\n"; @@ -572,13 +572,13 @@ function print_mnet_log($hostid, $course, $user=0, $date=0, $order="l.time ASC", $strftimedatetime = get_string("strftimedatetime"); - echo "

\n"; + echo "

\n"; print_string("displayingrecords", "", $totalcount); - echo "

\n"; + echo "
\n"; print_paging_bar($totalcount, $page, $perpage, "$url&perpage=$perpage&"); - echo "\n"; + echo "
\n"; echo ""; if ($course->id == SITEID) { echo "\n"; @@ -625,23 +625,23 @@ function print_mnet_log($hostid, $course, $user=0, $date=0, $order="l.time ASC", echo ''; if ($course->id == SITEID) { - echo "\n"; } - echo "\n"; - echo "\n"; $fullname = fullname($log, has_capability('moodle/site:viewfullnames', get_context_instance(CONTEXT_COURSE, $course->id))); - echo "\n"; - echo "\n";; - echo "\n"; + echo "\n"; echo "\n"; } echo "
".get_string('course')."
\n"; + echo "\n"; echo " wwwroot}/course/view.php?id={$log->course}\">".$courses[$log->course]."\n"; echo "".userdate($log->time, '%a'). + echo "".userdate($log->time, '%a'). ' '.userdate($log->time, $strftimedatetime)."\n"; + echo "\n"; link_to_popup_window("/iplookup/index.php?ip=$log->ip&user=$log->userid", 'iplookup',$log->ip, 400, 700); echo "\n"; + echo "\n"; echo " wwwroot/user/view.php?id={$log->userid}\">$fullname\n"; echo "\n"; + echo "\n"; echo $log->action .': '.$log->module; echo "{$log->info}{$log->info}
\n"; diff --git a/course/report/log/lib.php b/course/report/log/lib.php index 17b267c22b..9bcdb90c0c 100644 --- a/course/report/log/lib.php +++ b/course/report/log/lib.php @@ -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 "
wwwroot/course/report/log/index.php\" method=\"get\">\n"; - echo "
\n"; + echo "wwwroot/course/report/log/index.php\" method=\"get\">\n"; + echo "
\n";//invisible fieldset here breaks wrapping echo "\n"; echo "\n"; echo "\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 '
'; 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 ''; - echo '
'; - echo "
"; + echo ''; + echo ''; } 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 "
\n"; - echo "
wwwroot/course/report/log/index.php\" method=\"get\">\n"; + echo "wwwroot/course/report/log/index.php\" method=\"get\">\n"; + echo "
\n"; echo "\n"; echo "\n"; echo "\n"; @@ -443,9 +437,10 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate='today' } else { // echo ''; $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 ''; - echo ""; - echo "
"; + echo ''; + echo ''; } ?> diff --git a/course/report/log/mod.php b/course/report/log/mod.php index 92c7eaa26c..6673a1c307 100644 --- a/course/report/log/mod.php +++ b/course/report/log/mod.php @@ -12,10 +12,8 @@ print_log_selector_form($course); - echo '
'; - echo '
'; print_heading(get_string('chooselivelogs') .':'); + echo '

'; link_to_popup_window('/course/report/log/live.php?id='. $course->id,'livelog', get_string('livelogs'), 500, 800); - echo '

'; - echo '
'; + echo '

'; ?> \ No newline at end of file diff --git a/course/report/outline/mod.php b/course/report/outline/mod.php index fd43012cc6..4dfc569fcf 100644 --- a/course/report/outline/mod.php +++ b/course/report/outline/mod.php @@ -4,7 +4,7 @@ die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page } - echo '

'; + echo '

'; $activityreport = get_string( 'activityreport' ); echo "wwwroot}/course/report/outline/index.php?id={$course->id}\">"; echo "$activityreport\n"; diff --git a/course/report/participation/index.php b/course/report/participation/index.php index e17e026652..b72c770eea 100644 --- a/course/report/participation/index.php +++ b/course/report/participation/index.php @@ -113,6 +113,10 @@ $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, @@ -120,29 +124,20 @@ // print first controls. - echo '

'."\n". - ''."\n". - ''."\n". - ''."\n". - ''."\n". - "
\n". - get_string('activitymodule').' '; + echo '
'."\n". + ''."\n". + ''."\n". + ''; + echo ''; choose_from_menu($modoptions,'moduleid',$moduleid); - echo "
\n". - get_string('lookback').' '; + echo ''; choose_from_menu($timeoptions,'timefrom',$timefrom); - echo "". - get_string('showonly').' '; + echo ''; choose_from_menu($useroptions,'roleid',$roleid,''); - echo "\n". - get_string('showactions'),' '; + echo ''; choose_from_menu($actionoptions,'action',$action,''); - echo ''; helpbutton('participationreport',get_string('participationreport')); - echo - ''."\n". - "
\n". - "
\n"; + echo ''."\n\n"; if (empty($moduleid)) { notify(get_string('selectamodule')); diff --git a/course/report/participation/mod.php b/course/report/participation/mod.php index a240034ed4..9e15b80f3d 100644 --- a/course/report/participation/mod.php +++ b/course/report/participation/mod.php @@ -65,6 +65,10 @@ $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, @@ -72,27 +76,18 @@ // print first controls. - echo '
'."\n". - ''."\n". - ''."\n". - "
\n". - get_string('activitymodule').' '; + echo '
'."\n". + ''."\n"; + echo ''; choose_from_menu($modoptions,'moduleid',0); - echo "
\n". - get_string('lookback').' '; + echo ''; choose_from_menu($timeoptions,'timefrom',0); - echo "". - get_string('showonly').' '; + echo ''; choose_from_menu($useroptions,'roleid',0,''); - echo "\n". - get_string('showactions'),' '; + echo ''; choose_from_menu($actionoptions,'action',0,''); - echo ''; helpbutton('participationreport',get_string('participationreport')); - echo - ''."\n". - "
\n". - "
\n"; + echo ''."\n\n"; ?> diff --git a/course/report/stats/mod.php b/course/report/stats/mod.php index e012363a33..1f305d42c4 100644 --- a/course/report/stats/mod.php +++ b/course/report/stats/mod.php @@ -5,8 +5,12 @@ } if (!empty($CFG->enablestats)) { - echo '

'; + echo '

'; echo ''.get_string('stats').''; echo '

'; + } else { + echo '

'; + echo get_string('statsoff'); + echo '

'; } ?> diff --git a/lib/adminlib.php b/lib/adminlib.php index 5466009c73..e8c4966b23 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -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 ''; + echo '
'; echo ''; diff --git a/theme/standard/styles_layout.css b/theme/standard/styles_layout.css index 8215797a0d..665824f5c2 100644 --- a/theme/standard/styles_layout.css +++ b/theme/standard/styles_layout.css @@ -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 ***/ -- 2.39.5
'; blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT); echo '