SCORM MDL-30146 AICC - add ability to link direct to a simple AICC url

This commit is contained in:
Dan Marsden 2011-11-05 21:51:24 +13:00
parent ba0e91a281
commit 4388bd45b2
6 changed files with 79 additions and 8 deletions

View file

@ -62,6 +62,10 @@ class mod_scorm_mod_form extends moodleform_mod {
$options[SCORM_TYPE_IMSREPOSITORY] = get_string('typeimsrepository', 'scorm');
}
if ($cfg_scorm->allowtypeexternalaicc) {
$options[SCORM_TYPE_AICCURL] = get_string('typeaiccurl', 'scorm');
}
// Reference
if (count($options) > 1) {
$mform->addElement('select', 'scormtype', get_string('scormtype', 'scorm'), $options);
@ -360,19 +364,24 @@ class mod_scorm_mod_form extends moodleform_mod {
} else if ($type === SCORM_TYPE_EXTERNAL) {
$reference = $data['packageurl'];
if (!preg_match('/(http:\/\/|https:\/\/|www).*\/imsmanifest.xml$/i', $reference)) {
$errors['packageurl'] = get_string('required'); // TODO: improve help
$errors['packageurl'] = get_string('invalidurl', 'scorm');
}
} else if ($type === 'packageurl') {
$reference = $data['reference'];
if (!preg_match('/(http:\/\/|https:\/\/|www).*(\.zip|\.pif)$/i', $reference)) {
$errors['packageurl'] = get_string('required'); // TODO: improve help
$errors['packageurl'] = get_string('invalidurl', 'scorm');
}
} else if ($type === SCORM_TYPE_IMSREPOSITORY) {
$reference = $data['packageurl'];
if (stripos($reference, '#') !== 0) {
$errors['packageurl'] = get_string('required');
$errors['packageurl'] = get_string('invalidurl', 'scorm');
}
} else if ($type === SCORM_TYPE_AICCURL) {
$reference = $data['packageurl'];
if (!preg_match('/(http:\/\/|https:\/\/|www).*/', $reference)) {
$errors['packageurl'] = get_string('invalidurl', 'scorm');
}
}