Index: lang/en_utf8/scorm.php =================================================================== RCS file: /cvsroot/moodle/moodle/lang/en_utf8/scorm.php,v retrieving revision 1.18.4.9 diff -u -r1.18.4.9 scorm.php --- lang/en_utf8/scorm.php 24 Sep 2008 07:02:46 -0000 1.18.4.9 +++ lang/en_utf8/scorm.php 7 Oct 2008 05:27:56 -0000 @@ -12,6 +12,7 @@ $string['attemptsx'] = '$a attempts'; $string['attr_error'] = 'Bad value for attribute ($a->attr) in tag $a->tag.'; $string['autocontinue'] = 'Auto-Continue'; +$string['autocontinuedesc'] = 'This preferences sets the default auto continue for the activity'; $string['averageattempt'] = 'Average attempts'; $string['badmanifest'] = 'Some manifest errors: see errors log'; $string['badpackage'] = 'The specified package/manifest is not valid. Check it and try again.'; @@ -30,6 +31,7 @@ $string['details'] = 'Track details'; $string['directories'] = 'Show the directory links'; $string['display'] = 'Display package'; +$string['displaydesc'] = 'This preference set the default of whether to display the package or not for an activity'; $string['domxml'] = 'DOMXML external library'; $string['element'] = 'Element'; $string['entercourse'] = 'Enter course'; @@ -52,15 +54,19 @@ $string['gradeaverage'] = 'Average grade'; $string['gradehighest'] = 'Highest grade'; $string['grademethod'] = 'Grading method'; +$string['grademethoddesc'] = 'This preferences sets the default grade method for an activity'; $string['gradescoes'] = 'Learning Objects'; $string['gradesum'] = 'Sum grade'; $string['height'] = 'Height'; $string['hidden'] = 'Hidden'; $string['hidebrowse'] = 'Disable preview mode'; +$string['hidebrowsedesc'] = 'This preferences sets the default or whether to disable or enable the preview mode'; $string['hideexit'] = 'Hide exit link'; $string['hidenav'] = 'Hide navigation buttons'; +$string['hidenavdesc'] = 'This preferences sets the default or whether to show or hide the navigation buttons'; $string['hidereview'] = 'Hide review button'; $string['hidetoc'] = 'Course structure display (TOC)'; +$string['hidetocdesc'] = 'This preferences sets the default for whether to show or hide the course structure display (TOC)'; $string['highestattempt'] = 'Highest attempt'; $string['identifier'] = 'Question Identifier'; $string['iframe'] = 'Current window'; @@ -73,6 +79,8 @@ $string['location'] = 'Show the location bar'; $string['max'] = 'Max score'; $string['maximumattempts'] = 'Number of attempts'; +$string['maximumattemptsdesc'] = 'This preferences sets the default number of maximum attempts for an activity'; +$string['maximumgradedesc'] = 'This preferences sets the default maximum grade for an activity'; $string['menubar'] = 'Show the menu bar'; $string['min'] = 'Min score'; $string['missing_attribute'] = 'Missing attribute $a->attr in tag $a->tag'; @@ -104,6 +112,8 @@ $string['passed'] = 'Passed'; $string['php5'] = 'PHP 5 (DOMXML native library)'; $string['popup'] = 'New window'; +$string['popupblocked'] = 'If a new windows doesn\'t apprear click $a to open a new window'; +$string['popupblockedlinkname'] = 'here'; $string['popupmenu'] = 'In a drop down menu'; $string['popupopen'] = 'Open package in a new window'; $string['position_error'] = 'The $a->tag tag can\'t be child of $a->parent tag'; @@ -126,6 +136,7 @@ $string['scrollbars'] = 'Allow the window to be scrolled'; $string['sided'] = 'On the left side'; $string['skipview'] = 'Student skip content structure page'; +$string['skipviewdesc'] = 'This preferences sets the default of when to skip content structure for a page'; $string['slashargs'] = 'WARNING: slash arguments is disabled on this site and objects may not function as expected!'; $string['stagesize'] = 'Stage size'; $string['started'] = 'Started on'; @@ -151,10 +162,12 @@ $string['viewallreports'] = 'View reports for $a attempts'; $string['viewalluserreports'] = 'View reports for $a users'; $string['whatgrade'] = 'Attempts grading'; +$string['whatgradedesc'] = 'This preferences sets the default attempts grading'; $string['width'] = 'Width'; $string['window'] = 'Window'; $string['unziperror'] = 'An error occurs during package unzip'; $string['othersettings'] = 'Additional settings'; +$string['updatefreqdesc'] = 'This preferences sets the default auto-update frequency of an activity'; $string['updatefreq'] = 'Auto-update frequency'; $string['options'] = 'Options'; $string['activityloading'] = "You will be automatically redirected to the activity in"; // used in conjunction with numseconds Index: mod/scorm/locallib.php =================================================================== RCS file: /cvsroot/moodle/moodle/mod/scorm/locallib.php,v retrieving revision 1.46.2.18 diff -u -r1.46.2.18 locallib.php --- mod/scorm/locallib.php 26 Sep 2008 00:35:10 -0000 1.46.2.18 +++ mod/scorm/locallib.php 13 Oct 2008 18:06:58 -0000 @@ -1,4 +1,4 @@ - get_string('gradescoes', 'scorm'), - GRADEHIGHEST => get_string('gradehighest', 'scorm'), - GRADEAVERAGE => get_string('gradeaverage', 'scorm'), - GRADESUM => get_string('gradesum', 'scorm')); define('HIGHESTATTEMPT', '0'); define('AVERAGEATTEMPT', '1'); define('FIRSTATTEMPT', '2'); define('LASTATTEMPT', '3'); -$SCORM_WHAT_GRADE = array (HIGHESTATTEMPT => get_string('highestattempt', 'scorm'), - AVERAGEATTEMPT => get_string('averageattempt', 'scorm'), - FIRSTATTEMPT => get_string('firstattempt', 'scorm'), - LASTATTEMPT => get_string('lastattempt', 'scorm')); - -$SCORM_POPUP_OPTIONS = array('resizable'=>1, - 'scrollbars'=>1, - 'directories'=>0, - 'location'=>0, - 'menubar'=>0, - 'toolbar'=>0, - 'status'=>0); + +/** + * Returns an array of the popup options for SCORM and each options default value + * + * @return array an array of popup options as the key and their defaults as the value + */ +function scorm_get_popup_options_array(){ + global $CFG; + return array('resizable'=> $CFG->scorm_resizable, + 'scrollbars'=> $CFG->scorm_scrollbars, + 'directories'=> $CFG->scorm_directories, + 'location'=> $CFG->scorm_location, + 'menubar'=> $CFG->scorm_menubar, + 'toolbar'=> $CFG->scorm_toolbar, + 'status'=> $CFG->scorm_status); +} + $stdoptions = ''; -foreach ($SCORM_POPUP_OPTIONS as $popupopt => $value) { +foreach (scorm_get_popup_options_array() as $popupopt => $value) { $stdoptions .= $popupopt.'='.$value; if ($popupopt != 'status') { $stdoptions .= ','; } } -if (!isset($CFG->scorm_maxattempts)) { - set_config('scorm_maxattempts','6'); -} - -if (!isset($CFG->scorm_frameheight)) { - set_config('scorm_frameheight','500'); -} - -if (!isset($CFG->scorm_framewidth)) { - set_config('scorm_framewidth','100%'); -} - if (!isset($CFG->scorm_updatetime)) { set_config('scorm_updatetime','2'); } @@ -68,6 +57,88 @@ } /// Local Library of functions for module scorm +/** + * Returns an array of the array of what grade options + * + * @return array an array of what grade options + */ +function scorm_get_grade_method_array(){ + return array (GRADESCOES => get_string('gradescoes', 'scorm'), + GRADEHIGHEST => get_string('gradehighest', 'scorm'), + GRADEAVERAGE => get_string('gradeaverage', 'scorm'), + GRADESUM => get_string('gradesum', 'scorm')); +} + +/** + * Returns an array of the array of what grade options + * + * @return array an array of what grade options + */ +function scorm_get_what_grade_array(){ + return array (HIGHESTATTEMPT => get_string('highestattempt', 'scorm'), + AVERAGEATTEMPT => get_string('averageattempt', 'scorm'), + FIRSTATTEMPT => get_string('firstattempt', 'scorm'), + LASTATTEMPT => get_string('lastattempt', 'scorm')); +} + +/** + * Returns an array of the array of skip view options + * + * @return array an array of skip view options + */ +function scorm_get_skip_view_array(){ + return array(0 => get_string('never'), + 1 => get_string('firstaccess','scorm'), + 2 => get_string('always')); +} + +/** + * Returns an array of the array of hide table of contents options + * + * @return array an array of hide table of contents options + */ +function scorm_get_hidetoc_array(){ + return array(0 =>get_string('sided','scorm'), + 1 => get_string('hidden','scorm'), + 2 => get_string('popupmenu','scorm')); +} + +/** + * Returns an array of the array of update frequency options + * + * @return array an array of update frequency options + */ +function scorm_get_updatefreq_array(){ + return array(0 => get_string('never'), + 1 => get_string('everyday','scorm'), + 2 => get_string('everytime','scorm')); +} + +/** + * Returns an array of the array of popup display options + * + * @return array an array of popup display options + */ +function scorm_get_popup_display_array(){ + return array(0 => get_string('iframe', 'scorm'), + 1 => get_string('popup', 'scorm')); +} + +/** + * Returns an array of the array of attempt options + * + * @return array an array of attempt options + */ +function scorm_get_attempts_array(){ + $attempts = array(0 => get_string('nolimit','scorm'), + 1 => get_string('attempt1','scorm')); + + for ($i=2; $i<=6; $i++) { + $attempts[$i] = get_string('attemptsx','scorm', $i); + } + + return $attempts; +} /** * This function will permanently delete the given Index: mod/scorm/mod_form.php =================================================================== RCS file: /cvsroot/moodle/moodle/mod/scorm/mod_form.php,v retrieving revision 1.11.2.7 diff -u -r1.11.2.7 mod_form.php --- mod/scorm/mod_form.php 27 Aug 2008 22:02:53 -0000 1.11.2.7 +++ mod/scorm/mod_form.php 10 Oct 2008 23:27:40 -0000 @@ -6,7 +6,7 @@ function definition() { - global $CFG, $COURSE, $SCORM_GRADE_METHOD, $SCORM_WHAT_GRADE; + global $CFG, $COURSE; $mform =& $this->_form; if (isset($CFG->slasharguments) && !$CFG->slasharguments) { $mform->addElement('static', '', '',notify(get_string('slashargs', 'scorm'), 'notifyproblem', 'center', true)); @@ -40,39 +40,31 @@ $mform->addElement('header', 'advanced', get_string('othersettings', 'form')); // Grade Method - $mform->addElement('select', 'grademethod', get_string('grademethod', 'scorm'), $SCORM_GRADE_METHOD); + $mform->addElement('select', 'grademethod', get_string('grademethod', 'scorm'), scorm_get_grade_method_array()); $mform->setHelpButton('grademethod', array('grademethod',get_string('grademethod', 'scorm'),'scorm')); - $mform->setDefault('grademethod', 0); + $mform->setDefault('grademethod', $CFG->scorm_grademethod); // Maximum Grade for ($i=0; $i<=100; $i++) { $grades[$i] = "$i"; } $mform->addElement('select', 'maxgrade', get_string('maximumgrade'), $grades); - $mform->setDefault('maxgrade', 0); + $mform->setDefault('maxgrade', $CFG->scorm_maxgrade); $mform->disabledIf('maxgrade', 'grademethod','eq',GRADESCOES); // Attempts $mform->addElement('static', '', '' ,'
'); // Max Attempts - $attempts = array(0 => get_string('nolimit','scorm')); - for ($i=1; $i<=$CFG->scorm_maxattempts; $i++) { - if ($i == 1) { - $attempts[$i] = get_string('attempt1','scorm'); - } else { - $attempts[$i] = get_string('attemptsx','scorm', $i); - } - } - $mform->addElement('select', 'maxattempt', get_string('maximumattempts', 'scorm'), $attempts); + $mform->addElement('select', 'maxattempt', get_string('maximumattempts', 'scorm'), scorm_get_attempts_array()); $mform->setHelpButton('maxattempt', array('maxattempt',get_string('maximumattempts', 'scorm'), 'scorm')); - $mform->setDefault('maxattempt', 1); + $mform->setDefault('maxattempt', $CFG->scorm_maxattempts); // What Grade - $mform->addElement('select', 'whatgrade', get_string('whatgrade', 'scorm'), $SCORM_WHAT_GRADE); + $mform->addElement('select', 'whatgrade', get_string('whatgrade', 'scorm'), scorm_get_what_grade_array()); $mform->disabledIf('whatgrade', 'maxattempt','eq',1); $mform->setHelpButton('whatgrade', array('whatgrade',get_string('whatgrade', 'scorm'), 'scorm')); - $mform->setDefault('whatgrade', 0); + $mform->setDefault('whatgrade', $CFG->scorm_whatgrade); $mform->setAdvanced('whatgrade'); // Activation period @@ -109,77 +101,52 @@ $mform->setType('height', PARAM_INT); // Framed / Popup Window - $options = array(); - $options[0] = get_string('iframe', 'scorm'); - $options[1] = get_string('popup', 'scorm'); - $mform->addElement('select', 'popup', get_string('display','scorm'), $options); - $mform->setDefault('popup', 0); + $mform->addElement('select', 'popup', get_string('display','scorm'), scorm_get_popup_display_array()); + $mform->setDefault('popup', $CFG->scorm_popup); $mform->setAdvanced('popup'); // Window Options $winoptgrp = array(); - $winoptgrp[] = &$mform->createElement('checkbox', 'resizable', '', get_string('resizable', 'scorm')); - $winoptgrp[] = &$mform->createElement('checkbox', 'scrollbars', '', get_string('scrollbars', 'scorm')); - $winoptgrp[] = &$mform->createElement('checkbox', 'directories', '', get_string('directories', 'scorm')); - $winoptgrp[] = &$mform->createElement('checkbox', 'location', '', get_string('location', 'scorm')); - $winoptgrp[] = &$mform->createElement('checkbox', 'menubar', '', get_string('menubar', 'scorm')); - $winoptgrp[] = &$mform->createElement('checkbox', 'toolbar', '', get_string('toolbar', 'scorm')); - $winoptgrp[] = &$mform->createElement('checkbox', 'status', '', get_string('status', 'scorm')); + foreach(scorm_get_popup_options_array() as $key => $value){ + $winoptgrp[] = &$mform->createElement('checkbox', $key, '', get_string($key, 'scorm')); + $mform->setDefault($key, $value); + } $mform->addGroup($winoptgrp, 'winoptgrp', get_string('options','scorm'), '
', false); - $mform->setDefault('resizable', 1); - $mform->setDefault('scrollbars', 1); - $mform->setDefault('directories', 0); - $mform->setDefault('location', 0); - $mform->setDefault('menubar', 0); - $mform->setDefault('toolbar', 0); - $mform->setDefault('status', 0); $mform->setAdvanced('winoptgrp'); $mform->disabledIf('winoptgrp', 'popup', 'eq', 0); // Skip view page - $options = array(); - $options[0]=get_string('never'); - $options[1]=get_string('firstaccess','scorm'); - $options[2]=get_string('always'); - $mform->addElement('select', 'skipview', get_string('skipview', 'scorm'), $options); + $mform->addElement('select', 'skipview', get_string('skipview', 'scorm'), scorm_get_skip_view_array()); $mform->setHelpButton('skipview', array('skipview',get_string('skipview', 'scorm'), 'scorm')); - $mform->setDefault('skipview', 1); + $mform->setDefault('skipview', $CFG->scorm_skipview); $mform->setAdvanced('skipview'); // Hide Browse $mform->addElement('selectyesno', 'hidebrowse', get_string('hidebrowse', 'scorm')); $mform->setHelpButton('hidebrowse', array('hidebrowse',get_string('hidebrowse', 'scorm'), 'scorm')); - $mform->setDefault('hidebrowse', 0); + $mform->setDefault('hidebrowse', $CFG->scorm_hidebrowse); $mform->setAdvanced('hidebrowse'); // Toc display - $options = array(); - $options[1]=get_string('hidden','scorm'); - $options[0]=get_string('sided','scorm'); - $options[2]=get_string('popupmenu','scorm'); - $mform->addElement('select', 'hidetoc', get_string('hidetoc', 'scorm'), $options); - $mform->setDefault('hidetoc', 0); + $mform->addElement('select', 'hidetoc', get_string('hidetoc', 'scorm'), scorm_get_hidetoc_array()); + $mform->setDefault('hidetoc', $CFG->scorm_hidetoc); $mform->setAdvanced('hidetoc'); // Hide Navigation panel $mform->addElement('selectyesno', 'hidenav', get_string('hidenav', 'scorm')); - $mform->setDefault('hidenav', 0); + $mform->setDefault('hidenav', $CFG->scorm_hidenav); $mform->setAdvanced('hidenav'); // Autocontinue $mform->addElement('selectyesno', 'auto', get_string('autocontinue', 'scorm')); $mform->setHelpButton('auto', array('autocontinue',get_string('autocontinue', 'scorm'), 'scorm')); - $mform->setDefault('auto', 0); + $mform->setDefault('auto', $CFG->scorm_auto); $mform->setAdvanced('auto'); // Update packages timing - $options = array(); - $options[0]=get_string('never'); - // $options[1]=get_string('onchanges','scorm'); - nolonger required, but dont change the sequence - $options[2]=get_string('everyday','scorm'); - $options[3]=get_string('everytime','scorm'); - $mform->addElement('select', 'updatefreq', get_string('updatefreq', 'scorm'), $options); - $mform->setDefault('updatefreq', 0); + $options = + $mform->addElement('select', 'updatefreq', get_string('updatefreq', 'scorm'), scorm_get_updatefreq_array()); + $mform->setDefault('updatefreq', $CFG->scorm_updatefreq); $mform->setAdvanced('updatefreq'); //------------------------------------------------------------------------------- @@ -203,7 +170,7 @@ } - function defaults_preprocessing(&$default_values) { + function data_preprocessing(&$default_values) { global $COURSE; if (isset($default_values['popup']) && ($default_values['popup'] == 1) && isset($default_values['options'])) { Index: mod/scorm/player.php =================================================================== RCS file: /cvsroot/moodle/moodle/mod/scorm/player.php,v retrieving revision 1.34.2.8 diff -u -r1.34.2.8 player.php --- mod/scorm/player.php 17 Sep 2008 02:11:46 -0000 1.34.2.8 +++ mod/scorm/player.php 7 Oct 2008 05:25:17 -0000 @@ -319,6 +319,9 @@ wwwroot.'/mod/scorm/loadSCO.php?id='.$cm->id.$scoidstr.$modestr.'" target="new">'.get_string('popupblockedlinkname','scorm').''; + print_simple_box(get_string('popupblocked','scorm',$link),'center'); } } else { print_simple_box(get_string('noprerequisites','scorm'),'center'); Index: mod/scorm/settings.php =================================================================== RCS file: /cvsroot/moodle/moodle/mod/scorm/settings.php,v retrieving revision 1.1.2.2 diff -u -r1.1.2.2 settings.php --- mod/scorm/settings.php 19 Dec 2007 17:38:49 -0000 1.1.2.2 +++ mod/scorm/settings.php 10 Oct 2008 23:29:33 -0000 @@ -1,9 +1,41 @@ -add(new admin_setting_configselect('scorm_grademethod', get_string('grademethod', 'scorm'),get_string('grademethoddesc', 'scorm'), '', scorm_get_grade_method_array())); + +for ($i=0; $i<=100; $i++) { + $grades[$i] = "$i"; +} +$settings->add(new admin_setting_configselect('scorm_maxgrade', get_string('maximumgrade'),get_string('maximumgradedesc','scorm'), '', $grades)); + +$settings->add(new admin_setting_configselect('scorm_maxattempts', get_string('maximumattempts', 'scorm'), get_string('maximumattemptsdesc', 'scorm'), '', scorm_get_attempts_array())); + +$settings->add(new admin_setting_configselect('scorm_whatgrade', get_string('whatgrade', 'scorm'), get_string('whatgradedesc', 'scorm'), '', scorm_get_what_grade_array())); $settings->add(new admin_setting_configtext('scorm_framewidth', get_string('width', 'scorm'), get_string('framewidth', 'scorm'), '100%')); $settings->add(new admin_setting_configtext('scorm_frameheight', get_string('height', 'scorm'), get_string('frameheight', 'scorm'), 500)); + +$settings->add(new admin_setting_configselect('scorm_popup', get_string('display','scorm'), get_string('displaydesc','scorm'), '', scorm_get_popup_display_array())); + +foreach(scorm_get_popup_options_array() as $key => $value){ + $settings->add(new admin_setting_configcheckbox('scorm_'.$key, get_string($key, 'scorm'),'',$value)); +} + +$settings->add(new admin_setting_configselect('scorm_skipview', get_string('skipview', 'scorm'), get_string('skipviewdesc', 'scorm'), '', scorm_get_skip_view_array())); + +$yesno = array(0 => get_string('no'), + 1 => get_string('yes')); + +$settings->add(new admin_setting_configselect('scorm_hidebrowse', get_string('hidebrowse', 'scorm'), get_string('hidebrowsedesc', 'scorm'), '', $yesno)); + +$settings->add(new admin_setting_configselect('scorm_hidetoc', get_string('hidetoc', 'scorm'), get_string('hidetocdesc', 'scorm'), '', scorm_get_hidetoc_array())); + +$settings->add(new admin_setting_configselect('scorm_hidenav', get_string('hidenav', 'scorm'), get_string('hidenavdesc', 'scorm'), '', $yesno)); + +$settings->add(new admin_setting_configselect('scorm_auto', get_string('autocontinue', 'scorm'), get_string('autocontinuedesc', 'scorm'), '', $yesno)); +$settings->add(new admin_setting_configselect('scorm_updatefreq', get_string('updatefreq', 'scorm'), get_string('updatefreqdesc', 'scorm'), '', scorm_get_updatefreq_array())); ?>