From: piers Date: Tue, 11 Nov 2008 02:46:20 +0000 (+0000) Subject: MDL-16810 - Allow site configuration of scorm settings. Thanks Jason Hardin. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=30fc6e2dac6608f731015483da61220e2152687f;p=moodle.git MDL-16810 - Allow site configuration of scorm settings. Thanks Jason Hardin. --- diff --git a/lang/en_utf8/scorm.php b/lang/en_utf8/scorm.php index 9e96c6db49..f6ec138c68 100644 --- a/lang/en_utf8/scorm.php +++ b/lang/en_utf8/scorm.php @@ -20,6 +20,7 @@ $string['attempts'] = 'Attempts'; $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.'; @@ -39,9 +40,12 @@ $string['datadir'] = 'Filesystem Error: Can\'t create course data directory'; $string['details'] = 'Track details'; $string['directories'] = 'Show the directory links'; $string['display'] = 'Display package'; +$string['displaydesc'] = 'This preference sets the default of whether to display the package or not for an activity'; $string['domxml'] = 'DOMXML external library'; $string['displayattemptstatus'] = 'Display attempt status'; +$string['displayattemptstatusdesc'] = 'This preference sets the default value for the display attempt status setting'; $string['displaycoursestructure'] = 'Display course structure'; +$string['displaycoursestructuredesc'] = 'This preference sets the default value for the display course structure setting'; $string['element'] = 'Element'; $string['entercourse'] = 'Enter course'; $string['enter'] = 'Enter'; @@ -61,20 +65,25 @@ $string['framewidth'] = 'This preference set the default width for stage frame o $string['fullscreen'] = 'Fill the whole screen'; $string['general'] = 'General data'; $string['forcenewattempt'] = 'Force new attempt'; +$string['forcenewattemptdesc'] = 'This preference sets the default value for the force new attempt setting'; $string['forcecompleted'] = 'Force completed'; +$string['forcecompleteddesc'] = 'This preference sets the default value for the force completed setting'; $string['gradeaverage'] = 'Average grade'; $string['gradehighest'] = 'Highest grade'; $string['grademethod'] = 'Grading method'; -$string['gradereported'] = 'Grade reported'; +$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'; @@ -86,9 +95,12 @@ $string['last'] = 'Last accessed on'; $string['lastaccess'] = 'Last access'; $string['lastattempt'] = 'Last attempt'; $string['lastattemptlock'] = 'Lock after final attempt'; +$string['lastattemptlockdesc'] = 'This preference sets the default value for the lock after final attempt setting'; $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'; @@ -120,6 +132,8 @@ $string['packagefile'] = 'No package file specified'; $string['passed'] = 'Passed'; $string['php5'] = 'PHP 5 (DOMXML native library)'; $string['popup'] = 'New window'; +$string['popupblocked'] = 'If a new window does not apprear click $a to launch the activity'; +$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'; @@ -143,6 +157,7 @@ $string['scormtype'] = 'Type'; $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'; @@ -174,10 +189,12 @@ $string['versionwarning'] = 'The manifest version is older than 1.3, warning at $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 diff --git a/mod/scorm/db/upgrade.php b/mod/scorm/db/upgrade.php index 5e4611eb46..85161c9f50 100644 --- a/mod/scorm/db/upgrade.php +++ b/mod/scorm/db/upgrade.php @@ -264,6 +264,43 @@ function xmldb_scorm_upgrade($oldversion) { upgrade_mod_savepoint($result, 2008090305, 'scorm'); } + + // remove redundant config values + if ($result && $oldversion < 2008090306) { + $redundant_config = array( + 'scorm_allowapidebug', + 'scorm_allowtypeexternal', + 'scorm_allowtypeimsrepository', + 'scorm_allowtypelocalsync', + 'scorm_apidebugmask', + 'scorm_frameheight', + 'scorm_framewidth', + 'scorm_maxattempts', + 'scorm_updatetime'); + foreach ($redundant_config as $rcfg) { + if (isset($CFG->$rcfg)) { + unset_config($rcfg); + } + } + + $cfg_scorm = get_config('scorm'); + $new_config = array('resizable', + 'scrollbars', + 'directories', + 'location', + 'menubar', + 'toolbar', + 'status'); + foreach ($new_config as $ncfg) { + if (!isset($cfg_scorm->$ncfg)) { + set_config($ncfg, 1, 'scorm'); + } + } + /// scorm savepoint reached + upgrade_mod_savepoint($result, 2008090306, 'scorm'); + } + + return $result; } diff --git a/mod/scorm/locallib.php b/mod/scorm/locallib.php index ebe990193f..1aec6c99a3 100755 --- a/mod/scorm/locallib.php +++ b/mod/scorm/locallib.php @@ -22,9 +22,109 @@ define('AVERAGEATTEMPT', '1'); define('FIRSTATTEMPT', '2'); define('LASTATTEMPT', '3'); - /// Local Library of functions for module scorm +/** + * 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; + $cfg_scorm = get_config('scorm'); + + 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); +} + +/** + * 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('onchanges','scorm'), + 2 => get_string('everyday','scorm'), + 3 => 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; +} /** * Extracts scrom package, sets up all variables. * Called whenever scorm changes @@ -34,6 +134,7 @@ define('LASTATTEMPT', '3'); */ function scorm_parse($scorm, $full) { global $CFG, $DB; + $cfg_scorm = get_config('scorm'); if (!isset($scorm->cmid)) { $cm = get_coursemodule_from_instance('scorm', $scorm->id); @@ -54,7 +155,7 @@ function scorm_parse($scorm, $full) { $newhash = null; } } else { - if (!$CFG->scorm_allowtypelocalsync) { + if (!$cfg_scorm->allowtypelocalsync) { // sorry - localsync disabled return; } @@ -107,7 +208,7 @@ function scorm_parse($scorm, $full) { } } - } else if ($scorm->scormtype === SCORM_TYPE_EXTERNAL and $CFG->scorm_allowtypeexternal) { + } else if ($scorm->scormtype === SCORM_TYPE_EXTERNAL and $cfg_scorm->allowtypeexternal) { if (!$full and $scorm->sha1hash === sha1($scorm->reference)) { return; } @@ -118,7 +219,7 @@ function scorm_parse($scorm, $full) { } $newhash = sha1($scorm->reference); - } else if ($scorm->scormtype === SCORM_TYPE_IMSREPOSITORY and !empty($CFG->repositoryactivate) and $CFG->scorm_allowtypeimsrepository) { + } else if ($scorm->scormtype === SCORM_TYPE_IMSREPOSITORY and !empty($CFG->repositoryactivate) and $cfg_scorm->allowtypeimsrepository) { if (!$full and $scorm->sha1hash === sha1($scorm->reference)) { return; } @@ -966,11 +1067,13 @@ function scorm_get_attempt_count($user, $scorm) { */ function scorm_debugging($scorm) { global $CFG, $USER; - if (!$CFG->scorm_allowapidebug) { + $cfg_scorm = get_config('scorm'); + + if (!$cfg_scorm->allowapidebug) { return false; } $identifier = $USER->username.':'.$scorm->name; - $test = $CFG->scorm_apidebugmask; + $test = $cfg_scorm->apidebugmask; // check the regex is only a short list of safe characters if (!preg_match('/^[\w\s\*\.\?\+\:\_\\\]+$/', $test)) { return false; diff --git a/mod/scorm/mod_form.php b/mod/scorm/mod_form.php index f9980c138e..695b793baa 100644 --- a/mod/scorm/mod_form.php +++ b/mod/scorm/mod_form.php @@ -6,20 +6,10 @@ class mod_scorm_mod_form extends moodleform_mod { function definition() { global $CFG, $COURSE; + $cfg_scorm = get_config('scorm'); $mform = $this->_form; - $SCORM_GRADE_METHOD = array (GRADESCOES => get_string('gradescoes', 'scorm'), - GRADEHIGHEST => get_string('gradehighest', 'scorm'), - GRADEAVERAGE => get_string('gradeaverage', 'scorm'), - GRADESUM => get_string('gradesum', 'scorm')); - - $SCORM_WHAT_GRADE = array (HIGHESTATTEMPT => get_string('highestattempt', 'scorm'), - AVERAGEATTEMPT => get_string('averageattempt', 'scorm'), - FIRSTATTEMPT => get_string('firstattempt', 'scorm'), - LASTATTEMPT => get_string('lastattempt', 'scorm')); - - if (!$CFG->slasharguments) { $mform->addElement('static', '', '',notify(get_string('slashargs', 'scorm'), 'notifyproblem', 'center', true)); } @@ -48,15 +38,15 @@ class mod_scorm_mod_form extends moodleform_mod { // Scorm types $options = array(SCORM_TYPE_LOCAL => get_string('typelocal', 'scorm')); - if ($CFG->scorm_allowtypeexternal) { + if ($cfg_scorm->allowtypeexternal) { $options[SCORM_TYPE_EXTERNAL] = get_string('typeexternal', 'scorm'); } - if ($CFG->scorm_allowtypelocalsync) { + if ($cfg_scorm->allowtypelocalsync) { $options[SCORM_TYPE_LOCALSYNC] = get_string('typelocalsync', 'scorm'); } - if (!empty($CFG->repositoryactivate) and $CFG->scorm_allowtypeimsrepository) { + if (!empty($CFG->repositoryactivate) and $cfg_scorm->allowtypeimsrepository) { $options[SCORM_TYPE_IMSREPOSITORY] = get_string('typeimsrepository', 'scorm'); } @@ -81,67 +71,59 @@ class mod_scorm_mod_form extends moodleform_mod { $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); + // Display attempt status $mform->addElement('selectyesno', 'displayattemptstatus', get_string('displayattemptstatus', 'scorm')); $mform->setHelpButton('displayattemptstatus', array('displayattemptstatus',get_string('displayattemptstatus', 'scorm'), 'scorm')); - $mform->setDefault('displayattemptstatus', 1); - + $mform->setDefault('displayattemptstatus', $cfg_scorm->displayattemptstatus); + // Display course structure $mform->addElement('selectyesno', 'displaycoursestructure', get_string('displaycoursestructure', 'scorm')); $mform->setHelpButton('displaycoursestructure', array('displaycoursestructure',get_string('displaycoursestructure', 'scorm'), 'scorm')); - $mform->setDefault('displaycoursestructure', 1); - + $mform->setDefault('displaycoursestructure', $cfg_scorm->displaycoursestructure); + // Force completed $mform->addElement('selectyesno', 'forcecompleted', get_string('forcecompleted', 'scorm')); $mform->setHelpButton('forcecompleted', array('forcecompleted',get_string('forcecompleted', 'scorm'), 'scorm')); - $mform->setDefault('forcecompleted', 0); + $mform->setDefault('forcecompleted', $cfg_scorm->forcecompleted); $mform->setAdvanced('forcecompleted'); // Force new attempt $mform->addElement('selectyesno', 'forcenewattempt', get_string('forcenewattempt', 'scorm')); $mform->setHelpButton('forcenewattempt', array('forcenewattempt',get_string('forcenewattempt', 'scorm'), 'scorm')); - $mform->setDefault('forcenewattempt', 0); + $mform->setDefault('forcenewattempt', $cfg_scorm->forcenewattempt); $mform->setAdvanced('forcenewattempt'); // Last attempt lock - lock the enter button after the last available attempt has been made $mform->addElement('selectyesno', 'lastattemptlock', get_string('lastattemptlock', 'scorm')); $mform->setHelpButton('lastattemptlock', array('lastattemptlock',get_string('lastattemptlock', 'scorm'), 'scorm')); - $mform->setDefault('lastattemptlock', 0); + $mform->setDefault('lastattemptlock', $cfg_scorm->lastattemptlock); $mform->setAdvanced('lastattemptlock'); // 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 @@ -163,92 +145,67 @@ class mod_scorm_mod_form extends moodleform_mod { $mform->setDefault('enddisabled', 1); $mform->disabledIf('dateendgrp', 'enddisabled', 'checked'); */ + // Stage Size $mform->addElement('static', '', '' ,'
'); $mform->addElement('static', 'stagesize', get_string('stagesize','scorm')); $mform->setHelpButton('stagesize', array('stagesize',get_string('stagesize', 'scorm'), 'scorm')); // Width $mform->addElement('text', 'width', get_string('width','scorm'), 'maxlength="5" size="5"'); - $mform->setDefault('width', $CFG->scorm_framewidth); + $mform->setDefault('width', $cfg_scorm->framewidth); $mform->setType('width', PARAM_INT); // Height $mform->addElement('text', 'height', get_string('height','scorm'), 'maxlength="5" size="5"'); - $mform->setDefault('height', $CFG->scorm_frameheight); + $mform->setDefault('height', $cfg_scorm->frameheight); $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); + $mform->addElement('select', 'updatefreq', get_string('updatefreq', 'scorm'), scorm_get_updatefreq_array()); + $mform->setDefault('updatefreq', $cfg_scorm->updatefreq); $mform->setAdvanced('updatefreq'); //------------------------------------------------------------------------------- diff --git a/mod/scorm/player.php b/mod/scorm/player.php index 79c4ed6bb9..2029122faf 100755 --- a/mod/scorm/player.php +++ b/mod/scorm/player.php @@ -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'); diff --git a/mod/scorm/settings.php b/mod/scorm/settings.php index 0563e7bd37..341d17e5cd 100644 --- a/mod/scorm/settings.php +++ b/mod/scorm/settings.php @@ -1,28 +1,72 @@ get_string('no'), + 1 => get_string('yes')); + +$settings->add(new admin_setting_configselect('scorm/grademethod', get_string('grademethod', 'scorm'),get_string('grademethoddesc', 'scorm'), '', scorm_get_grade_method_array())); -$settings->add(new admin_setting_configtext('scorm_framewidth', get_string('width', 'scorm'), +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_configtext('scorm/maxattempts', get_string('maximumattempts', 'scorm'), + '', 6)); + + +$settings->add(new admin_setting_configselect('scorm/displayattemptstatus', get_string('displayattemptstatus', 'scorm'),get_string('displayattemptstatusdesc', 'scorm'),'',$yesno)); + +$settings->add(new admin_setting_configselect('scorm/displaycoursestructure', get_string('displaycoursestructure', 'scorm'),get_string('displaycoursestructuredesc', 'scorm'),'',$yesno)); + +$settings->add(new admin_setting_configselect('scorm/forcecompleted', get_string('forcecompleted', 'scorm'),get_string('forcecompleteddesc', 'scorm'),'',$yesno)); + +$settings->add(new admin_setting_configselect('scorm/forcenewattempt', get_string('forcenewattempt', 'scorm'),get_string('forcenewattemptdesc', 'scorm'),'',$yesno)); + +$settings->add(new admin_setting_configselect('scorm/lastattemptlock', get_string('lastattemptlock', 'scorm'),get_string('lastattemptlockdesc', 'scorm'),'',$yesno)); + +$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'), +$settings->add(new admin_setting_configtext('scorm/frameheight', get_string('height', 'scorm'), get_string('frameheight', 'scorm'), 500)); -$settings->add(new admin_setting_configtext('scorm_maxattempts', get_string('maximumattempts', 'scorm'), - '', 6)); + + +$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())); + +$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())); -$settings->add(new admin_setting_configtext('scorm_updatetime', get_string('updatetime', 'scorm'), +$settings->add(new admin_setting_configtext('scorm/updatetime', get_string('updatetime', 'scorm'), '', 2)); -$settings->add(new admin_setting_configcheckbox('scorm_allowtypeexternal', get_string('allowtypeexternal', 'scorm'), +$settings->add(new admin_setting_configcheckbox('scorm/allowtypeexternal', get_string('allowtypeexternal', 'scorm'), '', 0)); -$settings->add(new admin_setting_configcheckbox('scorm_allowtypelocalsync', get_string('allowtypelocalsync', 'scorm'), +$settings->add(new admin_setting_configcheckbox('scorm/allowtypelocalsync', get_string('allowtypelocalsync', 'scorm'), '', 0)); -$settings->add(new admin_setting_configcheckbox('scorm_allowtypeimsrepository', get_string('allowtypeimsrepository', 'scorm'), +$settings->add(new admin_setting_configcheckbox('scorm/allowtypeimsrepository', get_string('allowtypeimsrepository', 'scorm'), '', 0)); -$settings->add(new admin_setting_configcheckbox('scorm_allowapidebug', get_string('allowapidebug', 'scorm'), +$settings->add(new admin_setting_configcheckbox('scorm/allowapidebug', get_string('allowapidebug', 'scorm'), '', 0)); -$settings->add(new admin_setting_configtext('scorm_apidebugmask', get_string('apidebugmask', 'scorm'), +$settings->add(new admin_setting_configtext('scorm/apidebugmask', get_string('apidebugmask', 'scorm'), '', '.*')); diff --git a/mod/scorm/version.php b/mod/scorm/version.php index febd804a2a..a48211c766 100755 --- a/mod/scorm/version.php +++ b/mod/scorm/version.php @@ -10,7 +10,7 @@ // catch up now, so until 27th October please only increment in very tiny steps // in HEAD, until we get past that date.. -$module->version = 2008090305; // The (date) version of this module +$module->version = 2008090306; // The (date) version of this module $module->requires = 2008090108; // The version of Moodle that is required $module->cron = 300; // How often should cron check this module (seconds)?