mirror of
https://github.com/moodle/moodle.git
synced 2025-02-13 12:34:28 +01:00
Merge branch 'master_MDL-31652' of git://github.com/danmarsden/moodle
This commit is contained in:
commit
26fad611da
@ -210,7 +210,6 @@ $string['notattempted'] = 'Not attempted';
|
||||
$string['not_corr_type'] = 'Type mismatch for tag {$a->tag}';
|
||||
$string['notopenyet'] = 'Sorry, this activity is not available until {$a}';
|
||||
$string['objectives'] = 'Objectives';
|
||||
$string['onchanges'] = 'Whenever it changes';
|
||||
$string['optallstudents'] = 'all users';
|
||||
$string['optattemptsonly'] = 'users with attempts only';
|
||||
$string['optnoattemptsonly'] = 'users with no attempts only';
|
||||
@ -310,6 +309,7 @@ $string['typelocal'] = 'Uploaded package';
|
||||
$string['typelocalsync'] = 'Downloaded package';
|
||||
$string['unziperror'] = 'An error occurs during package unzip';
|
||||
$string['updatefreq'] = 'Auto-update frequency';
|
||||
$string['updatefreq_help'] = 'This allows the external package to be automatically downloaded and updated';
|
||||
$string['updatefreqdesc'] = 'This preference sets the default auto-update frequency of an activity';
|
||||
$string['validateascorm'] = 'Validate a package';
|
||||
$string['validation'] = 'Validation result';
|
||||
|
@ -502,7 +502,7 @@ function scorm_cron () {
|
||||
|
||||
mtrace('Updating scorm packages which require daily update');//We are updating
|
||||
|
||||
$scormsupdate = $DB->get_records('scorm', array('updatefreq'=>UPDATE_EVERYDAY));
|
||||
$scormsupdate = $DB->get_records_select('scorm', 'updatefreq = ? AND scormtype <> ?', array(SCORM_UPDATE_EVERYDAY, SCORM_TYPE_LOCAL));
|
||||
foreach ($scormsupdate as $scormupdate) {
|
||||
scorm_parse($scormupdate, true);
|
||||
}
|
||||
|
@ -18,10 +18,9 @@ require_once("$CFG->dirroot/mod/scorm/lib.php");
|
||||
require_once("$CFG->libdir/filelib.php");
|
||||
|
||||
/// Constants and settings for module scorm
|
||||
define('UPDATE_NEVER', '0');
|
||||
define('UPDATE_ONCHANGE', '1');
|
||||
define('UPDATE_EVERYDAY', '2');
|
||||
define('UPDATE_EVERYTIME', '3');
|
||||
define('SCORM_UPDATE_NEVER', '0');
|
||||
define('SCORM_UPDATE_EVERYDAY', '2');
|
||||
define('SCORM_UPDATE_EVERYTIME', '3');
|
||||
|
||||
define('SCO_ALL', 0);
|
||||
define('SCO_DATA', 1);
|
||||
@ -133,10 +132,9 @@ function scorm_get_hidetoc_array() {
|
||||
* @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'));
|
||||
return array(SCORM_UPDATE_NEVER => get_string('never'),
|
||||
SCORM_UPDATE_EVERYDAY => get_string('everyday', 'scorm'),
|
||||
SCORM_UPDATE_EVERYTIME => get_string('everytime', 'scorm'));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -729,7 +727,7 @@ function scorm_course_format_display($user, $course) {
|
||||
function scorm_view_display ($user, $scorm, $action, $cm) {
|
||||
global $CFG, $DB, $PAGE, $OUTPUT;
|
||||
|
||||
if ($scorm->updatefreq == UPDATE_EVERYTIME) {
|
||||
if ($scorm->scormtype != SCORM_TYPE_LOCAL && $scorm->updatefreq == SCORM_UPDATE_EVERYTIME) {
|
||||
scorm_parse($scorm, false);
|
||||
}
|
||||
|
||||
@ -823,7 +821,7 @@ function scorm_simple_play($scorm, $user, $context, $cmid) {
|
||||
|
||||
$result = false;
|
||||
|
||||
if ($scorm->updatefreq == UPDATE_EVERYTIME) {
|
||||
if ($scorm->scormtype != SCORM_TYPE_LOCAL && $scorm->updatefreq == SCORM_UPDATE_EVERYTIME) {
|
||||
scorm_parse($scorm, false);
|
||||
}
|
||||
if (has_capability('mod/scorm:viewreport', $context)) { //if this user can view reports, don't skipview so they can see links to reports.
|
||||
|
@ -48,27 +48,27 @@ class mod_scorm_mod_form extends moodleform_mod {
|
||||
$this->add_intro_editor(true);
|
||||
|
||||
// Scorm types
|
||||
$options = array(SCORM_TYPE_LOCAL => get_string('typelocal', 'scorm'));
|
||||
$scormtypes = array(SCORM_TYPE_LOCAL => get_string('typelocal', 'scorm'));
|
||||
|
||||
if ($cfg_scorm->allowtypeexternal) {
|
||||
$options[SCORM_TYPE_EXTERNAL] = get_string('typeexternal', 'scorm');
|
||||
$scormtypes[SCORM_TYPE_EXTERNAL] = get_string('typeexternal', 'scorm');
|
||||
}
|
||||
|
||||
if ($cfg_scorm->allowtypelocalsync) {
|
||||
$options[SCORM_TYPE_LOCALSYNC] = get_string('typelocalsync', 'scorm');
|
||||
$scormtypes[SCORM_TYPE_LOCALSYNC] = get_string('typelocalsync', 'scorm');
|
||||
}
|
||||
|
||||
if (!empty($CFG->repositoryactivate) and $cfg_scorm->allowtypeimsrepository) {
|
||||
$options[SCORM_TYPE_IMSREPOSITORY] = get_string('typeimsrepository', 'scorm');
|
||||
$scormtypes[SCORM_TYPE_IMSREPOSITORY] = get_string('typeimsrepository', 'scorm');
|
||||
}
|
||||
|
||||
if ($cfg_scorm->allowtypeexternalaicc) {
|
||||
$options[SCORM_TYPE_AICCURL] = get_string('typeaiccurl', 'scorm');
|
||||
$scormtypes[SCORM_TYPE_AICCURL] = get_string('typeaiccurl', 'scorm');
|
||||
}
|
||||
|
||||
// Reference
|
||||
if (count($options) > 1) {
|
||||
$mform->addElement('select', 'scormtype', get_string('scormtype', 'scorm'), $options);
|
||||
if (count($scormtypes) > 1) {
|
||||
$mform->addElement('select', 'scormtype', get_string('scormtype', 'scorm'), $scormtypes);
|
||||
$mform->addHelpButton('scormtype', 'scormtype', 'scorm');
|
||||
$mform->addElement('text', 'packageurl', get_string('packageurl', 'scorm'), array('size'=>60));
|
||||
$mform->setType('packageurl', PARAM_RAW);
|
||||
@ -237,11 +237,16 @@ class mod_scorm_mod_form extends moodleform_mod {
|
||||
$mform->setDefault('auto', $cfg_scorm->auto);
|
||||
$mform->setAdvanced('auto', $cfg_scorm->auto_adv);
|
||||
|
||||
// Update packages timing
|
||||
$mform->addElement('select', 'updatefreq', get_string('updatefreq', 'scorm'), scorm_get_updatefreq_array());
|
||||
$mform->setDefault('updatefreq', $cfg_scorm->updatefreq);
|
||||
$mform->setAdvanced('updatefreq', $cfg_scorm->updatefreq_adv);
|
||||
|
||||
if (count($scormtypes) > 1) {
|
||||
// Update packages timing
|
||||
$mform->addElement('select', 'updatefreq', get_string('updatefreq', 'scorm'), scorm_get_updatefreq_array());
|
||||
$mform->setDefault('updatefreq', $cfg_scorm->updatefreq);
|
||||
$mform->setAdvanced('updatefreq', $cfg_scorm->updatefreq_adv);
|
||||
$mform->addHelpButton('updatefreq', 'updatefreq', 'scorm');
|
||||
$mform->disabledIf('updatefreq', 'scormtype', 'eq', SCORM_TYPE_LOCAL);
|
||||
} else {
|
||||
$mform->addElement('hidden', 'updatefreq', 0);
|
||||
}
|
||||
//-------------------------------------------------------------------------------
|
||||
// Hidden Settings
|
||||
$mform->addElement('hidden', 'datadir', null);
|
||||
|
Loading…
x
Reference in New Issue
Block a user