]> git.mjollnir.org Git - moodle.git/commitdiff
course reports MDL-16706 Eliminated inline scripts to use PAGE methods
authorsamhemelryk <samhemelryk>
Thu, 2 Jul 2009 04:14:41 +0000 (04:14 +0000)
committersamhemelryk <samhemelryk>
Thu, 2 Jul 2009 04:14:41 +0000 (04:14 +0000)
course/report/log/live.php
course/report/participation/index.php
course/report/participation/participation.js [new file with mode: 0644]

index ebf4ad189bd5c814ffa1616227eb0fa20aa1fe56..9ed7d5f5e02db9179dfbc5b969e6273166b150a0 100644 (file)
     $strlivelogs = get_string("livelogs");
     $strupdatesevery = get_string("updatesevery", "moodle", COURSE_LIVELOG_REFRESH);
 
-    print_header("$strlivelogs ($strupdatesevery)", "$strlivelogs", "", "", 
-                 '<meta http-equiv="Refresh" content="'.COURSE_LIVELOG_REFRESH.'; url=live.php?id='.$course->id.'" />');
+    $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&amp;user=$user&amp;date=$date");
 
-    print_footer('none');
+    echo $OUTPUT->footer();
 
     exit;
 
index 56ba3d3be783789e0225b14cb2d2e23ab2db1ddb..6b6d9b8f4e38c9cc3ffc5d77fd891f76f0d1069b 100644 (file)
         }
 
         echo '<h2>'.get_string('counteditems', '', $a).'</h2>'."\n";
-        echo '
-<script type="text/javascript">
-//<![CDATA[
-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<el.length;i++) {
-        if (el[i].value == 0) {
-            void(el[i].checked=1)
-        }
-    }
-}
 
-//]]>
-</script>
-';
+        echo $PAGE->requires->js('course/report/participation/participation.js')->asap();
+
         echo '<form action="'.$CFG->wwwroot.'/user/action_redir.php" method="post" id="studentsform" onsubmit="return checksubmit(this);">'."\n";
         echo '<div>'."\n";
         echo '<input type="hidden" name="id" value="'.$id.'" />'."\n";
diff --git a/course/report/participation/participation.js b/course/report/participation/participation.js
new file mode 100644 (file)
index 0000000..10a05ed
--- /dev/null
@@ -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<el.length;i++) {
+        if (el[i].value == 0) {
+            void(el[i].checked=1)
+        }
+    }
+}
\ No newline at end of file