diff --git a/.travis.yml b/.travis.yml index 61478ceb835aea6591a5f527867400301e075a36..a53e2f8daad96bd2d2feb40463412649d07ece63 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,19 +1,11 @@ # This is the language of our project. language: php -# If using Behat, then this should be true due to an issue with Travis CI. -# If not using Behat, recommended to use `sudo: false` as it is faster. -sudo: false - # Installs the required version of Firefox for Behat, an updated version # of PostgreSQL and extra APT packages. Java 8 is only required # for Mustache command. addons: - firefox: "47.0.1" - postgresql: "9.4" - apt: - packages: - - openjdk-8-jre-headless + postgresql: "9.5" # Cache NPM's and Composer's caches to speed up build times. cache: @@ -27,12 +19,15 @@ cache: php: - 7.0 - 7.1 + - 7.2 + - 7.3 + - 7.4 # This section sets up the environment variables for the build. env: global: # This line determines which version branch of Moodle to test against. - - MOODLE_BRANCH=MOODLE_35_STABLE + - MOODLE_BRANCH=MOODLE_39_STABLE - IGNORE_PATHS=lang,editor,library,reporting # This matrix is used for testing against multiple databases. So for # each version of PHP being tested, one build will be created for each @@ -41,7 +36,7 @@ env: # using PHP 5.6 and mysqli. matrix: - DB=pgsql -# - DB=mysqli + - DB=mysqli # Optionally, it is possible to specify a different Moodle repo to use # (git://github.com/moodle/moodle.git is used by default): @@ -51,14 +46,11 @@ env: before_install: # This disables XDebug which should speed up the build. - phpenv config-rm xdebug.ini - # This installs NodeJS which is used by Grunt, etc. - - nvm install 8.9 - - nvm use 8.9 # Currently we are inside of the clone of your repository. We move up two # directories to build the project. - cd ../.. # Install this project into a directory called "ci". - - composer create-project -n --no-dev --prefer-dist blackboard-open-source/moodle-plugin-ci ci ^2 + - composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3 # Update the $PATH so scripts from this project can be called easily. - export PATH="$(cd ci/bin; pwd):$(cd ci/vendor/bin; pwd):$PATH" diff --git a/classes/file_storage.php b/classes/file_storage.php index aaf615c1478d410e890c1a7ac7c517a96950fd42..157837150d79cc189cf7ec88fc6c51483e219b66 100644 --- a/classes/file_storage.php +++ b/classes/file_storage.php @@ -730,7 +730,7 @@ class file_storage implements \H5PFileStorage { } } - // TODO: Return list of all files so they can be marked as temporary. JI-366 + // TODO: Return list of all files so they can be marked as temporary. JI-366. } /** @@ -874,7 +874,7 @@ class file_storage implements \H5PFileStorage { // Make sure the directory exists first. $matches = array(); preg_match('/(.+)\/[^\/]*$/', $filepath, $matches); - // Recursively make directories + // Recursively make directories. if (!file_exists($matches[1])) { mkdir($matches[1], 0777, true); } diff --git a/classes/framework.php b/classes/framework.php index d5ad2c33cd081a48c3ed4b757577044f2b27d8a9..2d659b35f0fc6382fdde9157fe3046534a19a6e0 100644 --- a/classes/framework.php +++ b/classes/framework.php @@ -55,7 +55,7 @@ class framework implements \H5PFrameworkInterface { if (!isset($interface)) { $interface = new \mod_hvp\framework(); - // Support alternate file storage class defined in $CFG + // Support alternate file storage class defined in $CFG. if (!empty($CFG->mod_hvp_file_storage_class)) { $fsclass = $CFG->mod_hvp_file_storage_class; } else { @@ -494,7 +494,7 @@ class framework implements \H5PFrameworkInterface { // Some strings such as error messages are not translatable, in this case use message // directly instead of crashing - // @see https://github.com/h5p/h5p-php-library/commit/2bd972168e7b22aaeea2dd13682ced9cf8233452#diff-5ca86cd0514d58be6708beff914aba66R1296 + // @see https://github.com/h5p/h5p-php-library/commit/2bd972168e7b22aaeea2dd13682ced9cf8233452#diff-5ca86cd0514d58be6708beff914aba66R1296. if (!isset($translationsmap[$message])) { return $message; } @@ -968,7 +968,7 @@ class framework implements \H5PFrameworkInterface { 'timemodified' => time(), )); - if( isset( $content[ 'completionpass' ] ) ){ + if (isset($content[ 'completionpass'])) { $data[ 'completionpass' ] = $content[ 'completionpass' ]; } diff --git a/classes/user_grades.php b/classes/user_grades.php index b6ef20fc23b94a55e7a7daa2bbb08c4bdd9b42d4..3981875ab271d484b2a772e0388f77c1f029a6a2 100644 --- a/classes/user_grades.php +++ b/classes/user_grades.php @@ -96,7 +96,7 @@ class user_grades { $completion = new \completion_info( $course ); if ( $completion->is_enabled( $cm) ) { - $completion->update_state($cm,COMPLETION_COMPLETE); + $completion->update_state($cm, COMPLETION_COMPLETE); } // Log results set event. @@ -106,7 +106,7 @@ class user_grades { $content->name, $content->major_version . '.' . $content->minor_version ); - // Trigger Moodle event for async notification messages + // Trigger Moodle event for async notification messages. $event = \mod_hvp\event\attempt_submitted::create([ 'context' => $context, ]); diff --git a/classes/view_assets.php b/classes/view_assets.php index 49686fa183a80b09f73e8cf7d173d5240dd919b5..7c08bcef093f0d17a888068c31b773607b31b94e 100644 --- a/classes/view_assets.php +++ b/classes/view_assets.php @@ -339,7 +339,7 @@ class view_assets { */ public static function getsiteroot() { global $CFG; - // In Moodle 3.4 version wwwroot is always the same as httpswwwroot + // In Moodle 3.4 version wwwroot is always the same as httpswwwroot. if ($CFG->version < 2017111300) { return $CFG->httpswwwroot; } diff --git a/db/upgrade.php b/db/upgrade.php index 642ffa41da7b6c48aaff62a914225aef5e2477fa..5303b4e2202bcd9ca93c108e7f3ea92e61621da0 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -481,7 +481,7 @@ function hvp_upgrade_2019030700() { } } -function hvp_upgrade_2020080400(){ +function hvp_upgrade_2020080400() { global $DB; $dbman = $DB->get_manager(); // Define field completionscorerequired to be added to hvp. diff --git a/embed.php b/embed.php index bb0b28c578c8c71fe15d68ac5a1f1fa9ff5e71f8..d6a8afefe3aeb727bdcea58e31737762e131eba9 100644 --- a/embed.php +++ b/embed.php @@ -75,7 +75,10 @@ require_capability('mod/hvp:view', $context); core\session\manager::write_close(); // Set up view assets. -$view = new \mod_hvp\view_assets($cm, $course, ['disabledownload' => $disabledownload, 'disablefullscreen' => $disablefullscreen]); +$view = new \mod_hvp\view_assets($cm, $course, [ + 'disabledownload' => $disabledownload, + 'disablefullscreen' => $disablefullscreen +]); $content = $view->getcontent(); $view->validatecontent(); diff --git a/lang/en/hvp.php b/lang/en/hvp.php index b3cc6b28662b5c9b9e9d857cd64f3216f3a667e0..1cc289f7b5ce5d426a6c2002d39e80a12e6b7b7c 100644 --- a/lang/en/hvp.php +++ b/lang/en/hvp.php @@ -434,7 +434,7 @@ $string['reusecontent'] = 'Reuse Content'; $string['reusedescription'] = 'Reuse this content.'; $string['contentcopied'] = 'Content is copied to the clipboard'; -// Offline +// Offline. $string['connectionlost'] = 'Connection lost. Results will be stored and sent when you regain connection.'; $string['connectionreestablished'] = 'Connection reestablished.'; $string['resubmitscores'] = 'Attempting to submit stored results.'; @@ -452,7 +452,7 @@ $string['couldnotparsejsonfromzip'] = 'Unable to parse JSON from the package: %f $string['couldnotparsepostdata'] = 'Could not parse post data.'; $string['nombstringexteension'] = 'The mbstring PHP extension is not loaded. H5P needs this to function properly'; -// Messaging api +// Messaging api. $string['messageprovider:confirmation'] = 'Confirmation of your own H5P submissions'; $string['messageprovider:submission'] = 'Notification of H5P submissions'; $string['emailnotifysubject'] = '{$a->studentname} has completed {$a->hvpname}'; diff --git a/lib.php b/lib.php index 7a7234d6a03e9e0766cf53d32878d4981e201fdb..2db08dbbc78b639e6e87a35db2ab24b6d09d8e7f 100644 --- a/lib.php +++ b/lib.php @@ -421,4 +421,4 @@ function hvp_get_completion_state($course, $cm, $userid, $type) { } } return false; -} +} diff --git a/locallib.php b/locallib.php index f75e4d344ad687d1e46070e57bbc9fe495980413..6679b0acccf29ca09410e344b7681c59ab23775a 100644 --- a/locallib.php +++ b/locallib.php @@ -64,7 +64,8 @@ function hvp_get_core_settings($context) { $settings = array( 'baseUrl' => $basepath, 'url' => "{$basepath}pluginfile.php/{$context->instanceid}/mod_hvp", - 'urlLibraries' => "{$basepath}pluginfile.php/{$systemcontext->id}/mod_hvp/libraries", // NOTE: Separate context from content URL ! + // NOTE: Separate context from content URL ! + 'urlLibraries' => "{$basepath}pluginfile.php/{$systemcontext->id}/mod_hvp/libraries", 'postUserStatistics' => true, 'ajax' => $ajaxpaths, 'saveFreq' => $savefreq, diff --git a/mod_form.php b/mod_form.php index f3e546ca06ebc5d0e4b76f9cb6efdea801a63b08..403c2105528ae3cf2d81de3d7fb55824fab49729 100644 --- a/mod_form.php +++ b/mod_form.php @@ -393,7 +393,9 @@ class mod_hvp_mod_form extends moodleform_mod { // Fix for legacy content upload to work. // Fetch title from h5p.json or use a default string if not available. $h5pvalidator = \mod_hvp\framework::instance('validator'); - $data->metadata->title = empty($h5pvalidator->h5pC->mainJsonData['title']) ? 'Uploaded Content' : $h5pvalidator->h5pC->mainJsonData['title']; + $data->metadata->title = empty($h5pvalidator->h5pC->mainJsonData['title']) + ? 'Uploaded Content' + : $h5pvalidator->h5pC->mainJsonData['title']; } $data->name = $data->metadata->title; // Sort of a hack, // but there is no JavaScript that sets the value when there is no editor... @@ -432,17 +434,18 @@ class mod_hvp_mod_form extends moodleform_mod { } return $data; } - + public function add_completion_rules() { - $mform =& $this->_form; - $items = array(); - $group = array(); + $mform =& $this->_form; + $items = array(); + $group = array(); $group[] = $mform->createElement('advcheckbox', 'completionpass', null, get_string('completionpass', 'hvp'), - array('group' => 'cpass')); + array('group' => 'cpass')); $mform->disabledIf('completionpass', 'completionusegrade', 'notchecked'); $mform->addGroup($group, 'completionpassgroup', get_string('completionpass', 'hvp'), ' ', false); $mform->addHelpButton('completionpassgroup', 'completionpass', 'hvp'); $items[] = 'completionpassgroup'; + return $items; } }