diff --git a/.travis.yml b/.travis.yml index 9010d63..828ae09 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,14 +12,19 @@ php: - 5.6 env: - - MOODLE_BRANCH=MOODLE_28_STABLE DB=pgsql + - MOODLE_BRANCH=MOODLE_26_STABLE DB=mysqli + - MOODLE_BRANCH=MOODLE_27_STABLE DB=mysqli - MOODLE_BRANCH=MOODLE_28_STABLE DB=mysqli - - MOODLE_BRANCH=MOODLE_29_STABLE DB=pgsql - MOODLE_BRANCH=MOODLE_29_STABLE DB=mysqli - - MOODLE_BRANCH=MOODLE_30_STABLE DB=pgsql - MOODLE_BRANCH=MOODLE_30_STABLE DB=mysqli + - MOODLE_BRANCH=MOODLE_26_STABLE DB=pgsql + - MOODLE_BRANCH=MOODLE_27_STABLE DB=pgsql + - MOODLE_BRANCH=MOODLE_28_STABLE DB=pgsql + - MOODLE_BRANCH=MOODLE_29_STABLE DB=pgsql + - MOODLE_BRANCH=MOODLE_30_STABLE DB=pgsql matrix: + fast_finish: true include: - php: 7.0 env: MOODLE_BRANCH=MOODLE_30_STABLE DB=pgsql diff --git a/2.x-activity-module/mod/aspirelists/classes/event/aspirelists_launch.php b/2.x-activity-module/mod/aspirelists/classes/event/aspirelists_launch.php new file mode 100644 index 0000000..925902c --- /dev/null +++ b/2.x-activity-module/mod/aspirelists/classes/event/aspirelists_launch.php @@ -0,0 +1,41 @@ +data['objecttable'] = 'aspirelists'; + $this->data['edulevel'] = self::LEVEL_PARTICIPATING; + $this->data['crud'] = 'r'; + } + + public static function get_name() { + return get_string('eventAspireLaunch', 'aspirelists'); + } + + public function get_description() { + return "The user with id {$this->userid} Launched an LTI link with id {$this->objectid}."; + } + + public function get_legacy_logdata() { + return $this->legacy_log_data; + } + + /** + * easily set our old add_to_log data + * @param array $data + */ + public function set_legacy_logdata(array $data) { + $this->legacy_log_data = $data; + } +} \ No newline at end of file diff --git a/2.x-activity-module/mod/aspirelists/classes/event/course_module_viewed.php b/2.x-activity-module/mod/aspirelists/classes/event/course_module_viewed.php new file mode 100644 index 0000000..731bd87 --- /dev/null +++ b/2.x-activity-module/mod/aspirelists/classes/event/course_module_viewed.php @@ -0,0 +1,32 @@ +data['objecttable'] = 'aspirelists'; + $this->data['edulevel'] = self::LEVEL_PARTICIPATING; + $this->data['crud'] = 'r'; + parent::init(); + } + + public function get_legacy_logdata() { + return $this->legacy_log_data; + } + + /** + * easily set our old add_to_log data + * @param array $data + */ + public function set_legacy_logdata(array $data) { + $this->legacy_log_data = $data; + } +} \ No newline at end of file diff --git a/2.x-activity-module/mod/aspirelists/db/upgrade.php b/2.x-activity-module/mod/aspirelists/db/upgrade.php index 7aba7de..1f840f6 100644 --- a/2.x-activity-module/mod/aspirelists/db/upgrade.php +++ b/2.x-activity-module/mod/aspirelists/db/upgrade.php @@ -119,4 +119,8 @@ function xmldb_aspirelists_upgrade($oldversion) { upgrade_mod_savepoint(true, 2016051100, 'aspirelists'); } + if ($oldversion < 2016061400){ + upgrade_mod_savepoint(true, 2016061400, 'aspirelists'); + } + } \ No newline at end of file diff --git a/2.x-activity-module/mod/aspirelists/lang/en/aspirelists.php b/2.x-activity-module/mod/aspirelists/lang/en/aspirelists.php index b9df22f..8b4db3d 100644 --- a/2.x-activity-module/mod/aspirelists/lang/en/aspirelists.php +++ b/2.x-activity-module/mod/aspirelists/lang/en/aspirelists.php @@ -5,6 +5,8 @@ $string['modulename'] = 'Course Resource List'; $string['pluginname'] = 'Course Resource List'; +$string['eventAspireLaunch'] = 'Talis Aspire Launch Event'; + $string['pluginadministration'] = 'Course resource list administration'; diff --git a/2.x-activity-module/mod/aspirelists/launch.php b/2.x-activity-module/mod/aspirelists/launch.php index 5b813ca..4966bc7 100644 --- a/2.x-activity-module/mod/aspirelists/launch.php +++ b/2.x-activity-module/mod/aspirelists/launch.php @@ -4,6 +4,7 @@ require_once($CFG->dirroot.'/mod/aspirelists/lib.php'); require_once($CFG->dirroot.'/mod/lti/lib.php'); require_once($CFG->dirroot.'/mod/lti/locallib.php'); +require_once($CFG->dirroot.'/mod/aspirelists/classes/event/aspirelists_launch.php'); // make sure that this launch.php page is not cached by any proxies. header("Cache-Control: no-cache, must-revalidate"); @@ -15,8 +16,21 @@ $cm = get_coursemodule_from_id('aspirelists', $id, 0, false, MUST_EXIST); $list = $DB->get_record('aspirelists', array('id' => $cm->instance), '*', MUST_EXIST); $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST); +$context = context_module::instance($cm->id); -add_to_log($course->id, "aspirelists", "launch", "launch.php?id=$cm->id", "$list->id"); +if($CFG->version < 2014051200) { + add_to_log($course->id, "aspirelists", "launch", "launch.php?id=$cm->id", "$list->id"); +} else { + $event = \aspirelists\event\aspire_lists_launch::create( + array( + 'objectid' => $cm->instance, + 'context' => $context, + 'other' => $list->id + ) + ); + $event->set_legacy_logdata(array($course->id, "aspirelists", "launch", "launch.php?id=$cm->id", "$list->id")); + $event->trigger(); +} $list->cmid = $cm->id; aspirelists_add_lti_properties($list); @@ -27,4 +41,4 @@ else{ // Moodle 1.x/2.x lti_view($list); -} \ No newline at end of file +} diff --git a/2.x-activity-module/mod/aspirelists/lib.php b/2.x-activity-module/mod/aspirelists/lib.php index 96bac05..8462f8b 100644 --- a/2.x-activity-module/mod/aspirelists/lib.php +++ b/2.x-activity-module/mod/aspirelists/lib.php @@ -118,6 +118,9 @@ function aspirelists_add_lti_properties(&$aspirelist) $aspirelist->instructorchoiceacceptgrades = false; $aspirelist->instructorchoicesendname = false; $aspirelist->instructorchoicesendemailaddr = false; + if($CFG->version >= 2015051100 ) { // greater or in Moodle 2.9. + $aspirelist->instructorchoiceallowroster = false; + } $aspirelist->launchcontainer = null; $aspirelist->servicesalt = uniqid('', true); if(function_exists('get_course')) @@ -161,11 +164,11 @@ function aspirelists_add_lti_properties(&$aspirelist) */ function aspirelists_cm_info_view(cm_info $cm) { global $CFG,$PAGE; - if ($cm->uservisible && $cm->get_custom_data()) { + if ($cm->uservisible && $cm->customdata) { // Restore folder object from customdata. // Note the field 'customdata' is not empty IF AND ONLY IF we display contens inline. // Otherwise the content is default. - $aspirelist = $cm->get_custom_data(); + $aspirelist = $cm->customdata; $aspirelist->id = (int)$cm->instance; $aspirelist->course = (int)$cm->course; $aspirelist->display = ASPIRELISTS_DISPLAY_INLINE; @@ -195,11 +198,11 @@ function aspirelists_cm_info_view(cm_info $cm) { */ function aspirelists_cm_info_dynamic(cm_info $cm) { global $CFG; - if ($cm->get_custom_data()) { + if ($cm->customdata) { // the field 'customdata' is not empty IF AND ONLY IF we display contens inline require_once($CFG->dirroot . '/mod/aspirelists/load_js.php'); $cm->set_extra_classes('aspirelists_inline_readings_toggle'); - $aspirelist = $cm->get_custom_data(); + $aspirelist = $cm->customdata; if(isset($aspirelist->showexpanded) && $aspirelist->showexpanded === '1') { $afterLink = get_string('accordion_open', 'aspirelists'); diff --git a/2.x-activity-module/mod/aspirelists/mod_form.php b/2.x-activity-module/mod/aspirelists/mod_form.php index 096a899..85719ae 100644 --- a/2.x-activity-module/mod/aspirelists/mod_form.php +++ b/2.x-activity-module/mod/aspirelists/mod_form.php @@ -35,7 +35,13 @@ function definition() { $mform->setDefault('name', get_string('default_section_title', 'aspirelists')); $mform->addRule('name', null, 'required', null, 'client'); $mform->setType('name', PARAM_TEXT); - $this->add_intro_editor(false); + + if($CFG->version >= 2015111600 ) { // greater or in Moodle 3.0. + $this->standard_intro_elements(false); + } else { + $this->add_intro_editor(false); + } + $mform->setAdvanced('introeditor'); // Display the label to the right of the checkbox so it looks better & matches rest of the form diff --git a/2.x-activity-module/mod/aspirelists/version.php b/2.x-activity-module/mod/aspirelists/version.php index 980c3aa..4615668 100644 --- a/2.x-activity-module/mod/aspirelists/version.php +++ b/2.x-activity-module/mod/aspirelists/version.php @@ -7,7 +7,7 @@ $plugin = new stdClass(); } -$plugin->version = 2016051100; // Version for this plugin - based on the date and then an increment number +$plugin->version = 2016061400; // Version for this plugin - based on the date and then an increment number $plugin->requires = 2012062507; // See http://docs.moodle.org/dev/Moodle_Versions $plugin->cron = 0; $plugin->component = 'mod_aspirelists'; @@ -26,3 +26,4 @@ $module->component = $plugin->component; } } + diff --git a/2.x-activity-module/mod/aspirelists/view.php b/2.x-activity-module/mod/aspirelists/view.php index 8788f91..2f4cfa4 100644 --- a/2.x-activity-module/mod/aspirelists/view.php +++ b/2.x-activity-module/mod/aspirelists/view.php @@ -39,6 +39,7 @@ require_once($CFG->dirroot.'/mod/lti/lib.php'); require_once($CFG->dirroot.'/mod/lti/locallib.php'); require_once($CFG->dirroot . '/lib/completionlib.php'); +require_once($CFG->dirroot.'/mod/aspirelists/classes/event/course_module_viewed.php'); $id = optional_param('id', 0, PARAM_INT); // Course Module ID, or $l = optional_param('l', 0, PARAM_INT); // aspirelists ID @@ -90,7 +91,16 @@ $completion = new completion_info($course); $completion->set_module_viewed($cm); -add_to_log($course->id, "aspirelists", "view", "view.php?id=$cm->id", "$list->id"); +$event = \aspirelists\event\course_module_viewed::create( + array( + 'objectid' => $PAGE->cm->instance, + 'context' => $context, + 'other' => $list->id + ) +); +$event->add_record_snapshot('course', $PAGE->course); +$event->set_legacy_logdata(array($course->id, "aspirelists", "view", "view.php?id=$cm->id", "$list->id")); +$event->trigger(); $pagetitle = strip_tags($course->shortname.': '.format_string($list->name)); $PAGE->set_title($pagetitle);