echo $OUTPUT->heading($mootyper->name); $htmlout = ''; $htmlout .= '<script type="text/javascript"> function removeAtts() { document.getElementById("lesson").disabled = false; document.getElementById("mode").disabled = false; document.getElementById("exercise").disabled = false; } </script>'; $htmlout .= '<form id="setupform" onsubmit="removeAtts();" name="setupform" method="POST">'; $disSelect = $ePO == 1 ? ' disabled="disabled"' : ''; $htmlout .= '<table><tr><td>' . get_string('fmode', 'mootyper') . '</td><td><select' . $disSelect . ' onchange="this.form.submit()" name="mode" id="mode">'; //$lessons = get_typerlessons(); if (has_capability('mod/mootyper:editall', context_module::instance($cm->id))) { $lessons = get_typerlessons(); } else { $lessons = get_mootyperlessons($USER->id, $course->id); } if ($modePO == 0 || is_null($modePO)) { $htmlout .= '<option selected="true" value="0">' . get_string('sflesson', 'mootyper') . '</option><option value="1">' . get_string('isexamtext', 'mootyper') . '</option>'; $htmlout .= '</select></td></tr><tr><td>'; $htmlout .= get_string('excategory', 'mootyper') . '</td><td><select' . $disSelect . ' onchange="this.form.submit()" id="lesson" name="lesson">'; for ($ij = 0; $ij < count($lessons); $ij++) { if ($lessons[$ij]['id'] == $lessonPO) { $htmlout .= '<option selected="true" value="' . $lessons[$ij]['id'] . '">' . $lessons[$ij]['lessonname'] . '</option>'; } else { $htmlout .= '<option value="' . $lessons[$ij]['id'] . '">' . $lessons[$ij]['lessonname'] . '</option>'; } } $htmlout .= '</select></td></tr><tr><td>' . get_string('requiredgoal', 'mootyper') . '</td><td><input value="' . $goalPO . '" style="width: 20px;" type="text" name="requiredgoal"> % </td></tr>';
} //$context = get_context_instance(CONTEXT_MODULE, $cm->id); //add_to_log($course->id, 'mootyper', 'view', "view.php?id={$cm->id}", $mootyper->name, $cm->id); /// Print the page header $PAGE->set_url('/mod/mootyper/eins.php', array('id' => $course->id)); $PAGE->set_title(get_string('etitle', 'mootyper')); $PAGE->set_heading(get_string('eheading', 'mootyper')); //$PAGE->set_context($context); // other things you may want to set - remove if not needed $PAGE->set_cacheable(false); //$PAGE->set_focuscontrol('tb1'); //$PAGE->add_body_class('mootyper-'.$somevar); // Output starts here echo $OUTPUT->header(); // action="?id='.$id.'&ins=true" $lessonsG = get_typerlessons(); if (has_capability('mod/mootyper:editall', context_course::instance($course->id))) { $lessons = $lessonsG; } else { $lessons = array(); foreach ($lessonsG as $lsnG) { if (is_editable_by_me($USER->id, $lsnG['id'])) { $lessons[] = $lsnG; } } } echo '<form method="POST">'; echo get_string('fnewexercise', 'mootyper') . ' '; echo '<select onchange="this.form.submit()" name="lesson">'; echo '<option value="-1">' . get_string('fnewlesson', 'mootyper') . '</option>'; for ($ij = 0; $ij < count($lessons); $ij++) {