course reports MDL-16706 Eliminated inline scripts to use PAGE methods

This commit is contained in:
samhemelryk
2009-07-02 04:14:41 +00:00
parent 2a29ba7edb
commit 82a91b718d
3 changed files with 39 additions and 39 deletions
+7 -3
View File
@@ -29,8 +29,12 @@
$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;
+1 -36
View File
@@ -239,44 +239,9 @@
}
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;
}
echo $PAGE->requires->js('course/report/participation/participation.js')->asap();
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 '<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";
@@ -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)
}
}
}