From 82a91b718da8d74fafd4ca6f1ed7fd7652e24b9a Mon Sep 17 00:00:00 2001 From: samhemelryk Date: Thu, 2 Jul 2009 04:14:41 +0000 Subject: [PATCH] course reports MDL-16706 Eliminated inline scripts to use PAGE methods --- course/report/log/live.php | 10 +++-- course/report/participation/index.php | 39 +------------------- course/report/participation/participation.js | 31 ++++++++++++++++ 3 files changed, 40 insertions(+), 40 deletions(-) create mode 100644 course/report/participation/participation.js diff --git a/course/report/log/live.php b/course/report/log/live.php index ebf4ad189b..9ed7d5f5e0 100644 --- a/course/report/log/live.php +++ b/course/report/log/live.php @@ -29,8 +29,12 @@ $strlivelogs = get_string("livelogs"); $strupdatesevery = get_string("updatesevery", "moodle", COURSE_LIVELOG_REFRESH); - print_header("$strlivelogs ($strupdatesevery)", "$strlivelogs", "", "", - ''); + $PAGE->set_url('/course/report/log/live.php', Array('id'=>$course->id)); + $PAGE->set_generaltype('popup'); + $PAGE->set_title("$strlivelogs ($strupdatesevery)"); + $PAGE->set_periodic_refresh_delay(COURSE_LIVELOG_REFRESH); + $PAGE->set_heading($strlivelogs); + echo $OUTPUT->header(); $user=0; $date=time() - 3600; @@ -38,7 +42,7 @@ print_log($course, $user, $date, "l.time DESC", $page, 500, "live.php?id=$course->id&user=$user&date=$date"); - print_footer('none'); + echo $OUTPUT->footer(); exit; diff --git a/course/report/participation/index.php b/course/report/participation/index.php index 56ba3d3be7..6b6d9b8f4e 100644 --- a/course/report/participation/index.php +++ b/course/report/participation/index.php @@ -239,44 +239,9 @@ } echo '

'.get_string('counteditems', '', $a).'

'."\n"; - echo ' - -'; + echo $PAGE->requires->js('course/report/participation/participation.js')->asap(); + echo '
'."\n"; echo '
'."\n"; echo ''."\n"; diff --git a/course/report/participation/participation.js b/course/report/participation/participation.js new file mode 100644 index 0000000000..10a05ed624 --- /dev/null +++ b/course/report/participation/participation.js @@ -0,0 +1,31 @@ +function checksubmit(form) { + var destination = form.formaction.options[form.formaction.selectedIndex].value; + if (destination == "" || !checkchecked(form)) { + form.formaction.selectedIndex = 0; + return false; + } else { + return true; + } +} + +function checkchecked(form) { + var inputs = document.getElementsByTagName('INPUT'); + var checked = false; + inputs = filterByParent(inputs, function() {return form;}); + for(var i = 0; i < inputs.length; ++i) { + if(inputs[i].type == 'checkbox' && inputs[i].checked) { + checked = true; + } + } + return checked; +} + +function checknos() { + void(d=document); + void(el=d.getElementsByTagName('INPUT')); + for(i=0;i