Skip to content
Browse files

MDL-42588 mod_scorm: display activity name

Added option to display or hide activity name on SCORM player. Added default admin setting and amended generator accordingly.
  • Loading branch information...
2 parents 9b8555f + 74ecabb commit 74d2a9df6d1a17772ec3949b99c20a31b41aaa9f Jetha Chan committed Mar 25, 2014
View
3 mod/scorm/backup/moodle2/backup_scorm_stepslib.php
@@ -45,7 +45,8 @@ protected function define_structure() {
'skipview', 'hidebrowse', 'hidetoc', 'nav', 'navpositionleft', 'navpositiontop',
'auto', 'popup', 'options', 'width',
'height', 'timeopen', 'timeclose', 'timemodified',
- 'completionstatusrequired', 'completionscorerequired'));
+ 'completionstatusrequired', 'completionscorerequired',
+ 'displayactivityname'));
$scoes = new backup_nested_element('scoes');
View
3 mod/scorm/backup/moodle2/restore_scorm_stepslib.php
@@ -65,6 +65,9 @@ protected function process_scorm($data) {
$data->timeclose = $this->apply_date_offset($data->timeclose);
$data->timemodified = $this->apply_date_offset($data->timemodified);
+ if(!isset($data->displayactivityname))
+ $data->displayactivityname = true;
+
// insert the scorm record
$newitemid = $DB->insert_record('scorm', $data);
// immediately after inserting "activity" record, call this
View
3 mod/scorm/db/install.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="mod/scorm/db" VERSION="20130924" COMMENT="XMLDB file for Moodle mod/scorm"
+<XMLDB PATH="mod/scorm/db" VERSION="20140317" COMMENT="XMLDB file for Moodle mod/scorm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
@@ -44,6 +44,7 @@
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="completionstatusrequired" TYPE="int" LENGTH="1" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="completionscorerequired" TYPE="int" LENGTH="2" NOTNULL="false" SEQUENCE="false"/>
+ <FIELD NAME="displayactivityname" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
View
24 mod/scorm/db/upgrade.php
@@ -251,6 +251,30 @@ function xmldb_scorm_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2014021700, 'scorm');
}
+
+ if ($oldversion < 2014031700) {
+ // Define field displayactivityname to be added to scorm.
+ $table = new xmldb_table('scorm');
+ $field = new xmldb_field(
+ 'displayactivityname',
+ XMLDB_TYPE_INTEGER,
+ '4',
+ null,
+ XMLDB_NOTNULL,
+ null,
+ '1',
+ 'completionscorerequired'
+ );
+
+ // Conditionally launch add field displayactivityname.
+ if (!$dbman->field_exists($table, $field)) {
+ $dbman->add_field($table, $field);
+ }
+
+ // Scorm savepoint reached.
+ upgrade_mod_savepoint(true, 2014031700, 'scorm');
+ }
+
return true;
}
View
2 mod/scorm/lang/en/scorm.php
@@ -94,6 +94,8 @@
$string['directories'] = 'Show the directory links';
$string['disabled'] = 'Disabled';
$string['display'] = 'Display package';
+$string['displayactivityname'] = 'Display activity name';
+$string['displayactivityname_help'] = 'Whether or not to display the activity name above the SCORM player.';
$string['displayattemptstatus'] = 'Display attempt status';
$string['displayattemptstatus_help'] = 'This preference allows a summary of the users attempts to show in the course overview block in My home and/or the SCORM entry page.';
$string['displayattemptstatusdesc'] = 'Whether a summary of the user\'s attempts is shown in the course overview block in My home and/or the SCORM entry page.';
View
6 mod/scorm/mod_form.php
@@ -130,6 +130,11 @@ public function definition() {
$mform->disabledIf('winoptgrp', 'popup', 'eq', 0);
$mform->setAdvanced('winoptgrp', $cfgscorm->winoptgrp_adv);
+ // Display activity name.
+ $mform->addElement('advcheckbox', 'displayactivityname', get_string('displayactivityname', 'scorm'));
+ $mform->addHelpButton('displayactivityname', 'displayactivityname', 'scorm');
+ $mform->setDefault('displayactivityname', $cfgscorm->displayactivityname);
+
// Skip view page.
$skipviewoptions = scorm_get_skip_view_array();
if ($COURSE->format == 'singleactivity') { // Remove option that would cause a constant redirect.
@@ -337,7 +342,6 @@ public function data_preprocessing(&$defaultvalues) {
if (!isset($defaultvalues['completionscorerequired']) || !strlen($defaultvalues['completionscorerequired'])) {
$defaultvalues['completionscoredisabled'] = 1;
}
-
}
public function validation($data, $files) {
View
4 mod/scorm/player.php
@@ -166,7 +166,9 @@
$PAGE->requires->js('/mod/scorm/request.js', true);
$PAGE->requires->js('/lib/cookies.js', true);
echo $OUTPUT->header();
-echo $OUTPUT->heading(format_string($scorm->name));
+if (!empty($scorm->displayactivityname)) {
+ echo $OUTPUT->heading(format_string($scorm->name));
+}
$PAGE->requires->string_for_js('navigation', 'scorm');
$PAGE->requires->string_for_js('toc', 'scorm');
View
3 mod/scorm/settings.php
@@ -32,6 +32,9 @@
get_string('display', 'scorm'), get_string('displaydesc', 'scorm'),
array('value' => 0, 'adv' => false), scorm_get_popup_display_array()));
+ $settings->add(new admin_setting_configcheckbox('scorm/displayactivityname',
+ get_string('displayactivityname', 'scorm'), get_string('displayactivityname_help', 'scorm'), 1));
+
$settings->add(new admin_setting_configtext_with_advanced('scorm/framewidth',
get_string('width', 'scorm'), get_string('framewidth', 'scorm'),
array('value' => '100', 'adv' => true)));
View
3 mod/scorm/tests/generator/lib.php
@@ -68,7 +68,8 @@ public function create_instance($record = null, array $options = null) {
'forcenewattempt' => $cfgscorm->forcenewattempt,
'lastattemptlock' => $cfgscorm->lastattemptlock,
'forcecompleted' => $cfgscorm->forcecompleted,
- 'auto' => $cfgscorm->auto
+ 'auto' => $cfgscorm->auto,
+ 'displayactivityname' => $cfgscorm->displayactivityname
);
// The 'packagefile' value corresponds to the draft file area ID. If not specified, create from packagefilepath.
View
8 mod/scorm/version.php
@@ -24,7 +24,7 @@
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2014021701; // The current module version (Date: YYYYMMDDXX)
-$plugin->requires = 2013110500; // Requires this Moodle version
-$plugin->component = 'mod_scorm'; // Full name of the plugin (used for diagnostics)
-$plugin->cron = 300;
+$module->version = 2014032500; // The current module version (Date: YYYYMMDDXX).
+$module->requires = 2013110500; // Requires this Moodle version.
+$module->component = 'mod_scorm'; // Full name of the plugin (used for diagnostics).
+$module->cron = 300;

0 comments on commit 74d2a9d

Please sign in to comment.
Something went wrong with that request. Please try again.