diff --git a/.github/workflows/moodle-ci.yml b/.github/workflows/moodle-ci.yml
index 77c374f..50f8c92 100644
--- a/.github/workflows/moodle-ci.yml
+++ b/.github/workflows/moodle-ci.yml
@@ -30,7 +30,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- php: ['8.1', '8.3']
+ php: ['7.4', '8.1', '8.3']
moodle-branch: ['MOODLE_401_STABLE', 'MOODLE_404_STABLE']
database: [pgsql, mariadb]
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 5567af6..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,10 +0,0 @@
-.aider*
-.env
-
-# mess detector rules
-phpmd-rules.xml
-
-# Composer ignores
-/vendor/
-/composer.lock
-/composer.phar
\ No newline at end of file
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 2f04b89..0000000
--- a/Makefile
+++ /dev/null
@@ -1,122 +0,0 @@
-# Makefile to facilitate the use of Docker in the exelearning-web project
-
-# Detect the operating system and shell environment
-ifeq ($(OS),Windows_NT)
- # Initially assume Windows shell
- SHELLTYPE := windows
- # Check if we are in Cygwin or MSYS (e.g., Git Bash)
- ifdef MSYSTEM
- SHELLTYPE := unix
- else ifdef CYGWIN
- SHELLTYPE := unix
- endif
-else
- SHELLTYPE := unix
-endif
-
-# Check if Docker is running
-# This target verifies if Docker is installed and running on the system.
-check-docker:
-ifeq ($(SHELLTYPE),windows)
- @echo "Detected system: Windows (cmd, powershell)"
- @docker version > NUL 2>&1 || (echo. & echo Error: Docker is not running. Please make sure Docker is installed and running. & echo. & exit 1)
-else
- @echo "Detected system: Unix (Linux/macOS/Cygwin/MinGW)"
- @docker version > /dev/null 2>&1 || (echo "" && echo "Error: Docker is not running. Please make sure Docker is installed and running." && echo "" && exit 1)
-endif
-
-# Check if the .env file exists, if not, copy from .env.dist
-# This target ensures that the .env file is present by copying it from .env.dist if it doesn't exist.
-check-env:
-ifeq ($(SHELLTYPE),windows)
- @if not exist .env ( \
- echo The .env file does not exist. Copying from .env.dist... && \
- copy .env.dist .env \
- ) 2>nul
-else
- @if [ ! -f .env ]; then \
- echo "The .env file does not exist. Copying from .env.dist..."; \
- cp .env.dist .env; \
- fi
-endif
-
-# Start Docker containers in interactive mode
-# This target builds and starts the Docker containers, allowing interaction with the terminal.
-up: check-docker
- docker compose up --build
-
-# Start Docker containers in background mode (daemon)
-# This target builds and starts the Docker containers in the background.
-upd: check-docker
- docker compose up -d
-
-# Stop and remove Docker containers
-# This target stops and removes all running Docker containers.
-down: check-docker
- docker compose down
-
-# Pull the latest images from the registry
-# This target pulls the latest Docker images from the registry.
-pull: check-docker
- docker compose -f docker-compose.yml pull
-
-# Build or rebuild Docker containers
-# This target builds or rebuilds the Docker containers.
-build: check-docker
- docker compose build
-
-# Open a shell inside the moodle container
-# This target opens an interactive shell session inside the running Moodle container.
-shell: check-docker
- docker compose exec moodle sh
-
-# Clean up and stop Docker containers, removing volumes and orphan containers
-# This target stops all containers and removes them along with their volumes and any orphan containers.
-clean: check-docker
- docker compose down -v --remove-orphans
-
-# Install PHP dependencies using Composer
-install-deps:
- COMPOSER_ALLOW_SUPERUSER=1 composer install --no-interaction --prefer-dist --optimize-autoloader --no-progress
-
-# Run code linting using Composer
-lint:
- composer lint
-
-# Automatically fix code style issues using Composer
-fix:
- composer fix
-
-# Run tests using Composer
-test:
- composer test
-
-# Run PHP Mess Detector using Composer
-phpmd:
- composer phpmd
-
-# Run Behat tests using Composer
-behat:
- composer behat
-# Display help with available commands
-# This target lists all available Makefile commands with a brief description.
-help:
- @echo "Available commands:"
- @echo " up - Start Docker containers in interactive mode"
- @echo " upd - Start Docker containers in background mode (daemon)"
- @echo " down - Stop and remove Docker containers"
- @echo " build - Build or rebuild Docker containers"
- @echo " pull - Pull the latest images from the registry"
- @echo " clean - Clean up and stop Docker containers, removing volumes and orphan containers"
- @echo " shell - Open a shell inside the exelearning-web container"
- @echo " install-deps - Install PHP dependencies using Composer"
- @echo " lint - Run code linting using Composer"
- @echo " fix - Automatically fix code style issues using Composer"
- @echo " test - Run tests using Composer"
- @echo " phpmd - Run PHP Mess Detector using Composer"
- @echo " behat - Run Behat tests using Composer"
- @echo " help - Display this help with available commands"
-
-
-# Set help as the default goal if no target is specified
-.DEFAULT_GOAL := help
diff --git a/aicc.php b/aicc.php
index cd87a1d..1764637 100644
--- a/aicc.php
+++ b/aicc.php
@@ -39,7 +39,7 @@
$cfgexescorm = get_config('exescorm');
-$url = new moodle_url('/mod/exescorm/aicc.php', ['command' => $command, 'session_id' => $sessionid]);
+$url = new moodle_url('/mod/exescorm/aicc.php', array('command' => $command, 'session_id' => $sessionid));
if ($aiccdata !== 0) {
$url->param('aicc_data', $aiccdata);
}
@@ -57,7 +57,7 @@
if (empty($exescormsession)) {
throw new \moodle_exception('invalidhacpsession', 'exescorm');
}
- $aiccuser = $DB->get_record('user', ['id' => $exescormsession->userid], 'id,username,lastname,firstname', MUST_EXIST);
+ $aiccuser = $DB->get_record('user', array('id' => $exescormsession->userid), 'id,username,lastname,firstname', MUST_EXIST);
}
if (!empty($command)) {
@@ -83,7 +83,7 @@
}
if ($sco = exescorm_get_sco($scoid, EXESCORM_SCO_ONLY)) {
- if (!$exescorm = $DB->get_record('exescorm', ['id' => $sco->exescorm])) {
+ if (!$exescorm = $DB->get_record('exescorm', array('id' => $sco->exescorm))) {
throw new \moodle_exception('cannotcallscript');
}
} else {
@@ -99,7 +99,7 @@
exescorm_debug_log_write("aicc", "HACP Request:\r\n$aiccrequest", $scoid);
ob_start();
- if ($exescorm = $DB->get_record('exescorm', ['id' => $sco->exescorm])) {
+ if ($exescorm = $DB->get_record('exescorm', array('id' => $sco->exescorm))) {
switch ($command) {
case 'getparam':
if ($status == 'Not Initialized') {
@@ -233,7 +233,7 @@
$attempt, $element, $value);
break;
case 'cmi.core.lesson_status':
- $statuses = [
+ $statuses = array(
'passed' => 'passed',
'completed' => 'completed',
'failed' => 'failed',
@@ -245,16 +245,16 @@
'f' => 'failed',
'i' => 'incomplete',
'b' => 'browsed',
- 'n' => 'not attempted',
- ];
- $exites = [
+ 'n' => 'not attempted'
+ );
+ $exites = array(
'logout' => 'logout',
'time-out' => 'time-out',
'suspend' => 'suspend',
'l' => 'logout',
't' => 'time-out',
's' => 'suspend',
- ];
+ );
$values = explode(',', $value);
$value = '';
if (count($values) > 1) {
@@ -402,11 +402,11 @@
case 'exitau':
if ($status == 'Running') {
if (isset($exescormsession->sessiontime) && ($exescormsession->sessiontime != '')) {
- if ($track = $DB->get_record('exescorm_scoes_track', ["userid" => $aiccuser->id,
+ if ($track = $DB->get_record('exescorm_scoes_track', array("userid" => $aiccuser->id,
"exescormid" => $exescorm->id,
"scoid" => $sco->id,
"attempt" => $attempt,
- "element" => 'cmi.core.total_time'])) {
+ "element" => 'cmi.core.total_time'))) {
// Add session_time to total_time.
$value = exescorm_add_time($track->value, $exescormsession->sessiontime);
$track->value = $value;
diff --git a/amd/src/fullscreen.js b/amd/src/fullscreen.js
index e5dc731..b5d3c21 100644
--- a/amd/src/fullscreen.js
+++ b/amd/src/fullscreen.js
@@ -29,7 +29,6 @@ define([
'core/templates'
], function($, Str, Ajax, Templates) {
"use strict";
- /* eslint-disable no-console */
/**
* @constructor
*/
diff --git a/backup/moodle2/backup_exescorm_stepslib.php b/backup/moodle2/backup_exescorm_stepslib.php
index d6f1a6f..d7cff6d 100644
--- a/backup/moodle2/backup_exescorm_stepslib.php
+++ b/backup/moodle2/backup_exescorm_stepslib.php
@@ -36,7 +36,7 @@ protected function define_structure() {
$userinfo = $this->get_setting_value('userinfo');
// Define each element separated.
- $exescorm = new backup_nested_element('exescorm', ['id'], [
+ $exescorm = new backup_nested_element('exescorm', array('id'), array(
'name', 'exescormtype', 'reference', 'intro',
'introformat', 'version', 'maxgrade', 'grademethod',
'whatgrade', 'maxattempt', 'forcecompleted', 'forcenewattempt',
@@ -47,56 +47,56 @@ protected function define_structure() {
'height', 'timeopen', 'timeclose', 'timemodified',
'completionstatusrequired', 'completionscorerequired',
'completionstatusallscos',
- 'autocommit']);
+ 'autocommit'));
$scoes = new backup_nested_element('scoes');
- $sco = new backup_nested_element('sco', ['id'], [
+ $sco = new backup_nested_element('sco', array('id'), array(
'manifest', 'organization', 'parent', 'identifier',
- 'launch', 'exescormtype', 'title', 'sortorder']);
+ 'launch', 'exescormtype', 'title', 'sortorder'));
$scodatas = new backup_nested_element('sco_datas');
- $scodata = new backup_nested_element('sco_data', ['id'], [
- 'name', 'value']);
+ $scodata = new backup_nested_element('sco_data', array('id'), array(
+ 'name', 'value'));
$seqruleconds = new backup_nested_element('seq_ruleconds');
- $seqrulecond = new backup_nested_element('seq_rulecond', ['id'], [
- 'conditioncombination', 'ruletype', 'action']);
+ $seqrulecond = new backup_nested_element('seq_rulecond', array('id'), array(
+ 'conditioncombination', 'ruletype', 'action'));
$seqrulecondsdatas = new backup_nested_element('seq_rulecond_datas');
- $seqrulecondsdata = new backup_nested_element('seq_rulecond_data', ['id'], [
- 'refrencedobjective', 'measurethreshold', 'operator', 'cond']);
+ $seqrulecondsdata = new backup_nested_element('seq_rulecond_data', array('id'), array(
+ 'refrencedobjective', 'measurethreshold', 'operator', 'cond'));
$seqrolluprules = new backup_nested_element('seq_rolluprules');
- $seqrolluprule = new backup_nested_element('seq_rolluprule', ['id'], [
+ $seqrolluprule = new backup_nested_element('seq_rolluprule', array('id'), array(
'childactivityset', 'minimumcount', 'minimumpercent', 'conditioncombination',
- 'action']);
+ 'action'));
$seqrollupruleconds = new backup_nested_element('seq_rllprlconds');
- $seqrolluprulecond = new backup_nested_element('seq_rllprlcond', ['id'], [
- 'cond', 'operator']);
+ $seqrolluprulecond = new backup_nested_element('seq_rllprlcond', array('id'), array(
+ 'cond', 'operator'));
$seqobjectives = new backup_nested_element('seq_objectives');
- $seqobjective = new backup_nested_element('seq_objective', ['id'], [
- 'primaryobj', 'objectiveid', 'satisfiedbymeasure', 'minnormalizedmeasure']);
+ $seqobjective = new backup_nested_element('seq_objective', array('id'), array(
+ 'primaryobj', 'objectiveid', 'satisfiedbymeasure', 'minnormalizedmeasure'));
$seqmapinfos = new backup_nested_element('seq_mapinfos');
- $seqmapinfo = new backup_nested_element('seq_mapinfo', ['id'], [
+ $seqmapinfo = new backup_nested_element('seq_mapinfo', array('id'), array(
'targetobjectiveid', 'readsatisfiedstatus', 'readnormalizedmeasure', 'writesatisfiedstatus',
- 'writenormalizedmeasure']);
+ 'writenormalizedmeasure'));
$scotracks = new backup_nested_element('sco_tracks');
- $scotrack = new backup_nested_element('sco_track', ['id'], [
+ $scotrack = new backup_nested_element('sco_track', array('id'), array(
'userid', 'attempt', 'element', 'value',
- 'timemodified']);
+ 'timemodified'));
// Build the tree.
$exescorm->add_child($scoes);
@@ -127,24 +127,24 @@ protected function define_structure() {
$scotracks->add_child($scotrack);
// Define sources.
- $exescorm->set_source_table('exescorm', ['id' => backup::VAR_ACTIVITYID]);
+ $exescorm->set_source_table('exescorm', array('id' => backup::VAR_ACTIVITYID));
// Order is important for several EXESCORM calls (especially exescorm_scoes)
// in the following calls to set_source_table.
- $sco->set_source_table('exescorm_scoes', ['exescorm' => backup::VAR_PARENTID], 'sortorder, id');
- $scodata->set_source_table('exescorm_scoes_data', ['scoid' => backup::VAR_PARENTID], 'id ASC');
- $seqrulecond->set_source_table('exescorm_seq_ruleconds', ['scoid' => backup::VAR_PARENTID], 'id ASC');
+ $sco->set_source_table('exescorm_scoes', array('exescorm' => backup::VAR_PARENTID), 'sortorder, id');
+ $scodata->set_source_table('exescorm_scoes_data', array('scoid' => backup::VAR_PARENTID), 'id ASC');
+ $seqrulecond->set_source_table('exescorm_seq_ruleconds', array('scoid' => backup::VAR_PARENTID), 'id ASC');
$seqrulecondsdata->set_source_table(
- 'exescorm_seq_rulecond', ['ruleconditionsid' => backup::VAR_PARENTID], 'id ASC'
+ 'exescorm_seq_rulecond', array('ruleconditionsid' => backup::VAR_PARENTID), 'id ASC'
);
- $seqrolluprule->set_source_table('exescorm_seq_rolluprule', ['scoid' => backup::VAR_PARENTID], 'id ASC');
- $seqrolluprulecond->set_source_table('exescorm_seq_rllprlcond', ['rollupruleid' => backup::VAR_PARENTID], 'id ASC');
- $seqobjective->set_source_table('exescorm_seq_objective', ['scoid' => backup::VAR_PARENTID], 'id ASC');
- $seqmapinfo->set_source_table('exescorm_seq_mapinfo', ['objectiveid' => backup::VAR_PARENTID], 'id ASC');
+ $seqrolluprule->set_source_table('exescorm_seq_rolluprule', array('scoid' => backup::VAR_PARENTID), 'id ASC');
+ $seqrolluprulecond->set_source_table('exescorm_seq_rllprlcond', array('rollupruleid' => backup::VAR_PARENTID), 'id ASC');
+ $seqobjective->set_source_table('exescorm_seq_objective', array('scoid' => backup::VAR_PARENTID), 'id ASC');
+ $seqmapinfo->set_source_table('exescorm_seq_mapinfo', array('objectiveid' => backup::VAR_PARENTID), 'id ASC');
// All the rest of elements only happen if we are including user info.
if ($userinfo) {
- $scotrack->set_source_table('exescorm_scoes_track', ['scoid' => backup::VAR_PARENTID], 'id ASC');
+ $scotrack->set_source_table('exescorm_scoes_track', array('scoid' => backup::VAR_PARENTID), 'id ASC');
}
// Define id annotations.
diff --git a/backup/moodle2/restore_exescorm_activity_task.class.php b/backup/moodle2/restore_exescorm_activity_task.class.php
index 9f9a552..cd977e1 100644
--- a/backup/moodle2/restore_exescorm_activity_task.class.php
+++ b/backup/moodle2/restore_exescorm_activity_task.class.php
@@ -51,9 +51,9 @@ protected function define_my_steps() {
* processed by the link decoder.
*/
public static function define_decode_contents() {
- $contents = [];
+ $contents = array();
- $contents[] = new restore_decode_content('exescorm', ['intro'], 'exescorm');
+ $contents[] = new restore_decode_content('exescorm', array('intro'), 'exescorm');
return $contents;
}
@@ -63,7 +63,7 @@ public static function define_decode_contents() {
* to the activity to be executed by the link decoder.
*/
public static function define_decode_rules() {
- $rules = [];
+ $rules = array();
$rules[] = new restore_decode_rule('EXESCORMVIEWBYID', '/mod/exescorm/view.php?id=$1', 'course_module');
$rules[] = new restore_decode_rule('EXESCORMINDEX', '/mod/exescorm/index.php?id=$1', 'course');
@@ -74,12 +74,12 @@ public static function define_decode_rules() {
/**
* Define the restore log rules that will be applied
- * by the {@see \restore_logs_processor} when restoring
+ * by the {@link restore_logs_processor} when restoring
* exescorm logs. It must return one array
- * of {@see \restore_log_rule} objects.
+ * of {@link restore_log_rule} objects.
*/
public static function define_restore_log_rules() {
- $rules = [];
+ $rules = array();
$rules[] = new restore_log_rule('exescorm', 'add', 'view.php?id={course_module}', '{exescorm}');
$rules[] = new restore_log_rule('exescorm', 'update', 'view.php?id={course_module}', '{exescorm}');
@@ -98,16 +98,16 @@ public static function define_restore_log_rules() {
/**
* Define the restore log rules that will be applied
- * by the {@see \restore_logs_processor} when restoring
+ * by the {@link restore_logs_processor} when restoring
* course logs. It must return one array
- * of {@see \restore_log_rule} objects.
+ * of {@link restore_log_rule} objects.
*
* Note this rules are applied when restoring course logs
* by the restore final task, but are defined here at
* activity level. All them are rules not linked to any module instance (cmid = 0).
*/
public static function define_restore_log_rules_for_course() {
- $rules = [];
+ $rules = array();
$rules[] = new restore_log_rule('exescorm', 'view all', 'index.php?id={course}', null);
diff --git a/backup/moodle2/restore_exescorm_stepslib.php b/backup/moodle2/restore_exescorm_stepslib.php
index bc85387..694e288 100644
--- a/backup/moodle2/restore_exescorm_stepslib.php
+++ b/backup/moodle2/restore_exescorm_stepslib.php
@@ -32,7 +32,7 @@ class restore_exescorm_activity_structure_step extends restore_activity_structur
protected function define_structure() {
- $paths = [];
+ $paths = array();
$userinfo = $this->get_setting_value('userinfo');
$paths[] = new restore_path_element('exescorm', '/activity/exescorm');
@@ -208,12 +208,12 @@ protected function after_execute() {
// Fix launch param in exescorm table to use new sco id.
$exescormid = $this->get_new_parentid('exescorm');
- $exescorm = $DB->get_record('exescorm', ['id' => $exescormid]);
+ $exescorm = $DB->get_record('exescorm', array('id' => $exescormid));
$exescorm->launch = $this->get_mappingid('exescorm_sco', $exescorm->launch, '');
if (!empty($exescorm->launch)) {
// Check that this sco has a valid launch value.
- $scolaunch = $DB->get_field('exescorm_scoes', 'launch', ['id' => $exescorm->launch]);
+ $scolaunch = $DB->get_field('exescorm_scoes', 'launch', array('id' => $exescorm->launch));
if (empty($scolaunch)) {
// This is not a valid sco - set to empty so we can find a valid launch sco.
$exescorm->launch = '';
@@ -224,7 +224,7 @@ protected function after_execute() {
// This exescorm has an invalid launch param - we need to calculate it and get the first launchable sco.
$sqlselect = 'exescorm = ? AND '.$DB->sql_isnotempty('exescorm_scoes', 'launch', false, true);
// We use get_records here as we need to pass a limit in the query that works cross db.
- $scoes = $DB->get_records_select('exescorm_scoes', $sqlselect, [$exescormid], 'sortorder', 'id', 0, 1);
+ $scoes = $DB->get_records_select('exescorm_scoes', $sqlselect, array($exescormid), 'sortorder', 'id', 0, 1);
if (!empty($scoes)) {
$sco = reset($scoes); // We only care about the first record - the above query only returns one.
$exescorm->launch = $sco->id;
diff --git a/classes/analytics/indicator/activity_base.php b/classes/analytics/indicator/activity_base.php
index 2c059b7..bd1c2c7 100644
--- a/classes/analytics/indicator/activity_base.php
+++ b/classes/analytics/indicator/activity_base.php
@@ -40,7 +40,7 @@ abstract class activity_base extends \core_analytics\local\indicator\community_o
*/
protected function feedback_viewed_events() {
// Any view after the data graded counts as feedback viewed.
- return ['\mod_exescorm\event\course_module_viewed'];
+ return array('\mod_exescorm\event\course_module_viewed');
}
/**
diff --git a/classes/analytics/indicator/cognitive_depth.php b/classes/analytics/indicator/cognitive_depth.php
index a5db612..968a485 100644
--- a/classes/analytics/indicator/cognitive_depth.php
+++ b/classes/analytics/indicator/cognitive_depth.php
@@ -40,7 +40,7 @@ class cognitive_depth extends activity_base {
*
* @return \lang_string
*/
- public static function get_name(): \lang_string {
+ public static function get_name() : \lang_string {
return new \lang_string('indicator:cognitivedepth', 'mod_exescorm');
}
diff --git a/classes/analytics/indicator/social_breadth.php b/classes/analytics/indicator/social_breadth.php
index 54d8672..19f9e7d 100644
--- a/classes/analytics/indicator/social_breadth.php
+++ b/classes/analytics/indicator/social_breadth.php
@@ -40,7 +40,7 @@ class social_breadth extends activity_base {
*
* @return \lang_string
*/
- public static function get_name(): \lang_string {
+ public static function get_name() : \lang_string {
return new \lang_string('indicator:socialbreadth', 'mod_exescorm');
}
diff --git a/classes/event/attempt_deleted.php b/classes/event/attempt_deleted.php
index 5e8ebd2..e225d3c 100644
--- a/classes/event/attempt_deleted.php
+++ b/classes/event/attempt_deleted.php
@@ -73,7 +73,7 @@ public static function get_name() {
* @return \moodle_url
*/
public function get_url() {
- return new \moodle_url('/mod/exescorm/report.php', ['id' => $this->contextinstanceid]);
+ return new \moodle_url('/mod/exescorm/report.php', array('id' => $this->contextinstanceid));
}
/**
@@ -82,8 +82,8 @@ public function get_url() {
* @return array of parameters to be passed to legacy add_to_log() function.
*/
protected function get_legacy_logdata() {
- return [$this->courseid, 'exescorm', 'delete attempts', 'report.php?id=' . $this->contextinstanceid,
- $this->other['attemptid'], $this->contextinstanceid];
+ return array($this->courseid, 'exescorm', 'delete attempts', 'report.php?id=' . $this->contextinstanceid,
+ $this->other['attemptid'], $this->contextinstanceid);
}
/**
diff --git a/classes/event/cmielement_submitted.php b/classes/event/cmielement_submitted.php
index 227c403..248ddd0 100644
--- a/classes/event/cmielement_submitted.php
+++ b/classes/event/cmielement_submitted.php
@@ -70,7 +70,7 @@ public function get_description() {
*/
public function get_url() {
return new \moodle_url('/mod/exescorm/report/userreport.php',
- ['id' => $this->contextinstanceid, 'user' => $this->userid, 'attempt' => $this->other['attemptid']]);
+ array('id' => $this->contextinstanceid, 'user' => $this->userid, 'attempt' => $this->other['attemptid']));
}
/**
diff --git a/classes/event/course_module_viewed.php b/classes/event/course_module_viewed.php
index b0e52df..0411c3b 100644
--- a/classes/event/course_module_viewed.php
+++ b/classes/event/course_module_viewed.php
@@ -49,12 +49,12 @@ protected function init() {
* @return array of parameters to be passed to legacy add_to_log() function.
*/
protected function get_legacy_logdata() {
- return [$this->courseid, 'exescorm', 'pre-view', 'view.php?id=' . $this->contextinstanceid, $this->objectid,
- $this->contextinstanceid];
+ return array($this->courseid, 'exescorm', 'pre-view', 'view.php?id=' . $this->contextinstanceid, $this->objectid,
+ $this->contextinstanceid);
}
public static function get_objectid_mapping() {
- return ['db' => 'exescorm', 'restore' => 'exescorm'];
+ return array('db' => 'exescorm', 'restore' => 'exescorm');
}
}
diff --git a/classes/event/interactions_viewed.php b/classes/event/interactions_viewed.php
index b95738b..82ca7fb 100644
--- a/classes/event/interactions_viewed.php
+++ b/classes/event/interactions_viewed.php
@@ -74,11 +74,11 @@ public static function get_name() {
* @return \moodle_url
*/
public function get_url() {
- $params = [
+ $params = array(
'id' => $this->contextinstanceid,
'user' => $this->relateduserid,
- 'attempt' => $this->other['attemptid'],
- ];
+ 'attempt' => $this->other['attemptid']
+ );
return new \moodle_url('/mod/exescorm/userreportinteractions.php', $params);
}
@@ -88,9 +88,9 @@ public function get_url() {
* @return array
*/
protected function get_legacy_logdata() {
- return [$this->courseid, 'exescorm', 'userreportinteractions', 'report/userreportinteractions.php?id=' .
+ return array($this->courseid, 'exescorm', 'userreportinteractions', 'report/userreportinteractions.php?id=' .
$this->contextinstanceid . '&user=' . $this->relateduserid . '&attempt=' . $this->other['attemptid'],
- $this->other['instanceid'], $this->contextinstanceid];
+ $this->other['instanceid'], $this->contextinstanceid);
}
/**
@@ -116,8 +116,8 @@ protected function validate_data() {
}
public static function get_other_mapping() {
- $othermapped = [];
- $othermapped['instanceid'] = ['db' => 'exescorm', 'restore' => 'exescorm'];
+ $othermapped = array();
+ $othermapped['instanceid'] = array('db' => 'exescorm', 'restore' => 'exescorm');
return $othermapped;
}
diff --git a/classes/event/report_viewed.php b/classes/event/report_viewed.php
index f4bffc2..0cff4de 100644
--- a/classes/event/report_viewed.php
+++ b/classes/event/report_viewed.php
@@ -74,7 +74,7 @@ public static function get_name() {
* @return \moodle_url
*/
public function get_url() {
- return new \moodle_url('/mod/exescorm/report.php', ['id' => $this->contextinstanceid, 'mode' => $this->other['mode'] ]);
+ return new \moodle_url('/mod/exescorm/report.php', ['id' => $this->contextinstanceid, 'mode' => $this->other['mode'], ]);
}
/**
@@ -83,8 +83,8 @@ public function get_url() {
* @return array of parameters to be passed to legacy add_to_log() function.
*/
protected function get_legacy_logdata() {
- return [$this->courseid, 'exescorm', 'report', 'report.php?id=' . $this->contextinstanceid .
- '&mode=' . $this->other['mode'], $this->other['exescormid'], $this->contextinstanceid];
+ return array($this->courseid, 'exescorm', 'report', 'report.php?id=' . $this->contextinstanceid .
+ '&mode=' . $this->other['mode'], $this->other['exescormid'], $this->contextinstanceid);
}
/**
@@ -106,8 +106,8 @@ protected function validate_data() {
}
public static function get_other_mapping() {
- $othermapped = [];
- $othermapped['exescormid'] = ['db' => 'exescorm', 'restore' => 'exescorm'];
+ $othermapped = array();
+ $othermapped['exescormid'] = array('db' => 'exescorm', 'restore' => 'exescorm');
return $othermapped;
}
diff --git a/classes/event/sco_launched.php b/classes/event/sco_launched.php
index 7c71fd3..049acbf 100644
--- a/classes/event/sco_launched.php
+++ b/classes/event/sco_launched.php
@@ -75,7 +75,7 @@ public static function get_name() {
* @return \moodle_url
*/
public function get_url() {
- return new \moodle_url('/mod/exescorm/player.php', ['cm' => $this->contextinstanceid, 'scoid' => $this->objectid]);
+ return new \moodle_url('/mod/exescorm/player.php', array('cm' => $this->contextinstanceid, 'scoid' => $this->objectid));
}
/**
@@ -84,8 +84,8 @@ public function get_url() {
* @return array of parameters to be passed to legacy add_to_log() function.
*/
protected function get_legacy_logdata() {
- return [$this->courseid, 'exescorm', 'launch', 'view.php?id=' . $this->contextinstanceid,
- $this->other['loadedcontent'], $this->contextinstanceid];
+ return array($this->courseid, 'exescorm', 'launch', 'view.php?id=' . $this->contextinstanceid,
+ $this->other['loadedcontent'], $this->contextinstanceid);
}
/**
@@ -103,12 +103,12 @@ protected function validate_data() {
}
public static function get_objectid_mapping() {
- return ['db' => 'exescorm_scoes', 'restore' => 'exescorm_sco'];
+ return array('db' => 'exescorm_scoes', 'restore' => 'exescorm_sco');
}
public static function get_other_mapping() {
- $othermapped = [];
- $othermapped['instanceid'] = ['db' => 'exescorm', 'restore' => 'exescorm'];
+ $othermapped = array();
+ $othermapped['instanceid'] = array('db' => 'exescorm', 'restore' => 'exescorm');
return $othermapped;
}
diff --git a/classes/event/status_submitted.php b/classes/event/status_submitted.php
index cb93244..a9dc7c9 100644
--- a/classes/event/status_submitted.php
+++ b/classes/event/status_submitted.php
@@ -61,13 +61,13 @@ protected function validate_data() {
parent::validate_data();
if (!in_array($this->other['cmielement'],
- ['cmi.completion_status', 'cmi.core.lesson_status', 'cmi.success_status'])) {
+ array('cmi.completion_status', 'cmi.core.lesson_status', 'cmi.success_status'))) {
throw new \coding_exception(
"The 'cmielement' must represents a valid CMI status element ({$this->other['cmielement']}).");
}
if (!in_array($this->other['cmivalue'],
- ['passed', 'completed', 'failed', 'incomplete', 'browsed', 'not attempted', 'unknown'])) {
+ array('passed', 'completed', 'failed', 'incomplete', 'browsed', 'not attempted', 'unknown'))) {
throw new \coding_exception(
"The 'cmivalue' must represents a valid CMI status value ({$this->other['cmivalue']}).");
}
diff --git a/classes/event/tracks_viewed.php b/classes/event/tracks_viewed.php
index 67722fb..6939438 100644
--- a/classes/event/tracks_viewed.php
+++ b/classes/event/tracks_viewed.php
@@ -75,12 +75,12 @@ public static function get_name() {
* @return \moodle_url
*/
public function get_url() {
- $params = [
+ $params = array(
'id' => $this->contextinstanceid,
'user' => $this->relateduserid,
'attempt' => $this->other['attemptid'],
- 'scoid' => $this->other['scoid'],
- ];
+ 'scoid' => $this->other['scoid']
+ );
return new \moodle_url('/mod/exescorm/userreporttracks.php', $params);
}
@@ -93,7 +93,7 @@ protected function get_legacy_logdata() {
return [
$this->courseid, 'exescorm', 'userreporttracks', 'report/userreporttracks.php?id=' . $this->contextinstanceid
. '&user=' . $this->relateduserid . '&attempt=' . $this->other['attemptid'] . '&scoid=' . $this->other['scoid']
- . '&mode=' . $this->other['mode'], $this->other['instanceid'], $this->contextinstanceid,
+ . '&mode=' . $this->other['mode'], $this->other['instanceid'], $this->contextinstanceid
];
}
@@ -121,9 +121,9 @@ protected function validate_data() {
}
public static function get_other_mapping() {
- $othermapped = [];
- $othermapped['instanceid'] = ['db' => 'exescorm', 'restore' => 'exescorm'];
- $othermapped['scoid'] = ['db' => 'exescorm_scoes', 'restore' => 'exescorm_scoe'];
+ $othermapped = array();
+ $othermapped['instanceid'] = array('db' => 'exescorm', 'restore' => 'exescorm');
+ $othermapped['scoid'] = array('db' => 'exescorm_scoes', 'restore' => 'exescorm_scoe');
return $othermapped;
}
diff --git a/classes/event/user_report_viewed.php b/classes/event/user_report_viewed.php
index e9efa78..5c06259 100644
--- a/classes/event/user_report_viewed.php
+++ b/classes/event/user_report_viewed.php
@@ -73,11 +73,11 @@ public static function get_name() {
* @return \moodle_url
*/
public function get_url() {
- $params = [
+ $params = array(
'id' => $this->contextinstanceid,
'user' => $this->relateduserid,
- 'attempt' => $this->other['attemptid'],
- ];
+ 'attempt' => $this->other['attemptid']
+ );
return new \moodle_url('/mod/exescorm/userreport.php', $params);
}
@@ -87,9 +87,9 @@ public function get_url() {
* @return array
*/
protected function get_legacy_logdata() {
- return [$this->courseid, 'exescorm', 'userreport', 'report/userreport.php?id=' .
+ return array($this->courseid, 'exescorm', 'userreport', 'report/userreport.php?id=' .
$this->contextinstanceid . '&user=' . $this->relateduserid . '&attempt=' . $this->other['attemptid'],
- $this->other['instanceid'], $this->contextinstanceid];
+ $this->other['instanceid'], $this->contextinstanceid);
}
/**
@@ -113,8 +113,8 @@ protected function validate_data() {
}
public static function get_other_mapping() {
- $othermapped = [];
- $othermapped['instanceid'] = ['db' => 'exescorm', 'restore' => 'exescorm'];
+ $othermapped = array();
+ $othermapped['instanceid'] = array('db' => 'exescorm', 'restore' => 'exescorm');
return $othermapped;
}
diff --git a/classes/exeonline/exescorm_redirector.php b/classes/exeonline/exescorm_redirector.php
index 5dd3d0d..4afba48 100644
--- a/classes/exeonline/exescorm_redirector.php
+++ b/classes/exeonline/exescorm_redirector.php
@@ -27,7 +27,7 @@
namespace mod_exescorm\exeonline;
use mod_exescorm\exeonline\token_manager;
-use moodle_url;
+use \moodle_url;
class exescorm_redirector {
diff --git a/classes/external.php b/classes/external.php
index 3a6076d..13e956a 100644
--- a/classes/external.php
+++ b/classes/external.php
@@ -51,9 +51,9 @@ class mod_exescorm_external extends external_api {
*/
public static function view_exescorm_parameters() {
return new external_function_parameters(
- [
- 'exescormid' => new external_value(PARAM_INT, 'exescorm instance id'),
- ]
+ array(
+ 'exescormid' => new external_value(PARAM_INT, 'exescorm instance id')
+ )
);
}
@@ -70,13 +70,13 @@ public static function view_exescorm($exescormid) {
require_once($CFG->dirroot . '/mod/exescorm/lib.php');
$params = self::validate_parameters(self::view_exescorm_parameters(),
- [
- 'exescormid' => $exescormid,
- ]);
- $warnings = [];
+ array(
+ 'exescormid' => $exescormid
+ ));
+ $warnings = array();
// Request and permission validation.
- $exescorm = $DB->get_record('exescorm', ['id' => $params['exescormid']], '*', MUST_EXIST);
+ $exescorm = $DB->get_record('exescorm', array('id' => $params['exescormid']), '*', MUST_EXIST);
list($course, $cm) = get_course_and_cm_from_instance($exescorm, 'exescorm');
$context = context_module::instance($cm->id);
@@ -85,7 +85,7 @@ public static function view_exescorm($exescormid) {
// Call the exescorm/lib API.
exescorm_view($exescorm, $course, $cm, $context);
- $result = [];
+ $result = array();
$result['status'] = true;
$result['warnings'] = $warnings;
return $result;
@@ -99,10 +99,10 @@ public static function view_exescorm($exescormid) {
*/
public static function view_exescorm_returns() {
return new external_single_structure(
- [
+ array(
'status' => new external_value(PARAM_BOOL, 'status: true if success'),
- 'warnings' => new external_warnings(),
- ]
+ 'warnings' => new external_warnings()
+ )
);
}
@@ -114,13 +114,13 @@ public static function view_exescorm_returns() {
*/
public static function get_exescorm_attempt_count_parameters() {
return new external_function_parameters(
- [
+ array(
'exescormid' => new external_value(PARAM_INT, 'EXESCORM instance id'),
'userid' => new external_value(PARAM_INT, 'User id'),
'ignoremissingcompletion' => new external_value(PARAM_BOOL,
'Ignores attempts that haven\'t reported a grade/completion',
VALUE_DEFAULT, false),
- ]
+ )
);
}
@@ -137,13 +137,13 @@ public static function get_exescorm_attempt_count($exescormid, $userid, $ignorem
global $USER, $DB;
$params = self::validate_parameters(self::get_exescorm_attempt_count_parameters(),
- ['exescormid' => $exescormid, 'userid' => $userid,
- 'ignoremissingcompletion' => $ignoremissingcompletion]);
+ array('exescormid' => $exescormid, 'userid' => $userid,
+ 'ignoremissingcompletion' => $ignoremissingcompletion));
- $attempts = [];
- $warnings = [];
+ $attempts = array();
+ $warnings = array();
- $exescorm = $DB->get_record('exescorm', ['id' => $params['exescormid']], '*', MUST_EXIST);
+ $exescorm = $DB->get_record('exescorm', array('id' => $params['exescormid']), '*', MUST_EXIST);
$cm = get_coursemodule_from_instance('exescorm', $exescorm->id);
$context = context_module::instance($cm->id);
@@ -162,7 +162,7 @@ public static function get_exescorm_attempt_count($exescormid, $userid, $ignorem
$attemptscount = exescorm_get_attempt_count($user->id, $exescorm, false, $params['ignoremissingcompletion']);
- $result = [];
+ $result = array();
$result['attemptscount'] = $attemptscount;
$result['warnings'] = $warnings;
return $result;
@@ -177,10 +177,10 @@ public static function get_exescorm_attempt_count($exescormid, $userid, $ignorem
public static function get_exescorm_attempt_count_returns() {
return new external_single_structure(
- [
+ array(
'attemptscount' => new external_value(PARAM_INT, 'Attempts count'),
'warnings' => new external_warnings(),
- ]
+ )
);
}
@@ -192,10 +192,10 @@ public static function get_exescorm_attempt_count_returns() {
*/
public static function get_exescorm_scoes_parameters() {
return new external_function_parameters(
- [
+ array(
'exescormid' => new external_value(PARAM_INT, 'exescorm instance id'),
- 'organization' => new external_value(PARAM_RAW, 'organization id', VALUE_DEFAULT, ''),
- ]
+ 'organization' => new external_value(PARAM_RAW, 'organization id', VALUE_DEFAULT, '')
+ )
);
}
@@ -211,12 +211,12 @@ public static function get_exescorm_scoes($exescormid, $organization = '') {
global $DB;
$params = self::validate_parameters(self::get_exescorm_scoes_parameters(),
- ['exescormid' => $exescormid, 'organization' => $organization]);
+ array('exescormid' => $exescormid, 'organization' => $organization));
- $scoes = [];
- $warnings = [];
+ $scoes = array();
+ $warnings = array();
- $exescorm = $DB->get_record('exescorm', ['id' => $params['exescormid']], '*', MUST_EXIST);
+ $exescorm = $DB->get_record('exescorm', array('id' => $params['exescormid']), '*', MUST_EXIST);
$cm = get_coursemodule_from_instance('exescorm', $exescorm->id);
$context = context_module::instance($cm->id);
@@ -227,25 +227,25 @@ public static function get_exescorm_scoes($exescormid, $organization = '') {
if (!$scoes = exescorm_get_scoes($exescorm->id, $params['organization'])) {
// Function exescorm_get_scoes return false, not an empty array.
- $scoes = [];
+ $scoes = array();
} else {
$scoreturnstructure = self::get_exescorm_scoes_returns();
foreach ($scoes as $sco) {
- $extradata = [];
+ $extradata = array();
foreach ($sco as $element => $value) {
// Check if the element is extra data (not a basic SCO element).
if (!isset($scoreturnstructure->keys['scoes']->content->keys[$element])) {
- $extradata[] = [
+ $extradata[] = array(
'element' => $element,
- 'value' => $value,
- ];
+ 'value' => $value
+ );
}
}
$sco->extradata = $extradata;
}
}
- $result = [];
+ $result = array();
$result['scoes'] = $scoes;
$result['warnings'] = $warnings;
return $result;
@@ -260,10 +260,10 @@ public static function get_exescorm_scoes($exescormid, $organization = '') {
public static function get_exescorm_scoes_returns() {
return new external_single_structure(
- [
+ array(
'scoes' => new external_multiple_structure(
new external_single_structure(
- [
+ array(
'id' => new external_value(PARAM_INT, 'sco id'),
'exescorm' => new external_value(PARAM_INT, 'exescorm id'),
'manifest' => new external_value(PARAM_NOTAGS, 'manifest id'),
@@ -276,17 +276,17 @@ public static function get_exescorm_scoes_returns() {
'sortorder' => new external_value(PARAM_INT, 'sort order'),
'extradata' => new external_multiple_structure(
new external_single_structure(
- [
+ array(
'element' => new external_value(PARAM_RAW, 'element name'),
- 'value' => new external_value(PARAM_RAW, 'element value'),
- ]
+ 'value' => new external_value(PARAM_RAW, 'element value')
+ )
), 'Additional SCO data', VALUE_OPTIONAL
- ),
- ], 'EXESCORM SCO data'
+ )
+ ), 'EXESCORM SCO data'
)
),
'warnings' => new external_warnings(),
- ]
+ )
);
}
@@ -298,10 +298,10 @@ public static function get_exescorm_scoes_returns() {
*/
public static function get_exescorm_user_data_parameters() {
return new external_function_parameters(
- [
+ array(
'exescormid' => new external_value(PARAM_INT, 'exescorm instance id'),
- 'attempt' => new external_value(PARAM_INT, 'attempt number'),
- ]
+ 'attempt' => new external_value(PARAM_INT, 'attempt number')
+ )
);
}
@@ -318,12 +318,12 @@ public static function get_exescorm_user_data($exescormid, $attempt) {
global $CFG, $DB;
$params = self::validate_parameters(self::get_exescorm_user_data_parameters(),
- ['exescormid' => $exescormid, 'attempt' => $attempt]);
+ array('exescormid' => $exescormid, 'attempt' => $attempt));
- $data = [];
- $warnings = [];
+ $data = array();
+ $warnings = array();
- $exescorm = $DB->get_record('exescorm', ['id' => $params['exescormid']], '*', MUST_EXIST);
+ $exescorm = $DB->get_record('exescorm', array('id' => $params['exescormid']), '*', MUST_EXIST);
$cm = get_coursemodule_from_instance('exescorm', $exescorm->id);
$context = context_module::instance($cm->id);
@@ -347,31 +347,31 @@ public static function get_exescorm_user_data($exescormid, $attempt) {
// We force mode normal, this can be override by the client at any time.
$def->{$sco->id} = get_exescorm_default($user->{$sco->id}, $exescorm, $sco->id, $params['attempt'], 'normal');
- $userdata = [];
- $defaultdata = [];
+ $userdata = array();
+ $defaultdata = array();
foreach ((array) $user->{$sco->id} as $key => $val) {
- $userdata[] = [
+ $userdata[] = array(
'element' => $key,
- 'value' => $val,
- ];
+ 'value' => $val
+ );
}
foreach ($def->{$sco->id} as $key => $val) {
- $defaultdata[] = [
+ $defaultdata[] = array(
'element' => $key,
- 'value' => $val,
- ];
+ 'value' => $val
+ );
}
- $data[] = [
+ $data[] = array(
'scoid' => $sco->id,
'userdata' => $userdata,
'defaultdata' => $defaultdata,
- ];
+ );
}
}
- $result = [];
+ $result = array();
$result['data'] = $data;
$result['warnings'] = $warnings;
return $result;
@@ -386,32 +386,32 @@ public static function get_exescorm_user_data($exescormid, $attempt) {
public static function get_exescorm_user_data_returns() {
return new external_single_structure(
- [
+ array(
'data' => new external_multiple_structure(
new external_single_structure(
- [
+ array(
'scoid' => new external_value(PARAM_INT, 'sco id'),
'userdata' => new external_multiple_structure(
new external_single_structure(
- [
+ array(
'element' => new external_value(PARAM_RAW, 'element name'),
- 'value' => new external_value(PARAM_RAW, 'element value'),
- ]
+ 'value' => new external_value(PARAM_RAW, 'element value')
+ )
)
),
'defaultdata' => new external_multiple_structure(
new external_single_structure(
- [
+ array(
'element' => new external_value(PARAM_RAW, 'element name'),
- 'value' => new external_value(PARAM_RAW, 'element value'),
- ]
+ 'value' => new external_value(PARAM_RAW, 'element value')
+ )
)
),
- ], 'SCO data'
+ ), 'SCO data'
)
),
'warnings' => new external_warnings(),
- ]
+ )
);
}
@@ -423,18 +423,18 @@ public static function get_exescorm_user_data_returns() {
*/
public static function insert_exescorm_tracks_parameters() {
return new external_function_parameters(
- [
+ array(
'scoid' => new external_value(PARAM_INT, 'SCO id'),
'attempt' => new external_value(PARAM_INT, 'attempt number'),
'tracks' => new external_multiple_structure(
new external_single_structure(
- [
+ array(
'element' => new external_value(PARAM_RAW, 'element name'),
- 'value' => new external_value(PARAM_RAW, 'element value'),
- ]
+ 'value' => new external_value(PARAM_RAW, 'element value')
+ )
)
),
- ]
+ )
);
}
@@ -454,17 +454,17 @@ public static function insert_exescorm_tracks($scoid, $attempt, $tracks) {
global $USER, $DB;
$params = self::validate_parameters(self::insert_exescorm_tracks_parameters(),
- ['scoid' => $scoid, 'attempt' => $attempt, 'tracks' => $tracks]);
+ array('scoid' => $scoid, 'attempt' => $attempt, 'tracks' => $tracks));
- $trackids = [];
- $warnings = [];
+ $trackids = array();
+ $warnings = array();
$sco = exescorm_get_sco($params['scoid'], EXESCORM_SCO_ONLY);
if (!$sco) {
throw new moodle_exception('cannotfindsco', 'exescorm');
}
- $exescorm = $DB->get_record('exescorm', ['id' => $sco->exescorm], '*', MUST_EXIST);
+ $exescorm = $DB->get_record('exescorm', array('id' => $sco->exescorm), '*', MUST_EXIST);
$cm = get_coursemodule_from_instance('exescorm', $exescorm->id);
$context = context_module::instance($cm->id);
@@ -485,16 +485,16 @@ public static function insert_exescorm_tracks($scoid, $attempt, $tracks) {
if ($trackid) {
$trackids[] = $trackid;
} else {
- $warnings[] = [
+ $warnings[] = array(
'item' => 'exescorm',
'itemid' => $exescorm->id,
'warningcode' => 1,
- 'message' => 'Element: ' . $element . ' was not saved',
- ];
+ 'message' => 'Element: ' . $element . ' was not saved'
+ );
}
}
- $result = [];
+ $result = array();
$result['trackids'] = $trackids;
$result['warnings'] = $warnings;
return $result;
@@ -509,10 +509,10 @@ public static function insert_exescorm_tracks($scoid, $attempt, $tracks) {
public static function insert_exescorm_tracks_returns() {
return new external_single_structure(
- [
+ array(
'trackids' => new external_multiple_structure(new external_value(PARAM_INT, 'track id')),
'warnings' => new external_warnings(),
- ]
+ )
);
}
@@ -524,11 +524,11 @@ public static function insert_exescorm_tracks_returns() {
*/
public static function get_exescorm_sco_tracks_parameters() {
return new external_function_parameters(
- [
+ array(
'scoid' => new external_value(PARAM_INT, 'sco id'),
'userid' => new external_value(PARAM_INT, 'user id'),
- 'attempt' => new external_value(PARAM_INT, 'attempt number (0 for last attempt)', VALUE_DEFAULT, 0),
- ]
+ 'attempt' => new external_value(PARAM_INT, 'attempt number (0 for last attempt)', VALUE_DEFAULT, 0)
+ )
);
}
@@ -545,17 +545,17 @@ public static function get_exescorm_sco_tracks($scoid, $userid, $attempt = 0) {
global $USER, $DB;
$params = self::validate_parameters(self::get_exescorm_sco_tracks_parameters(),
- ['scoid' => $scoid, 'userid' => $userid, 'attempt' => $attempt]);
+ array('scoid' => $scoid, 'userid' => $userid, 'attempt' => $attempt));
- $tracks = [];
- $warnings = [];
+ $tracks = array();
+ $warnings = array();
$sco = exescorm_get_sco($params['scoid'], EXESCORM_SCO_ONLY);
if (!$sco) {
throw new moodle_exception('cannotfindsco', 'exescorm');
}
- $exescorm = $DB->get_record('exescorm', ['id' => $sco->exescorm], '*', MUST_EXIST);
+ $exescorm = $DB->get_record('exescorm', array('id' => $sco->exescorm), '*', MUST_EXIST);
$cm = get_coursemodule_from_instance('exescorm', $exescorm->id);
$context = context_module::instance($cm->id);
@@ -581,24 +581,24 @@ public static function get_exescorm_sco_tracks($scoid, $userid, $attempt = 0) {
if ($exescormtracks->status != '') {
$attempted = true;
foreach ($exescormtracks as $element => $value) {
- $tracks[] = [
+ $tracks[] = array(
'element' => $element,
'value' => $value,
- ];
+ );
}
}
}
if (!$attempted) {
- $warnings[] = [
+ $warnings[] = array(
'item' => 'attempt',
'itemid' => $params['attempt'],
'warningcode' => 'notattempted',
- 'message' => get_string('notattempted', 'mod_exescorm'),
- ];
+ 'message' => get_string('notattempted', 'mod_exescorm')
+ );
}
- $result = [];
+ $result = array();
$result['data']['attempt'] = $params['attempt'];
$result['data']['tracks'] = $tracks;
$result['warnings'] = $warnings;
@@ -614,22 +614,22 @@ public static function get_exescorm_sco_tracks($scoid, $userid, $attempt = 0) {
public static function get_exescorm_sco_tracks_returns() {
return new external_single_structure(
- [
+ array(
'data' => new external_single_structure(
- [
+ array(
'attempt' => new external_value(PARAM_INT, 'Attempt number'),
'tracks' => new external_multiple_structure(
new external_single_structure(
- [
+ array(
'element' => new external_value(PARAM_RAW, 'Element name'),
- 'value' => new external_value(PARAM_RAW, 'Element value'),
- ], 'Tracks data'
+ 'value' => new external_value(PARAM_RAW, 'Element value')
+ ), 'Tracks data'
)
),
- ], 'SCO data'
+ ), 'SCO data'
),
'warnings' => new external_warnings(),
- ]
+ )
);
}
@@ -641,11 +641,11 @@ public static function get_exescorm_sco_tracks_returns() {
*/
public static function get_exescorms_by_courses_parameters() {
return new external_function_parameters (
- [
+ array(
'courseids' => new external_multiple_structure(
- new external_value(PARAM_INT, 'course id'), 'Array of course ids', VALUE_DEFAULT, []
+ new external_value(PARAM_INT, 'course id'), 'Array of course ids', VALUE_DEFAULT, array()
),
- ]
+ )
);
}
@@ -657,15 +657,15 @@ public static function get_exescorms_by_courses_parameters() {
* @return array the exescorm details
* @since Moodle 3.0
*/
- public static function get_exescorms_by_courses($courseids = []) {
+ public static function get_exescorms_by_courses($courseids = array()) {
global $CFG;
- $returnedexescorms = [];
- $warnings = [];
+ $returnedexescorms = array();
+ $warnings = array();
- $params = self::validate_parameters(self::get_exescorms_by_courses_parameters(), ['courseids' => $courseids]);
+ $params = self::validate_parameters(self::get_exescorms_by_courses_parameters(), array('courseids' => $courseids));
- $courses = [];
+ $courses = array();
if (empty($params['courseids'])) {
$courses = enrol_get_my_courses();
$params['courseids'] = array_keys($courses);
@@ -693,12 +693,12 @@ public static function get_exescorms_by_courses($courseids = []) {
if (!$open) {
foreach ($openwarnings as $warningkey => $warningdata) {
- $warnings[] = [
+ $warnings[] = array(
'item' => 'exescorm',
'itemid' => $exescorm->id,
'warningcode' => $warningkey,
- 'message' => get_string($warningkey, 'mod_exescorm', $warningdata),
- ];
+ 'message' => get_string($warningkey, 'mod_exescorm', $warningdata)
+ );
}
} else {
$module['packagesize'] = 0;
@@ -724,16 +724,16 @@ public static function get_exescorms_by_courses($courseids = []) {
$module['protectpackagedownloads'] = get_config('exescorm', 'protectpackagedownloads');
- $viewablefields = ['version', 'maxgrade', 'grademethod', 'whatgrade', 'maxattempt', 'forcecompleted',
+ $viewablefields = array('version', 'maxgrade', 'grademethod', 'whatgrade', 'maxattempt', 'forcecompleted',
'forcenewattempt', 'lastattemptlock', 'displayattemptstatus', 'displaycoursestructure',
'sha1hash', 'md5hash', 'revision', 'launch', 'skipview', 'hidebrowse', 'hidetoc', 'nav',
'navpositionleft', 'navpositiontop', 'auto', 'popup', 'width', 'height', 'timeopen',
- 'timeclose', 'exescormtype', 'reference'];
+ 'timeclose', 'exescormtype', 'reference');
// Check additional permissions for returning optional private settings.
if (has_capability('moodle/course:manageactivities', $context)) {
- $additionalfields = ['updatefreq', 'options', 'completionstatusrequired', 'completionscorerequired',
- 'completionstatusallscos', 'autocommit', 'timemodified'];
+ $additionalfields = array('updatefreq', 'options', 'completionstatusrequired', 'completionscorerequired',
+ 'completionstatusallscos', 'autocommit', 'timemodified');
$viewablefields = array_merge($viewablefields, $additionalfields);
}
@@ -746,7 +746,7 @@ public static function get_exescorms_by_courses($courseids = []) {
}
}
- $result = [];
+ $result = array();
$result['exescorms'] = $returnedexescorms;
$result['warnings'] = $warnings;
return $result;
@@ -761,7 +761,7 @@ public static function get_exescorms_by_courses($courseids = []) {
public static function get_exescorms_by_courses_returns() {
return new external_single_structure(
- [
+ array(
'exescorms' => new external_multiple_structure(
new external_single_structure(array_merge(
helper_for_get_mods_by_courses::standard_coursemodule_elements_returns(),
@@ -821,7 +821,7 @@ public static function get_exescorms_by_courses_returns() {
), 'EXESCORM')
),
'warnings' => new external_warnings(),
- ]
+ )
);
}
@@ -833,10 +833,10 @@ public static function get_exescorms_by_courses_returns() {
*/
public static function launch_sco_parameters() {
return new external_function_parameters(
- [
+ array(
'exescormid' => new external_value(PARAM_INT, 'EXESCORM instance id'),
- 'scoid' => new external_value(PARAM_INT, 'SCO id (empty for launching the first SCO)', VALUE_DEFAULT, 0),
- ]
+ 'scoid' => new external_value(PARAM_INT, 'SCO id (empty for launching the first SCO)', VALUE_DEFAULT, 0)
+ )
);
}
@@ -855,14 +855,14 @@ public static function launch_sco($exescormid, $scoid = 0) {
require_once($CFG->libdir . '/completionlib.php');
$params = self::validate_parameters(self::launch_sco_parameters(),
- [
+ array(
'exescormid' => $exescormid,
- 'scoid' => $scoid,
- ]);
- $warnings = [];
+ 'scoid' => $scoid
+ ));
+ $warnings = array();
// Request and permission validation.
- $exescorm = $DB->get_record('exescorm', ['id' => $params['exescormid']], '*', MUST_EXIST);
+ $exescorm = $DB->get_record('exescorm', array('id' => $params['exescormid']), '*', MUST_EXIST);
list($course, $cm) = get_course_and_cm_from_instance($exescorm, 'exescorm');
$context = context_module::instance($cm->id);
@@ -883,7 +883,7 @@ public static function launch_sco($exescormid, $scoid = 0) {
// Trigger the SCO launched event.
exescorm_launch_sco($exescorm, $sco, $cm, $context, $scolaunchurl);
- $result = [];
+ $result = array();
$result['status'] = true;
$result['warnings'] = $warnings;
return $result;
@@ -897,10 +897,10 @@ public static function launch_sco($exescormid, $scoid = 0) {
*/
public static function launch_sco_returns() {
return new external_single_structure(
- [
+ array(
'status' => new external_value(PARAM_BOOL, 'status: true if success'),
- 'warnings' => new external_warnings(),
- ]
+ 'warnings' => new external_warnings()
+ )
);
}
@@ -912,9 +912,9 @@ public static function launch_sco_returns() {
*/
public static function get_exescorm_access_information_parameters() {
return new external_function_parameters (
- [
- 'exescormid' => new external_value(PARAM_INT, 'exescorm instance id.'),
- ]
+ array(
+ 'exescormid' => new external_value(PARAM_INT, 'exescorm instance id.')
+ )
);
}
@@ -934,13 +934,13 @@ public static function get_exescorm_access_information($exescormid) {
);
// Request and permission validation.
- $exescorm = $DB->get_record('exescorm', ['id' => $params['exescormid']], '*', MUST_EXIST);
+ $exescorm = $DB->get_record('exescorm', array('id' => $params['exescormid']), '*', MUST_EXIST);
list($course, $cm) = get_course_and_cm_from_instance($exescorm, 'exescorm');
$context = context_module::instance($cm->id);
self::validate_context($context);
- $result = [];
+ $result = array();
// Return all the available capabilities.
$capabilities = load_capability_def('mod_exescorm');
foreach ($capabilities as $capname => $capdata) {
@@ -949,7 +949,7 @@ public static function get_exescorm_access_information($exescormid) {
$result[$field] = has_capability($capname, $context);
}
- $result['warnings'] = [];
+ $result['warnings'] = array();
return $result;
}
@@ -961,9 +961,9 @@ public static function get_exescorm_access_information($exescormid) {
*/
public static function get_exescorm_access_information_returns() {
- $structure = [
- 'warnings' => new external_warnings(),
- ];
+ $structure = array(
+ 'warnings' => new external_warnings()
+ );
$capabilities = load_capability_def('mod_exescorm');
foreach ($capabilities as $capname => $capdata) {
diff --git a/classes/output/actionbar.php b/classes/output/actionbar.php
index 078b678..2972328 100644
--- a/classes/output/actionbar.php
+++ b/classes/output/actionbar.php
@@ -79,19 +79,19 @@ public function export_for_template(renderer_base $output): array {
if ($mode === 'basic') {
$options = [
'id' => $this->id, 'mode' => $mode,
- 'attemptsmode' => $this->attemptsmode, 'sesskey' => $sesskey,
+ 'attemptsmode' => $this->attemptsmode, 'sesskey' => $sesskey
];
} else if ($mode === 'interactions') {
$options = [
'id' => $this->id, 'mode' => $mode, 'qtext' => '0',
'resp' => '1', 'right' => '0', 'result' => '0',
- 'attemptsmode' => $this->attemptsmode, 'sesskey' => $sesskey,
+ 'attemptsmode' => $this->attemptsmode, 'sesskey' => $sesskey
];
} else if ($mode === 'objectives') {
$options = [
'id' => $this->id, 'mode' => $mode,
'attemptsmode' => $this->attemptsmode, 'objectivescore' => '0',
- 'sesskey' => $sesskey,
+ 'sesskey' => $sesskey
];
}
@@ -115,7 +115,7 @@ public function export_for_template(renderer_base $output): array {
'candownload' => $this->download,
'downloadods' => ($this->download) ? $downloadodslink->out(false) : '',
'downloadexcel' => ($this->download) ? $downloadexcellink->out(false) : '',
- 'downloadtext' => ($this->download) ? $downloadtextlink->out(false) : '',
+ 'downloadtext' => ($this->download) ? $downloadtextlink->out(false) : ''
];
return $data;
}
diff --git a/classes/output/userreportsactionbar.php b/classes/output/userreportsactionbar.php
index f618fc2..96bb1d3 100644
--- a/classes/output/userreportsactionbar.php
+++ b/classes/output/userreportsactionbar.php
@@ -75,7 +75,7 @@ public function __construct(int $id, int $userid, int $attempt, string $reportty
*/
public function export_for_template(renderer_base $output): array {
$data = [
- 'backurl' => (new moodle_url('/mod/exescorm/report.php', ['id' => $this->id, 'mode' => $this->mode]))->out(false),
+ 'backurl' => (new moodle_url('/mod/exescorm/report.php', ['id' => $this->id, 'mode' => $this->mode]))->out(false)
];
if (!$this->scoid) {
diff --git a/classes/privacy/provider.php b/classes/privacy/provider.php
index c8734d1..1165a68 100644
--- a/classes/privacy/provider.php
+++ b/classes/privacy/provider.php
@@ -50,13 +50,13 @@ class provider implements
* @param collection $collection The initialised collection to add items to.
* @return collection A listing of user data stored through this system.
*/
- public static function get_metadata(collection $collection): collection {
+ public static function get_metadata(collection $collection) : collection {
$collection->add_database_table('exescorm_scoes_track', [
'userid' => 'privacy:metadata:userid',
'attempt' => 'privacy:metadata:attempt',
'element' => 'privacy:metadata:scoes_track:element',
'value' => 'privacy:metadata:scoes_track:value',
- 'timemodified' => 'privacy:metadata:timemodified',
+ 'timemodified' => 'privacy:metadata:timemodified'
], 'privacy:metadata:exescorm_scoes_track');
$collection->add_database_table('exescorm_aicc_session', [
@@ -71,7 +71,7 @@ public static function get_metadata(collection $collection): collection {
], 'privacy:metadata:exescorm_aicc_session');
$collection->add_external_location_link('aicc', [
- 'data' => 'privacy:metadata:aicc:data',
+ 'data' => 'privacy:metadata:aicc:data'
], 'privacy:metadata:aicc:externalpurpose');
return $collection;
@@ -83,7 +83,7 @@ public static function get_metadata(collection $collection): collection {
* @param int $userid The user to search.
* @return contextlist $contextlist The contextlist containing the list of contexts used in this plugin.
*/
- public static function get_contexts_for_userid(int $userid): contextlist {
+ public static function get_contexts_for_userid(int $userid) : contextlist {
$sql = "SELECT ctx.id
FROM {%s} ss
JOIN {modules} m
@@ -199,7 +199,7 @@ public static function export_user_data(approved_contextlist $contextlist) {
array_walk($attemptsdata, function($data, $attempt) use ($context) {
$subcontext = [
get_string('myattempts', 'mod_exescorm'),
- get_string('attempt', 'mod_exescorm'). " $attempt",
+ get_string('attempt', 'mod_exescorm'). " $attempt"
];
writer::with_context($context)->export_data(
$subcontext,
@@ -247,7 +247,7 @@ public static function export_user_data(approved_contextlist $contextlist) {
array_walk($alldata, function($data, $contextid) {
$context = \context::instance_by_id($contextid);
$subcontext = [
- get_string('myaiccsessions', 'mod_exescorm'),
+ get_string('myaiccsessions', 'mod_exescorm')
];
writer::with_context($context)->export_data(
$subcontext,
diff --git a/classes/report.php b/classes/report.php
index 76c939c..5d3c712 100644
--- a/classes/report.php
+++ b/classes/report.php
@@ -13,7 +13,6 @@
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
-
/**
* @package mod_exescorm
* @author Ankit Kumar Agarwal
@@ -98,15 +97,15 @@ protected function generate_row_checkbox(string $name, string $value): string {
* Generates an action button that deletes the selected attempts.
*/
protected function generate_delete_selected_button(): string {
- $deleteselectedparams = [
+ $deleteselectedparams = array(
'type' => 'submit',
'value' => get_string('deleteselected', 'mod_exescorm'),
'class' => 'btn btn-secondary',
'data-action' => 'toggle',
'data-togglegroup' => 'exescorm-attempts',
'data-toggle' => 'action',
- 'disabled' => true,
- ];
+ 'disabled' => true
+ );
return \html_writer::empty_tag('input', $deleteselectedparams);
}
}
diff --git a/composer.json b/composer.json
deleted file mode 100644
index cb0ffa9..0000000
--- a/composer.json
+++ /dev/null
@@ -1,46 +0,0 @@
-{
- "name": "moodle/moodle-mod_exescorm",
- "description": "Moodle ExeSCORM plugin",
- "require-dev": {
- "moodlehq/moodle-local_codechecker": "^3.0",
- "squizlabs/php_codesniffer": "^3.6",
- "phpunit/phpunit": "^9.5",
- "behat/behat": "^3.8",
- "phpmd/phpmd": "^2.14.0",
- "php-parallel-lint/php-parallel-lint": "^1.3.2",
- "php-parallel-lint/php-console-highlighter": "^1.0.0",
- "moodlehq/moodle-cs": "^3.4.10"
- },
- "scripts": {
- "lint": [
- "phpcs --standard=moodle --extensions=php --ignore=vendor/* -p -w -s --no-cache --colors --report-full --report-width=132 --encoding=utf-8 ."
-
- ],
- "fix": [
- "phpcbf --standard=moodle --extensions=php --ignore=vendor/* -p -w -s --no-cache --colors --report-full --report-width=132 --encoding=utf-8 ."
-
- ],
- "test": [
- "phpunit",
- "phpcs --standard=moodle --extensions=php --ignore=vendor/,node_modules/ .",
- "phpcbf --standard=moodle --extensions=php --ignore=vendor/,node_modules/ ."
- ],
- "phpmd": [
- "curl -o phpmd-rules.xml https://raw.githubusercontent.com/moodlehq/moodle-plugin-ci/refs/heads/main/res/config/phpmd.xml",
- "phpmd . text phpmd-rules.xml"
- ],
- "behat": [
- "vendor/bin/behat --config behat.yml"
- ]
- },
- "config": {
- "optimize-autoloader": true,
- "preferred-install": "dist",
- "sort-packages": true,
- "allow-plugins": {
- "dealerdirect/phpcodesniffer-composer-installer": true
- }
- },
- "minimum-stability": "dev",
- "prefer-stable": true
-}
diff --git a/datamodel.php b/datamodel.php
index 51890e9..65f8fd8 100644
--- a/datamodel.php
+++ b/datamodel.php
@@ -26,17 +26,17 @@
if (! $cm = get_coursemodule_from_id('exescorm', $id)) {
throw new \moodle_exception('invalidcoursemodule');
}
- if (! $course = $DB->get_record("course", ["id" => $cm->course])) {
+ if (! $course = $DB->get_record("course", array("id" => $cm->course))) {
throw new \moodle_exception('coursemisconf');
}
- if (! $exescorm = $DB->get_record("exescorm", ["id" => $cm->instance])) {
+ if (! $exescorm = $DB->get_record("exescorm", array("id" => $cm->instance))) {
throw new \moodle_exception('invalidcoursemodule');
}
} else if (!empty($a)) {
- if (! $exescorm = $DB->get_record("exescorm", ["id" => $a])) {
+ if (! $exescorm = $DB->get_record("exescorm", array("id" => $a))) {
throw new \moodle_exception('invalidcoursemodule');
}
- if (! $course = $DB->get_record("course", ["id" => $exescorm->course])) {
+ if (! $course = $DB->get_record("course", array("id" => $exescorm->course))) {
throw new \moodle_exception('coursemisconf');
}
if (! $cm = get_coursemodule_from_instance("exescorm", $exescorm->id, $course->id)) {
@@ -70,9 +70,9 @@
// SCORM 2004 Sequencing Request.
require_once($CFG->dirroot.'/mod/exescorm/datamodels/scorm_13lib.php');
- $search = ['@continue@', '@previous@', '@\{target=(\S+)\}choice@', '@exit@',
- '@exitAll@', '@abandon@', '@abandonAll@'];
- $replace = ['continue_', 'previous_', '\1', 'exit_', 'exitall_', 'abandon_', 'abandonall'];
+ $search = array('@continue@', '@previous@', '@\{target=(\S+)\}choice@', '@exit@',
+ '@exitAll@', '@abandon@', '@abandonAll@');
+ $replace = array('continue_', 'previous_', '\1', 'exit_', 'exitall_', 'abandon_', 'abandonall');
$action = preg_replace($search, $replace, $value);
if ($action != $value) {
@@ -81,8 +81,8 @@
$valid = 'true';
// Set valid request.
- $search = ['@continue@', '@previous@', '@\{target=(\S+)\}choice@'];
- $replace = ['true', 'true', 'true'];
+ $search = array('@continue@', '@previous@', '@\{target=(\S+)\}choice@');
+ $replace = array('true', 'true', 'true');
$matched = preg_replace($search, $replace, $value);
if ($matched == 'true') {
$request = 'adl.nav.request_valid["'.$action.'"] = "'.$valid.'";';
diff --git a/datamodels/aicc.php b/datamodels/aicc.php
index c26f590..3ec5800 100644
--- a/datamodels/aicc.php
+++ b/datamodels/aicc.php
@@ -26,7 +26,7 @@
$currentorg = '';
}
-if ($scoes = $DB->get_records('exescorm_scoes', ['exescorm' => $exescorm->id], 'sortorder, id')) {
+if ($scoes = $DB->get_records('exescorm_scoes', array('exescorm' => $exescorm->id), 'sortorder, id')) {
// Drop keys so that it is a simple array.
$scoes = array_values($scoes);
foreach ($scoes as $sco) {
diff --git a/datamodels/aicclib.php b/datamodels/aicclib.php
index ecfbf6c..7211ac0 100644
--- a/datamodels/aicclib.php
+++ b/datamodels/aicclib.php
@@ -82,7 +82,7 @@ function exescorm_add_time($a, $b) {
function exescorm_get_aicc_columns($row, $mastername='system_id') {
$tok = strtok(strtolower($row), "\",\n\r");
$result = new stdClass();
- $result->columns = [];
+ $result->columns = array();
$result->mastercol = 0;
$i = 0;
while ($tok) {
@@ -138,9 +138,9 @@ function exescorm_parse_aicc(&$exescorm) {
$files = $fs->get_area_files($context->id, 'mod_exescorm', 'content', 0, 'sortorder, itemid, filepath, filename', false);
$version = 'AICC';
- $ids = [];
- $courses = [];
- $extaiccfiles = ['crs', 'des', 'au', 'cst', 'ort', 'pre', 'cmp'];
+ $ids = array();
+ $courses = array();
+ $extaiccfiles = array('crs', 'des', 'au', 'cst', 'ort', 'pre', 'cmp');
foreach ($files as $file) {
$filename = $file->get_filename();
@@ -275,7 +275,7 @@ function exescorm_parse_aicc(&$exescorm) {
}
}
- $oldscoes = $DB->get_records('exescorm_scoes', ['exescorm' => $exescorm->id]);
+ $oldscoes = $DB->get_records('exescorm_scoes', array('exescorm' => $exescorm->id));
$sortorder = 0;
$launch = 0;
if (isset($courses)) {
@@ -291,8 +291,8 @@ function exescorm_parse_aicc(&$exescorm) {
$sco->exescormtype = '';
$sco->sortorder = $sortorder;
- if ($ss = $DB->get_record('exescorm_scoes', ['exescorm' => $exescorm->id,
- 'identifier' => $sco->identifier])) {
+ if ($ss = $DB->get_record('exescorm_scoes', array('exescorm' => $exescorm->id,
+ 'identifier' => $sco->identifier))) {
$id = $ss->id;
$sco->id = $id;
$DB->update_record('exescorm_scoes', $sco);
@@ -334,7 +334,7 @@ function exescorm_parse_aicc(&$exescorm) {
$sco->id = $oldscoid;
$DB->update_record('exescorm_scoes', $sco);
$id = $oldscoid;
- $DB->delete_records('exescorm_scoes_data', ['scoid' => $oldscoid]);
+ $DB->delete_records('exescorm_scoes_data', array('scoid' => $oldscoid));
unset($oldscoes[$oldscoid]);
} else {
$id = $DB->insert_record('exescorm_scoes', $sco);
@@ -382,15 +382,15 @@ function exescorm_parse_aicc(&$exescorm) {
}
if (!empty($oldscoes)) {
foreach ($oldscoes as $oldsco) {
- $DB->delete_records('exescorm_scoes', ['id' => $oldsco->id]);
- $DB->delete_records('exescorm_scoes_track', ['scoid' => $oldsco->id]);
+ $DB->delete_records('exescorm_scoes', array('id' => $oldsco->id));
+ $DB->delete_records('exescorm_scoes_track', array('scoid' => $oldsco->id));
}
}
// Find first launchable object.
$sqlselect = 'exescorm = ? AND '.$DB->sql_isnotempty('exescorm_scoes', 'launch', false, true);
// We use get_records here as we need to pass a limit in the query that works cross db.
- $scoes = $DB->get_records_select('exescorm_scoes', $sqlselect, [$exescorm->id], 'sortorder', 'id', 0, 1);
+ $scoes = $DB->get_records_select('exescorm_scoes', $sqlselect, array($exescorm->id), 'sortorder', 'id', 0, 1);
if (!empty($scoes)) {
$sco = reset($scoes); // We only care about the first record - the above query only returns one.
$exescorm->launch = $sco->id;
@@ -443,7 +443,7 @@ function exescorm_aicc_confirm_hacp_session($hacpsession) {
}
$time = time() - ($cfgexescorm->aicchacptimeout * 60);
$sql = "hacpsession = ? AND timemodified > ?";
- $hacpsession = $DB->get_record_select('exescorm_aicc_session', $sql, [$hacpsession, $time]);
+ $hacpsession = $DB->get_record_select('exescorm_aicc_session', $sql, array($hacpsession, $time));
if (!empty($hacpsession)) { // Update timemodified as this is still an active session - resets the timeout.
$hacpsession->timemodified = time();
$DB->update_record('exescorm_aicc_session', $hacpsession);
@@ -461,7 +461,7 @@ function exescorm_aicc_confirm_hacp_session($hacpsession) {
function exescorm_aicc_generate_simple_sco($exescorm) {
global $DB;
// Find the oldest one.
- $scos = $DB->get_records('exescorm_scoes', ['exescorm' => $exescorm->id], 'id');
+ $scos = $DB->get_records('exescorm_scoes', array('exescorm' => $exescorm->id), 'id');
if (!empty($scos)) {
$sco = array_shift($scos);
} else {
@@ -469,8 +469,8 @@ function exescorm_aicc_generate_simple_sco($exescorm) {
}
// Get rid of old ones.
foreach ($scos as $oldsco) {
- $DB->delete_records('exescorm_scoes', ['id' => $oldsco->id]);
- $DB->delete_records('exescorm_scoes_track', ['scoid' => $oldsco->id]);
+ $DB->delete_records('exescorm_scoes', array('id' => $oldsco->id));
+ $DB->delete_records('exescorm_scoes_track', array('scoid' => $oldsco->id));
}
$sco->identifier = 'A1';
@@ -556,7 +556,7 @@ function get_exescorm_default (&$userdata, $exescorm, $scoid, $attempt, $mode) {
}
}
- $def = [];
+ $def = array();
$def['cmi.core.student_id'] = $userdata->student_id;
$def['cmi.core.student_name'] = $userdata->student_name;
$def['cmi.core.credit'] = $userdata->credit;
diff --git a/datamodels/debug.js.php b/datamodels/debug.js.php
index c0842d3..fa40299 100644
--- a/datamodels/debug.js.php
+++ b/datamodels/debug.js.php
@@ -91,9 +91,9 @@ function toggleLog () {
$lmsprefix = (exescorm_version_check($exescorm->version, EXESCORM_SCORM_12) || empty($exescorm->version)) ? 'LMS' : '';
$lmsapi = (exescorm_version_check($exescorm->version, EXESCORM_SCORM_12) || empty($exescorm->version)) ? 'API' : 'API_1484_11';
-$lmselements = [];
+$lmselements = array();
if (exescorm_version_check($exescorm->version, EXESCORM_SCORM_12) || empty($exescorm->version)) {
- $lmselements = [ 'cmi.core._children',
+ $lmselements = array( 'cmi.core._children',
'cmi.core.student_id',
'cmi.core.student_name',
'cmi.core.lesson_location',
@@ -141,9 +141,9 @@ function toggleLog () {
'cmi.interactions.n.weighting',
'cmi.interactions.n.student_response',
'cmi.interactions.n.result',
- 'cmi.interactions.n.latency'];
+ 'cmi.interactions.n.latency');
} else {
- $lmselements = [ 'cmi._children',
+ $lmselements = array( 'cmi._children',
'cmi._version',
'cmi.learner_id',
'cmi.learner_name',
@@ -215,7 +215,7 @@ function toggleLog () {
'cmi.interactions.n.result',
'cmi.interactions.n.latency',
'cmi.interactions.n.description',
- 'adl.nav.request'];
+ 'adl.nav.request');
}
?>
diff --git a/datamodels/scorm_12.php b/datamodels/scorm_12.php
index 001ecce..cc19e97 100644
--- a/datamodels/scorm_12.php
+++ b/datamodels/scorm_12.php
@@ -28,7 +28,7 @@
$currentorg = '';
}
-if ($scoes = $DB->get_records('exescorm_scoes', ['exescorm' => $exescorm->id], 'sortorder, id')) {
+if ($scoes = $DB->get_records('exescorm_scoes', array('exescorm' => $exescorm->id), 'sortorder, id')) {
// Drop keys so that it is a simple array.
$scoes = array_values($scoes);
foreach ($scoes as $sco) {
@@ -38,9 +38,9 @@
// Reconstitute objectives.
$cmiobj->{($sco->id)} = exescorm_reconstitute_array_element($exescorm->version, $userdata->{($sco->id)},
- 'cmi.objectives', ['score']);
+ 'cmi.objectives', array('score'));
$cmiint->{($sco->id)} = exescorm_reconstitute_array_element($exescorm->version, $userdata->{($sco->id)},
- 'cmi.interactions', ['objectives', 'correct_responses']);
+ 'cmi.interactions', array('objectives', 'correct_responses'));
}
}
@@ -57,10 +57,10 @@
$exescorm->masteryoverride = ($exescorm->masteryoverride === "1") ? true : false;
$PAGE->requires->js_init_call(
'M.exescorm_api.init',
- [$def, $cmiobj, $cmiint, $cmistring256, $cmistring4096,
+ array($def, $cmiobj, $cmiint, $cmistring256, $cmistring4096,
exescorm_debugging($exescorm), $exescorm->auto, $exescorm->id, $CFG->wwwroot,
sesskey(), $scoid, $attempt, $mode, $id, $currentorg, $exescorm->autocommit,
- $exescorm->masteryoverride, $exescorm->hidetoc]
+ $exescorm->masteryoverride, $exescorm->hidetoc)
);
// Pull in the debugging utilities.
diff --git a/datamodels/scorm_12lib.php b/datamodels/scorm_12lib.php
index dfcc50c..b2ae561 100644
--- a/datamodels/scorm_12lib.php
+++ b/datamodels/scorm_12lib.php
@@ -14,6 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+
/**
* Sets up $userdata array and default values for SCORM 1.2 .
*
@@ -76,7 +77,7 @@ function get_exescorm_default (&$userdata, $exescorm, $scoid, $attempt, $mode) {
$userdata->credit = 'no-credit';
}
- $def = [];
+ $def = array();
$def['cmi.core.student_id'] = $userdata->student_id;
$def['cmi.core.student_name'] = $userdata->student_name;
$def['cmi.core.credit'] = $userdata->credit;
diff --git a/datamodels/scorm_13.php b/datamodels/scorm_13.php
index a84ff8d..37e5326 100644
--- a/datamodels/scorm_13.php
+++ b/datamodels/scorm_13.php
@@ -29,7 +29,7 @@
$currentorg = '';
}
-if ($scoes = $DB->get_records('exescorm_scoes', ['exescorm' => $exescorm->id], 'sortorder, id')) {
+if ($scoes = $DB->get_records('exescorm_scoes', array('exescorm' => $exescorm->id), 'sortorder, id')) {
// Drop keys so that it is a simple array.
$scoes = array_values($scoes);
foreach ($scoes as $sco) {
@@ -39,22 +39,22 @@
// Reconstitute objectives, comments_from_learner and comments_from_lms.
$cmiobj->{($sco->id)} = exescorm_reconstitute_array_element($exescorm->version, $userdata->{($sco->id)},
- 'cmi.objectives', ['score']);
+ 'cmi.objectives', array('score'));
$cmiint->{($sco->id)} = exescorm_reconstitute_array_element($exescorm->version, $userdata->{($sco->id)},
- 'cmi.interactions', ['objectives', 'correct_responses']);
+ 'cmi.interactions', array('objectives', 'correct_responses'));
$cmicommentsuser->{($sco->id)} = exescorm_reconstitute_array_element($exescorm->version, $userdata->{($sco->id)},
- 'cmi.comments_from_learner', []);
+ 'cmi.comments_from_learner', array());
$cmicommentslms->{($sco->id)} = exescorm_reconstitute_array_element($exescorm->version, $userdata->{($sco->id)},
- 'cmi.comments_from_lms', []);
+ 'cmi.comments_from_lms', array());
}
}
$exescorm->autocommit = ($exescorm->autocommit === "1") ? true : false;
$PAGE->requires->js_init_call(
'M.exescorm_api.init',
- [$def, $cmiobj, $cmiint, $cmicommentsuser, $cmicommentslms,
+ array($def, $cmiobj, $cmiint, $cmicommentsuser, $cmicommentslms,
exescorm_debugging($exescorm), $exescorm->auto, $exescorm->id, $CFG->wwwroot,
- sesskey(), $scoid, $attempt, $mode, $id, $currentorg, $exescorm->autocommit]
+ sesskey(), $scoid, $attempt, $mode, $id, $currentorg, $exescorm->autocommit)
);
diff --git a/datamodels/scorm_13lib.php b/datamodels/scorm_13lib.php
index 126d381..1c166a6 100644
--- a/datamodels/scorm_13lib.php
+++ b/datamodels/scorm_13lib.php
@@ -82,7 +82,7 @@ function exescorm_seq_navigation ($scoid, $userid, $request, $attempt=0) {
if (empty($seq->currentactivity)) {
// TODO: I think it's suspend instead of suspendedactivity.
if ($track = $DB->get_record('exescorm_scoes_track',
- ['scoid' => $scoid, 'userid' => $userid, 'element' => 'suspendedactivity'])) {
+ array('scoid' => $scoid, 'userid' => $userid, 'element' => 'suspendedactivity'))) {
$seq->navigation = true;
$seq->sequencing = 'resumeall';
@@ -326,9 +326,9 @@ function exescorm_seq_end_attempt($sco, $userid, $seq) {
if (!isset($sco->completionsetbycontent) || ($sco->completionsetbycontent == 0)) {
if (!exescorm_seq_is('attemptprogressstatus', $sco->id, $userid, $seq->attempt)) {
$incomplete = $DB->get_field('exescorm_scoes_track', 'value',
- ['scoid' => $sco->id,
+ array('scoid' => $sco->id,
'userid' => $userid,
- 'element' => 'cmi.completion_status']);
+ 'element' => 'cmi.completion_status'));
if ($incomplete != 'incomplete') {
exescorm_seq_set('attemptprogressstatus', $sco->id, $userid, $seq->attempt);
exescorm_seq_set('attemptcompletionstatus', $sco->id, $userid, $seq->attempt);
@@ -336,7 +336,7 @@ function exescorm_seq_end_attempt($sco, $userid, $seq) {
}
}
if (!isset($sco->objectivesetbycontent) || ($sco->objectivesetbycontent == 0)) {
- if ($objectives = $DB->get_records('exescorm_seq_objective', ['scoid' => $sco->id])) {
+ if ($objectives = $DB->get_records('exescorm_seq_objective', array('scoid' => $sco->id))) {
foreach ($objectives as $objective) {
if ($objective->primaryobj) {
if (!exescorm_seq_is('objectiveprogressstatus', $sco->id, $userid, $seq->attempt)) {
@@ -373,7 +373,7 @@ function exescorm_seq_is($what, $scoid, $userid, $attempt=0) {
// Check if passed activity $what is active.
$active = false;
if ($track = $DB->get_record('exescorm_scoes_track',
- ['scoid' => $scoid, 'userid' => $userid, 'attempt' => $attempt, 'element' => $what])) {
+ array('scoid' => $scoid, 'userid' => $userid, 'attempt' => $attempt, 'element' => $what))) {
$active = true;
}
return $active;
@@ -386,14 +386,14 @@ function exescorm_seq_set($what, $scoid, $userid, $attempt=0, $value='true') {
// Set passed activity to active or not.
if ($value == false) {
- $DB->delete_records('exescorm_scoes_track', ['scoid' => $scoid, 'userid' => $userid,
- 'attempt' => $attempt, 'element' => $what]);
+ $DB->delete_records('exescorm_scoes_track', array('scoid' => $scoid, 'userid' => $userid,
+ 'attempt' => $attempt, 'element' => $what));
} else {
exescorm_insert_track($userid, $sco->exescorm, $sco->id, $attempt, $what, $value);
}
// Update grades in gradebook.
- $exescorm = $DB->get_record('exescorm', ['id' => $sco->exescorm]);
+ $exescorm = $DB->get_record('exescorm', array('id' => $sco->exescorm));
exescorm_update_grades($exescorm, $userid, true);
}
@@ -428,10 +428,10 @@ function exescorm_evaluate_condition ($rollupruleconds, $sco, $userid) {
switch ($condition['condition']) {
case 'satisfied':
$r = $DB->get_record('exescorm_scoes_track',
- ['scoid' => $sco->id, 'userid' => $userid, 'element' => 'objectivesatisfiedstatus']);
+ array('scoid' => $sco->id, 'userid' => $userid, 'element' => 'objectivesatisfiedstatus'));
if ((!isset($r->value) && !$checknot) || (isset($r->value) && ($r->value == $checknot))) {
$r = $DB->get_record('exescorm_scoes_track',
- ['scoid' => $sco->id, 'userid' => $userid, 'element' => 'objectiveprogressstatus']);
+ array('scoid' => $sco->id, 'userid' => $userid, 'element' => 'objectiveprogressstatus'));
if ((!isset($r->value) && !$checknot) || (isset($r->value) && ($r->value == $checknot))) {
$res = true;
}
@@ -440,7 +440,7 @@ function exescorm_evaluate_condition ($rollupruleconds, $sco, $userid) {
case 'objectiveStatusKnown':
$r = $DB->get_record('exescorm_scoes_track',
- ['scoid' => $sco->id, 'userid' => $userid, 'element' => 'objectiveprogressstatus']);
+ array('scoid' => $sco->id, 'userid' => $userid, 'element' => 'objectiveprogressstatus'));
if ((!isset($r->value) && !$checknot) || (isset($r->value) && ($r->value == $checknot))) {
$res = true;
}
@@ -448,7 +448,7 @@ function exescorm_evaluate_condition ($rollupruleconds, $sco, $userid) {
case 'notobjectiveStatusKnown':
$r = $DB->get_record('exescorm_scoes_track',
- ['scoid' => $sco->id, 'userid' => $userid, 'element' => 'objectiveprogressstatus']);
+ array('scoid' => $sco->id, 'userid' => $userid, 'element' => 'objectiveprogressstatus'));
if ((!isset($r->value) && !$checknot) || (isset($r->value) && ($r->value == $checknot))) {
$res = true;
}
@@ -456,7 +456,7 @@ function exescorm_evaluate_condition ($rollupruleconds, $sco, $userid) {
case 'objectiveMeasureKnown':
$r = $DB->get_record('exescorm_scoes_track',
- ['scoid' => $sco->id, 'userid' => $userid, 'element' => 'objectivemeasurestatus']);
+ array('scoid' => $sco->id, 'userid' => $userid, 'element' => 'objectivemeasurestatus'));
if ((!isset($r->value) && !$checknot) || (isset($r->value) && ($r->value == $checknot))) {
$res = true;
}
@@ -464,7 +464,7 @@ function exescorm_evaluate_condition ($rollupruleconds, $sco, $userid) {
case 'notobjectiveMeasureKnown':
$r = $DB->get_record('exescorm_scoes_track',
- ['scoid' => $sco->id, 'userid' => $userid, 'element' => 'objectivemeasurestatus']);
+ array('scoid' => $sco->id, 'userid' => $userid, 'element' => 'objectivemeasurestatus'));
if ((!isset($r->value) && !$checknot) || (isset($r->value) && ($r->value == $checknot))) {
$res = true;
}
@@ -472,10 +472,10 @@ function exescorm_evaluate_condition ($rollupruleconds, $sco, $userid) {
case 'completed':
$r = $DB->get_record('exescorm_scoes_track',
- ['scoid' => $sco->id, 'userid' => $userid, 'element' => 'attemptcompletionstatus']);
+ array('scoid' => $sco->id, 'userid' => $userid, 'element' => 'attemptcompletionstatus'));
if ((!isset($r->value) && !$checknot) || (isset($r->value) && ($r->value == $checknot))) {
$r = $DB->get_record('exescorm_scoes_track',
- ['scoid' => $sco->id, 'userid' => $userid, 'element' => 'attemptprogressstatus']);
+ array('scoid' => $sco->id, 'userid' => $userid, 'element' => 'attemptprogressstatus'));
if ((!isset($r->value) && !$checknot) || (isset($r->value) && ($r->value == $checknot))) {
$res = true;
}
@@ -484,7 +484,7 @@ function exescorm_evaluate_condition ($rollupruleconds, $sco, $userid) {
case 'attempted':
$attempt = $DB->get_field('exescorm_scoes_track', 'attempt',
- ['scoid' => $sco->id, 'userid' => $userid, 'element' => 'x.start.time']);
+ array('scoid' => $sco->id, 'userid' => $userid, 'element' => 'x.start.time'));
if ($checknot && $attempt > 0) {
$res = true;
} else if (!$checknot && $attempt <= 0) {
@@ -494,13 +494,13 @@ function exescorm_evaluate_condition ($rollupruleconds, $sco, $userid) {
case 'attemptLimitExceeded':
$r = $DB->get_record('exescorm_scoes_track',
- ['scoid' => $sco->id, 'userid' => $userid, 'element' => 'activityprogressstatus']);
+ array('scoid' => $sco->id, 'userid' => $userid, 'element' => 'activityprogressstatus'));
if ((!isset($r->value) && !$checknot) || (isset($r->value) && ($r->value == $checknot))) {
$r = $DB->get_record('exescorm_scoes_track',
[
'scoid' => $sco->id,
'userid' => $userid,
- 'element' => 'limitconditionattemptlimitcontrol',
+ 'element' => 'limitconditionattemptlimitcontrol'
]
);
if ((!isset($r->value) && !$checknot) || (isset($r->value) && ($r->value == $checknot))) {
@@ -509,7 +509,7 @@ function exescorm_evaluate_condition ($rollupruleconds, $sco, $userid) {
[
'scoid' => $sco->id,
'userid' => $userid,
- 'element' => 'limitconditionattemptlimit',
+ 'element' => 'limitconditionattemptlimit'
]
)
) {
@@ -525,10 +525,10 @@ function exescorm_evaluate_condition ($rollupruleconds, $sco, $userid) {
case 'activityProgressKnown':
$r = $DB->get_record('exescorm_scoes_track',
- ['scoid' => $sco->id, 'userid' => $userid, 'element' => 'activityprogressstatus']);
+ array('scoid' => $sco->id, 'userid' => $userid, 'element' => 'activityprogressstatus'));
if ((!isset($r->value) && !$checknot) || (isset($r->value) && ($r->value == $checknot))) {
$r = $DB->get_record('exescorm_scoes_track',
- ['scoid' => $sco->id, 'userid' => $userid, 'element' => 'attemptprogressstatus']);
+ array('scoid' => $sco->id, 'userid' => $userid, 'element' => 'attemptprogressstatus'));
if ((!isset($r->value) && !$checknot) || (isset($r->value) && ($r->value == $checknot))) {
$res = true;
}
@@ -570,7 +570,7 @@ function exescorm_limit_cond_check ($activity, $userid) {
if (!isset($activity->limitcontrol) || ($activity->limitcontrol == 1)) {
$r = $DB->get_record('exescorm_scoes_track',
- ['scoid' => $activity->id, 'userid' => $userid, 'element' => 'activityattemptcount']);
+ array('scoid' => $activity->id, 'userid' => $userid, 'element' => 'activityattemptcount'));
if (exescorm_seq_is('activityprogressstatus', $activity->id, $userid) && ($r->value >= $activity->limitattempt)) {
return true;
}
@@ -578,7 +578,7 @@ function exescorm_limit_cond_check ($activity, $userid) {
if (!isset($activity->limitabsdurcontrol) || ($activity->limitabsdurcontrol == 1)) {
$r = $DB->get_record('exescorm_scoes_track',
- ['scoid' => $activity->id, 'userid' => $userid, 'element' => 'activityabsoluteduration']);
+ array('scoid' => $activity->id, 'userid' => $userid, 'element' => 'activityabsoluteduration'));
if (exescorm_seq_is('activityprogressstatus', $activity->id, $userid) && ($r->value >= $activity->limitabsduration)) {
return true;
}
@@ -586,7 +586,7 @@ function exescorm_limit_cond_check ($activity, $userid) {
if (!isset($activity->limitexpdurcontrol) || ($activity->limitexpdurcontrol == 1)) {
$r = $DB->get_record('exescorm_scoes_track',
- ['scoid' => $activity->id, 'userid' => $userid, 'element' => 'activityexperiencedduration']);
+ array('scoid' => $activity->id, 'userid' => $userid, 'element' => 'activityexperiencedduration'));
if (exescorm_seq_is('activityprogressstatus', $activity->id, $userid) && ($r->value >= $activity->limitexpduration)) {
return true;
}
@@ -594,7 +594,7 @@ function exescorm_limit_cond_check ($activity, $userid) {
if (!isset($activity->limitattabsdurcontrol) || ($activity->limitattabsdurcontrol == 1)) {
$r = $DB->get_record('exescorm_scoes_track',
- ['scoid' => $activity->id, 'userid' => $userid, 'element' => 'attemptabsoluteduration']);
+ array('scoid' => $activity->id, 'userid' => $userid, 'element' => 'attemptabsoluteduration'));
if (exescorm_seq_is('activityprogressstatus', $activity->id, $userid) && ($r->value >= $activity->limitattabsduration)) {
return true;
}
@@ -602,7 +602,7 @@ function exescorm_limit_cond_check ($activity, $userid) {
if (!isset($activity->limitattexpdurcontrol) || ($activity->limitattexpdurcontrol == 1)) {
$r = $DB->get_record('exescorm_scoes_track',
- ['scoid' => $activity->id, 'userid' => $userid, 'element' => 'attemptexperiencedduration']);
+ array('scoid' => $activity->id, 'userid' => $userid, 'element' => 'attemptexperiencedduration'));
if (exescorm_seq_is('activityprogressstatus', $activity->id, $userid) && ($r->value >= $activity->limitattexpduration)) {
return true;
}
@@ -610,7 +610,7 @@ function exescorm_limit_cond_check ($activity, $userid) {
if (!isset($activity->limitbegincontrol) || ($activity->limitbegincontrol == 1)) {
$r = $DB->get_record('exescorm_scoes_track',
- ['scoid' => $activity->id, 'userid' => $userid, 'element' => 'begintime']);
+ array('scoid' => $activity->id, 'userid' => $userid, 'element' => 'begintime'));
if (isset($activity->limitbegintime) && time() >= $activity->limitbegintime) {
return true;
}
@@ -634,7 +634,7 @@ function exescorm_seq_rules_check ($sco, $action) {
global $DB;
$act = null;
- if ($rules = $DB->get_records('exescorm_seq_ruleconds', ['scoid' => $sco->id, 'action' => $action])) {
+ if ($rules = $DB->get_records('exescorm_seq_ruleconds', array('scoid' => $sco->id, 'action' => $action))) {
foreach ($rules as $rule) {
if ($act = exescorm_seq_rule_check($sco, $rule)) {
return $act;
@@ -648,9 +648,9 @@ function exescorm_seq_rules_check ($sco, $action) {
function exescorm_seq_rule_check ($sco, $rule) {
global $DB;
- $bag = [];
+ $bag = Array();
$cond = '';
- $ruleconds = $DB->get_records('exescorm_seq_rulecond', ['scoid' => $sco->id, 'ruleconditionsid' => $rule->id]);
+ $ruleconds = $DB->get_records('exescorm_seq_rulecond', array('scoid' => $sco->id, 'ruleconditionsid' => $rule->id));
foreach ($ruleconds as $rulecond) {
if ($rulecond->operator == 'not') {
if ($rulecond->cond != 'unknown' ) {
@@ -695,7 +695,7 @@ function exescorm_seq_measure_rollup($sco, $userid, $attempt = 0) {
$valid = false; // Same as in the last line.
$countedmeasures = 0; // Same too.
$targetobjective = null;
- $objectives = $DB->get_records('exescorm_seq_objective', ['scoid' => $sco->id]);
+ $objectives = $DB->get_records('exescorm_seq_objective', array('scoid' => $sco->id));
foreach ($objectives as $objective) {
if ($objective->primaryobj == true) { // Objective contributes to rollup.
@@ -711,7 +711,7 @@ function exescorm_seq_measure_rollup($sco, $userid, $attempt = 0) {
$child = exescorm_get_sco ($child);
if (!isset($child->tracked) || ($child->tracked == 1)) {
$rolledupobjective = null;// We set the rolled up activity to undefined.
- $objectives = $DB->get_records('exescorm_seq_objective', ['scoid' => $child->id]);
+ $objectives = $DB->get_records('exescorm_seq_objective', array('scoid' => $child->id));
foreach ($objectives as $objective) {
if ($objective->primaryobj == true) {// Objective contributes to rollup I'm using primaryobj field, but not.
$rolledupobjective = $objective;
@@ -723,7 +723,7 @@ function exescorm_seq_measure_rollup($sco, $userid, $attempt = 0) {
$countedmeasures = $countedmeasures + ($child->measureweight);
if (!exescorm_seq_is('objectivemeasurestatus', $sco->id, $userid, $attempt)) {
$normalizedmeasure = $DB->get_record('exescorm_scoes_track',
- ['scoid' => $child->id, 'userid' => $userid, 'element' => 'objectivenormalizedmeasure']);
+ array('scoid' => $child->id, 'userid' => $userid, 'element' => 'objectivenormalizedmeasure'));
$totalmeasure = $totalmeasure + (($normalizedmeasure->value) * ($child->measureweight));
$valid = true;
}
@@ -759,7 +759,7 @@ function exescorm_seq_objective_rollup_measure($sco, $userid, $attempt = 0) {
$targetobjective = null;
- $objectives = $DB->get_records('exescorm_seq_objective', ['scoid' => $sco->id]);
+ $objectives = $DB->get_records('exescorm_seq_objective', array('scoid' => $sco->id));
foreach ($objectives as $objective) {
if ($objective->primaryobj == true) {
$targetobjective = $objective;
@@ -778,7 +778,7 @@ function exescorm_seq_objective_rollup_measure($sco, $userid, $attempt = 0) {
}
$normalizedmeasure = $DB->get_record('exescorm_scoes_track',
- ['scoid' => $sco->id, 'userid' => $userid, 'element' => 'objectivenormalizedmeasure']);
+ array('scoid' => $sco->id, 'userid' => $userid, 'element' => 'objectivenormalizedmeasure'));
$sco = exescorm_get_sco ($sco->id);
@@ -805,9 +805,9 @@ function exescorm_seq_objective_rollup_default($sco, $userid, $attempt = 0) {
if (! (exescorm_seq_rollup_rule_check($sco, $userid, 'incomplete')) &&
! (exescorm_seq_rollup_rule_check($sco, $userid, 'completed'))
) {
- if ($rolluprules = $DB->get_record('exescorm_seq_rolluprule', ['scoid' => $sco->id])) {
+ if ($rolluprules = $DB->get_record('exescorm_seq_rolluprule', array('scoid' => $sco->id))) {
foreach ($rolluprules as $rolluprule) {
- $rollupruleconds = $DB->get_records('exescorm_seq_rllprlcond', ['rollupruleid' => $rolluprule->id]);
+ $rollupruleconds = $DB->get_records('exescorm_seq_rllprlcond', array('rollupruleid' => $rolluprule->id));
foreach ($rollupruleconds as $rolluprulecond) {
if ($rolluprulecond->cond != 'satisfied' && $rolluprulecond->cond != 'completed' &&
$rolluprulecond->cond != 'attempted') {
@@ -826,7 +826,7 @@ function exescorm_seq_objective_rollup_rules($sco, $userid, $attempt = 0) {
$targetobjective = null;
- $objectives = $DB->get_records('exescorm_seq_objective', ['scoid' => $sco->id]);
+ $objectives = $DB->get_records('exescorm_seq_objective', array('scoid' => $sco->id));
foreach ($objectives as $objective) {
if ($objective->primaryobj == true) {// Objective contributes to rollup I'm using primaryobj field, but not.
$targetobjective = $objective;
@@ -867,8 +867,8 @@ function exescorm_seq_activity_progress_rollup ($sco, $userid, $seq) {
function exescorm_seq_rollup_rule_check ($sco, $userid, $action) {
global $DB;
- if ($rolluprules = $DB->get_record('exescorm_seq_rolluprule', ['scoid' => $sco->id, 'action' => $action])) {
- $childrenbag = [];
+ if ($rolluprules = $DB->get_record('exescorm_seq_rolluprule', array('scoid' => $sco->id, 'action' => $action))) {
+ $childrenbag = Array ();
$children = exescorm_get_children ($sco);
foreach ($rolluprules as $rolluprule) {
@@ -876,7 +876,7 @@ function exescorm_seq_rollup_rule_check ($sco, $userid, $action) {
$child = exescorm_get_sco ($child);
if (!isset($child->tracked) || ($child->tracked == 1)) {
if (exescorm_seq_check_child ($child, $action, $userid)) {
- $rollupruleconds = $DB->get_records('exescorm_seq_rllprlcond', ['rollupruleid' => $rolluprule->id]);
+ $rollupruleconds = $DB->get_records('exescorm_seq_rllprlcond', array('rollupruleid' => $rolluprule->id));
$evaluate = exescorm_seq_evaluate_rollupcond($child, $rolluprule->conditioncombination,
$rollupruleconds, $userid);
if ($evaluate == 'unknown') {
@@ -968,7 +968,7 @@ function exescorm_seq_flow_tree_traversal($activity, $direction, $childrenflag,
if (!empty($parent)) {
$children = exescorm_get_available_children($parent);
} else {
- $children = [];
+ $children = array();
}
$childrensize = count($children);
@@ -981,7 +981,7 @@ function exescorm_seq_flow_tree_traversal($activity, $direction, $childrenflag,
if ($direction == 'forward') {
$ancestors = exescorm_get_ancestors($activity);
$ancestorsroot = array_reverse($ancestors);
- $preorder = [];
+ $preorder = array();
$preorder = exescorm_get_preorder($preorder, $ancestorsroot[0]);
$preordersize = count($preorder);
if (($activity->id == $preorder[$preordersize - 1]->id) || (($activity->parent == '/') && !($childrenflag))) {
@@ -1050,7 +1050,7 @@ function exescorm_seq_flow_tree_traversal($activity, $direction, $childrenflag,
} else {
$ancestors = exescorm_get_ancestors($activity);
$ancestorsroot = array_reverse($ancestors);
- $preorder = [];
+ $preorder = array();
$preorder = exescorm_get_preorder($preorder, $ancestorsroot[0]);
$position = 0;
foreach ($preorder as $sco) {
@@ -1227,7 +1227,7 @@ function get_exescorm_default (&$userdata, $exescorm, $scoid, $attempt, $mode) {
$userdata->credit = 'no-credit';
}
- $objectives = $DB->get_records('exescorm_seq_objective', ['scoid' => $scoid]);
+ $objectives = $DB->get_records('exescorm_seq_objective', array('scoid' => $scoid));
$index = 0;
foreach ($objectives as $objective) {
if (!empty($objective->minnormalizedmeasure)) {
@@ -1239,7 +1239,7 @@ function get_exescorm_default (&$userdata, $exescorm, $scoid, $attempt, $mode) {
}
}
- $def = [];
+ $def = array();
$def['cmi.learner_id'] = $userdata->student_id;
$def['cmi.learner_name'] = $userdata->student_name;
$def['cmi.mode'] = $userdata->mode;
diff --git a/datamodels/scormlib.php b/datamodels/scormlib.php
index b3f35ab..2a0c479 100644
--- a/datamodels/scormlib.php
+++ b/datamodels/scormlib.php
@@ -23,7 +23,7 @@
*/
function exescorm_get_resources($blocks) {
- $resources = [];
+ $resources = array();
foreach ($blocks as $block) {
if ($block['name'] == 'RESOURCES' && isset($block['children'])) {
foreach ($block['children'] as $resource) {
@@ -38,13 +38,13 @@ function exescorm_get_resources($blocks) {
function exescorm_get_manifest($blocks, $scoes) {
global $OUTPUT;
- static $parents = [];
+ static $parents = array();
static $resources;
static $manifest;
static $organization;
- $manifestresourcesnotfound = [];
+ $manifestresourcesnotfound = array();
if (count($blocks) > 0) {
foreach ($blocks as $block) {
switch ($block['name']) {
@@ -72,7 +72,7 @@ function exescorm_get_manifest($blocks, $scoes) {
case 'MANIFEST':
$manifest = $block['attrs']['IDENTIFIER'];
$organization = '';
- $resources = [];
+ $resources = array();
$resources = exescorm_get_resources($block['children']);
$scoes = exescorm_get_manifest($block['children'], $scoes);
if (empty($scoes->elements) || count($scoes->elements) <= 0) {
@@ -106,7 +106,7 @@ function exescorm_get_manifest($blocks, $scoes) {
$scoes->elements[$manifest][$organization][$identifier]->launch = '';
$scoes->elements[$manifest][$organization][$identifier]->exescormtype = '';
- $parents = [];
+ $parents = array();
$parent = new stdClass();
$parent->identifier = $identifier;
$parent->organization = $organization;
@@ -331,7 +331,7 @@ function exescorm_get_manifest($blocks, $scoes) {
}
}
if ($sequencing['name'] == 'IMSSS:OBJECTIVES') {
- $objectives = [];
+ $objectives = array();
foreach ($sequencing['children'] as $objective) {
$objectivedata = new stdClass();
$objectivedata->primaryobj = 0;
@@ -350,7 +350,7 @@ function exescorm_get_manifest($blocks, $scoes) {
}
$objectivedata->minnormalizedmeasure = 1.0;
if (!empty($objective['children'])) {
- $mapinfos = [];
+ $mapinfos = array();
foreach ($objective['children'] as $objectiveparam) {
if ($objectiveparam['name'] == 'IMSSS:MINNORMALIZEDMEASURE') {
if (isset($objectiveparam['tagData'])) {
@@ -429,7 +429,7 @@ function exescorm_get_manifest($blocks, $scoes) {
}
if (!empty($sequencing['children'])) {
- $rolluprules = [];
+ $rolluprules = array();
foreach ($sequencing['children'] as $sequencingrolluprule) {
if ($sequencingrolluprule['name'] == 'IMSSS:ROLLUPRULE' ) {
$rolluprule = new stdClass();
@@ -448,7 +448,7 @@ function exescorm_get_manifest($blocks, $scoes) {
if (!empty($sequencingrolluprule['children'])) {
foreach ($sequencingrolluprule['children'] as $rolluproleconditions) {
if ($rolluproleconditions['name'] == 'IMSSS:ROLLUPCONDITIONS') {
- $conditions = [];
+ $conditions = array();
$rolluprule->conditioncombination = 'all';
if (isset($rolluproleconditions['attrs']['CONDITIONCOMBINATION'])) {
$rolluprule->CONDITIONCOMBINATION =
@@ -485,7 +485,7 @@ function exescorm_get_manifest($blocks, $scoes) {
if ($sequencing['name'] == 'IMSSS:SEQUENCINGRULES') {
if (!empty($sequencing['children'])) {
- $sequencingrules = [];
+ $sequencingrules = array();
foreach ($sequencing['children'] as $conditionrules) {
$conditiontype = -1;
switch($conditionrules['name']) {
@@ -503,7 +503,7 @@ function exescorm_get_manifest($blocks, $scoes) {
$sequencingrule = new stdClass();
foreach ($conditionrules['children'] as $conditionrule) {
if ($conditionrule['name'] == 'IMSSS:RULECONDITIONS') {
- $ruleconditions = [];
+ $ruleconditions = array();
$sequencingrule->conditioncombination = 'all';
if (isset($conditionrule['attrs']['CONDITIONCOMBINATION'])) {
$sequencingrule->conditioncombination =
@@ -595,10 +595,10 @@ function exescorm_parse_scorm(&$exescorm, $manifest) {
$scoes = new stdClass();
$scoes->version = '';
$scoes = exescorm_get_manifest($manifests, $scoes);
- $newscoes = [];
+ $newscoes = array();
$sortorder = 0;
if (!empty($scoes->elements) && is_iterable($scoes->elements)) {
- $olditems = $DB->get_records('exescorm_scoes', ['exescorm' => $exescorm->id]);
+ $olditems = $DB->get_records('exescorm_scoes', array('exescorm' => $exescorm->id));
foreach ($scoes->elements as $manifest => $organizations) {
foreach ($organizations as $organization => $items) {
foreach ($items as $identifier => $item) {
@@ -609,7 +609,7 @@ function exescorm_parse_scorm(&$exescorm, $manifest) {
$newitem->manifest = $manifest;
$newitem->organization = $organization;
$newitem->sortorder = $sortorder;
- $standarddatas = ['parent', 'identifier', 'launch', 'exescormtype', 'title'];
+ $standarddatas = array('parent', 'identifier', 'launch', 'exescormtype', 'title');
foreach ($standarddatas as $standarddata) {
if (isset($item->$standarddata)) {
$newitem->$standarddata = $item->$standarddata;
@@ -632,13 +632,13 @@ function exescorm_parse_scorm(&$exescorm, $manifest) {
$DB->update_record('exescorm_scoes', $newitem);
$id = $olditemid;
// Remove all old data so we don't duplicate it.
- $DB->delete_records('exescorm_scoes_data', ['scoid' => $olditemid]);
- $DB->delete_records('exescorm_seq_objective', ['scoid' => $olditemid]);
- $DB->delete_records('exescorm_seq_mapinfo', ['scoid' => $olditemid]);
- $DB->delete_records('exescorm_seq_ruleconds', ['scoid' => $olditemid]);
- $DB->delete_records('exescorm_seq_rulecond', ['scoid' => $olditemid]);
- $DB->delete_records('exescorm_seq_rolluprule', ['scoid' => $olditemid]);
- $DB->delete_records('exescorm_seq_rllprlcond', ['scoid' => $olditemid]);
+ $DB->delete_records('exescorm_scoes_data', array('scoid' => $olditemid));
+ $DB->delete_records('exescorm_seq_objective', array('scoid' => $olditemid));
+ $DB->delete_records('exescorm_seq_mapinfo', array('scoid' => $olditemid));
+ $DB->delete_records('exescorm_seq_ruleconds', array('scoid' => $olditemid));
+ $DB->delete_records('exescorm_seq_rulecond', array('scoid' => $olditemid));
+ $DB->delete_records('exescorm_seq_rolluprule', array('scoid' => $olditemid));
+ $DB->delete_records('exescorm_seq_rllprlcond', array('scoid' => $olditemid));
// Now remove this SCO from the olditems object as we have dealt with it.
unset($olditems[$olditemid]);
@@ -740,21 +740,21 @@ function exescorm_parse_scorm(&$exescorm, $manifest) {
}
if (!empty($olditems)) {
foreach ($olditems as $olditem) {
- $DB->delete_records('exescorm_scoes', ['id' => $olditem->id]);
- $DB->delete_records('exescorm_scoes_data', ['scoid' => $olditem->id]);
- $DB->delete_records('exescorm_scoes_track', ['scoid' => $olditem->id]);
- $DB->delete_records('exescorm_seq_objective', ['scoid' => $olditem->id]);
- $DB->delete_records('exescorm_seq_mapinfo', ['scoid' => $olditem->id]);
- $DB->delete_records('exescorm_seq_ruleconds', ['scoid' => $olditem->id]);
- $DB->delete_records('exescorm_seq_rulecond', ['scoid' => $olditem->id]);
- $DB->delete_records('exescorm_seq_rolluprule', ['scoid' => $olditem->id]);
- $DB->delete_records('exescorm_seq_rllprlcond', ['scoid' => $olditem->id]);
+ $DB->delete_records('exescorm_scoes', array('id' => $olditem->id));
+ $DB->delete_records('exescorm_scoes_data', array('scoid' => $olditem->id));
+ $DB->delete_records('exescorm_scoes_track', array('scoid' => $olditem->id));
+ $DB->delete_records('exescorm_seq_objective', array('scoid' => $olditem->id));
+ $DB->delete_records('exescorm_seq_mapinfo', array('scoid' => $olditem->id));
+ $DB->delete_records('exescorm_seq_ruleconds', array('scoid' => $olditem->id));
+ $DB->delete_records('exescorm_seq_rulecond', array('scoid' => $olditem->id));
+ $DB->delete_records('exescorm_seq_rolluprule', array('scoid' => $olditem->id));
+ $DB->delete_records('exescorm_seq_rllprlcond', array('scoid' => $olditem->id));
}
}
if (empty($scoes->version)) {
$scoes->version = 'SCORM_1.2';
}
- $DB->set_field('exescorm', 'version', $scoes->version, ['id' => $exescorm->id]);
+ $DB->set_field('exescorm', 'version', $scoes->version, array('id' => $exescorm->id));
$exescorm->version = $scoes->version;
}
$exescorm->launch = 0;
@@ -776,7 +776,7 @@ function exescorm_parse_scorm(&$exescorm, $manifest) {
// No valid Launch is specified - find the first launchable sco instead.
$sqlselect = 'exescorm = ? AND '.$DB->sql_isnotempty('exescorm_scoes', 'launch', false, true);
// We use get_records here as we need to pass a limit in the query that works cross db.
- $scoes = $DB->get_records_select('exescorm_scoes', $sqlselect, [$exescorm->id], 'sortorder', 'id', 0, 1);
+ $scoes = $DB->get_records_select('exescorm_scoes', $sqlselect, array($exescorm->id), 'sortorder', 'id', 0, 1);
if (!empty($scoes)) {
$sco = reset($scoes); // We only care about the first record - the above query only returns one.
$exescorm->launch = $sco->id;
@@ -787,8 +787,8 @@ function exescorm_parse_scorm(&$exescorm, $manifest) {
}
function exescorm_optionals_data($item, $standarddata) {
- $result = [];
- $sequencingdata = ['sequencingrules', 'rolluprules', 'objectives'];
+ $result = array();
+ $sequencingdata = array('sequencingrules', 'rolluprules', 'objectives');
foreach ($item as $element => $value) {
if (! in_array($element, $standarddata)) {
if (! in_array($element, $sequencingdata)) {
@@ -880,7 +880,7 @@ function exescorm_get_siblings($sco) {
}
// Get an array that contains all the parent scos for this sco.
function exescorm_get_ancestors($sco) {
- $ancestors = [];
+ $ancestors = array();
$continue = true;
while ($continue) {
$ancestor = exescorm_get_parent($sco);
@@ -897,7 +897,7 @@ function exescorm_get_ancestors($sco) {
return $ancestors;
}
-function exescorm_get_preorder(&$preorder = [], $sco = null) {
+function exescorm_get_preorder(&$preorder = array(), $sco = null) {
if ($sco != null) {
array_push($preorder, $sco);
if ($children = exescorm_get_children($sco)) {
@@ -929,7 +929,7 @@ function exescorm_find_common_ancestor($ancestors, $sco) {
*/
class xml2Array {
- public $arroutput = [];
+ public $arroutput = array();
public $resparser;
public $strxmldata;
@@ -943,7 +943,7 @@ public function utf8_to_entities($str) {
global $CFG;
$entities = '';
- $values = [];
+ $values = array();
$lookingfor = 1;
return $str;
@@ -975,7 +975,7 @@ public function parse($strinputxml) {
}
public function tagopen($parser, $name, $attrs) {
- $tag = ["name" => $name, "attrs" => $attrs];
+ $tag = array("name" => $name, "attrs" => $attrs);
array_push($this->arroutput, $tag);
}
diff --git a/datamodels/sequencinghandler.php b/datamodels/sequencinghandler.php
index 0b90687..886966c 100644
--- a/datamodels/sequencinghandler.php
+++ b/datamodels/sequencinghandler.php
@@ -26,18 +26,18 @@
if (!empty($id)) {
$cm = get_coursemodule_from_id('exescorm', $id, 0, false, MUST_EXIST);
- $course = $DB->get_record("course", ["id" => $cm->course], '*', MUST_EXIST);
- $exescorm = $DB->get_record("exescorm", ["id" => $cm->instance], '*', MUST_EXIST);
+ $course = $DB->get_record("course", array("id" => $cm->course), '*', MUST_EXIST);
+ $exescorm = $DB->get_record("exescorm", array("id" => $cm->instance), '*', MUST_EXIST);
} else if (!empty($a)) {
- $exescorm = $DB->get_record("exescorm", ["id" => $a], '*', MUST_EXIST);
- $course = $DB->get_record("course", ["id" => $exescorm->course], '*', MUST_EXIST);
+ $exescorm = $DB->get_record("exescorm", array("id" => $a), '*', MUST_EXIST);
+ $course = $DB->get_record("course", array("id" => $exescorm->course), '*', MUST_EXIST);
$cm = get_coursemodule_from_instance("exescorm", $exescorm->id, $course->id, false, MUST_EXIST);
} else {
throw new \moodle_exception('missingparameter');
}
$PAGE->set_url('/mod/exescorm/datamodels/sequencinghandler.php',
- ['scoid' => $scoid, 'attempt' => $attempt, 'id' => $cm->id, 'function' => $function, 'request' => $request]);
+ array('scoid' => $scoid, 'attempt' => $attempt, 'id' => $cm->id, 'function' => $function, 'request' => $request));
require_login($course, false, $cm);
diff --git a/datamodels/sequencinglib.php b/datamodels/sequencinglib.php
index 7650ec4..3cb7aad 100644
--- a/datamodels/sequencinglib.php
+++ b/datamodels/sequencinglib.php
@@ -64,7 +64,7 @@ function exescorm_seq_post_cond_rules($seq, $userid) {
function exescorm_seq_evaluate_rollupcond($sco, $conditioncombination, $rollupruleconds, $userid) {
- $bag = [];
+ $bag = Array();
$con = "";
$val = false;
$unk = false;
@@ -242,7 +242,7 @@ function exescorm_seq_start_sequencing($scoid, $userid, $seq) {
$seq->exception = 'SB.2.5-1';
return $seq;
}
- $sco = $DB->get_record('exescorm_scoes', ['scoid' => $scoid, 'userid' => $userid]);
+ $sco = $DB->get_record('exescorm_scoes', array('scoid' => $scoid, 'userid' => $userid));
if (($sco->parent == '/') && exescorm_is_leaf($sco)) { // If the activity is the root and is leaf.
$seq->delivery = $sco;
} else {
@@ -270,7 +270,7 @@ function exescorm_seq_resume_all_sequencing($scoid, $userid, $seq) {
return $seq;
}
// We assign the sco to the delivery.
- $seq->delivery = $DB->get_record('exescorm_scoes', ['scoid' => $scoid, 'userid' => $userid]);
+ $seq->delivery = $DB->get_record('exescorm_scoes', array('scoid' => $scoid, 'userid' => $userid));
}
function exescorm_seq_continue_sequencing($scoid, $userid, $seq) {
@@ -373,7 +373,7 @@ function exescorm_seq_retry_sequencing($scoid, $userid, $seq) {
function exescorm_seq_choice_sequencing($sco, $userid, $seq) {
- $avchildren = [];
+ $avchildren = Array ();
$comancestor = null;
$traverse = null;
@@ -546,7 +546,7 @@ function exescorm_seq_choice_sequencing($sco, $userid, $seq) {
}
$seq = exescorm_seq_choice_flow($constrained, $traverse, $seq);
$actconsider = $seq->identifiedactivity;
- $avdescendents = [];
+ $avdescendents = Array();
$avdescendents = exescorm_get_available_descendents($actconsider);
if (array_search ($avdescendents, $sco) !== false && $sco->id != $actconsider->id && $constrained->id != $sco->id ) {
$seq->delivery = null;
@@ -755,9 +755,9 @@ function exescorm_content_delivery_environment($seq, $userid) {
$seq->exception = 'DB.2-1';
return $seq;
}
- $track = $DB->get_record('exescorm_scoes_track', ['scoid' => $act->id,
+ $track = $DB->get_record('exescorm_scoes_track', array('scoid' => $act->id,
'userid' => $userid,
- 'element' => 'suspendedactivity']);
+ 'element' => 'suspendedactivity'));
if ($track != null) {
$seq = exescorm_clear_suspended_activity($seq->delivery, $seq, $userid);
@@ -770,9 +770,9 @@ function exescorm_content_delivery_environment($seq, $userid) {
if (!exescorm_seq_is('active', $activity->id, $userid)) {
if (!isset($activity->tracked) || ($activity->tracked == 1)) {
if (!exescorm_seq_is('suspended', $activity->id, $userid)) {
- $r = $DB->get_record('exescorm_scoes_track', ['scoid' => $activity->id,
+ $r = $DB->get_record('exescorm_scoes_track', array('scoid' => $activity->id,
'userid' => $userid,
- 'element' => 'activityattemptcount']);
+ 'element' => 'activityattemptcount'));
$r->value = ($r->value) + 1;
$DB->update_record('exescorm_scoes_track', $r);
if ($r->value == 1) {
@@ -809,12 +809,12 @@ function exescorm_content_delivery_environment($seq, $userid) {
if (isset($activity->tracked) || ($activity->tracked == 0)) {
// How should I track the info and what should I do to not record the information for the activity during delivery?
- $atabsdur = $DB->get_record('exescorm_scoes_track', ['scoid' => $activity->id,
+ $atabsdur = $DB->get_record('exescorm_scoes_track', array('scoid' => $activity->id,
'userid' => $userid,
- 'element' => 'attemptabsoluteduration']);
- $atexpdur = $DB->get_record('exescorm_scoes_track', ['scoid' => $activity->id,
+ 'element' => 'attemptabsoluteduration'));
+ $atexpdur = $DB->get_record('exescorm_scoes_track', array('scoid' => $activity->id,
'userid' => $userid,
- 'element' => 'attemptexperiencedduration']);
+ 'element' => 'attemptexperiencedduration'));
}
return $seq;
}
@@ -822,9 +822,9 @@ function exescorm_content_delivery_environment($seq, $userid) {
function exescorm_clear_suspended_activity($act, $seq, $userid) {
global $DB;
$currentact = $seq->currentactivity;
- $track = $DB->get_record('exescorm_scoes_track', ['scoid' => $currentact->id,
+ $track = $DB->get_record('exescorm_scoes_track', array('scoid' => $currentact->id,
'userid' => $userid,
- 'element' => 'suspendedactivity']);
+ 'element' => 'suspendedactivity'));
if ($track != null) {
$ancestors = exescorm_get_ancestors($act);
$commonpos = exescorm_find_common_ancestor($ancestors, $currentact);
@@ -861,9 +861,9 @@ function exescorm_select_children_process($scoid, $userid) {
$sco = exescorm_get_sco($scoid);
if (!exescorm_is_leaf($sco)) {
if (!exescorm_seq_is('suspended', $scoid, $userid) && !exescorm_seq_is('active', $scoid, $userid)) {
- $r = $DB->get_record('exescorm_scoes_track', ['scoid' => $scoid,
+ $r = $DB->get_record('exescorm_scoes_track', array('scoid' => $scoid,
'userid' => $userid,
- 'element' => 'selectiontiming']);
+ 'element' => 'selectiontiming'));
switch ($r->value) {
case 'oneachnewattempt':
@@ -874,9 +874,9 @@ function exescorm_select_children_process($scoid, $userid) {
if (!exescorm_seq_is('activityprogressstatus', $scoid, $userid)) {
if (exescorm_seq_is('selectioncountsstatus', $scoid, $userid)) {
$childlist = '';
- $res = $DB->get_record('exescorm_scoes_track', ['scoid' => $scoid,
+ $res = $DB->get_record('exescorm_scoes_track', array('scoid' => $scoid,
'userid' => $userid,
- 'element' => 'selectioncount']);
+ 'element' => 'selectioncount'));
$i = ($res->value) - 1;
$children = exescorm_get_children($sco);
@@ -904,9 +904,9 @@ function exescorm_randomize_children_process($scoid, $userid) {
$sco = exescorm_get_sco($scoid);
if (!exescorm_is_leaf($sco)) {
if (!exescorm_seq_is('suspended', $scoid, $userid) && !exescorm_seq_is('active', $scoid, $userid)) {
- $r = $DB->get_record('exescorm_scoes_track', ['scoid' => $scoid,
+ $r = $DB->get_record('exescorm_scoes_track', array('scoid' => $scoid,
'userid' => $userid,
- 'element' => 'randomizationtiming']);
+ 'element' => 'randomizationtiming'));
switch ($r->value) {
case 'never':
@@ -916,7 +916,7 @@ function exescorm_randomize_children_process($scoid, $userid) {
case 'once':
if (!exescorm_seq_is('activityprogressstatus', $scoid, $userid)) {
if (exescorm_seq_is('randomizechildren', $scoid, $userid)) {
- $childlist = [];
+ $childlist = array();
$res = exescorm_get_available_children($sco);
$i = count($res) - 1;
$children = $res->value;
diff --git a/db/access.php b/db/access.php
index 18ccf96..99242b2 100644
--- a/db/access.php
+++ b/db/access.php
@@ -24,78 +24,78 @@
defined('MOODLE_INTERNAL') || die();
-$capabilities = [
+$capabilities = array(
- 'mod/exescorm:addinstance' => [
+ 'mod/exescorm:addinstance' => array(
'riskbitmask' => RISK_XSS,
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
- 'archetypes' => [
+ 'archetypes' => array(
'editingteacher' => CAP_ALLOW,
- 'manager' => CAP_ALLOW,
- ],
- 'clonepermissionsfrom' => 'moodle/course:manageactivities',
- ],
+ 'manager' => CAP_ALLOW
+ ),
+ 'clonepermissionsfrom' => 'moodle/course:manageactivities'
+ ),
- 'mod/exescorm:viewreport' => [
+ 'mod/exescorm:viewreport' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
- 'archetypes' => [
+ 'archetypes' => array(
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
- 'manager' => CAP_ALLOW,
- ],
- ],
+ 'manager' => CAP_ALLOW
+ )
+ ),
- 'mod/exescorm:skipview' => [
+ 'mod/exescorm:skipview' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
- 'archetypes' => [
- 'student' => CAP_ALLOW,
- ],
- ],
+ 'archetypes' => array(
+ 'student' => CAP_ALLOW
+ )
+ ),
- 'mod/exescorm:savetrack' => [
+ 'mod/exescorm:savetrack' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_MODULE,
- 'archetypes' => [
+ 'archetypes' => array(
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
- 'manager' => CAP_ALLOW,
- ],
- ],
+ 'manager' => CAP_ALLOW
+ )
+ ),
- 'mod/exescorm:viewscores' => [
+ 'mod/exescorm:viewscores' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
- 'archetypes' => [
+ 'archetypes' => array(
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
- 'manager' => CAP_ALLOW,
- ],
- ],
- 'mod/exescorm:deleteresponses' => [
+ 'manager' => CAP_ALLOW
+ )
+ ),
+ 'mod/exescorm:deleteresponses' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_MODULE,
- 'archetypes' => [
+ 'archetypes' => array(
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
- 'manager' => CAP_ALLOW,
- ],
- ],
- 'mod/exescorm:deleteownresponses' => [
+ 'manager' => CAP_ALLOW
+ )
+ ),
+ 'mod/exescorm:deleteownresponses' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_MODULE,
- 'archetypes' => [],
- ],
-];
+ 'archetypes' => array()
+ )
+);
diff --git a/db/tasks.php b/db/tasks.php
index 2542e65..bed6b2c 100644
--- a/db/tasks.php
+++ b/db/tasks.php
@@ -33,6 +33,6 @@
'hour' => '*',
'day' => '*',
'month' => '*',
- 'dayofweek' => '*',
+ 'dayofweek' => '*'
],
];
diff --git a/deprecatedlib.php b/deprecatedlib.php
index f25667e..c02c222 100644
--- a/deprecatedlib.php
+++ b/deprecatedlib.php
@@ -44,7 +44,7 @@ function exescorm_get_completion_state($course, $cm, $userid, $type) {
$result = $type;
// Get exescorm.
- if (!$exescorm = $DB->get_record('exescorm', ['id' => $cm->instance])) {
+ if (!$exescorm = $DB->get_record('exescorm', array('id' => $cm->instance))) {
throw new \moodle_exception('cannotfindexescorm');
}
// Only check for existence of tracks and return false if completionstatusrequired or completionscorerequired
@@ -72,7 +72,7 @@ function exescorm_get_completion_state($course, $cm, $userid, $type) {
'cmi.score.raw'
)
",
- [$exescorm->id, $userid]
+ array($exescorm->id, $userid)
);
if (!$tracks) {
@@ -87,9 +87,9 @@ function exescorm_get_completion_state($course, $cm, $userid, $type) {
$statuses = array_flip(exescorm_status_options());
$nstatus = 0;
// Check any track for these values.
- $scostatus = [];
+ $scostatus = array();
foreach ($tracks as $track) {
- if (!in_array($track->element, ['cmi.core.lesson_status', 'cmi.completion_status', 'cmi.success_status'])) {
+ if (!in_array($track->element, array('cmi.core.lesson_status', 'cmi.completion_status', 'cmi.success_status'))) {
continue;
}
if (array_key_exists($track->value, $statuses)) {
@@ -100,7 +100,7 @@ function exescorm_get_completion_state($course, $cm, $userid, $type) {
if (!empty($exescorm->completionstatusallscos)) {
// Iterate over all scos and make sure each has a lesson_status.
- $scos = $DB->get_records('exescorm_scoes', ['exescorm' => $exescorm->id, 'exescormtype' => 'sco']);
+ $scos = $DB->get_records('exescorm_scoes', array('exescorm' => $exescorm->id, 'exescormtype' => 'sco'));
foreach ($scos as $sco) {
if (empty($scostatus[$sco->id])) {
return completion_info::aggregate_completion_states($type, $result, false);
@@ -119,7 +119,7 @@ function exescorm_get_completion_state($course, $cm, $userid, $type) {
$maxscore = -1;
foreach ($tracks as $track) {
- if (!in_array($track->element, ['cmi.core.score.raw', 'cmi.score.raw'])) {
+ if (!in_array($track->element, array('cmi.core.score.raw', 'cmi.score.raw'))) {
continue;
}
diff --git a/docker-compose.yml b/docker-compose.yml
deleted file mode 100644
index a4a0741..0000000
--- a/docker-compose.yml
+++ /dev/null
@@ -1,89 +0,0 @@
----
-version: "3"
-services:
-
- exelearning-web:
- image: ghcr.io/exelearning/exelearning-web:latest
- # build: ${EXELEARNING_WEB_PATH:-} # If EXELEARNING_WEB_PATH is not defined, skip build
- ports:
- - 8080:8080
- restart: unless-stopped # Restart the container unless it is stopped manually
- volumes:
- - mnt-data:/mnt/data:rw # Mount the volume for persistent data
- environment:
- APP_ENV: prod
- APP_DEBUG: 0
- XDEBUG_MODE: off
- APP_SECRET: CHANGE_THIS_TO_A_SECRET
- PRE_CONFIGURE_COMMANDS:
- POST_CONFIGURE_COMMANDS: |
- echo "this is a test line 1"
- echo "this is a test line 2"
- php bin/console app:create-user test@exelearning.net testpassword testuser --no-fail
-
- moodle:
- image: erseco/alpine-moodle
- restart: unless-stopped
- environment:
- LANG: es_ES.UTF-8
- LANGUAGE: es_ES:es
- SITE_URL: http://localhost
- DB_TYPE: mariadb
- DB_HOST: db
- DB_PORT: 3306
- DB_NAME: moodle
- DB_USER: root
- DB_PASS: moodle
- DB_PREFIX: mdl_
- DEBUG: true
- MOODLE_EMAIL: test@exelearning.net
- MOODLE_LANGUAGE: es
- MOODLE_SITENAME: New-Site
- MOODLE_USERNAME: testuser
- MOODLE_PASSWORD: testpassword
- PRE_CONFIGURE_COMMANDS: |
- echo 'This is a pre-configure command'
- POST_CONFIGURE_COMMANDS: |
- echo 'This is a post-configure command'
- echo 'Forcing upgrade to re-install exe plugin...'
- php admin/cli/upgrade.php --non-interactive
- php admin/cli/cfg.php --component=exescorm --name=exeonlinebaseuri --set=http://localhost:8080
- php admin/cli/cfg.php --component=exescorm --name=hmackey1 --set=CHANGE_THIS_TO_A_SECRET
- ports:
- - 80:8080
- volumes:
- - moodledata:/var/www/moodledata
- - moodlehtml:/var/www/html
- - ./:/var/www/html/mod/exescorm:rw # Mount local plugin on the container
-
- depends_on:
- - db
-
- db:
- image: mariadb:10.6.7
- restart: unless-stopped # Restart the container unless it is stopped manually
- environment:
- MYSQL_DATABASE: moodle
- MYSQL_ROOT_PASSWORD: moodle
- volumes:
- - dbdata:/var/lib/mysql
-
- phpmyadmin:
- image: phpmyadmin
- ports:
- - 8002:80 # Maps the host's port 8002 to the container's port 80
- environment:
- PMA_HOST: db
- PMA_USER: root
- PMA_PASSWORD: moodle
- UPLOAD_LIMIT: 300M
- depends_on:
- - db
-
-volumes:
- dbdata:
- mnt-data:
- moodledata: null
- moodlehtml: null
-
-
diff --git a/get_ode.php b/get_ode.php
index f88d3dd..f6c1900 100644
--- a/get_ode.php
+++ b/get_ode.php
@@ -26,7 +26,7 @@
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
- use mod_exescorm\exeonline\token_manager;
+ use \mod_exescorm\exeonline\token_manager;
// @codingStandardsIgnoreLine as we validate via account id, HMAC keys, etc.
require_once(__DIR__ . '/../../config.php');
diff --git a/grade.php b/grade.php
index 4cebd5b..091dae7 100644
--- a/grade.php
+++ b/grade.php
@@ -31,11 +31,11 @@
throw new \moodle_exception('invalidcoursemodule');
}
-if (! $exescorm = $DB->get_record('exescorm', ['id' => $cm->instance])) {
+if (! $exescorm = $DB->get_record('exescorm', array('id' => $cm->instance))) {
throw new \moodle_exception('invalidcoursemodule');
}
-if (! $course = $DB->get_record('course', ['id' => $exescorm->course])) {
+if (! $course = $DB->get_record('course', array('id' => $exescorm->course))) {
throw new \moodle_exception('coursemisconf');
}
diff --git a/index.php b/index.php
index e907d65..56e6675 100644
--- a/index.php
+++ b/index.php
@@ -19,10 +19,10 @@
$id = required_param('id', PARAM_INT); // Course id.
-$PAGE->set_url('/mod/exescorm/index.php', ['id' => $id]);
+$PAGE->set_url('/mod/exescorm/index.php', array('id' => $id));
if (!empty($id)) {
- if (!$course = $DB->get_record('course', ['id' => $id])) {
+ if (!$course = $DB->get_record('course', array('id' => $id))) {
throw new \moodle_exception('invalidcourseid');
}
} else {
@@ -33,7 +33,7 @@
$PAGE->set_pagelayout('incourse');
// Trigger instances list viewed event.
-$event = \mod_exescorm\event\course_module_instance_list_viewed::create(['context' => context_course::instance($course->id) ]);
+$event = \mod_exescorm\event\course_module_instance_list_viewed::create(['context' => context_course::instance($course->id), ]);
$event->add_record_snapshot('course', $course);
$event->trigger();
@@ -66,11 +66,11 @@
if ($usesections) {
$strsectionname = get_string('sectionname', 'format_'.$course->format);
- $table->head = [$strsectionname, $strname, $strsummary, $strreport];
- $table->align = ["center", "left", "left", "left"];
+ $table->head = array ($strsectionname, $strname, $strsummary, $strreport);
+ $table->align = array ("center", "left", "left", "left");
} else {
- $table->head = [$strlastmodified, $strname, $strsummary, $strreport];
- $table->align = ["left", "left", "left", "left"];
+ $table->head = array ($strlastmodified, $strname, $strsummary, $strreport);
+ $table->align = array ("left", "left", "left", "left");
}
foreach ($exescorms as $exescorm) {
@@ -98,13 +98,13 @@
$report = exescorm_grade_user($exescorm, $USER->id);
$reportshow = get_string('score', 'mod_exescorm').": ".$report;
}
- $options = (object)['noclean' => true];
+ $options = (object)array('noclean' => true);
if (!$exescorm->visible) {
// Show dimmed if the mod is hidden.
- $table->data[] = [$tt, html_writer::link('view.php?id='.$exescorm->coursemodule,
+ $table->data[] = array ($tt, html_writer::link('view.php?id='.$exescorm->coursemodule,
format_string($exescorm->name),
- ['class' => 'dimmed']),
- format_module_intro('exescorm', $exescorm, $exescorm->coursemodule), $reportshow];
+ array('class' => 'dimmed')),
+ format_module_intro('exescorm', $exescorm, $exescorm->coursemodule), $reportshow);
} else {
// Show normal if the mod is visible.
$table->data[] = [$tt,
diff --git a/lang/en/exescorm.php b/lang/en/exescorm.php
index 0995009..04daad6 100644
--- a/lang/en/exescorm.php
+++ b/lang/en/exescorm.php
@@ -21,7 +21,6 @@
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-$string['modulename'] = 'ExeSCORM';
$string['toc'] = 'TOC';
$string['navigation'] = 'Navigation';
$string['aicchacptimeout'] = 'AICC HACP timeout';
@@ -126,8 +125,8 @@
$string['displaysettings'] = 'Display settings';
$string['dnduploadexescorm'] = 'Add an eXeLearning SCORM package';
$string['domxml'] = 'DOMXML external library';
-$string['editonlinebtnlabel'] = 'Edit';
-$string['editonlinebtnlabel_help'] = 'Send package to eXeLearning for edition.';
+$string['editonlinebtnlabel' ] = 'Edit';
+$string['editonlinebtnlabel_help' ] = 'Send package to eXeLearning for edition.';
$string['element'] = 'Element';
$string['enter'] = 'Enter';
$string['entercourse'] = 'Enter course';
diff --git a/lang/es/exescorm.php b/lang/es/exescorm.php
index 8d8a0e2..ce3077a 100644
--- a/lang/es/exescorm.php
+++ b/lang/es/exescorm.php
@@ -21,7 +21,6 @@
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-$string['modulename'] = 'ExeSCORM';
$string['toc'] = 'TOC (Tabla de Contenidos)';
$string['navigation'] = 'Navegación';
$string['aicchacptimeout'] = 'Tiempo de espera AICC HACP';
diff --git a/lib.php b/lib.php
index b2889fe..7b11844 100644
--- a/lib.php
+++ b/lib.php
@@ -69,10 +69,10 @@
*/
function exescorm_status_options($withstrings = false) {
// Id's are important as they are bits.
- $options = [
+ $options = array(
2 => 'passed',
- 4 => 'completed',
- ];
+ 4 => 'completed'
+ );
if ($withstrings) {
foreach ($options as $key => $value) {
@@ -131,10 +131,10 @@ function exescorm_add_instance($exescorm, $mform=null) {
$id = $DB->insert_record('exescorm', $exescorm);
// Update course module record - from now on this instance properly exists and all function may be used.
- $DB->set_field('course_modules', 'instance', $id, ['id' => $cmid]);
+ $DB->set_field('course_modules', 'instance', $id, array('id' => $cmid));
// Reload exescorm instance.
- $record = $DB->get_record('exescorm', ['id' => $id]);
+ $record = $DB->get_record('exescorm', array('id' => $id));
if ($exescorm->exescormtype === EXESCORM_TYPE_EXESCORMNET) {
$record->exescormtype = EXESCORM_TYPE_LOCAL;
@@ -177,7 +177,7 @@ function exescorm_add_instance($exescorm, $mform=null) {
$fs = get_file_storage();
$fs->delete_area_files($context->id, 'mod_exescorm', 'package');
file_save_draft_area_files($exescorm->packagefile, $context->id, 'mod_exescorm', 'package',
- 0, ['subdirs' => 0, 'maxfiles' => 1]);
+ 0, array('subdirs' => 0, 'maxfiles' => 1));
// Get filename of zip that was uploaded.
$files = $fs->get_area_files($context->id, 'mod_exescorm', 'package', 0, '', false);
$file = reset($files);
@@ -264,7 +264,7 @@ function exescorm_update_instance($exescorm, $mform=null) {
$fs = get_file_storage();
$fs->delete_area_files($context->id, 'mod_exescorm', 'package');
file_save_draft_area_files($exescorm->packagefile, $context->id, 'mod_exescorm', 'package',
- 0, ['subdirs' => 0, 'maxfiles' => 1]);
+ 0, array('subdirs' => 0, 'maxfiles' => 1));
// Get filename of zip that was uploaded.
$files = $fs->get_area_files($context->id, 'mod_exescorm', 'package', 0, '', false);
$file = reset($files);
@@ -298,7 +298,7 @@ function exescorm_update_instance($exescorm, $mform=null) {
// We need to find this out before we blow away the form data.
$completionexpected = (!empty($exescorm->completionexpected)) ? $exescorm->completionexpected : null;
- $exescorm = $DB->get_record('exescorm', ['id' => $exescorm->id]);
+ $exescorm = $DB->get_record('exescorm', array('id' => $exescorm->id));
// Extra fields required in grade related functions.
$exescorm->course = $courseid;
@@ -328,29 +328,29 @@ function exescorm_update_instance($exescorm, $mform=null) {
function exescorm_delete_instance($id) {
global $CFG, $DB;
- if (! $exescorm = $DB->get_record('exescorm', ['id' => $id])) {
+ if (! $exescorm = $DB->get_record('exescorm', array('id' => $id))) {
return false;
}
$result = true;
// Delete any dependent records.
- if (! $DB->delete_records('exescorm_scoes_track', ['exescormid' => $exescorm->id])) {
+ if (! $DB->delete_records('exescorm_scoes_track', array('exescormid' => $exescorm->id))) {
$result = false;
}
- if ($scoes = $DB->get_records('exescorm_scoes', ['exescorm' => $exescorm->id])) {
+ if ($scoes = $DB->get_records('exescorm_scoes', array('exescorm' => $exescorm->id))) {
foreach ($scoes as $sco) {
- if (! $DB->delete_records('exescorm_scoes_data', ['scoid' => $sco->id])) {
+ if (! $DB->delete_records('exescorm_scoes_data', array('scoid' => $sco->id))) {
$result = false;
}
}
- $DB->delete_records('exescorm_scoes', ['exescorm' => $exescorm->id]);
+ $DB->delete_records('exescorm_scoes', array('exescorm' => $exescorm->id));
}
exescorm_grade_item_delete($exescorm);
// We must delete the module record after we delete the grade item.
- if (! $DB->delete_records('exescorm', ['id' => $exescorm->id])) {
+ if (! $DB->delete_records('exescorm', array('id' => $exescorm->id))) {
$result = false;
}
@@ -437,24 +437,24 @@ function exescorm_user_complete($course, $user, $mod, $exescorm) {
if ($orgs = $DB->get_records_select('exescorm_scoes', 'exescorm = ? AND '.
$DB->sql_isempty('exescorm_scoes', 'launch', false, true).' AND '.
$DB->sql_isempty('exescorm_scoes', 'organization', false, false),
- [$exescorm->id], 'sortorder, id', 'id, identifier, title')) {
+ array($exescorm->id), 'sortorder, id', 'id, identifier, title')) {
if (count($orgs) <= 1) {
unset($orgs);
- $orgs = [];
+ $orgs = array();
$org = new stdClass();
$org->identifier = '';
$orgs[] = $org;
}
$report .= html_writer::start_div('mod-exescorm');
foreach ($orgs as $org) {
- $conditions = [];
+ $conditions = array();
$currentorg = '';
if (!empty($org->identifier)) {
$report .= html_writer::div($org->title, 'orgtitle');
$currentorg = $org->identifier;
$conditions['organization'] = $currentorg;
}
- $report .= html_writer::start_tag('ul', ['id' => '0', 'class' => $liststyle]);
+ $report .= html_writer::start_tag('ul', array('id' => '0', 'class' => $liststyle));
$conditions['exescorm'] = $exescorm->id;
if ($scoes = $DB->get_records('exescorm_scoes', $conditions, "sortorder, id")) {
// Drop keys so that we can access array sequentially.
@@ -476,7 +476,7 @@ function exescorm_user_complete($course, $user, $mod, $exescorm) {
}
if (($i == 0) && ($sco->parent != $currentorg)) {
$report .= html_writer::start_tag('li');
- $report .= html_writer::start_tag('ul', ['id' => $sublist, 'class' => $liststyle]);
+ $report .= html_writer::start_tag('ul', array('id' => $sublist, 'class' => $liststyle));
$level++;
} else {
$report .= $closelist;
@@ -495,7 +495,7 @@ function exescorm_user_complete($course, $user, $mod, $exescorm) {
(($level == 0) || (($level > 0) && ($nextsco->parent == $sco->identifier)))) {
$sublist++;
} else {
- $report .= $OUTPUT->spacer(["height" => "12", "width" => "13"]);
+ $report .= $OUTPUT->spacer(array("height" => "12", "width" => "13"));
}
if ($sco->launch) {
@@ -525,7 +525,7 @@ function exescorm_user_complete($course, $user, $mod, $exescorm) {
$report .= " $sco->title $score$totaltime".html_writer::end_tag('li');
if ($usertrack !== false) {
$sometoreport = true;
- $report .= html_writer::start_tag('li').html_writer::start_tag('ul', ['class' => $liststyle]);
+ $report .= html_writer::start_tag('li').html_writer::start_tag('ul', array('class' => $liststyle));
foreach ($usertrack as $element => $value) {
if (substr($element, 0, 3) == 'cmi') {
$report .= html_writer::tag('li', s($element) . ' => ' . s($value));
@@ -594,7 +594,7 @@ function exescorm_cron_scheduled_task () {
mtrace('Updating exescorm packages which require daily update');// We are updating.
- $exescormsupdate = $DB->get_records('exescorm', ['updatefreq' => EXESCORM_UPDATE_EVERYDAY]);
+ $exescormsupdate = $DB->get_records('exescorm', array('updatefreq' => EXESCORM_UPDATE_EVERYDAY));
foreach ($exescormsupdate as $exescormupdate) {
exescorm_parse($exescormupdate, true);
}
@@ -603,7 +603,7 @@ function exescorm_cron_scheduled_task () {
$cfgexescorm = get_config('exescorm');
if (!empty($cfgexescorm->allowaicchacp)) {
$expiretime = time() - ($cfgexescorm->aicchacpkeepsessiondata * 24 * 60 * 60);
- $DB->delete_records_select('exescorm_aicc_session', 'timemodified < ?', [$expiretime]);
+ $DB->delete_records_select('exescorm_aicc_session', 'timemodified < ?', array($expiretime));
}
}
@@ -623,10 +623,10 @@ function exescorm_get_user_grades($exescorm, $userid=0) {
global $CFG, $DB;
require_once($CFG->dirroot.'/mod/exescorm/locallib.php');
- $grades = [];
+ $grades = array();
if (empty($userid)) {
$scousers = $DB->get_records_select('exescorm_scoes_track', "exescormid=? GROUP BY userid",
- [$exescorm->id], "", "userid,null");
+ array($exescorm->id), "", "userid,null");
if ($scousers) {
foreach ($scousers as $scouser) {
$grades[$scouser->userid] = new stdClass();
@@ -640,7 +640,7 @@ function exescorm_get_user_grades($exescorm, $userid=0) {
} else {
$preattempt = $DB->get_records_select('exescorm_scoes_track', "exescormid=? AND userid=? GROUP BY userid",
- [$exescorm->id, $userid], "", "userid,null");
+ array($exescorm->id, $userid), "", "userid,null");
if (!$preattempt) {
return false; // No attempt yet.
}
@@ -699,14 +699,14 @@ function exescorm_grade_item_update($exescorm, $grades=null) {
require_once($CFG->libdir.'/gradelib.php');
}
- $params = ['itemname' => $exescorm->name];
+ $params = array('itemname' => $exescorm->name);
if (isset($exescorm->cmidnumber)) {
$params['idnumber'] = $exescorm->cmidnumber;
}
if ($exescorm->grademethod == EXESCORM_GRADESCOES) {
$maxgrade = $DB->count_records_select('exescorm_scoes', 'exescorm = ? AND '
- . $DB->sql_isnotempty('exescorm_scoes', 'launch', false, true), [$exescorm->id]);
+ . $DB->sql_isnotempty('exescorm_scoes', 'launch', false, true), array($exescorm->id));
if ($maxgrade) {
$params['gradetype'] = GRADE_TYPE_VALUE;
$params['grademax'] = $maxgrade;
@@ -747,7 +747,7 @@ function exescorm_grade_item_delete($exescorm) {
$exescorm->id,
0,
null,
- ['deleted' => 1]
+ array('deleted' => 1)
);
}
@@ -762,7 +762,7 @@ function exescorm_grade_item_delete($exescorm) {
* @return array
*/
function exescorm_get_view_actions() {
- return ['pre-view', 'view', 'view all', 'report'];
+ return array('pre-view', 'view', 'view all', 'report');
}
/**
@@ -776,7 +776,7 @@ function exescorm_get_view_actions() {
* @return array
*/
function exescorm_get_post_actions() {
- return [];
+ return array();
}
/**
@@ -788,7 +788,7 @@ function exescorm_option2text($exescorm) {
if (isset($exescorm->popup)) {
if ($exescorm->popup == 1) {
- $optionlist = [];
+ $optionlist = array();
foreach ($exescormpopoupoptions as $name => $option) {
if (isset($exescorm->$name)) {
$optionlist[] = $name.'='.$exescorm->$name;
@@ -824,7 +824,7 @@ function exescorm_reset_course_form_definition(&$mform) {
* @return array
*/
function exescorm_reset_course_form_defaults($course) {
- return ['reset_exescorm' => 1];
+ return array('reset_exescorm' => 1);
}
/**
@@ -842,7 +842,7 @@ function exescorm_reset_gradebook($courseid, $type='') {
FROM {exescorm} s, {course_modules} cm, {modules} m
WHERE m.name='exescorm' AND m.id=cm.module AND cm.instance=s.id AND s.course=?";
- if ($exescorms = $DB->get_records_sql($sql, [$courseid])) {
+ if ($exescorms = $DB->get_records_sql($sql, array($courseid))) {
foreach ($exescorms as $exescorm) {
exescorm_grade_item_update($exescorm, 'reset');
}
@@ -862,14 +862,14 @@ function exescorm_reset_userdata($data) {
global $CFG, $DB;
$componentstr = get_string('modulenameplural', 'mod_exescorm');
- $status = [];
+ $status = array();
if (!empty($data->reset_exescorm)) {
$exescormssql = "SELECT s.id
FROM {exescorm} s
WHERE s.course=?";
- $DB->delete_records_select('exescorm_scoes_track', "exescormid IN ($exescormssql)", [$data->courseid]);
+ $DB->delete_records_select('exescorm_scoes_track', "exescormid IN ($exescormssql)", array($data->courseid));
// Remove all grades from gradebook.
if (empty($data->reset_gradebook_grades)) {
@@ -881,8 +881,8 @@ function exescorm_reset_userdata($data) {
// Any changes to the list of dates that needs to be rolled should be same during course restore and course reset.
// See MDL-9367.
- shift_course_mod_dates('exescorm', ['timeopen', 'timeclose'], $data->timeshift, $data->courseid);
- $status[] = ['component' => $componentstr, 'item' => get_string('datechanged'), 'error' => false];
+ shift_course_mod_dates('exescorm', array('timeopen', 'timeclose'), $data->timeshift, $data->courseid);
+ $status[] = array('component' => $componentstr, 'item' => get_string('datechanged'), 'error' => false);
return $status;
}
@@ -896,7 +896,7 @@ function exescorm_reset_userdata($data) {
* @return array
*/
function exescorm_get_file_areas($course, $cm, $context) {
- $areas = [];
+ $areas = array();
$areas['content'] = get_string('areacontent', 'mod_exescorm');
$areas['package'] = get_string('areapackage', 'mod_exescorm');
return $areas;
@@ -983,7 +983,7 @@ function exescorm_get_file_info($browser, $areas, $course, $cm, $context, $filea
* @param array $options additional options affecting the file serving
* @return bool false if file not found, does not return if found - just send the file
*/
-function exescorm_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options=[]) {
+function exescorm_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options=array()) {
global $CFG, $DB;
if ($context->contextlevel != CONTEXT_MODULE) {
@@ -999,7 +999,7 @@ function exescorm_pluginfile($course, $cm, $context, $filearea, $args, $forcedow
if (!$canmanageactivity) {
require_once($CFG->dirroot.'/mod/exescorm/locallib.php');
- $exescorm = $DB->get_record('exescorm', ['id' => $cm->instance], 'id, timeopen, timeclose', MUST_EXIST);
+ $exescorm = $DB->get_record('exescorm', array('id' => $cm->instance), 'id, timeopen, timeclose', MUST_EXIST);
list($available, $warnings) = exescorm_get_availability_status($exescorm);
if (!$available) {
return false;
@@ -1157,7 +1157,7 @@ function exescorm_debug_log_remove($type, $scoid) {
* @param stdClass $currentcontext Current context of block
*/
function exescorm_page_type_list($pagetype, $parentcontext, $currentcontext) {
- $modulepagetype = ['mod-exescorm-*' => get_string('page-mod-exescorm-x', 'mod_exescorm')];
+ $modulepagetype = array('mod-exescorm-*' => get_string('page-mod-exescorm-x', 'mod_exescorm'));
return $modulepagetype;
}
@@ -1201,9 +1201,9 @@ function exescorm_version_check($exescormversion, $version='') {
* @return array containing details of the files / types the mod can handle
*/
function exescorm_dndupload_register() {
- return ['files' => [
- ['extension' => 'zip', 'message' => get_string('dnduploadexescorm', 'mod_exescorm')],
- ]];
+ return array('files' => array(
+ array('extension' => 'zip', 'message' => get_string('dnduploadexescorm', 'mod_exescorm'))
+ ));
}
/**
@@ -1247,7 +1247,7 @@ function exescorm_dndupload_handle($uploadinfo) {
* @param int $completionstate Completion state
* @param array $grades grades array of users with grades - used when $userid = 0
*/
-function exescorm_set_completion($exescorm, $userid, $completionstate = COMPLETION_COMPLETE, $grades = []) {
+function exescorm_set_completion($exescorm, $userid, $completionstate = COMPLETION_COMPLETE, $grades = array()) {
$course = new stdClass();
$course->id = $exescorm->course;
$completion = new completion_info($course);
@@ -1347,7 +1347,7 @@ function exescorm_check_mode($exescorm, &$newattempt, &$attempt, $userid, &$mode
if ($attempt == 1) {
// Check if the user has any existing data or if this is really the first attempt.
$exists = $DB->record_exists(
- 'exescorm_scoes_track', ['userid' => $userid, 'exescormid' => $exescorm->id]
+ 'exescorm_scoes_track', array('userid' => $userid, 'exescormid' => $exescorm->id)
);
if (!$exists) {
// No records yet - Attempt should == 1.
@@ -1367,11 +1367,11 @@ function exescorm_check_mode($exescorm, &$newattempt, &$attempt, $userid, &$mode
// This means the values 'passed' or 'failed' will never be reported for a track inEXESCORM_SCORM_13 and
// the only status that will be treated as complete is 'completed'.
- $completionelements = [
+ $completionelements = array(
EXESCORM_SCORM_12 => 'cmi.core.lesson_status',
EXESCORM_SCORM_13 => 'cmi.completion_status',
- EXESCORM_SCORM_AICC => 'cmi.core.lesson_status',
- ];
+ EXESCORM_SCORM_AICC => 'cmi.core.lesson_status'
+ );
$exescormversion = exescorm_version_check($exescorm->version);
if ($exescormversion === false) {
$exescormversion = EXESCORM_SCORM_12;
@@ -1383,7 +1383,7 @@ function exescorm_check_mode($exescorm, &$newattempt, &$attempt, $userid, &$mode
LEFT JOIN {exescorm_scoes_track} t ON sc.exescorm = t.exescormid AND sc.id = t.scoid
AND t.element = ? AND t.userid = ? AND t.attempt = ?
WHERE sc.exescormtype = 'sco' AND sc.exescorm = ?";
- $tracks = $DB->get_recordset_sql($sql, [$completionelement, $userid, $attempt, $exescorm->id]);
+ $tracks = $DB->get_recordset_sql($sql, array($completionelement, $userid, $attempt, $exescorm->id));
foreach ($tracks as $track) {
if (($track->value == 'completed') || ($track->value == 'passed') || ($track->value == 'failed')) {
@@ -1428,10 +1428,10 @@ function exescorm_check_mode($exescorm, &$newattempt, &$attempt, $userid, &$mode
function exescorm_view($exescorm, $course, $cm, $context) {
// Trigger course_module_viewed event.
- $params = [
+ $params = array(
'context' => $context,
- 'objectid' => $exescorm->id,
- ];
+ 'objectid' => $exescorm->id
+ );
$event = \mod_exescorm\event\course_module_viewed::create($params);
$event->add_record_snapshot('course_modules', $cm);
@@ -1449,21 +1449,21 @@ function exescorm_view($exescorm, $course, $cm, $context) {
* @return stdClass an object with the different type of areas indicating if they were updated or not
* @since Moodle 3.2
*/
-function exescorm_check_updates_since(cm_info $cm, $from, $filter = []) {
+function exescorm_check_updates_since(cm_info $cm, $from, $filter = array()) {
global $DB, $USER, $CFG;
require_once($CFG->dirroot . '/mod/exescorm/locallib.php');
- $exescorm = $DB->get_record($cm->modname, ['id' => $cm->instance], '*', MUST_EXIST);
+ $exescorm = $DB->get_record($cm->modname, array('id' => $cm->instance), '*', MUST_EXIST);
$updates = new stdClass();
list($available, $warnings) = exescorm_get_availability_status($exescorm, true, $cm->context);
if (!$available) {
return $updates;
}
- $updates = course_check_module_updates_since($cm, $from, ['package'], $filter);
+ $updates = course_check_module_updates_since($cm, $from, array('package'), $filter);
- $updates->tracks = (object) ['updated' => false];
+ $updates->tracks = (object) array('updated' => false);
$select = 'exescormid = ? AND userid = ? AND timemodified > ?';
- $params = [$exescorm->id, $USER->id, $from];
+ $params = array($exescorm->id, $USER->id, $from);
$tracks = $DB->get_records_select('exescorm_scoes_track', $select, $params, '', 'id');
if (!empty($tracks)) {
$updates->tracks->updated = true;
@@ -1473,7 +1473,7 @@ function exescorm_check_updates_since(cm_info $cm, $from, $filter = []) {
// Now, teachers should see other students updates.
if (has_capability('mod/exescorm:viewreport', $cm->context)) {
$select = 'exescormid = ? AND timemodified > ?';
- $params = [$exescorm->id, $from];
+ $params = array($exescorm->id, $from);
if (groups_get_activity_groupmode($cm) == SEPARATEGROUPS) {
$groupusers = array_keys(groups_get_activity_shared_group_members($cm));
@@ -1485,7 +1485,7 @@ function exescorm_check_updates_since(cm_info $cm, $from, $filter = []) {
$params = array_merge($params, $inparams);
}
- $updates->usertracks = (object) ['updated' => false];
+ $updates->usertracks = (object) array('updated' => false);
$tracks = $DB->get_records_select('exescorm_scoes_track', $select, $params, '', 'id');
if (!empty($tracks)) {
$updates->usertracks->updated = true;
@@ -1536,11 +1536,11 @@ function exescorm_refresh_events($courseid = 0, $instance = null, $cm = null) {
// If we have instance information then we can just update the one event instead of updating all events.
if (isset($instance)) {
if (!is_object($instance)) {
- $instance = $DB->get_record('exescorm', ['id' => $instance], '*', MUST_EXIST);
+ $instance = $DB->get_record('exescorm', array('id' => $instance), '*', MUST_EXIST);
}
if (isset($cm)) {
if (!is_object($cm)) {
- $cm = (object)['id' => $cm];
+ $cm = (object)array('id' => $cm);
}
} else {
$cm = get_coursemodule_from_instance('exescorm', $instance->id);
@@ -1554,7 +1554,7 @@ function exescorm_refresh_events($courseid = 0, $instance = null, $cm = null) {
if (!is_numeric($courseid)) {
return false;
}
- if (!$exescorms = $DB->get_records('exescorm', ['course' => $courseid])) {
+ if (!$exescorms = $DB->get_records('exescorm', array('course' => $courseid))) {
return false;
}
} else {
@@ -1622,7 +1622,7 @@ function mod_exescorm_core_calendar_provide_event_action(calendar_event $event,
return $factory->create_instance(
get_string('enter', 'mod_exescorm'),
- new \moodle_url('/mod/exescorm/view.php', ['id' => $cm->id]),
+ new \moodle_url('/mod/exescorm/view.php', array('id' => $cm->id)),
1,
$actionable
);
@@ -1693,7 +1693,7 @@ function mod_exescorm_get_completion_active_rule_descriptions($cm) {
case 'completionstatusrequired':
if (!is_null($val)) {
// Determine the selected statuses using a bitwise operation.
- $cvalues = [];
+ $cvalues = array();
foreach (exescorm_status_options(true) as $bit => $string) {
if (($val & $bit) == $bit) {
$cvalues[] = $string;
@@ -1817,7 +1817,7 @@ function mod_exescorm_core_calendar_get_valid_event_timestart_range(\calendar_ev
if (!empty($instance->timeclose)) {
$maxdate = [
$instance->timeclose,
- get_string('openafterclose', 'mod_exescorm'),
+ get_string('openafterclose', 'mod_exescorm')
];
}
} else if ($event->eventtype == EXESCORM_EVENT_TYPE_CLOSE) {
@@ -1826,7 +1826,7 @@ function mod_exescorm_core_calendar_get_valid_event_timestart_range(\calendar_ev
if (!empty($instance->timeopen)) {
$mindate = [
$instance->timeopen,
- get_string('closebeforeopen', 'mod_exescorm'),
+ get_string('closebeforeopen', 'mod_exescorm')
];
}
}
@@ -1841,7 +1841,7 @@ function mod_exescorm_core_calendar_get_valid_event_timestart_range(\calendar_ev
* @param array $args The path (the part after the filearea and before the filename).
* @return array The itemid and the filepath inside the $args path, for the defined filearea.
*/
-function mod_exescorm_get_path_from_pluginfile(string $filearea, array $args): array {
+function mod_exescorm_get_path_from_pluginfile(string $filearea, array $args) : array {
// EXESCORM never has an itemid (the number represents the revision but it's not stored in database).
array_shift($args);
diff --git a/loadSCO.php b/loadSCO.php
index f2b809d..ac0ee19 100644
--- a/loadSCO.php
+++ b/loadSCO.php
@@ -27,17 +27,17 @@
if (! $cm = get_coursemodule_from_id('exescorm', $id)) {
throw new \moodle_exception('invalidcoursemodule');
}
- if (! $course = $DB->get_record('course', ['id' => $cm->course])) {
+ if (! $course = $DB->get_record('course', array('id' => $cm->course))) {
throw new \moodle_exception('coursemisconf');
}
- if (! $exescorm = $DB->get_record('exescorm', ['id' => $cm->instance])) {
+ if (! $exescorm = $DB->get_record('exescorm', array('id' => $cm->instance))) {
throw new \moodle_exception('invalidcoursemodule');
}
} else if (!empty($a)) {
- if (! $exescorm = $DB->get_record('exescorm', ['id' => $a])) {
+ if (! $exescorm = $DB->get_record('exescorm', array('id' => $a))) {
throw new \moodle_exception('coursemisconf');
}
- if (! $course = $DB->get_record('course', ['id' => $exescorm->course])) {
+ if (! $course = $DB->get_record('course', array('id' => $exescorm->course))) {
throw new \moodle_exception('coursemisconf');
}
if (! $cm = get_coursemodule_from_instance('exescorm', $exescorm->id, $course->id)) {
@@ -47,7 +47,7 @@
throw new \moodle_exception('missingparameter');
}
-$PAGE->set_url('/mod/exescorm/loadSCO.php', ['scoid' => $scoid, 'id' => $cm->id]);
+$PAGE->set_url('/mod/exescorm/loadSCO.php', array('scoid' => $scoid, 'id' => $cm->id));
if (!isloggedin()) { // Prevent login page from being shown in iframe.
// Using simple html instead of exceptions here as shown inside iframe/object.
diff --git a/locallib.php b/locallib.php
index 5706a4f..0ee0536 100644
--- a/locallib.php
+++ b/locallib.php
@@ -87,12 +87,12 @@ public function get_visible_name() {
function exescorm_get_popup_options_array() {
$cfgexescorm = get_config('exescorm');
- return ['scrollbars' => isset($cfgexescorm->scrollbars) ? $cfgexescorm->scrollbars : 0,
+ return array('scrollbars' => isset($cfgexescorm->scrollbars) ? $cfgexescorm->scrollbars : 0,
'directories' => isset($cfgexescorm->directories) ? $cfgexescorm->directories : 0,
'location' => isset($cfgexescorm->location) ? $cfgexescorm->location : 0,
'menubar' => isset($cfgexescorm->menubar) ? $cfgexescorm->menubar : 0,
'toolbar' => isset($cfgexescorm->toolbar) ? $cfgexescorm->toolbar : 0,
- 'status' => isset($cfgexescorm->status) ? $cfgexescorm->status : 0];
+ 'status' => isset($cfgexescorm->status) ? $cfgexescorm->status : 0);
}
/**
@@ -101,10 +101,10 @@ function exescorm_get_popup_options_array() {
* @return array an array of what grade options
*/
function exescorm_get_grade_method_array() {
- return [EXESCORM_GRADESCOES => get_string('gradescoes', 'mod_exescorm'),
+ return array (EXESCORM_GRADESCOES => get_string('gradescoes', 'mod_exescorm'),
EXESCORM_GRADEHIGHEST => get_string('gradehighest', 'mod_exescorm'),
EXESCORM_GRADEAVERAGE => get_string('gradeaverage', 'mod_exescorm'),
- EXESCORM_GRADESUM => get_string('gradesum', 'mod_exescorm')];
+ EXESCORM_GRADESUM => get_string('gradesum', 'mod_exescorm'));
}
/**
@@ -113,10 +113,10 @@ function exescorm_get_grade_method_array() {
* @return array an array of what grade options
*/
function exescorm_get_what_grade_array() {
- return [EXESCORM_HIGHESTATTEMPT => get_string('EXESCORM_HIGHESTATTEMPT', 'mod_exescorm'),
+ return array (EXESCORM_HIGHESTATTEMPT => get_string('EXESCORM_HIGHESTATTEMPT', 'mod_exescorm'),
EXESCORM_AVERAGEATTEMPT => get_string('EXESCORM_AVERAGEATTEMPT', 'mod_exescorm'),
EXESCORM_FIRSTATTEMPT => get_string('firstattempt', 'mod_exescorm'),
- EXESCORM_LASTATTEMPT => get_string('lastattempt', 'mod_exescorm')];
+ EXESCORM_LASTATTEMPT => get_string('lastattempt', 'mod_exescorm'));
}
/**
@@ -125,9 +125,9 @@ function exescorm_get_what_grade_array() {
* @return array an array of skip view options
*/
function exescorm_get_skip_view_array() {
- return [EXESCORM_SKIPVIEW_NEVER => get_string('never'),
+ return array(EXESCORM_SKIPVIEW_NEVER => get_string('never'),
EXESCORM_SKIPVIEW_FIRST => get_string('firstaccess', 'mod_exescorm'),
- EXESCORM_SKIPVIEW_ALWAYS => get_string('always')];
+ EXESCORM_SKIPVIEW_ALWAYS => get_string('always'));
}
/**
@@ -136,10 +136,10 @@ function exescorm_get_skip_view_array() {
* @return array an array of hide table of contents options
*/
function exescorm_get_hidetoc_array() {
- return [EXESCORM_TOC_SIDE => get_string('sided', 'mod_exescorm'),
+ return array(EXESCORM_TOC_SIDE => get_string('sided', 'mod_exescorm'),
EXESCORM_TOC_HIDDEN => get_string('hidden', 'mod_exescorm'),
EXESCORM_TOC_POPUP => get_string('popupmenu', 'mod_exescorm'),
- EXESCORM_TOC_DISABLED => get_string('disabled', 'mod_exescorm')];
+ EXESCORM_TOC_DISABLED => get_string('disabled', 'mod_exescorm'));
}
/**
@@ -148,9 +148,9 @@ function exescorm_get_hidetoc_array() {
* @return array an array of update frequency options
*/
function exescorm_get_updatefreq_array() {
- return [EXESCORM_UPDATE_NEVER => get_string('never'),
+ return array(EXESCORM_UPDATE_NEVER => get_string('never'),
EXESCORM_UPDATE_EVERYDAY => get_string('everyday', 'mod_exescorm'),
- EXESCORM_UPDATE_EVERYTIME => get_string('everytime', 'mod_exescorm')];
+ EXESCORM_UPDATE_EVERYTIME => get_string('everytime', 'mod_exescorm'));
}
/**
@@ -159,8 +159,8 @@ function exescorm_get_updatefreq_array() {
* @return array an array of popup display options
*/
function exescorm_get_popup_display_array() {
- return [0 => get_string('currentwindow', 'mod_exescorm'),
- 1 => get_string('popup', 'mod_exescorm')];
+ return array(0 => get_string('currentwindow', 'mod_exescorm'),
+ 1 => get_string('popup', 'mod_exescorm'));
}
/**
@@ -169,9 +169,9 @@ function exescorm_get_popup_display_array() {
* @return array an array of navigation buttons display options
*/
function exescorm_get_navigation_display_array() {
- return [EXESCORM_NAV_DISABLED => get_string('no'),
+ return array(EXESCORM_NAV_DISABLED => get_string('no'),
EXESCORM_NAV_UNDER_CONTENT => get_string('undercontent', 'mod_exescorm'),
- EXESCORM_NAV_FLOATING => get_string('floating', 'mod_exescorm')];
+ EXESCORM_NAV_FLOATING => get_string('floating', 'mod_exescorm'));
}
/**
@@ -180,8 +180,8 @@ function exescorm_get_navigation_display_array() {
* @return array an array of attempt options
*/
function exescorm_get_attempts_array() {
- $attempts = [0 => get_string('nolimit', 'mod_exescorm'),
- 1 => get_string('attempt1', 'mod_exescorm')];
+ $attempts = array(0 => get_string('nolimit', 'mod_exescorm'),
+ 1 => get_string('attempt1', 'mod_exescorm'));
for ($i = 2; $i <= 6; $i++) {
$attempts[$i] = get_string('attemptsx', 'mod_exescorm', $i);
@@ -196,10 +196,10 @@ function exescorm_get_attempts_array() {
* @return array an array of attempt status options
*/
function exescorm_get_attemptstatus_array() {
- return [EXESCORM_DISPLAY_ATTEMPTSTATUS_NO => get_string('no'),
+ return array(EXESCORM_DISPLAY_ATTEMPTSTATUS_NO => get_string('no'),
EXESCORM_DISPLAY_ATTEMPTSTATUS_ALL => get_string('attemptstatusall', 'mod_exescorm'),
EXESCORM_DISPLAY_ATTEMPTSTATUS_MY => get_string('attemptstatusmy', 'mod_exescorm'),
- EXESCORM_DISPLAY_ATTEMPTSTATUS_ENTRY => get_string('attemptstatusentry', 'mod_exescorm')];
+ EXESCORM_DISPLAY_ATTEMPTSTATUS_ENTRY => get_string('attemptstatusentry', 'mod_exescorm'));
}
/**
@@ -208,9 +208,9 @@ function exescorm_get_attemptstatus_array() {
* @return array an array of attempt options
*/
function exescorm_get_forceattempt_array() {
- return [EXESCORM_FORCEATTEMPT_NO => get_string('no'),
+ return array(EXESCORM_FORCEATTEMPT_NO => get_string('no'),
EXESCORM_FORCEATTEMPT_ONCOMPLETE => get_string('forceattemptoncomplete', 'mod_exescorm'),
- EXESCORM_FORCEATTEMPT_ALWAYS => get_string('forceattemptalways', 'mod_exescorm')];
+ EXESCORM_FORCEATTEMPT_ALWAYS => get_string('forceattemptalways', 'mod_exescorm'));
}
/**
@@ -262,8 +262,8 @@ function exescorm_parse($exescorm, $full) {
}
if ($exescorm->reference !== '') {
$fs->delete_area_files($context->id, 'mod_exescorm', 'package');
- $filerecord = ['contextid' => $context->id, 'component' => 'mod_exescorm', 'filearea' => 'package',
- 'itemid' => 0, 'filepath' => '/'];
+ $filerecord = array('contextid' => $context->id, 'component' => 'mod_exescorm', 'filearea' => 'package',
+ 'itemid' => 0, 'filepath' => '/');
if ($packagefile = $fs->create_file_from_url($filerecord, $exescorm->reference, ['calctimeout' => true], true)) {
$newhash = $packagefile->get_contenthash();
} else {
@@ -402,14 +402,14 @@ function exescorm_external_link($link) {
function exescorm_get_sco($id, $what=EXESCORM_SCO_ALL) {
global $DB;
- if ($sco = $DB->get_record('exescorm_scoes', ['id' => $id])) {
+ if ($sco = $DB->get_record('exescorm_scoes', array('id' => $id))) {
$sco = ($what == EXESCORM_SCO_DATA) ? new stdClass() : $sco;
- if (($what != EXESCORM_SCO_ONLY) && ($scodatas = $DB->get_records('exescorm_scoes_data', ['scoid' => $id]))) {
+ if (($what != EXESCORM_SCO_ONLY) && ($scodatas = $DB->get_records('exescorm_scoes_data', array('scoid' => $id)))) {
foreach ($scodatas as $scodata) {
$sco->{$scodata->name} = $scodata->value;
}
} else if (($what != EXESCORM_SCO_ONLY) &&
- (!($scodatas = $DB->get_records('exescorm_scoes_data', ['scoid' => $id])))
+ (!($scodatas = $DB->get_records('exescorm_scoes_data', array('scoid' => $id))))
) {
$sco->parameters = '';
}
@@ -429,7 +429,7 @@ function exescorm_get_sco($id, $what=EXESCORM_SCO_ALL) {
function exescorm_get_scoes($id, $organisation=false) {
global $DB;
- $queryarray = ['exescorm' => $id];
+ $queryarray = array('exescorm' => $id);
if (!empty($organisation)) {
$queryarray['organization'] = $organisation;
}
@@ -437,7 +437,7 @@ function exescorm_get_scoes($id, $organisation=false) {
// Drop keys so that it is a simple array as expected.
$scoes = array_values($scoes);
foreach ($scoes as $sco) {
- if ($scodatas = $DB->get_records('exescorm_scoes_data', ['scoid' => $sco->id])) {
+ if ($scodatas = $DB->get_records('exescorm_scoes_data', array('scoid' => $sco->id))) {
foreach ($scodatas as $scodata) {
$sco->{$scodata->name} = $scodata->value;
}
@@ -461,7 +461,7 @@ function exescorm_insert_track($userid, $exescormid, $scoid, $attempt, $element,
if ($track = $DB->get_record_select('exescorm_scoes_track',
'userid=? AND exescormid=? AND scoid=? AND attempt=? '.
'AND element=\'cmi.core.score.raw\'',
- [$userid, $exescormid, $scoid, $attempt])) {
+ array($userid, $exescormid, $scoid, $attempt))) {
$value = 'completed';
}
}
@@ -469,7 +469,7 @@ function exescorm_insert_track($userid, $exescormid, $scoid, $attempt, $element,
if ($tracktest = $DB->get_record_select('exescorm_scoes_track',
'userid=? AND exescormid=? AND scoid=? AND attempt=? '.
'AND element=\'cmi.core.lesson_status\'',
- [$userid, $exescormid, $scoid, $attempt])) {
+ array($userid, $exescormid, $scoid, $attempt))) {
if ($tracktest->value == "incomplete") {
$tracktest->value = "completed";
$DB->update_record('exescorm_scoes_track', $tracktest);
@@ -477,18 +477,18 @@ function exescorm_insert_track($userid, $exescormid, $scoid, $attempt, $element,
}
}
if (($element == 'cmi.success_status') && ($value == 'passed' || $value == 'failed')) {
- if ($DB->get_record('exescorm_scoes_data', ['scoid' => $scoid, 'name' => 'objectivesetbycontent'])) {
+ if ($DB->get_record('exescorm_scoes_data', array('scoid' => $scoid, 'name' => 'objectivesetbycontent'))) {
$objectiveprogressstatus = true;
$objectivesatisfiedstatus = false;
if ($value == 'passed') {
$objectivesatisfiedstatus = true;
}
- if ($track = $DB->get_record('exescorm_scoes_track', ['userid' => $userid,
+ if ($track = $DB->get_record('exescorm_scoes_track', array('userid' => $userid,
'exescormid' => $exescormid,
'scoid' => $scoid,
'attempt' => $attempt,
- 'element' => 'objectiveprogressstatus'])) {
+ 'element' => 'objectiveprogressstatus'))) {
$track->value = $objectiveprogressstatus;
$track->timemodified = time();
$DB->update_record('exescorm_scoes_track', $track);
@@ -505,11 +505,11 @@ function exescorm_insert_track($userid, $exescormid, $scoid, $attempt, $element,
$id = $DB->insert_record('exescorm_scoes_track', $track);
}
if ($objectivesatisfiedstatus) {
- if ($track = $DB->get_record('exescorm_scoes_track', ['userid' => $userid,
+ if ($track = $DB->get_record('exescorm_scoes_track', array('userid' => $userid,
'exescormid' => $exescormid,
'scoid' => $scoid,
'attempt' => $attempt,
- 'element' => 'objectivesatisfiedstatus'])) {
+ 'element' => 'objectivesatisfiedstatus'))) {
$track->value = $objectivesatisfiedstatus;
$track->timemodified = time();
$DB->update_record('exescorm_scoes_track', $track);
@@ -537,11 +537,11 @@ function exescorm_insert_track($userid, $exescormid, $scoid, $attempt, $element,
$track = $trackdata[$element];
}
} else {
- $track = $DB->get_record('exescorm_scoes_track', ['userid' => $userid,
+ $track = $DB->get_record('exescorm_scoes_track', array('userid' => $userid,
'exescormid' => $exescormid,
'scoid' => $scoid,
'attempt' => $attempt,
- 'element' => $element]);
+ 'element' => $element));
}
if ($track) {
if ($element != 'x.start.time' ) { // Don't update x.start.time - keep the original value.
@@ -567,29 +567,29 @@ function exescorm_insert_track($userid, $exescormid, $scoid, $attempt, $element,
// Trigger updating grades based on a given set of EXESCORM CMI elements.
$exescorm = false;
- if (in_array($element, ['cmi.core.score.raw', 'cmi.score.raw']) ||
- (in_array($element, ['cmi.completion_status', 'cmi.core.lesson_status', 'cmi.success_status'])
- && in_array($track->value, ['completed', 'passed']))) {
- $exescorm = $DB->get_record('exescorm', ['id' => $exescormid]);
+ if (in_array($element, array('cmi.core.score.raw', 'cmi.score.raw')) ||
+ (in_array($element, array('cmi.completion_status', 'cmi.core.lesson_status', 'cmi.success_status'))
+ && in_array($track->value, array('completed', 'passed')))) {
+ $exescorm = $DB->get_record('exescorm', array('id' => $exescormid));
include_once($CFG->dirroot.'/mod/exescorm/lib.php');
exescorm_update_grades($exescorm, $userid);
}
// Trigger CMI element events.
- if (in_array($element, ['cmi.core.score.raw', 'cmi.score.raw']) ||
- (in_array($element, ['cmi.completion_status', 'cmi.core.lesson_status', 'cmi.success_status'])
- && in_array($track->value, ['completed', 'failed', 'passed']))) {
+ if (in_array($element, array('cmi.core.score.raw', 'cmi.score.raw')) ||
+ (in_array($element, array('cmi.completion_status', 'cmi.core.lesson_status', 'cmi.success_status'))
+ && in_array($track->value, array('completed', 'failed', 'passed')))) {
if (!$exescorm) {
- $exescorm = $DB->get_record('exescorm', ['id' => $exescormid]);
+ $exescorm = $DB->get_record('exescorm', array('id' => $exescormid));
}
$cm = get_coursemodule_from_instance('exescorm', $exescormid);
- $data = [
- 'other' => ['attemptid' => $attempt, 'cmielement' => $element, 'cmivalue' => $track->value],
+ $data = array(
+ 'other' => array('attemptid' => $attempt, 'cmielement' => $element, 'cmivalue' => $track->value),
'objectid' => $exescorm->id,
'context' => context_module::instance($cm->id),
- 'relateduserid' => $userid,
- ];
- if (in_array($element, ['cmi.core.score.raw', 'cmi.score.raw'])) {
+ 'relateduserid' => $userid
+ );
+ if (in_array($element, array('cmi.core.score.raw', 'cmi.score.raw'))) {
// Create score submitted event.
$event = \mod_exescorm\event\scoreraw_submitted::create($data);
} else {
@@ -622,7 +622,7 @@ function exescorm_insert_track($userid, $exescormid, $scoid, $attempt, $element,
*/
function exescorm_has_tracks($exescormid, $userid) {
global $DB;
- return $DB->record_exists('exescorm_scoes_track', ['userid' => $userid, 'exescormid' => $exescormid]);
+ return $DB->record_exists('exescorm_scoes_track', array('userid' => $userid, 'exescormid' => $exescormid));
}
function exescorm_get_tracks($scoid, $userid, $attempt='') {
@@ -630,14 +630,14 @@ function exescorm_get_tracks($scoid, $userid, $attempt='') {
global $DB;
if (empty($attempt)) {
- if ($exescormid = $DB->get_field('exescorm_scoes', 'exescorm', ['id' => $scoid])) {
+ if ($exescormid = $DB->get_field('exescorm_scoes', 'exescorm', array('id' => $scoid))) {
$attempt = exescorm_get_last_attempt($exescormid, $userid);
} else {
$attempt = 1;
}
}
- if ($tracks = $DB->get_records('exescorm_scoes_track', ['userid' => $userid, 'scoid' => $scoid,
- 'attempt' => $attempt], 'element ASC')) {
+ if ($tracks = $DB->get_records('exescorm_scoes_track', array('userid' => $userid, 'scoid' => $scoid,
+ 'attempt' => $attempt), 'element ASC')) {
$usertrack = exescorm_format_interactions($tracks);
$usertrack->userid = $userid;
$usertrack->scoid = $scoid;
@@ -708,7 +708,7 @@ function exescorm_get_sco_runtime($exescormid, $scoid, $userid, $attempt=1) {
global $DB;
$timedata = new stdClass();
- $params = ['userid' => $userid, 'exescormid' => $exescormid, 'attempt' => $attempt];
+ $params = array('userid' => $userid, 'exescormid' => $exescormid, 'attempt' => $attempt);
if (!empty($scoid)) {
$params['scoid'] = $scoid;
}
@@ -739,7 +739,7 @@ function exescorm_grade_user_attempt($exescorm, $userid, $attempt=1) {
$attemptscore->sum = 0;
$attemptscore->lastmodify = 0;
- if (!$scoes = $DB->get_records('exescorm_scoes', ['exescorm' => $exescorm->id], 'sortorder, id')) {
+ if (!$scoes = $DB->get_records('exescorm_scoes', array('exescorm' => $exescorm->id), 'sortorder, id')) {
return null;
}
@@ -836,7 +836,7 @@ function exescorm_count_launchable($exescormid, $organization='') {
global $DB;
$sqlorganization = '';
- $params = [$exescormid];
+ $params = array($exescormid);
if (!empty($organization)) {
$sqlorganization = " AND organization=?";
$params[] = $organization;
@@ -861,7 +861,7 @@ function exescorm_get_last_attempt($exescormid, $userid) {
$sql = "SELECT MAX(attempt)
FROM {exescorm_scoes_track}
WHERE userid = ? AND exescormid = ?";
- $lastattempt = $DB->get_field_sql($sql, [$userid, $exescormid]);
+ $lastattempt = $DB->get_field_sql($sql, array($userid, $exescormid));
if (empty($lastattempt)) {
return '1';
} else {
@@ -885,7 +885,7 @@ function exescorm_get_first_attempt($exescormid, $userid) {
FROM {exescorm_scoes_track}
WHERE userid = ? AND exescormid = ?";
- $lastattempt = $DB->get_field_sql($sql, [$userid, $exescormid]);
+ $lastattempt = $DB->get_field_sql($sql, array($userid, $exescormid));
if (empty($lastattempt)) {
return '1';
} else {
@@ -910,7 +910,7 @@ function exescorm_get_last_completed_attempt($exescormid, $userid) {
WHERE userid = ? AND exescormid = ?
AND (".$DB->sql_compare_text('value')." = ".$DB->sql_compare_text('?')." OR ".
$DB->sql_compare_text('value')." = ".$DB->sql_compare_text('?').")";
- $lastattempt = $DB->get_field_sql($sql, [$userid, $exescormid, 'completed', 'passed']);
+ $lastattempt = $DB->get_field_sql($sql, array($userid, $exescormid, 'completed', 'passed'));
if (empty($lastattempt)) {
return '1';
} else {
@@ -928,9 +928,9 @@ function exescorm_get_last_completed_attempt($exescormid, $userid) {
*/
function exescorm_get_all_attempts($exescormid, $userid) {
global $DB;
- $attemptids = [];
+ $attemptids = array();
$sql = "SELECT DISTINCT attempt FROM {exescorm_scoes_track} WHERE userid = ? AND exescormid = ? ORDER BY attempt";
- $attempts = $DB->get_records_sql($sql, [$userid, $exescormid]);
+ $attempts = $DB->get_records_sql($sql, array($userid, $exescormid));
foreach ($attempts as $attempt) {
$attemptids[] = $attempt->attempt;
}
@@ -964,7 +964,7 @@ function exescorm_print_launch ($user, $exescorm, $action, $cm) {
if ($orgs = $DB->get_records_select_menu('exescorm_scoes', 'exescorm = ? AND '.
$DB->sql_isempty('exescorm_scoes', 'launch', false, true).' AND '.
$DB->sql_isempty('exescorm_scoes', 'organization', false, false),
- [$exescorm->id], 'sortorder, id', 'id,title')) {
+ array($exescorm->id), 'sortorder, id', 'id,title')) {
if (count($orgs) > 1) {
$select = new single_select(new moodle_url($action), 'organization', $orgs, $organization, null);
$select->label = get_string('organizations', 'mod_exescorm');
@@ -1009,16 +1009,16 @@ function exescorm_print_launch ($user, $exescorm, $action, $cm) {
// Do not give the player launch FORM if the EXESCORM object is locked after the final attempt.
if ($exescorm->lastattemptlock == 0 || $result->attemptleft > 0) {
echo html_writer::start_div('exescorm-center');
- echo html_writer::start_tag('form', ['id' => 'exescormviewform',
+ echo html_writer::start_tag('form', array('id' => 'exescormviewform',
'method' => 'post',
- 'action' => $CFG->wwwroot.'/mod/exescorm/player.php']);
+ 'action' => $CFG->wwwroot.'/mod/exescorm/player.php'));
if ($exescorm->hidebrowse == 0) {
echo html_writer::tag('button', get_string('browse', 'mod_exescorm'),
['class' => 'btn btn-secondary mr-1', 'name' => 'mode',
'type' => 'submit', 'id' => 'b', 'value' => 'browse'])
. html_writer::end_tag('button');
} else {
- echo html_writer::empty_tag('input', ['type' => 'hidden', 'name' => 'mode', 'value' => 'normal']);
+ echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'mode', 'value' => 'normal'));
}
echo html_writer::tag('button', get_string('enter', 'mod_exescorm'),
['class' => 'btn btn-primary mx-1', 'name' => 'mode',
@@ -1027,7 +1027,7 @@ function exescorm_print_launch ($user, $exescorm, $action, $cm) {
if (!empty($exescorm->forcenewattempt)) {
if ($exescorm->forcenewattempt == EXESCORM_FORCEATTEMPT_ALWAYS ||
($exescorm->forcenewattempt == EXESCORM_FORCEATTEMPT_ONCOMPLETE && $incomplete === false)) {
- echo html_writer::empty_tag('input', ['type' => 'hidden', 'name' => 'newattempt', 'value' => 'on']);
+ echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'newattempt', 'value' => 'on'));
}
} else if (
!empty($attemptcount) &&
@@ -1035,18 +1035,18 @@ function exescorm_print_launch ($user, $exescorm, $action, $cm) {
(($result->attemptleft > 0)||($exescorm->maxattempt == 0))
) {
echo html_writer::start_div('pt-1');
- echo html_writer::checkbox('newattempt', 'on', false, '', ['id' => 'a']);
+ echo html_writer::checkbox('newattempt', 'on', false, '', array('id' => 'a'));
echo html_writer::label(get_string('newattempt', 'mod_exescorm'), 'a', true, ['class' => 'pl-1']);
echo html_writer::end_div();
}
if (!empty($exescorm->popup)) {
- echo html_writer::empty_tag('input', ['type' => 'hidden', 'name' => 'display', 'value' => 'popup']);
+ echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'display', 'value' => 'popup'));
}
echo html_writer::empty_tag('br');
- echo html_writer::empty_tag('input', ['type' => 'hidden', 'name' => 'scoid', 'value' => $launchsco]);
- echo html_writer::empty_tag('input', ['type' => 'hidden', 'name' => 'cm', 'value' => $cm->id]);
- echo html_writer::empty_tag('input', ['type' => 'hidden', 'name' => 'currentorg', 'value' => $orgidentifier]);
+ echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'scoid', 'value' => $launchsco));
+ echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'cm', 'value' => $cm->id));
+ echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'currentorg', 'value' => $orgidentifier));
echo html_writer::end_tag('form');
echo html_writer::end_div();
}
@@ -1066,7 +1066,7 @@ function exescorm_simple_play($exescorm, $user, $context, $cmid) {
exescorm_parse($exescorm, false);
}
$scoes = $DB->get_records_select('exescorm_scoes', 'exescorm = ? AND '.
- $DB->sql_isnotempty('exescorm_scoes', 'launch', false, true), [$exescorm->id], 'sortorder, id', 'id');
+ $DB->sql_isnotempty('exescorm_scoes', 'launch', false, true), array($exescorm->id), 'sortorder, id', 'id');
if ($scoes) {
$orgidentifier = '';
@@ -1080,7 +1080,7 @@ function exescorm_simple_play($exescorm, $user, $context, $cmid) {
if ($exescorm->skipview >= EXESCORM_SKIPVIEW_FIRST) {
$sco = current($scoes);
$result = exescorm_get_toc($user, $exescorm, $cmid, EXESCORM_TOCFULLURL, $orgidentifier);
- $url = new moodle_url('/mod/exescorm/player.php', ['a' => $exescorm->id, 'currentorg' => $orgidentifier]);
+ $url = new moodle_url('/mod/exescorm/player.php', array('a' => $exescorm->id, 'currentorg' => $orgidentifier));
// Set last incomplete sco to launch first if forcenewattempt not set to always.
if (!empty($result->sco->id) && $exescorm->forcenewattempt != EXESCORM_FORCEATTEMPT_ALWAYS) {
@@ -1112,13 +1112,13 @@ function exescorm_get_count_users($exescormid, $groupingid=null) {
INNER JOIN {groupings_groups} gg ON gm.groupid = gg.groupid
WHERE st.exescormid = ? AND gg.groupingid = ?
";
- $params = [$exescormid, $groupingid];
+ $params = array($exescormid, $groupingid);
} else {
$sql = "SELECT COUNT(DISTINCT st.userid)
FROM {exescorm_scoes_track} st
WHERE st.exescormid = ?
";
- $params = [$exescormid];
+ $params = array($exescormid);
}
return ($DB->count_records_sql($sql, $params));
@@ -1146,7 +1146,7 @@ function exescorm_reconstitute_array_element($sversion, $userdata, $elementname,
$exescormseperator = '.';
}
// Filter out the ones we want.
- $elementlist = [];
+ $elementlist = array();
foreach ($userdata as $element => $value) {
if (substr($element, 0, strlen($elementname)) == $elementname) {
$elementlist[$element] = $value;
@@ -1358,9 +1358,9 @@ function exescorm_get_attempt_status($user, $exescorm, $cm = null) {
if (!empty($cm)) {
$context = context_module::instance($cm->id);
if (has_capability('mod/exescorm:deleteownresponses', $context) &&
- $DB->record_exists('exescorm_scoes_track', ['userid' => $user->id, 'exescormid' => $exescorm->id])) {
+ $DB->record_exists('exescorm_scoes_track', array('userid' => $user->id, 'exescormid' => $exescorm->id))) {
// Check to see if any data is stored for this user.
- $deleteurl = new moodle_url($PAGE->url, ['action' => 'delete', 'sesskey' => sesskey()]);
+ $deleteurl = new moodle_url($PAGE->url, array('action' => 'delete', 'sesskey' => sesskey()));
$result .= $OUTPUT->single_button($deleteurl, get_string('deleteallattempts', 'mod_exescorm'));
}
}
@@ -1391,14 +1391,14 @@ function exescorm_get_attempt_count($userid, $exescorm, $returnobjects = false,
}
if ($returnobjects) {
- $params = ['userid' => $userid, 'exescormid' => $exescorm->id];
+ $params = array('userid' => $userid, 'exescormid' => $exescorm->id);
if ($ignoremissingcompletion) { // Exclude attempts that don't have the completion element requested.
$params['element'] = $element;
}
$attempts = $DB->get_records('exescorm_scoes_track', $params, 'attempt', 'DISTINCT attempt AS attemptnumber');
return $attempts;
} else {
- $params = [$userid, $exescorm->id];
+ $params = array($userid, $exescorm->id);
$sql = "SELECT COUNT(DISTINCT attempt)
FROM {exescorm_scoes_track}
WHERE userid = ? AND exescormid = ?";
@@ -1489,11 +1489,11 @@ function exescorm_delete_attempt($userid, $exescorm, $attemptid) {
$cm = get_coursemodule_from_instance('exescorm', $exescorm->id);
// Trigger instances list viewed event.
- $event = \mod_exescorm\event\attempt_deleted::create([
- 'other' => ['attemptid' => $attemptid],
+ $event = \mod_exescorm\event\attempt_deleted::create(array(
+ 'other' => array('attemptid' => $attemptid),
'context' => context_module::instance($cm->id),
- 'relateduserid' => $userid,
- ]);
+ 'relateduserid' => $userid
+ ));
$event->add_record_snapshot('course_modules', $cm);
$event->add_record_snapshot('exescorm', $exescorm);
$event->trigger();
@@ -1523,22 +1523,22 @@ function exescorm_format_duration($duration) {
// this regexp discards empty sections, takes Month/Minute ambiguity into consideration,
// and outputs filled sections, discarding leading zeroes and any format literals
// also saves the only zero before seconds decimals (if there are any) and discards decimals if they are zero.
- $pattern = [ '#([A-Z])0+Y#', '#([A-Z])0+M#', '#([A-Z])0+D#', '#P(|\d+Y)0*(\d+)M#',
+ $pattern = array( '#([A-Z])0+Y#', '#([A-Z])0+M#', '#([A-Z])0+D#', '#P(|\d+Y)0*(\d+)M#',
'#0*(\d+)Y#', '#0*(\d+)D#', '#P#', '#([A-Z])0+H#', '#([A-Z])[0.]+S#',
'#\.0+S#', '#T(|\d+H)0*(\d+)M#', '#0*(\d+)H#', '#0+\.(\d+)S#',
- '#0*([\d.]+)S#', '#T#' ];
- $replace = [ '$1', '$1', '$1', '$1$2 '.$strmonths.' ', '$1 '.$stryears.' ', '$1 '.$strdays.' ',
+ '#0*([\d.]+)S#', '#T#' );
+ $replace = array( '$1', '$1', '$1', '$1$2 '.$strmonths.' ', '$1 '.$stryears.' ', '$1 '.$strdays.' ',
'', '$1', '$1', 'S', '$1$2 '.$strminutes.' ', '$1 '.$strhours.' ',
- '0.$1 '.$strseconds, '$1 '.$strseconds, ''];
+ '0.$1 '.$strseconds, '$1 '.$strseconds, '');
} else {
// Else we have SCORM 1.2 format there
// first convert the timestamp to some SCORM 2004-like format for conveniency.
$duration = preg_replace('#^(\d+):(\d+):([\d.]+)$#', 'T$1H$2M$3S', $duration);
// Then convert in the same way as SCORM 2004.
- $pattern = [ '#T0+H#', '#([A-Z])0+M#', '#([A-Z])[0.]+S#', '#\.0+S#', '#0*(\d+)H#',
- '#0*(\d+)M#', '#0+\.(\d+)S#', '#0*([\d.]+)S#', '#T#' ];
- $replace = [ 'T', '$1', '$1', 'S', '$1 '.$strhours.' ', '$1 '.$strminutes.' ',
- '0.$1 '.$strseconds, '$1 '.$strseconds, '' ];
+ $pattern = array( '#T0+H#', '#([A-Z])0+M#', '#([A-Z])[0.]+S#', '#\.0+S#', '#0*(\d+)H#',
+ '#0*(\d+)M#', '#0+\.(\d+)S#', '#0*([\d.]+)S#', '#T#' );
+ $replace = array( 'T', '$1', '$1', 'S', '$1 '.$strhours.' ', '$1 '.$strminutes.' ',
+ '0.$1 '.$strseconds, '$1 '.$strseconds, '' );
}
$result = preg_replace($pattern, $replace, $duration);
@@ -1556,7 +1556,7 @@ function exescorm_get_toc_object($user, $exescorm, $currentorg='', $scoid='', $m
$modestr = '&mode='.$mode;
}
- $result = [];
+ $result = array();
$incomplete = false;
if (!empty($organizationsco)) {
@@ -1568,7 +1568,7 @@ function exescorm_get_toc_object($user, $exescorm, $currentorg='', $scoid='', $m
if ($scoes = exescorm_get_scoes($exescorm->id, $currentorg)) {
// Retrieve user tracking data for each learning object.
- $usertracks = [];
+ $usertracks = array();
foreach ($scoes as $sco) {
if (!empty($sco->launch)) {
if ($usertrack = exescorm_get_tracks($sco->id, $user->id, $attempt)) {
@@ -1681,11 +1681,11 @@ function exescorm_get_toc_object($user, $exescorm, $currentorg='', $scoid='', $m
$scoid = '';
}
- return ['scoes' => $result, 'usertracks' => $usertracks, 'scoid' => $scoid];
+ return array('scoes' => $result, 'usertracks' => $usertracks, 'scoid' => $scoid);
}
function exescorm_get_toc_get_parent_child(&$result, $currentorg) {
- $final = [];
+ $final = array();
$level = 0;
// Organization is always the root, prevparent.
if (!empty($currentorg)) {
@@ -1734,7 +1734,7 @@ function exescorm_get_toc_get_parent_child(&$result, $currentorg) {
$prevparent = $ident;
}
if (!isset($final[$i][$prevparent]->children)) {
- $final[$i][$prevparent]->children = [];
+ $final[$i][$prevparent]->children = array();
}
if ($sco->parent == $prevparent) {
$final[$i][$prevparent]->children[] = $sco;
@@ -1754,7 +1754,7 @@ function exescorm_get_toc_get_parent_child(&$result, $currentorg) {
}
}
- $results = [];
+ $results = array();
for ($i = 0; $i <= $level; $i++) {
$keys = array_keys($final[$i]);
$results[] = $final[$i][$keys[0]];
@@ -1829,7 +1829,7 @@ function exescorm_format_toc_for_treeview($user, $exescorm, $scoes, $usertracks,
$result->toc .= html_writer::link($url, format_string($sco->title)).$score;
} else {
$result->toc .= ' '.html_writer::link($url, format_string($sco->title),
- ['data-scoid' => $sco->id]).$score;
+ array('data-scoid' => $sco->id)).$score;
}
} else {
if ($sco->exescormtype == 'sco') {
@@ -1843,10 +1843,10 @@ function exescorm_format_toc_for_treeview($user, $exescorm, $scoes, $usertracks,
if ($sco->exescormtype == 'sco') {
$result->toc .= html_writer::tag('a', $sco->statusicon.' '.
format_string($sco->title).' '.$score,
- ['data-scoid' => $sco->id, 'title' => $sco->url]);
+ array('data-scoid' => $sco->id, 'title' => $sco->url));
} else {
$result->toc .= html_writer::tag('a', ' '.format_string($sco->title).' '.$score,
- ['data-scoid' => $sco->id, 'title' => $sco->url]);
+ array('data-scoid' => $sco->id, 'title' => $sco->url));
}
} else {
if ($sco->exescormtype == 'sco') {
@@ -1899,7 +1899,7 @@ function exescorm_format_toc_for_treeview($user, $exescorm, $scoes, $usertracks,
}
function exescorm_format_toc_for_droplist($exescorm, $scoes, $usertracks, $currentorg='', $organizationsco=null,
- $children=false, $level=0, $tocmenus=[]) {
+ $children=false, $level=0, $tocmenus=array()) {
if (!empty($scoes)) {
if (!empty($organizationsco) && !$children) {
$tocmenus[$organizationsco->id] = $organizationsco->title;
@@ -1952,8 +1952,8 @@ function exescorm_get_toc($user, $exescorm, $cmid, $toclink=EXESCORM_TOCJSLINK,
$organizationsco = null;
if ($tocheader) {
- $result->toc = html_writer::start_div('yui3-g-r', ['id' => 'exescorm_layout']);
- $result->toc .= html_writer::start_div('yui3-u-1-5 loading', ['id' => 'exescorm_toc']);
+ $result->toc = html_writer::start_div('yui3-g-r', array('id' => 'exescorm_layout'));
+ $result->toc .= html_writer::start_div('yui3-u-1-5 loading', array('id' => 'exescorm_toc'));
$result->toc .= html_writer::start_div('', ['id' => 'exescorm_tree']);
}
@@ -2012,18 +2012,18 @@ function exescorm_get_toc($user, $exescorm, $cmid, $toclink=EXESCORM_TOCJSLINK,
if ($tocheader) {
$result->toc .= html_writer::end_div().html_writer::end_div();
- $result->toc .= html_writer::start_div('loading', ['id' => 'exescorm_toc_toggle']);
+ $result->toc .= html_writer::start_div('loading', array('id' => 'exescorm_toc_toggle'));
$result->toc .= html_writer::tag('button', '',
- ['id' => 'exescorm_toc_toggle_btn', 'class' => 'bg-primary']).html_writer::end_div();
- $result->toc .= html_writer::start_div('', ['id' => 'exescorm_content']);
- $result->toc .= html_writer::div('', '', ['id' => 'exescorm_navpanel']);
+ array('id' => 'exescorm_toc_toggle_btn', 'class' => 'bg-primary')).html_writer::end_div();
+ $result->toc .= html_writer::start_div('', array('id' => 'exescorm_content'));
+ $result->toc .= html_writer::div('', '', array('id' => 'exescorm_navpanel'));
$result->toc .= html_writer::end_div().html_writer::end_div();
}
return $result;
}
-function exescorm_get_adlnav_json ($scoes, &$adlnav = [], $parentscoid = null) {
+function exescorm_get_adlnav_json ($scoes, &$adlnav = array(), $parentscoid = null) {
if (is_object($scoes)) {
$sco = $scoes;
if (isset($sco->url)) {
@@ -2095,11 +2095,11 @@ function exescorm_get_adlnav_json ($scoes, &$adlnav = [], $parentscoid = null) {
function exescorm_check_url($url) {
$curl = new curl;
// Same options as in {@link download_file_content()}, used in {@link exescorm_parse_scorm()}.
- $curl->setopt(['CURLOPT_FOLLOWLOCATION' => true, 'CURLOPT_MAXREDIRS' => 5]);
+ $curl->setopt(array('CURLOPT_FOLLOWLOCATION' => true, 'CURLOPT_MAXREDIRS' => 5));
$cmsg = $curl->head($url);
$info = $curl->get_info();
if (empty($info['http_code']) || $info['http_code'] != 200) {
- return get_string('invalidurlhttpcheck', 'mod_exescorm', ['cmsg' => $cmsg]);
+ return get_string('invalidurlhttpcheck', 'mod_exescorm', array('cmsg' => $cmsg));
}
return true;
@@ -2137,7 +2137,7 @@ function exescorm_check_launchable_sco($exescorm, $scoid) {
// This scoid might be a top level org that can't be launched, find the first launchable sco after this sco.
$scoes = $DB->get_records_select('exescorm_scoes',
'exescorm = ? AND '.$DB->sql_isnotempty('exescorm_scoes', 'launch', false, true).
- ' AND id > ?', [$exescorm->id, $sco->id], 'sortorder, id', 'id', 0, 1);
+ ' AND id > ?', array($exescorm->id, $sco->id), 'sortorder, id', 'id', 0, 1);
if (!empty($scoes)) {
$sco = reset($scoes); // Get first item from the list.
return $sco->id;
@@ -2163,7 +2163,7 @@ function exescorm_check_launchable_sco($exescorm, $scoid) {
function exescorm_get_availability_status($exescorm, $checkviewreportcap = false, $context = null, $userid = null) {
$open = true;
$closed = false;
- $warnings = [];
+ $warnings = array();
$timenow = time();
if (!empty($exescorm->timeopen) && $exescorm->timeopen > $timenow) {
@@ -2175,7 +2175,7 @@ function exescorm_get_availability_status($exescorm, $checkviewreportcap = false
if (!$open || $closed) {
if ($checkviewreportcap && !empty($context) && has_capability('mod/exescorm:viewreport', $context, $userid)) {
- return [true, $warnings];
+ return array(true, $warnings);
}
if (!$open) {
@@ -2184,11 +2184,11 @@ function exescorm_get_availability_status($exescorm, $checkviewreportcap = false
if ($closed) {
$warnings['expired'] = userdate($exescorm->timeclose);
}
- return [false, $warnings];
+ return array(false, $warnings);
}
// Scorm is available.
- return [true, $warnings];
+ return array(true, $warnings);
}
/**
@@ -2231,7 +2231,7 @@ function exescorm_get_sco_and_launch_url($exescorm, $scoid, $context) {
if ($scoes = $DB->get_records_select(
'exescorm_scoes',
'exescorm = ? AND '.$DB->sql_isnotempty('exescorm_scoes', 'launch', false, true).' AND id > ?',
- [$exescorm->id, $sco->id],
+ array($exescorm->id, $sco->id),
'sortorder, id')) {
$sco = current($scoes);
}
@@ -2244,7 +2244,7 @@ function exescorm_get_sco_and_launch_url($exescorm, $scoid, $context) {
$scoes = $DB->get_records_select(
'exescorm_scoes',
'exescorm = ? AND '.$DB->sql_isnotempty('exescorm_scoes', 'launch', false, true),
- [$exescorm->id],
+ array($exescorm->id),
'sortorder, id'
);
$sco = current($scoes);
@@ -2302,7 +2302,7 @@ function exescorm_get_sco_and_launch_url($exescorm, $scoid, $context) {
// EXESCORM does not work without slasharguments and moodle_url() encodes querystring vars.
$scolaunchurl = "$CFG->wwwroot/pluginfile.php/$context->id/mod_exescorm/content/$exescorm->revision/$launcher";
}
- return [$sco, $scolaunchurl];
+ return array($sco, $scolaunchurl);
}
/**
@@ -2317,11 +2317,11 @@ function exescorm_get_sco_and_launch_url($exescorm, $scoid, $context) {
*/
function exescorm_launch_sco($exescorm, $sco, $cm, $context, $scourl) {
- $event = \mod_exescorm\event\sco_launched::create([
+ $event = \mod_exescorm\event\sco_launched::create(array(
'objectid' => $sco->id,
'context' => $context,
- 'other' => ['instanceid' => $exescorm->id, 'loadedcontent' => $scourl],
- ]);
+ 'other' => array('instanceid' => $exescorm->id, 'loadedcontent' => $scourl)
+ ));
$event->add_record_snapshot('course_modules', $cm);
$event->add_record_snapshot('exescorm', $exescorm);
$event->add_record_snapshot('exescorm_scoes', $sco);
@@ -2343,8 +2343,8 @@ function exescorm_eval_prerequisites($prerequisites, $usertracks) {
// This is really a little language parser - AICC_SCRIPT is the reference
// see 2.3.2.5.1. Sequencing/Navigation Today - from the SCORM 1.2 spec.
$element = '';
- $stack = [];
- $statuses = [
+ $stack = array();
+ $statuses = array(
'passed' => 'passed',
'completed' => 'completed',
'failed' => 'failed',
@@ -2356,8 +2356,8 @@ function exescorm_eval_prerequisites($prerequisites, $usertracks) {
'f' => 'failed',
'i' => 'incomplete',
'b' => 'browsed',
- 'n' => 'notattempted',
- ];
+ 'n' => 'notattempted'
+ );
$i = 0;
// Expand the amp entities.
@@ -2371,7 +2371,7 @@ function exescorm_eval_prerequisites($prerequisites, $usertracks) {
$elements = explode('\t', trim($prerequisites));
// Process each token to build an expression to be evaluated.
- $stack = [];
+ $stack = array();
foreach ($elements as $element) {
$element = trim($element);
if (empty($element)) {
@@ -2453,7 +2453,7 @@ function exescorm_update_calendar(stdClass $exescorm, $cmid) {
// The EXESCORM_EVENT_TYPE_OPEN event should only be an action event if no close time is specified.
$event->type = empty($exescorm->timeclose) ? CALENDAR_EVENT_TYPE_ACTION : CALENDAR_EVENT_TYPE_STANDARD;
if ($event->id = $DB->get_field('event', 'id',
- ['modulename' => 'exescorm', 'instance' => $exescorm->id, 'eventtype' => $event->eventtype])) {
+ array('modulename' => 'exescorm', 'instance' => $exescorm->id, 'eventtype' => $event->eventtype))) {
if ((!empty($exescorm->timeopen)) && ($exescorm->timeopen > 0)) {
// Calendar event exists so update it.
$event->name = get_string('calendarstart', 'mod_exescorm', $exescorm->name);
@@ -2496,7 +2496,7 @@ function exescorm_update_calendar(stdClass $exescorm, $cmid) {
$event->type = CALENDAR_EVENT_TYPE_ACTION;
$event->eventtype = EXESCORM_EVENT_TYPE_CLOSE;
if ($event->id = $DB->get_field('event', 'id',
- ['modulename' => 'exescorm', 'instance' => $exescorm->id, 'eventtype' => $event->eventtype])) {
+ array('modulename' => 'exescorm', 'instance' => $exescorm->id, 'eventtype' => $event->eventtype))) {
if ((!empty($exescorm->timeclose)) && ($exescorm->timeclose > 0)) {
// Calendar event exists so update it.
$event->name = get_string('calendarend', 'mod_exescorm', $exescorm->name);
diff --git a/mod_form.php b/mod_form.php
index a930879..b333727 100644
--- a/mod_form.php
+++ b/mod_form.php
@@ -86,7 +86,7 @@ public function definition() {
$mform->setDefault('exescormtype', $defaulttype);
$mform->setType('exescormtype', PARAM_ALPHA);
$mform->addHelpButton('exescormtype', 'exescormtype', 'exescorm');
- $mform->addElement('text', 'packageurl', get_string('packageurl', 'mod_exescorm'), ['size' => 60]);
+ $mform->addElement('text', 'packageurl', get_string('packageurl', 'mod_exescorm'), array('size' => 60));
$mform->setType('packageurl', PARAM_RAW);
$mform->addHelpButton('packageurl', 'packageurl', 'exescorm');
$mform->hideIf('packageurl', 'exescormtype', 'in', [EXESCORM_TYPE_LOCAL, EXESCORM_TYPE_EXESCORMNET]);
@@ -99,8 +99,8 @@ public function definition() {
$mform->addGroup($group, 'typehelpgroup', '', ' ', false);
$mform->hideIf('typehelpgroup', 'exescormtype', 'noteq', EXESCORM_TYPE_EXESCORMNET);
// New local package upload.
- $filemanageroptions = [];
- $filemanageroptions['accepted_types'] = ['.zip', '.xml'];
+ $filemanageroptions = array();
+ $filemanageroptions['accepted_types'] = array('.zip', '.xml');
$filemanageroptions['maxbytes'] = 0;
$filemanageroptions['maxfiles'] = 1;
$filemanageroptions['subdirs'] = 0;
@@ -139,7 +139,7 @@ public function definition() {
$mform->hideIf('height', 'popup', 'eq', 0);
// Window Options.
- $winoptgrp = [];
+ $winoptgrp = array();
foreach (exescorm_get_popup_options_array() as $key => $value) {
$winoptgrp[] = &$mform->createElement('checkbox', $key, '', get_string($key, 'mod_exescorm'));
$mform->setDefault($key, $value);
@@ -208,9 +208,9 @@ public function definition() {
$mform->addElement('header', 'availability', get_string('availability'));
$mform->addElement('date_time_selector', 'timeopen',
- get_string("exescormopen", "mod_exescorm"), ['optional' => true]);
+ get_string("exescormopen", "mod_exescorm"), array('optional' => true));
$mform->addElement('date_time_selector', 'timeclose',
- get_string("exescormclose", "mod_exescorm"), ['optional' => true]);
+ get_string("exescormclose", "mod_exescorm"), array('optional' => true));
// Grade Settings.
$mform->addElement('header', 'gradesettings', get_string('gradenoun', 'mod_exescorm'));
@@ -317,7 +317,7 @@ public function add_edit_online_buttons($groupname) {
$mform = $this->_form;
// Elements in a row need a group.
- $buttonarray = [];
+ $buttonarray = array();
// Label for the submit button to return to the course.
// Ignore this button in single activity format because it is confusing.
@@ -331,7 +331,7 @@ public function add_edit_online_buttons($groupname) {
$buttonarray[] = $mform->createElement('cancel');
- $mform->addGroup($buttonarray, $groupname, '', [' '], false);
+ $mform->addGroup($buttonarray, $groupname, '', array(' '), false);
$mform->setType($groupname, PARAM_RAW);
}
@@ -365,7 +365,7 @@ public function data_preprocessing(&$defaultvalues) {
$draftitemid = file_get_submitted_draft_itemid('packagefile');
file_prepare_draft_area($draftitemid, $this->context->id, 'mod_exescorm', 'package', 0,
- ['subdirs' => 0, 'maxfiles' => 1]);
+ array('subdirs' => 0, 'maxfiles' => 1));
$defaultvalues['packagefile'] = $draftitemid;
if (($COURSE->format == 'singleactivity') &&
@@ -391,7 +391,7 @@ public function data_preprocessing(&$defaultvalues) {
}
// Set some completion default data.
- $cvalues = [];
+ $cvalues = array();
if (empty($this->_instance)) {
// When in add mode, set a default completion rule that requires the EXESCORM's status be set to "Completed".
$cvalues[4] = 1;
@@ -427,7 +427,7 @@ public function validation($data, $files) {
$draftitemid = file_get_submitted_draft_itemid('packagefile');
file_prepare_draft_area($draftitemid, $this->context->id, 'mod_exescorm', 'packagefilecheck', null,
- ['subdirs' => 0, 'maxfiles' => 1]);
+ array('subdirs' => 0, 'maxfiles' => 1));
// Get file from users draft area.
$usercontext = context_user::instance($USER->id);
@@ -555,11 +555,11 @@ public function set_data($defaultvalues) {
public function add_completion_rules() {
$mform =& $this->_form;
- $items = [];
+ $items = array();
// Require score.
- $group = [];
- $group[] =& $mform->createElement('text', 'completionscorerequired', '', ['size' => 5]);
+ $group = array();
+ $group[] =& $mform->createElement('text', 'completionscorerequired', '', array('size' => 5));
$group[] =& $mform->createElement('checkbox', 'completionscoredisabled', null, get_string('disable'));
$mform->setType('completionscorerequired', PARAM_INT);
$mform->addGroup($group, 'completionscoregroup', get_string('completionscorerequired', 'mod_exescorm'), '', false);
@@ -649,7 +649,7 @@ public function data_postprocessing($data) {
$returnto = new moodle_url("/mod/exescorm/view.php", ['id' => $data->coursemodule, 'forceview' => 1]);
} else {
// Return to course.
- $returnto = course_get_url($data->course, $data->coursesection ?? null, ['sr' => $data->sr]);
+ $returnto = course_get_url($data->course, $data->coursesection ?? null, array('sr' => $data->sr));
}
// Set this becouse modedit.php expects it.
$data->submitbutton = true;
diff --git a/player.php b/player.php
index 281a841..804a48d 100644
--- a/player.php
+++ b/player.php
@@ -32,17 +32,17 @@
if (! $cm = get_coursemodule_from_id('exescorm', $id, 0, true)) {
throw new \moodle_exception('invalidcoursemodule');
}
- if (! $course = $DB->get_record("course", ["id" => $cm->course])) {
+ if (! $course = $DB->get_record("course", array("id" => $cm->course))) {
throw new \moodle_exception('coursemisconf');
}
- if (! $exescorm = $DB->get_record("exescorm", ["id" => $cm->instance])) {
+ if (! $exescorm = $DB->get_record("exescorm", array("id" => $cm->instance))) {
throw new \moodle_exception('invalidcoursemodule');
}
} else if (!empty($a)) {
- if (! $exescorm = $DB->get_record("exescorm", ["id" => $a])) {
+ if (! $exescorm = $DB->get_record("exescorm", array("id" => $a))) {
throw new \moodle_exception('invalidcoursemodule');
}
- if (! $course = $DB->get_record("course", ["id" => $exescorm->course])) {
+ if (! $course = $DB->get_record("course", array("id" => $exescorm->course))) {
throw new \moodle_exception('coursemisconf');
}
if (! $cm = get_coursemodule_from_instance("exescorm", $exescorm->id, $course->id, true)) {
@@ -54,7 +54,7 @@
// PARAM_RAW is used for $currentorg, validate it against records stored in the table.
if (!empty($currentorg)) {
- if (!$DB->record_exists('exescorm_scoes', ['exescorm' => $exescorm->id, 'identifier' => $currentorg])) {
+ if (!$DB->record_exists('exescorm_scoes', array('exescorm' => $exescorm->id, 'identifier' => $currentorg))) {
$currentorg = '';
}
}
@@ -69,7 +69,7 @@
$scoid = exescorm_check_launchable_sco($exescorm, $scoid);
}
-$url = new moodle_url('/mod/exescorm/player.php', ['scoid' => $scoid, 'cm' => $cm->id]);
+$url = new moodle_url('/mod/exescorm/player.php', array('scoid' => $scoid, 'cm' => $cm->id));
if ($mode !== 'normal') {
$url->param('mode', $mode);
}
@@ -112,7 +112,7 @@
if ($displaymode == 'popup') {
$PAGE->set_pagelayout('embedded');
} else {
- $shortname = format_string($course->shortname, true, ['context' => $coursecontext]);
+ $shortname = format_string($course->shortname, true, array('context' => $coursecontext));
$pagetitle = strip_tags("$shortname: ".format_string($exescorm->name));
$PAGE->set_title($pagetitle);
$PAGE->set_heading($course->fullname);
@@ -178,16 +178,16 @@
}
// Print the page header.
-$stringforjs = ['player:next', 'player:prev', 'player:skipnext', 'player:skipprev', 'player:toogleFullscreen', 'player:up' ];
+$stringforjs = ['player:next', 'player:prev', 'player:skipnext', 'player:skipprev', 'player:toogleFullscreen', 'player:up', ];
$PAGE->requires->strings_for_js($stringforjs, 'mod_exescorm');
-$PAGE->requires->data_for_js('exescormplayerdata', ['launch' => false,
+$PAGE->requires->data_for_js('exescormplayerdata', Array('launch' => false,
'currentorg' => '',
'sco' => 0,
'exescorm' => 0,
'courseid' => $exescorm->course,
'cwidth' => $exescorm->width,
'cheight' => $exescorm->height,
- 'popupoptions' => $exescorm->options], true);
+ 'popupoptions' => $exescorm->options), true);
$PAGE->requires->js('/mod/exescorm/request.js', true);
$PAGE->requires->js('/lib/cookies.js', true);
@@ -200,7 +200,7 @@
$activityheader = $PAGE->activityheader;
$headerconfig = [
'description' => '',
- 'hidecompletion' => true,
+ 'hidecompletion' => true
];
$activityheader->set_attrs($headerconfig);
@@ -220,30 +220,30 @@
echo $renderer->generate_editexitbar($exiturl, $cm);
}
-echo html_writer::start_div('', ['id' => 'exescormpage']);
-echo html_writer::start_div('', ['id' => 'tocbox']);
-echo html_writer::div(html_writer::tag('script', '', ['id' => 'external-exescormapi', 'type' => 'text/JavaScript']), '',
- ['id' => 'exescormapi-parent']);
+echo html_writer::start_div('', array('id' => 'exescormpage'));
+echo html_writer::start_div('', array('id' => 'tocbox'));
+echo html_writer::div(html_writer::tag('script', '', array('id' => 'external-exescormapi', 'type' => 'text/JavaScript')), '',
+ array('id' => 'exescormapi-parent'));
if ($exescorm->hidetoc == EXESCORM_TOC_POPUP || $mode == 'browse' || $mode == 'review') {
- echo html_writer::start_div('pl-2', ['id' => 'exescormtop']);
+ echo html_writer::start_div('pl-2', array('id' => 'exescormtop'));
if ($mode == 'browse' || $mode == 'review') {
echo html_writer::div(get_string("{$mode}mode", 'mod_exescorm'), 'exescorm-left h3', ['id' => 'exescormmode']);
}
if ($exescorm->hidetoc == EXESCORM_TOC_POPUP) {
- echo html_writer::div($result->tocmenu, 'exescorm-right', ['id' => 'exescormnav']);
+ echo html_writer::div($result->tocmenu, 'exescorm-right', array('id' => 'exescormnav'));
}
echo html_writer::end_div();
}
-echo html_writer::start_div('', ['id' => 'toctree']);
+echo html_writer::start_div('', array('id' => 'toctree'));
// ADD actions button.
echo $renderer->generate_tocbox_action_buttons();
-echo html_writer::div('', '', ['id' => 'exescorm_toc_title']);
+echo html_writer::div('', '', array('id' => 'exescorm_toc_title'));
if (empty($exescorm->popup) || $displaymode == 'popup') {
echo $result->toc;
@@ -267,14 +267,14 @@
}
$name = 'exescorm_'.$name;
echo html_writer::script('', $CFG->wwwroot.'/mod/exescorm/player.js');
- $url = new moodle_url($PAGE->url, ['scoid' => $sco->id, 'display' => 'popup', 'mode' => $mode]);
+ $url = new moodle_url($PAGE->url, array('scoid' => $sco->id, 'display' => 'popup', 'mode' => $mode));
echo html_writer::script(
- js_writer::function_call('exescorm_openpopup', [$url->out(false),
+ js_writer::function_call('exescorm_openpopup', Array($url->out(false),
$name, $exescorm->options,
- $exescorm->width, $exescorm->height]));
+ $exescorm->width, $exescorm->height)));
echo html_writer::tag('noscript', html_writer::tag('iframe', '',
- ['id' => 'main', 'class' => 'scoframe', 'name' => 'main',
- 'src' => 'loadSCO.php?id='.$cm->id.$scoidstr.$modestr]));
+ array('id' => 'main', 'class' => 'scoframe', 'name' => 'main',
+ 'src' => 'loadSCO.php?id='.$cm->id.$scoidstr.$modestr)));
}
} else {
echo $OUTPUT->box(get_string('noprerequisites', 'mod_exescorm'));
@@ -288,11 +288,11 @@
if (!isset($result->toctitle)) {
$result->toctitle = get_string('toc', 'mod_exescorm');
}
- $jsmodule = [
+ $jsmodule = array(
'name' => 'mod_exescorm',
'fullpath' => '/mod/exescorm/module.js',
- 'requires' => ['json'],
- ];
+ 'requires' => array('json'),
+ );
$exescorm->nav = intval($exescorm->nav);
$PAGE->requires->js_init_call('M.mod_exescorm.init', [$exescorm->nav, $exescorm->navpositionleft,
$exescorm->navpositiontop, $exescorm->hidetoc, $collapsetocwinsize, $result->toctitle,
diff --git a/prereqs.php b/prereqs.php
index 824dde7..6501ea7 100644
--- a/prereqs.php
+++ b/prereqs.php
@@ -30,17 +30,17 @@
if (! $cm = get_coursemodule_from_id('exescorm', $id)) {
throw new \moodle_exception('invalidcoursemodule');
}
- if (! $course = $DB->get_record("course", ["id" => $cm->course])) {
+ if (! $course = $DB->get_record("course", array("id" => $cm->course))) {
throw new \moodle_exception('coursemisconf');
}
- if (! $exescorm = $DB->get_record("exescorm", ["id" => $cm->instance])) {
+ if (! $exescorm = $DB->get_record("exescorm", array("id" => $cm->instance))) {
throw new \moodle_exception('invalidcoursemodule');
}
} else if (!empty($a)) {
- if (! $exescorm = $DB->get_record("exescorm", ["id" => $a])) {
+ if (! $exescorm = $DB->get_record("exescorm", array("id" => $a))) {
throw new \moodle_exception('invalidcoursemodule');
}
- if (! $course = $DB->get_record("course", ["id" => $exescorm->course])) {
+ if (! $course = $DB->get_record("course", array("id" => $exescorm->course))) {
throw new \moodle_exception('coursemisconf');
}
if (! $cm = get_coursemodule_from_instance("exescorm", $exescorm->id, $course->id)) {
@@ -52,12 +52,12 @@
// PARAM_RAW is used for $currentorg, validate it against records stored in the table.
if (!empty($currentorg)) {
- if (!$DB->record_exists('exescorm_scoes', ['exescorm' => $exescorm->id, 'identifier' => $currentorg])) {
+ if (!$DB->record_exists('exescorm_scoes', array('exescorm' => $exescorm->id, 'identifier' => $currentorg))) {
$currentorg = '';
}
}
-$PAGE->set_url('/mod/exescorm/prereqs.php', ['scoid' => $scoid, 'attempt' => $attempt, 'id' => $cm->id]);
+$PAGE->set_url('/mod/exescorm/prereqs.php', array('scoid' => $scoid, 'attempt' => $attempt, 'id' => $cm->id));
require_login($course, false, $cm);
diff --git a/renderer.php b/renderer.php
index f431640..cc732d5 100644
--- a/renderer.php
+++ b/renderer.php
@@ -37,9 +37,9 @@ class mod_exescorm_renderer extends plugin_renderer_base {
public function view_user_heading($user, $course, $baseurl, $attempt, $attemptids) {
$output = '';
$output .= $this->box_start('generalbox boxaligncenter');
- $output .= html_writer::start_tag('div', ['class' => 'mdl-align']);
- $output .= $this->user_picture($user, ['courseid' => $course->id, 'link' => true]);
- $url = new moodle_url('/user/view.php', ['id' => $user->id, 'course' => $course->id]);
+ $output .= html_writer::start_tag('div', array('class' => 'mdl-align'));
+ $output .= $this->user_picture($user, array('courseid' => $course->id, 'link' => true));
+ $url = new moodle_url('/user/view.php', array('id' => $user->id, 'course' => $course->id));
$output .= html_writer::link($url, fullname($user));
$baseurl->param('attempt', '');
$pb = new mod_exescorm_attempt_bar($attemptids, $attempt, $baseurl, 'attempt');
@@ -75,7 +75,7 @@ protected function render_mod_exescorm_attempt_bar(mod_exescorm_attempt_bar $att
}
}
- return html_writer::tag('div', $output, ['class' => 'paging']);
+ return html_writer::tag('div', $output, array('class' => 'paging'));
}
/**
@@ -172,7 +172,7 @@ class mod_exescorm_attempt_bar implements renderable {
/**
* @var array An array of strings. One of them is just a string: the current attempt
*/
- public $attemptlinks = [];
+ public $attemptlinks = array();
/**
* Constructor mod_exescorm_attempt_bar with only the required params.
@@ -224,7 +224,7 @@ public function prepare(renderer_base $output, moodle_page $page, $target) {
$prevattempt = $previous;
} else {
$attemptlink = html_writer::link(
- new moodle_url($this->baseurl, [$this->pagevar => $attemptid]), $attemptid);
+ new moodle_url($this->baseurl, array($this->pagevar => $attemptid)), $attemptid);
$this->attemptlinks[] = $attemptlink;
if (empty($nextattempt) && $prevattempt !== null) {
// Set the nextattempt var as we have set previous attempt earlier.
@@ -236,14 +236,14 @@ public function prepare(renderer_base $output, moodle_page $page, $target) {
if ($this->attempt != $firstattempt) {
$this->previouslink = html_writer::link(
- new moodle_url($this->baseurl, [$this->pagevar => $prevattempt]),
- get_string('previous'), ['class' => 'previous']);
+ new moodle_url($this->baseurl, array($this->pagevar => $prevattempt)),
+ get_string('previous'), array('class' => 'previous'));
}
if ($this->attempt != $lastattempt) {
$this->nextlink = html_writer::link(
- new moodle_url($this->baseurl, [$this->pagevar => $nextattempt]),
- get_string('next'), ['class' => 'next']);
+ new moodle_url($this->baseurl, array($this->pagevar => $nextattempt)),
+ get_string('next'), array('class' => 'next'));
}
}
}
diff --git a/report.php b/report.php
index bc594fb..923f57f 100644
--- a/report.php
+++ b/report.php
@@ -33,8 +33,8 @@
$mode = optional_param('mode', '', PARAM_ALPHA); // Report mode.
$cm = get_coursemodule_from_id('exescorm', $id, 0, false, MUST_EXIST);
-$course = $DB->get_record('course', ['id' => $cm->course], '*', MUST_EXIST);
-$exescorm = $DB->get_record('exescorm', ['id' => $cm->instance], '*', MUST_EXIST);
+$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
+$exescorm = $DB->get_record('exescorm', array('id' => $cm->instance), '*', MUST_EXIST);
$contextmodule = context_module::instance($cm->id);
$reportlist = exescorm_report_list($contextmodule);
@@ -64,13 +64,13 @@
}
// Trigger a report viewed event.
-$event = \mod_exescorm\event\report_viewed::create([
+$event = \mod_exescorm\event\report_viewed::create(array(
'context' => $contextmodule,
- 'other' => [
+ 'other' => array(
'exescormid' => $exescorm->id,
- 'mode' => $mode,
- ],
-]);
+ 'mode' => $mode
+ )
+));
$event->add_record_snapshot('course_modules', $cm);
$event->add_record_snapshot('exescorm', $exescorm);
$event->trigger();
@@ -89,10 +89,10 @@
if ($CFG->version >= 2022041900) { // Moodle 4+.
$PAGE->activityheader->set_attrs([
'hidecompletion' => true,
- 'description' => '',
+ 'description' => ''
]);
}
- $PAGE->navbar->add($strreport, new moodle_url('/mod/exescorm/report.php', ['id' => $cm->id]));
+ $PAGE->navbar->add($strreport, new moodle_url('/mod/exescorm/report.php', array('id' => $cm->id)));
echo $OUTPUT->header();
if ($CFG->version < 2022041900) { // Moodle prior to 4.
diff --git a/report/basic/classes/privacy/provider.php b/report/basic/classes/privacy/provider.php
index 768c4dc..c801028 100644
--- a/report/basic/classes/privacy/provider.php
+++ b/report/basic/classes/privacy/provider.php
@@ -24,9 +24,9 @@
namespace exescormreport_basic\privacy;
-use core_privacy\local\metadata\collection;
-use core_privacy\local\request\transform;
-use core_privacy\local\request\writer;
+use \core_privacy\local\metadata\collection;
+use \core_privacy\local\request\transform;
+use \core_privacy\local\request\writer;
/**
* Privacy Subsystem for exescormreport_basic.
@@ -44,7 +44,7 @@ class provider implements
* @param collection $collection The initialised item collection to add items to.
* @return collection A listing of user data stored through this system.
*/
- public static function get_metadata(collection $collection): collection {
+ public static function get_metadata(collection $collection) : collection {
// User preferences shared between different exescorm reports.
$collection->add_user_preference('exescorm_report_pagesize', 'privacy:metadata:preference:exescorm_report_pagesize');
diff --git a/report/basic/classes/report.php b/report/basic/classes/report.php
index 989aa37..93bbdc9 100644
--- a/report/basic/classes/report.php
+++ b/report/basic/classes/report.php
@@ -13,7 +13,6 @@
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
-
/**
* Core Report class of basic reporting plugin
* @package exescormreport
@@ -40,9 +39,9 @@ public function display($exescorm, $cm, $course, $download) {
$contextmodule = \context_module::instance($cm->id);
$action = optional_param('action', '', PARAM_ALPHA);
- $attemptids = optional_param_array('attemptid', [], PARAM_RAW);
+ $attemptids = optional_param_array('attemptid', array(), PARAM_RAW);
$attemptsmode = optional_param('attemptsmode', EXESCORM_REPORT_ATTEMPTS_ALL_STUDENTS, PARAM_INT);
- $PAGE->set_url(new \moodle_url($PAGE->url, ['attemptsmode' => $attemptsmode]));
+ $PAGE->set_url(new \moodle_url($PAGE->url, array('attemptsmode' => $attemptsmode)));
// Scorm action bar for report.
if ($download === '') {
@@ -75,7 +74,7 @@ public function display($exescorm, $cm, $course, $download) {
}
// Select group menu.
- $displayoptions = [];
+ $displayoptions = array();
$displayoptions['attemptsmode'] = $attemptsmode;
if ($groupmode = groups_get_activity_groupmode($cm)) { // Groups are being used.
if (!$download) {
@@ -108,13 +107,13 @@ public function display($exescorm, $cm, $course, $download) {
// Now check if asked download of data.
$coursecontext = \context_course::instance($course->id);
if ($download) {
- $shortname = format_string($course->shortname, true, ['context' => $coursecontext]);
+ $shortname = format_string($course->shortname, true, array('context' => $coursecontext));
$filename = clean_filename("$shortname ".format_string($exescorm->name, true));
}
// Define table columns.
- $columns = [];
- $headers = [];
+ $columns = array();
+ $headers = array();
if (!$download && $candelete) {
$columns[] = 'checkbox';
$headers[] = $this->generate_master_checkbox();
@@ -353,16 +352,16 @@ public function display($exescorm, $cm, $course, $download) {
if (!$download) {
$attempts = $DB->get_records_sql($select.$from.$where.$sort, $params,
$table->get_page_start(), $table->get_page_size());
- echo \html_writer::start_div('', ['id' => 'exescormtablecontainer']);
+ echo \html_writer::start_div('', array('id' => 'exescormtablecontainer'));
if ($candelete) {
// Start form.
$strreallydel = addslashes_js(get_string('deleteattemptcheck', 'mod_exescorm'));
- echo \html_writer::start_tag('form', ['id' => 'attemptsform', 'method' => 'post',
+ echo \html_writer::start_tag('form', array('id' => 'attemptsform', 'method' => 'post',
'action' => $PAGE->url->out(false),
- 'onsubmit' => 'return confirm("'.$strreallydel.'");']);
- echo \html_writer::empty_tag('input', ['type' => 'hidden', 'name' => 'action', 'value' => 'delete']);
- echo \html_writer::empty_tag('input', ['type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()]);
- echo \html_writer::start_div('', ['style' => 'display: none;']);
+ 'onsubmit' => 'return confirm("'.$strreallydel.'");'));
+ echo \html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'action', 'value' => 'delete'));
+ echo \html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()));
+ echo \html_writer::start_div('', array('style' => 'display: none;'));
echo \html_writer::input_hidden_params($PAGE->url);
echo \html_writer::end_div();
echo \html_writer::start_div();
@@ -374,7 +373,7 @@ public function display($exescorm, $cm, $course, $download) {
if ($attempts) {
foreach ($attempts as $scouser) {
- $row = [];
+ $row = array();
if (!empty($scouser->attempt)) {
$timetracks = exescorm_get_sco_runtime($exescorm->id, false, $scouser->userid, $scouser->attempt);
} else {
@@ -392,10 +391,10 @@ public function display($exescorm, $cm, $course, $download) {
$additionalfields = explode(',', implode(',', \core_user\fields::get_picture_fields()));
$user = username_load_fields_from_object($user, $scouser, null, $additionalfields);
$user->id = $scouser->userid;
- $row[] = $OUTPUT->user_picture($user, ['courseid' => $course->id]);
+ $row[] = $OUTPUT->user_picture($user, array('courseid' => $course->id));
}
if (!$download) {
- $url = new \moodle_url('/user/view.php', ['id' => $scouser->userid, 'course' => $course->id]);
+ $url = new \moodle_url('/user/view.php', array('id' => $scouser->userid, 'course' => $course->id));
$row[] = \html_writer::link($url, fullname($scouser));
} else {
$row[] = fullname($scouser);
@@ -410,8 +409,8 @@ public function display($exescorm, $cm, $course, $download) {
$row[] = '-';
} else {
if (!$download) {
- $url = new \moodle_url('/mod/exescorm/report/userreport.php', ['id' => $cm->id,
- 'user' => $scouser->userid, 'attempt' => $scouser->attempt, 'mode' => 'basic']);
+ $url = new \moodle_url('/mod/exescorm/report/userreport.php', array('id' => $cm->id,
+ 'user' => $scouser->userid, 'attempt' => $scouser->attempt, 'mode' => 'basic'));
$row[] = \html_writer::link($url, $scouser->attempt);
} else {
$row[] = $scouser->attempt;
@@ -457,7 +456,7 @@ public function display($exescorm, $cm, $course, $download) {
$url = new \moodle_url('/mod/exescorm/report/userreporttracks.php',
[
'id' => $cm->id, 'scoid' => $sco->id, 'user' => $scouser->userid,
- 'attempt' => $scouser->attempt, 'mode' => 'basic',
+ 'attempt' => $scouser->attempt, 'mode' => 'basic'
]
);
$row[] = $OUTPUT->pix_icon($trackdata->status, $strstatus, 'exescorm') . '
' .
@@ -494,7 +493,7 @@ public function display($exescorm, $cm, $course, $download) {
if (!$download) {
$table->finish_output();
if ($candelete) {
- echo \html_writer::start_tag('table', ['id' => 'commands']);
+ echo \html_writer::start_tag('table', array('id' => 'commands'));
echo \html_writer::start_tag('tr').\html_writer::start_tag('td');
echo $this->generate_delete_selected_button();
echo \html_writer::end_tag('td').\html_writer::end_tag('tr').\html_writer::end_tag('table');
diff --git a/report/basic/version.php b/report/basic/version.php
index 577d1be..5152728 100644
--- a/report/basic/version.php
+++ b/report/basic/version.php
@@ -14,6 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+
/**
* Defines the version of exescorm_basic
*
diff --git a/report/graphs/classes/privacy/provider.php b/report/graphs/classes/privacy/provider.php
index b6f91af..5380fa8 100644
--- a/report/graphs/classes/privacy/provider.php
+++ b/report/graphs/classes/privacy/provider.php
@@ -38,7 +38,7 @@ class provider implements \core_privacy\local\metadata\null_provider {
*
* @return string
*/
- public static function get_reason(): string {
+ public static function get_reason() : string {
return 'privacy:metadata';
}
}
diff --git a/report/graphs/classes/report.php b/report/graphs/classes/report.php
index b35efab..455850b 100644
--- a/report/graphs/classes/report.php
+++ b/report/graphs/classes/report.php
@@ -13,7 +13,6 @@
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
-
/**
* Core Report class of graphs reporting plugin
*
@@ -152,7 +151,7 @@ public function display($exescorm, $cm, $course, $download) {
$labels[] = ($i - 1) * self::BANDWIDTH . ' - ' . $i * self::BANDWIDTH;
}
- if ($scoes = $DB->get_records('exescorm_scoes', ["exescorm" => $exescorm->id], 'sortorder, id')) {
+ if ($scoes = $DB->get_records('exescorm_scoes', array("exescorm" => $exescorm->id), 'sortorder, id')) {
foreach ($scoes as $sco) {
if ($sco->launch != '') {
diff --git a/report/graphs/version.php b/report/graphs/version.php
index e5e83b4..bb8d74b 100644
--- a/report/graphs/version.php
+++ b/report/graphs/version.php
@@ -14,6 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+
/**
* Defines the version of exescormreport_graphs
*
diff --git a/report/interactions/classes/privacy/provider.php b/report/interactions/classes/privacy/provider.php
index f88f5dc..080c7bb 100644
--- a/report/interactions/classes/privacy/provider.php
+++ b/report/interactions/classes/privacy/provider.php
@@ -24,9 +24,9 @@
namespace exescormreport_interactions\privacy;
-use core_privacy\local\metadata\collection;
-use core_privacy\local\request\transform;
-use core_privacy\local\request\writer;
+use \core_privacy\local\metadata\collection;
+use \core_privacy\local\request\transform;
+use \core_privacy\local\request\writer;
/**
* Privacy Subsystem for exescormreport_interactions.
@@ -44,7 +44,7 @@ class provider implements
* @param collection $collection The initialised item collection to add items to.
* @return collection A listing of user data stored through this system.
*/
- public static function get_metadata(collection $collection): collection {
+ public static function get_metadata(collection $collection) : collection {
// User preferences shared between different exescorm reports.
$collection->add_user_preference('exescorm_report_pagesize', 'privacy:metadata:preference:exescorm_report_pagesize');
diff --git a/report/interactions/classes/report.php b/report/interactions/classes/report.php
index efb4523..cbfa96a 100644
--- a/report/interactions/classes/report.php
+++ b/report/interactions/classes/report.php
@@ -13,7 +13,6 @@
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
-
/**
* Core Report class of basic reporting plugin
* @package exescormreport
@@ -41,9 +40,9 @@ public function display($exescorm, $cm, $course, $download) {
$contextmodule = \context_module::instance($cm->id);
$action = optional_param('action', '', PARAM_ALPHA);
- $attemptids = optional_param_array('attemptid', [], PARAM_RAW);
+ $attemptids = optional_param_array('attemptid', array(), PARAM_RAW);
$attemptsmode = optional_param('attemptsmode', EXESCORM_REPORT_ATTEMPTS_ALL_STUDENTS, PARAM_INT);
- $PAGE->set_url(new \moodle_url($PAGE->url, ['attemptsmode' => $attemptsmode]));
+ $PAGE->set_url(new \moodle_url($PAGE->url, array('attemptsmode' => $attemptsmode)));
// Scorm action bar for report.
if ($download === '') {
@@ -85,20 +84,20 @@ public function display($exescorm, $cm, $course, $download) {
}
// Select group menu.
- $displayoptions = [];
+ $displayoptions = array();
$displayoptions['attemptsmode'] = $attemptsmode;
$displayoptions['qtext'] = $includeqtext;
$displayoptions['resp'] = $includeresp;
$displayoptions['right'] = $includeright;
$displayoptions['result'] = $includeresult;
- $mform->set_data($displayoptions + ['pagesize' => $pagesize]);
+ $mform->set_data($displayoptions + array('pagesize' => $pagesize));
if ($groupmode = groups_get_activity_groupmode($cm)) { // Groups are being used.
if (!$download) {
groups_print_activity_menu($cm, new \moodle_url($PAGE->url, $displayoptions));
}
}
- $formattextoptions = ['context' => \context_course::instance($course->id)];
+ $formattextoptions = array('context' => \context_course::instance($course->id));
// We only want to show the checkbox to delete attempts
// if the user has permissions and if the report mode is showing attempts.
@@ -128,8 +127,8 @@ public function display($exescorm, $cm, $course, $download) {
}
// Define table columns.
- $columns = [];
- $headers = [];
+ $columns = array();
+ $headers = array();
if (!$download && $candelete) {
$columns[] = 'checkbox';
$headers[] = $this->generate_master_checkbox();
@@ -155,7 +154,7 @@ public function display($exescorm, $cm, $course, $download) {
$headers[] = get_string('last', 'mod_exescorm');
$columns[] = 'score';
$headers[] = get_string('score', 'mod_exescorm');
- $scoes = $DB->get_records('exescorm_scoes', ["exescorm" => $exescorm->id], 'sortorder, id');
+ $scoes = $DB->get_records('exescorm_scoes', array("exescorm" => $exescorm->id), 'sortorder, id');
foreach ($scoes as $sco) {
if ($sco->launch != '') {
$columns[] = 'scograde'.$sco->id;
@@ -397,16 +396,16 @@ public function display($exescorm, $cm, $course, $download) {
if (!$download) {
$attempts = $DB->get_records_sql($select.$from.$where.$sort, $params,
$table->get_page_start(), $table->get_page_size());
- echo \html_writer::start_div('', ['id' => 'exescormtablecontainer']);
+ echo \html_writer::start_div('', array('id' => 'exescormtablecontainer'));
if ($candelete) {
// Start form.
$strreallydel = addslashes_js(get_string('deleteattemptcheck', 'mod_exescorm'));
- echo \html_writer::start_tag('form', ['id' => 'attemptsform', 'method' => 'post',
+ echo \html_writer::start_tag('form', array('id' => 'attemptsform', 'method' => 'post',
'action' => $PAGE->url->out(false),
- 'onsubmit' => 'return confirm("'.$strreallydel.'");']);
- echo \html_writer::empty_tag('input', ['type' => 'hidden', 'name' => 'action', 'value' => 'delete']);
- echo \html_writer::empty_tag('input', ['type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()]);
- echo \html_writer::start_div('', ['style' => 'display: none;']);
+ 'onsubmit' => 'return confirm("'.$strreallydel.'");'));
+ echo \html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'action', 'value' => 'delete'));
+ echo \html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()));
+ echo \html_writer::start_div('', array('style' => 'display: none;'));
echo \html_writer::input_hidden_params($PAGE->url);
echo \html_writer::end_div();
echo \html_writer::start_div();
@@ -417,7 +416,7 @@ public function display($exescorm, $cm, $course, $download) {
}
if ($attempts) {
foreach ($attempts as $scouser) {
- $row = [];
+ $row = array();
if (!empty($scouser->attempt)) {
$timetracks = exescorm_get_sco_runtime($exescorm->id, false, $scouser->userid, $scouser->attempt);
} else {
@@ -435,10 +434,10 @@ public function display($exescorm, $cm, $course, $download) {
$additionalfields = explode(',', implode(',', \core_user\fields::get_picture_fields()));
$user = username_load_fields_from_object($user, $scouser, null, $additionalfields);
$user->id = $scouser->userid;
- $row[] = $OUTPUT->user_picture($user, ['courseid' => $course->id]);
+ $row[] = $OUTPUT->user_picture($user, array('courseid' => $course->id));
}
if (!$download) {
- $url = new \moodle_url('/user/view.php', ['id' => $scouser->userid, 'course' => $course->id]);
+ $url = new \moodle_url('/user/view.php', array('id' => $scouser->userid, 'course' => $course->id));
$row[] = \html_writer::link($url, fullname($scouser));
} else {
$row[] = fullname($scouser);
@@ -454,10 +453,10 @@ public function display($exescorm, $cm, $course, $download) {
} else {
if (!$download) {
$url = new \moodle_url('/mod/exescorm/report/userreport.php',
- ['id' => $cm->id,
+ array('id' => $cm->id,
'user' => $scouser->userid,
'attempt' => $scouser->attempt,
- 'mode' => 'interactions']);
+ 'mode' => 'interactions'));
$row[] = \html_writer::link($url, $scouser->attempt);
} else {
$row[] = $scouser->attempt;
@@ -494,11 +493,11 @@ public function display($exescorm, $cm, $course, $download) {
$score = $strstatus;
}
if (!$download) {
- $url = new \moodle_url('/mod/exescorm/report/userreporttracks.php', ['id' => $cm->id,
+ $url = new \moodle_url('/mod/exescorm/report/userreporttracks.php', array('id' => $cm->id,
'scoid' => $sco->id, 'user' => $scouser->userid, 'attempt' => $scouser->attempt,
- 'mode' => 'interactions']);
+ 'mode' => 'interactions'));
$row[] = $OUTPUT->pix_icon($trackdata->status, $strstatus, 'exescorm') . '
' .
- \html_writer::link($url, $score, ['title' => get_string('details', 'mod_exescorm')]);
+ \html_writer::link($url, $score, array('title' => get_string('details', 'mod_exescorm')));
} else {
$row[] = $score;
}
@@ -580,7 +579,7 @@ public function display($exescorm, $cm, $course, $download) {
if (!$download) {
$table->finish_output();
if ($candelete) {
- echo \html_writer::start_tag('table', ['id' => 'commands']);
+ echo \html_writer::start_tag('table', array('id' => 'commands'));
echo \html_writer::start_tag('tr').\html_writer::start_tag('td');
echo $this->generate_delete_selected_button();
echo \html_writer::end_tag('td').\html_writer::end_tag('tr').\html_writer::end_tag('table');
diff --git a/report/interactions/responsessettings_form.php b/report/interactions/responsessettings_form.php
index 501035b..1d9aa1c 100644
--- a/report/interactions/responsessettings_form.php
+++ b/report/interactions/responsessettings_form.php
@@ -33,7 +33,7 @@ public function definition() {
// -------------------------------------------------------------------------------
$mform->addElement('header', 'preferencespage', get_string('preferencespage', 'mod_exescorm'));
- $options = [];
+ $options = array();
if ($COURSE->id != SITEID) {
$options[EXESCORM_REPORT_ATTEMPTS_ALL_STUDENTS] = get_string('optallstudents', 'mod_exescorm');
$options[EXESCORM_REPORT_ATTEMPTS_STUDENTS_WITH] = get_string('optattemptsonly', 'mod_exescorm');
diff --git a/report/interactions/version.php b/report/interactions/version.php
index edd59ec..02c8fcd 100644
--- a/report/interactions/version.php
+++ b/report/interactions/version.php
@@ -14,6 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+
/**
* Defines the version of exescorm_interactions
* @package exescormreport
diff --git a/report/objectives/classes/privacy/provider.php b/report/objectives/classes/privacy/provider.php
index 290ab58..fa20bea 100644
--- a/report/objectives/classes/privacy/provider.php
+++ b/report/objectives/classes/privacy/provider.php
@@ -24,9 +24,9 @@
namespace exescormreport_objectives\privacy;
-use core_privacy\local\metadata\collection;
-use core_privacy\local\request\transform;
-use core_privacy\local\request\writer;
+use \core_privacy\local\metadata\collection;
+use \core_privacy\local\request\transform;
+use \core_privacy\local\request\writer;
/**
* Privacy Subsystem for exescormreport_objectives.
@@ -44,7 +44,7 @@ class provider implements
* @param collection $collection The initialised item collection to add items to.
* @return collection A listing of user data stored through this system.
*/
- public static function get_metadata(collection $collection): collection {
+ public static function get_metadata(collection $collection) : collection {
// User preferences shared between different exescorm reports.
$collection->add_user_preference('exescorm_report_pagesize', 'privacy:metadata:preference:exescorm_report_pagesize');
diff --git a/report/objectives/classes/report.php b/report/objectives/classes/report.php
index 74b05ec..f096dc2 100644
--- a/report/objectives/classes/report.php
+++ b/report/objectives/classes/report.php
@@ -13,7 +13,6 @@
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
-
/**
* Core Report class of objectives EXESCORM report plugin
* @package exescormreport_objectives
@@ -47,9 +46,9 @@ public function display($exescorm, $cm, $course, $download) {
$contextmodule = \context_module::instance($cm->id);
$action = optional_param('action', '', PARAM_ALPHA);
- $attemptids = optional_param_array('attemptid', [], PARAM_RAW);
+ $attemptids = optional_param_array('attemptid', array(), PARAM_RAW);
$attemptsmode = optional_param('attemptsmode', EXESCORM_REPORT_ATTEMPTS_ALL_STUDENTS, PARAM_INT);
- $PAGE->set_url(new \moodle_url($PAGE->url, ['attemptsmode' => $attemptsmode]));
+ $PAGE->set_url(new \moodle_url($PAGE->url, array('attemptsmode' => $attemptsmode)));
// Scorm action bar for report.
if ($download === '') {
@@ -82,17 +81,17 @@ public function display($exescorm, $cm, $course, $download) {
}
// Select group menu.
- $displayoptions = [];
+ $displayoptions = array();
$displayoptions['attemptsmode'] = $attemptsmode;
$displayoptions['objectivescore'] = $showobjectivescore;
- $mform->set_data($displayoptions + ['pagesize' => $pagesize]);
+ $mform->set_data($displayoptions + array('pagesize' => $pagesize));
if ($groupmode = groups_get_activity_groupmode($cm)) { // Groups are being used.
if (!$download) {
groups_print_activity_menu($cm, new \moodle_url($PAGE->url, $displayoptions));
}
}
- $formattextoptions = ['context' => \context_course::instance($course->id)];
+ $formattextoptions = array('context' => \context_course::instance($course->id));
// We only want to show the checkbox to delete attempts
// if the user has permissions and if the report mode is showing attempts.
@@ -122,8 +121,8 @@ public function display($exescorm, $cm, $course, $download) {
}
// Define table columns.
- $columns = [];
- $headers = [];
+ $columns = array();
+ $headers = array();
if (!$download && $candelete) {
$columns[] = 'checkbox';
$headers[] = $this->generate_master_checkbox();
@@ -149,7 +148,7 @@ public function display($exescorm, $cm, $course, $download) {
$headers[] = get_string('last', 'mod_exescorm');
$columns[] = 'score';
$headers[] = get_string('score', 'mod_exescorm');
- $scoes = $DB->get_records('exescorm_scoes', ["exescorm" => $exescorm->id], 'sortorder, id');
+ $scoes = $DB->get_records('exescorm_scoes', array("exescorm" => $exescorm->id), 'sortorder, id');
foreach ($scoes as $sco) {
if ($sco->launch != '') {
$columns[] = 'scograde'.$sco->id;
@@ -190,7 +189,7 @@ public function display($exescorm, $cm, $course, $download) {
$nbmaincolumns = count($columns); // Get number of main columns used.
$objectives = get_exescorm_objectives($exescorm->id);
- $nosort = [];
+ $nosort = array();
foreach ($objectives as $scoid => $sco) {
foreach ($sco as $id => $objectivename) {
$colid = $scoid.'objectivestatus' . $id;
@@ -387,16 +386,16 @@ public function display($exescorm, $cm, $course, $download) {
if (!$download) {
$attempts = $DB->get_records_sql($select.$from.$where.$sort, $params,
$table->get_page_start(), $table->get_page_size());
- echo \html_writer::start_div('', ['id' => 'exescormtablecontainer']);
+ echo \html_writer::start_div('', array('id' => 'exescormtablecontainer'));
if ($candelete) {
// Start form.
$strreallydel = addslashes_js(get_string('deleteattemptcheck', 'mod_exescorm'));
- echo \html_writer::start_tag('form', ['id' => 'attemptsform', 'method' => 'post',
+ echo \html_writer::start_tag('form', array('id' => 'attemptsform', 'method' => 'post',
'action' => $PAGE->url->out(false),
- 'onsubmit' => 'return confirm("'.$strreallydel.'");']);
- echo \html_writer::empty_tag('input', ['type' => 'hidden', 'name' => 'action', 'value' => 'delete']);
- echo \html_writer::empty_tag('input', ['type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()]);
- echo \html_writer::start_div('', ['style' => 'display: none;']);
+ 'onsubmit' => 'return confirm("'.$strreallydel.'");'));
+ echo \html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'action', 'value' => 'delete'));
+ echo \html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()));
+ echo \html_writer::start_div('', array('style' => 'display: none;'));
echo \html_writer::input_hidden_params($PAGE->url);
echo \html_writer::end_div();
echo \html_writer::start_div();
@@ -407,7 +406,7 @@ public function display($exescorm, $cm, $course, $download) {
}
if ($attempts) {
foreach ($attempts as $scouser) {
- $row = [];
+ $row = array();
if (!empty($scouser->attempt)) {
$timetracks = exescorm_get_sco_runtime($exescorm->id, false, $scouser->userid, $scouser->attempt);
} else {
@@ -425,10 +424,10 @@ public function display($exescorm, $cm, $course, $download) {
$additionalfields = explode(',', implode(',', \core_user\fields::get_picture_fields()));
$user = username_load_fields_from_object($user, $scouser, null, $additionalfields);
$user->id = $scouser->userid;
- $row[] = $OUTPUT->user_picture($user, ['courseid' => $course->id]);
+ $row[] = $OUTPUT->user_picture($user, array('courseid' => $course->id));
}
if (!$download) {
- $url = new \moodle_url('/user/view.php', ['id' => $scouser->userid, 'course' => $course->id]);
+ $url = new \moodle_url('/user/view.php', array('id' => $scouser->userid, 'course' => $course->id));
$row[] = \html_writer::link($url, fullname($scouser));
} else {
$row[] = fullname($scouser);
@@ -443,8 +442,8 @@ public function display($exescorm, $cm, $course, $download) {
$row[] = '-';
} else {
if (!$download) {
- $url = new \moodle_url('/mod/exescorm/report/userreport.php', ['id' => $cm->id,
- 'user' => $scouser->userid, 'attempt' => $scouser->attempt, 'mode' => 'objectives']);
+ $url = new \moodle_url('/mod/exescorm/report/userreport.php', array('id' => $cm->id,
+ 'user' => $scouser->userid, 'attempt' => $scouser->attempt, 'mode' => 'objectives'));
$row[] = \html_writer::link($url, $scouser->attempt);
} else {
$row[] = $scouser->attempt;
@@ -481,11 +480,11 @@ public function display($exescorm, $cm, $course, $download) {
$score = $strstatus;
}
if (!$download) {
- $url = new \moodle_url('/mod/exescorm/report/userreporttracks.php', ['id' => $cm->id,
+ $url = new \moodle_url('/mod/exescorm/report/userreporttracks.php', array('id' => $cm->id,
'scoid' => $sco->id, 'user' => $scouser->userid, 'attempt' => $scouser->attempt,
- 'mode' => 'objectives']);
+ 'mode' => 'objectives'));
$row[] = $OUTPUT->pix_icon($trackdata->status, $strstatus, 'exescorm') . '
' .
- \html_writer::link($url, $score, ['title' => get_string('details', 'mod_exescorm')]);
+ \html_writer::link($url, $score, array('title' => get_string('details', 'mod_exescorm')));
} else {
$row[] = $score;
}
@@ -498,9 +497,9 @@ public function display($exescorm, $cm, $course, $download) {
$objectiveprefix = "cmi.objectives_";
}
- $keywords = [".id", $objectiveprefix];
- $objectivestatus = [];
- $objectivescore = [];
+ $keywords = array(".id", $objectiveprefix);
+ $objectivestatus = array();
+ $objectivescore = array();
foreach ($trackdata as $name => $value) {
if (strpos($name, $objectiveprefix) === 0 && strrpos($name, '.id') !== false) {
$num = trim(str_ireplace($keywords, '', $name));
@@ -578,7 +577,7 @@ public function display($exescorm, $cm, $course, $download) {
if (!$download) {
$table->finish_output();
if ($candelete) {
- echo \html_writer::start_tag('table', ['id' => 'commands']);
+ echo \html_writer::start_tag('table', array('id' => 'commands'));
echo \html_writer::start_tag('tr').\html_writer::start_tag('td');
echo $this->generate_delete_selected_button();
echo \html_writer::end_tag('td').\html_writer::end_tag('tr').\html_writer::end_tag('table');
@@ -621,8 +620,8 @@ public function display($exescorm, $cm, $course, $download) {
*/
function get_exescorm_objectives($exescormid) {
global $DB;
- $objectives = [];
- $params = [];
+ $objectives = array();
+ $params = array();
$select = "exescormid = ? AND ";
$select .= $DB->sql_like("element", "?", false);
$params[] = $exescormid;
diff --git a/report/objectives/responsessettings_form.php b/report/objectives/responsessettings_form.php
index 18751de..c30a7d7 100644
--- a/report/objectives/responsessettings_form.php
+++ b/report/objectives/responsessettings_form.php
@@ -41,7 +41,7 @@ protected function definition() {
$mform->addElement('header', 'preferencespage', get_string('preferencespage', 'mod_exescorm'));
- $options = [];
+ $options = array();
if ($COURSE->id != SITEID) {
$options[EXESCORM_REPORT_ATTEMPTS_ALL_STUDENTS] = get_string('optallstudents', 'mod_exescorm');
$options[EXESCORM_REPORT_ATTEMPTS_STUDENTS_WITH] = get_string('optattemptsonly', 'mod_exescorm');
diff --git a/report/objectives/version.php b/report/objectives/version.php
index 0ba386e..6678e8b 100644
--- a/report/objectives/version.php
+++ b/report/objectives/version.php
@@ -14,6 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+
/**
* Defines the version of exescorm_objectives
* @package exescormreport_objectives
diff --git a/report/reportlib.php b/report/reportlib.php
index ace2287..605ebb8 100644
--- a/report/reportlib.php
+++ b/report/reportlib.php
@@ -72,13 +72,13 @@ function exescorm_report_list($context) {
function get_exescorm_question_count($exescormid) {
global $DB;
$count = 0;
- $params = [];
+ $params = array();
$select = "exescormid = ? AND ";
$select .= $DB->sql_like("element", "?", false);
$params[] = $exescormid;
$params[] = "cmi.interactions_%.id";
$rs = $DB->get_recordset_select("exescorm_scoes_track", $select, $params, 'element');
- $keywords = ["cmi.interactions_", ".id"];
+ $keywords = array("cmi.interactions_", ".id");
if ($rs->valid()) {
foreach ($rs as $record) {
$num = trim(str_ireplace($keywords, '', $record->element));
diff --git a/report/userreport.php b/report/userreport.php
index d58f1ad..9ac8b05 100644
--- a/report/userreport.php
+++ b/report/userreport.php
@@ -31,17 +31,17 @@
$mode = optional_param('mode', '', PARAM_ALPHA); // Scorm mode from which reached here.
// Building the url to use for links.+ data details buildup.
-$url = new moodle_url('/mod/exescorm/report/userreport.php', ['id' => $id,
+$url = new moodle_url('/mod/exescorm/report/userreport.php', array('id' => $id,
'user' => $userid,
- 'attempt' => $attempt]);
-$tracksurl = new moodle_url('/mod/exescorm/report/userreporttracks.php', ['id' => $id,
+ 'attempt' => $attempt));
+$tracksurl = new moodle_url('/mod/exescorm/report/userreporttracks.php', array('id' => $id,
'user' => $userid,
'attempt' => $attempt,
- 'mode' => $mode]);
+ 'mode' => $mode));
$cm = get_coursemodule_from_id('exescorm', $id, 0, false, MUST_EXIST);
$course = get_course($cm->course);
-$exescorm = $DB->get_record('exescorm', ['id' => $cm->instance], '*', MUST_EXIST);
-$user = $DB->get_record('user', ['id' => $userid], implode(',', \core_user\fields::get_picture_fields()), MUST_EXIST);
+$exescorm = $DB->get_record('exescorm', array('id' => $cm->instance), '*', MUST_EXIST);
+$user = $DB->get_record('user', array('id' => $userid), implode(',', \core_user\fields::get_picture_fields()), MUST_EXIST);
// Get list of attempts this user has made.
$attemptids = exescorm_get_all_attempts($exescorm->id, $userid);
@@ -63,11 +63,11 @@
}
// Trigger a user report viewed event.
-$event = \mod_exescorm\event\user_report_viewed::create([
+$event = \mod_exescorm\event\user_report_viewed::create(array(
'context' => $contextmodule,
'relateduserid' => $userid,
- 'other' => ['attemptid' => $attempt, 'instanceid' => $exescorm->id],
-]);
+ 'other' => array('attemptid' => $attempt, 'instanceid' => $exescorm->id)
+));
$event->add_record_snapshot('course_modules', $cm);
$event->add_record_snapshot('exescorm', $exescorm);
$event->trigger();
@@ -78,11 +78,11 @@
$PAGE->set_title("$course->shortname: ".format_string($exescorm->name));
$PAGE->set_heading($course->fullname);
-$PAGE->navbar->add($strreport, new moodle_url('/mod/exescorm/report.php', ['id' => $cm->id]));
+$PAGE->navbar->add($strreport, new moodle_url('/mod/exescorm/report.php', array('id' => $cm->id)));
$PAGE->navbar->add(fullname($user). " - $strattempt $attempt");
$PAGE->activityheader->set_attrs([
'hidecompletion' => true,
- 'description' => '',
+ 'description' => ''
]);
echo $OUTPUT->header();
@@ -97,22 +97,22 @@
$output = $PAGE->get_renderer('mod_exescorm');
echo $output->view_user_heading($user, $course, $PAGE->url, $attempt, $attemptids);
-if ($scoes = $DB->get_records('exescorm_scoes', ['exescorm' => $exescorm->id], 'sortorder, id')) {
+if ($scoes = $DB->get_records('exescorm_scoes', array('exescorm' => $exescorm->id), 'sortorder, id')) {
// Print general score data.
$table = new html_table();
- $table->head = [
+ $table->head = array(
get_string('title', 'mod_exescorm'),
get_string('status', 'mod_exescorm'),
get_string('time', 'mod_exescorm'),
get_string('score', 'mod_exescorm'),
- ''];
- $table->align = ['left', 'center', 'center', 'right', 'left'];
- $table->wrap = ['nowrap', 'nowrap', 'nowrap', 'nowrap', 'nowrap'];
+ '');
+ $table->align = array('left', 'center', 'center', 'right', 'left');
+ $table->wrap = array('nowrap', 'nowrap', 'nowrap', 'nowrap', 'nowrap');
$table->width = '80%';
- $table->size = ['*', '*', '*', '*', '*'];
+ $table->size = array('*', '*', '*', '*', '*');
foreach ($scoes as $sco) {
if ($sco->launch != '') {
- $row = [];
+ $row = array();
$score = ' ';
if ($trackdata = exescorm_get_tracks($sco->id, $userid, $attempt)) {
if ($trackdata->score_raw != '') {
@@ -140,7 +140,7 @@
$row[] = $score;
$row[] = $detailslink;
} else {
- $row = [format_string($sco->title), ' ', ' ', ' ', ' '];
+ $row = array(format_string($sco->title), ' ', ' ', ' ', ' ');
}
$table->data[] = $row;
}
diff --git a/report/userreportinteractions.php b/report/userreportinteractions.php
index c8d78f9..d5b0b2e 100644
--- a/report/userreportinteractions.php
+++ b/report/userreportinteractions.php
@@ -34,14 +34,14 @@
$mode = optional_param('mode', '', PARAM_ALPHA); // Scorm mode from which reached here.
// Building the url to use for links.+ data details buildup.
-$url = new moodle_url('/mod/exescorm/report/userreportinteractions.php', ['id' => $id,
+$url = new moodle_url('/mod/exescorm/report/userreportinteractions.php', array('id' => $id,
'user' => $userid,
- 'attempt' => $attempt]);
+ 'attempt' => $attempt));
$cm = get_coursemodule_from_id('exescorm', $id, 0, false, MUST_EXIST);
$course = get_course($cm->course);
-$exescorm = $DB->get_record('exescorm', ['id' => $cm->instance], '*', MUST_EXIST);
-$user = $DB->get_record('user', ['id' => $userid], implode(',', \core_user\fields::get_picture_fields()), MUST_EXIST);
+$exescorm = $DB->get_record('exescorm', array('id' => $cm->instance), '*', MUST_EXIST);
+$user = $DB->get_record('user', array('id' => $userid), implode(',', \core_user\fields::get_picture_fields()), MUST_EXIST);
// Get list of attempts this user has made.
$attemptids = exescorm_get_all_attempts($exescorm->id, $userid);
@@ -64,23 +64,23 @@
}
// Trigger a user interactions viewed event.
-$event = \mod_exescorm\event\interactions_viewed::create([
+$event = \mod_exescorm\event\interactions_viewed::create(array(
'context' => $contextmodule,
'relateduserid' => $userid,
- 'other' => ['attemptid' => $attempt, 'instanceid' => $exescorm->id],
-]);
+ 'other' => array('attemptid' => $attempt, 'instanceid' => $exescorm->id)
+));
$event->add_record_snapshot('course_modules', $cm);
$event->add_record_snapshot('exescorm', $exescorm);
$event->trigger();
-$trackdata = $DB->get_records('exescorm_scoes_track', ['userid' => $user->id, 'exescormid' => $exescorm->id,
- 'attempt' => $attempt]);
+$trackdata = $DB->get_records('exescorm_scoes_track', array('userid' => $user->id, 'exescormid' => $exescorm->id,
+ 'attempt' => $attempt));
$usertrack = exescorm_format_interactions($trackdata);
$questioncount = get_exescorm_question_count($exescorm->id);
$courseshortname = format_string($course->shortname, true,
- ['context' => context_course::instance($course->id)]);
+ array('context' => context_course::instance($course->id)));
$exportfilename = $courseshortname . '-' . format_string($exescorm->name, true) . '-'
. get_string('interactions', 'mod_exescorm');
@@ -95,13 +95,13 @@
$PAGE->set_title("$course->shortname: ".format_string($exescorm->name));
$PAGE->set_heading($course->fullname);
- $PAGE->navbar->add($strreport, new moodle_url('/mod/exescorm/report.php', ['id' => $cm->id]));
+ $PAGE->navbar->add($strreport, new moodle_url('/mod/exescorm/report.php', array('id' => $cm->id)));
$PAGE->navbar->add(fullname($user). " - $strattempt $attempt");
$PAGE->activityheader->set_attrs([
'hidecompletion' => true,
- 'description' => '',
+ 'description' => ''
]);
echo $OUTPUT->header();
@@ -119,17 +119,17 @@
}
$table->define_baseurl($PAGE->url);
-$table->define_columns(['id', 'studentanswer', 'correctanswer', 'result', 'calcweight']);
-$table->define_headers([get_string('trackid', 'mod_exescorm'), get_string('response', 'mod_exescorm'),
+$table->define_columns(array('id', 'studentanswer', 'correctanswer', 'result', 'calcweight'));
+$table->define_headers(array(get_string('trackid', 'mod_exescorm'), get_string('response', 'mod_exescorm'),
get_string('rightanswer', 'mod_exescorm'), get_string('result', 'mod_exescorm'),
- get_string('calculatedweight', 'mod_exescorm')]);
+ get_string('calculatedweight', 'mod_exescorm')));
$table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthwide');
-$table->show_download_buttons_at([TABLE_P_BOTTOM]);
+$table->show_download_buttons_at(array(TABLE_P_BOTTOM));
$table->setup();
for ($i = 0; $i < $questioncount; $i++) {
- $row = [];
+ $row = array();
$element = 'cmi.interactions_'.$i.'.id';
if (isset($usertrack->$element)) {
$row[] = s($usertrack->$element);
diff --git a/report/userreporttracks.php b/report/userreporttracks.php
index e1954b6..378883e 100644
--- a/report/userreporttracks.php
+++ b/report/userreporttracks.php
@@ -34,16 +34,16 @@
$download = optional_param('download', '', PARAM_ALPHA);
// Building the url to use for links.+ data details buildup.
-$url = new moodle_url('/mod/exescorm/report/userreporttracks.php', ['id' => $id,
+$url = new moodle_url('/mod/exescorm/report/userreporttracks.php', array('id' => $id,
'user' => $userid,
'attempt' => $attempt,
'scoid' => $scoid,
- 'mode' => $mode]);
+ 'mode' => $mode));
$cm = get_coursemodule_from_id('exescorm', $id, 0, false, MUST_EXIST);
$course = get_course($cm->course);
-$exescorm = $DB->get_record('exescorm', ['id' => $cm->instance], '*', MUST_EXIST);
-$user = $DB->get_record('user', ['id' => $userid], implode(',', \core_user\fields::get_picture_fields()), MUST_EXIST);
-$selsco = $DB->get_record('exescorm_scoes', ['id' => $scoid], '*', MUST_EXIST);
+$exescorm = $DB->get_record('exescorm', array('id' => $cm->instance), '*', MUST_EXIST);
+$user = $DB->get_record('user', array('id' => $userid), implode(',', \core_user\fields::get_picture_fields()), MUST_EXIST);
+$selsco = $DB->get_record('exescorm_scoes', array('id' => $scoid), '*', MUST_EXIST);
$PAGE->set_url($url);
// END of url setting + data buildup.
@@ -59,11 +59,11 @@
}
// Trigger a tracks viewed event.
-$event = \mod_exescorm\event\tracks_viewed::create([
+$event = \mod_exescorm\event\tracks_viewed::create(array(
'context' => $contextmodule,
'relateduserid' => $userid,
- 'other' => ['attemptid' => $attempt, 'instanceid' => $exescorm->id, 'scoid' => $scoid, 'mode' => $mode],
-]);
+ 'other' => array('attemptid' => $attempt, 'instanceid' => $exescorm->id, 'scoid' => $scoid, 'mode' => $mode)
+));
$event->add_record_snapshot('course_modules', $cm);
$event->add_record_snapshot('exescorm', $exescorm);
$event->trigger();
@@ -74,9 +74,9 @@
$PAGE->set_title("$course->shortname: ".format_string($exescorm->name));
$PAGE->set_heading($course->fullname);
-$PAGE->navbar->add($strreport, new moodle_url('/mod/exescorm/report.php', ['id' => $cm->id]));
+$PAGE->navbar->add($strreport, new moodle_url('/mod/exescorm/report.php', array('id' => $cm->id)));
$PAGE->navbar->add("$strattempt $attempt - ".fullname($user),
- new moodle_url('/mod/exescorm/report/userreport.php', ['id' => $id, 'user' => $userid, 'attempt' => $attempt]));
+ new moodle_url('/mod/exescorm/report/userreport.php', array('id' => $id, 'user' => $userid, 'attempt' => $attempt)));
$PAGE->navbar->add($selsco->title . ' - '. get_string('details', 'mod_exescorm'));
// Moodle 4.0+ only.
if ($CFG->version >= 2022041900) {
@@ -94,7 +94,7 @@
}
$courseshortname = format_string($course->shortname, true,
- ['context' => context_course::instance($course->id)]);
+ array('context' => context_course::instance($course->id)));
$exportfilename = $courseshortname . '-' . format_string($exescorm->name, true) . '-' . get_string('details', 'mod_exescorm');
$table = new flexible_table('mod_exescorm-userreporttracks');
@@ -102,7 +102,7 @@
if (!$table->is_downloading($download, $exportfilename)) {
$PAGE->activityheader->set_attrs([
'hidecompletion' => true,
- 'description' => '',
+ 'description' => ''
]);
echo $OUTPUT->header();
$currenttab = '';
@@ -114,16 +114,16 @@
format_string($selsco->title). ' - '. get_string('details', 'mod_exescorm'), 3);
}
$table->define_baseurl($PAGE->url);
-$table->define_columns(['element', 'value']);
-$table->define_headers([get_string('element', 'mod_exescorm'), get_string('value', 'mod_exescorm')]);
+$table->define_columns(array('element', 'value'));
+$table->define_headers(array(get_string('element', 'mod_exescorm'), get_string('value', 'mod_exescorm')));
$table->set_attribute('class', 'generaltable generalbox boxaligncenter exescormtrackreport');
-$table->show_download_buttons_at([TABLE_P_BOTTOM]);
+$table->show_download_buttons_at(array(TABLE_P_BOTTOM));
$table->setup();
foreach ($trackdata as $element => $value) {
if (substr($element, 0, 3) == 'cmi') {
$existelements = true;
- $row = [];
+ $row = array();
$string = false;
if (stristr($element, '.id') !== false) {
$string = "trackid";
diff --git a/report/version.php b/report/version.php
deleted file mode 100644
index 768ee98..0000000
--- a/report/version.php
+++ /dev/null
@@ -1,23 +0,0 @@
-.
-
-defined('MOODLE_INTERNAL') || die();
-
-$plugin->version = 2023101900; // Versión del subplugin (Fecha: YYYYMMDDXX).
-$plugin->requires = 2022041900; // Versión mÃnima de Moodle.
-$plugin->component = 'mod_exescormreport_basic'; // Nombre completo del subplugin.
-$plugin->maturity = MATURITY_BETA; // Estabilidad.
-$plugin->release = 'v1.0'; // Versión del subplugin.
diff --git a/reportsettings_form.php b/reportsettings_form.php
index 515fab9..da4de93 100644
--- a/reportsettings_form.php
+++ b/reportsettings_form.php
@@ -25,7 +25,7 @@ public function definition() {
// -------------------------------------------------------------------------------
$mform->addElement('header', 'preferencespage', get_string('preferencespage', 'mod_exescorm'));
- $options = [];
+ $options = array();
if ($COURSE->id != SITEID) {
$options[EXESCORM_REPORT_ATTEMPTS_ALL_STUDENTS] = get_string('optallstudents', 'mod_exescorm');
$options[EXESCORM_REPORT_ATTEMPTS_STUDENTS_WITH] = get_string('optattemptsonly', 'mod_exescorm');
diff --git a/set_ode.php b/set_ode.php
index b175b6f..c03f165 100644
--- a/set_ode.php
+++ b/set_ode.php
@@ -26,7 +26,7 @@
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-use mod_exescorm\exeonline\token_manager;
+use \mod_exescorm\exeonline\token_manager;
// @codingStandardsIgnoreLine as we validate via account id, HMAC keys, etc.
require_once(__DIR__ . '/../../config.php');
diff --git a/styles.css b/styles.css
index 083abed..9e7e904 100644
--- a/styles.css
+++ b/styles.css
@@ -236,7 +236,7 @@
}
#page-mod-exescorm-player #exescormpage li.yui3-treeview-has-children > div.yui3-treeview-row > span.yui3-treeview-icon {
- display: block; /* Fix indentation */
+ display: block;
}
#page-mod-exescorm-player #exescormpage div.yui3-u-1,
@@ -390,27 +390,27 @@
}
#page-mod-exescorm-player button#nav_skipprev {
- border-top-left-radius: 5px;
- border-bottom-left-radius: 5px;
- background-image: url('[[pix:mod_exescorm|skipprev]]');
+ border-top-left-radius: 5px !important;
+ border-bottom-left-radius: 5px !important;
+ background-image: url('[[pix:mod_exescorm|skipprev]]') !important;
}
#page-mod-exescorm-player button#nav_skipnext {
- border-top-right-radius: 5px;
- border-bottom-right-radius: 5px;
- background-image: url('[[pix:mod_exescorm|skipnext]]');
+ border-top-right-radius: 5px !important;
+ border-bottom-right-radius: 5px !important;
+ background-image: url('[[pix:mod_exescorm|skipnext]]') !important;
}
#page-mod-exescorm-player button#nav_next {
- background-image: url('[[pix:mod_exescorm|next]]');
+ background-image: url('[[pix:mod_exescorm|next]]') !important;
}
#page-mod-exescorm-player button#nav_prev {
- background-image: url('[[pix:mod_exescorm|prev]]');
+ background-image: url('[[pix:mod_exescorm|prev]]') !important;
}
#page-mod-exescorm-player button#nav_up {
- background-image: url('[[pix:mod_exescorm|up]]');
+ background-image: url('[[pix:mod_exescorm|up]]') !important;
}
#page-mod-exescorm-player #exescormpage li.yui3-treeview-has-children > div.yui3-treeview-row > span.yui3-treeview-icon {
diff --git a/tabs.php b/tabs.php
index bf98d23..79c14a2 100644
--- a/tabs.php
+++ b/tabs.php
@@ -39,10 +39,10 @@
$contextmodule = context_module::instance($cm->id);
-$tabs = [];
-$row = [];
-$inactive = [];
-$activated = [];
+$tabs = array();
+$row = array();
+$inactive = array();
+$activated = array();
if (has_capability('mod/exescorm:savetrack', $contextmodule)) {
$row[] = new tabobject('info', "$CFG->wwwroot/mod/exescorm/view.php?id=$cm->id", get_string('modulename', 'mod_exescorm'));
@@ -56,7 +56,7 @@
}
if ($currenttab == 'reports' && !empty($reportlist) && count($reportlist) > 1) {
- $row2 = [];
+ $row2 = array();
foreach ($reportlist as $rep) {
$row2[] = new tabobject('exescorm_'.$rep, $CFG->wwwroot."/mod/exescorm/report.php?id=$cm->id&mode=$rep",
get_string('pluginname', 'exescormreport_'.$rep));
diff --git a/templates/report_actionbar.mustache b/templates/report_actionbar.mustache
index 767d3e6..84fd902 100644
--- a/templates/report_actionbar.mustache
+++ b/templates/report_actionbar.mustache
@@ -38,7 +38,7 @@
"downloadtext": "http://localhost/moodle/mod/exescorm/report.php?id=143&mode=basic&attemptsmode=0&sesskey=AmfcC7riSb&download=CSV"
}
}}
-