From 4eeec9ac75863cd29f1290ad6c93a13b9a648057 Mon Sep 17 00:00:00 2001 From: nicolasconnault Date: Tue, 28 Jul 2009 09:32:23 +0000 Subject: [PATCH] MDL-19815 Migrated choose_from_menu to the new $OUTPUT->select_menu() function --- mod/scorm/locallib.php | 13 ++++++++++--- mod/scorm/report.php | 10 ++++++++-- mod/scorm/scorm.js | 5 +++++ 3 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 mod/scorm/scorm.js diff --git a/mod/scorm/locallib.php b/mod/scorm/locallib.php index ad3b9f99ab..5253f2da90 100755 --- a/mod/scorm/locallib.php +++ b/mod/scorm/locallib.php @@ -716,7 +716,7 @@ function scorm_course_format_display($user,$course) { } function scorm_view_display ($user, $scorm, $action, $cm, $boxwidth='') { - global $CFG, $DB; + global $CFG, $DB, $PAGE, $OUTPUT; if ($scorm->updatefreq == UPDATE_EVERYTIME) { scorm_parse($scorm, false); @@ -739,7 +739,14 @@ function scorm_view_display ($user, $scorm, $action, $cm, $boxwidth='') {
- + options = $orgs; + $selectmenu->name = 'organization'; + $selectmenu->selectedvalue = $organization; + $selectmenu->add_action('change', 'submit_form_by_id', array('id' => 'changeorg')); + echo $OUTPUT->select_menu($selectmenu); + ?>
delete_records('scorm_scoes_track', array('userid' => $userid, 'scormid' => $scormid, 'attempt' => $attemptid)); return true; } -?> \ No newline at end of file +?> diff --git a/mod/scorm/report.php b/mod/scorm/report.php index c66f2d5ac3..cb474a2053 100755 --- a/mod/scorm/report.php +++ b/mod/scorm/report.php @@ -198,8 +198,14 @@ echo ''.get_string('selectall', 'quiz').' / '; echo ''.get_string('selectnone', 'quiz').' '; echo '  '; - $options = array('delete' => get_string('delete')); - echo choose_from_menu($options, 'action', '', get_string('withselected', 'quiz'), 'if(this.selectedIndex > 0) submitFormById(\'attemptsform\');', '', true); + $PAGE->requires->js('mod/scorm/scorm.js'); + $selectmenu = new moodle_select_menu(); + $selectmenu->options = array('delete' => get_string('delete')); + $selectmenu->name = 'action'; + $selectmenu->button->label = get_string('withselected', 'quiz'); + $selectmenu->id = 'menuaction'; + $selectmenu->add_action('change', 'submit_attempts_form'); + echo $OUTPUT->select_menu($selectmenu); echo ''; diff --git a/mod/scorm/scorm.js b/mod/scorm/scorm.js new file mode 100644 index 0000000000..19897bd5d2 --- /dev/null +++ b/mod/scorm/scorm.js @@ -0,0 +1,5 @@ +function submit_attempts_form(e, args) { + if (e.target.selectedIndex > 0) { + submit_form_by_id(null, {id: 'attemptsform'}); + } +} -- 2.39.5