A number of small fixes.
Closed this issue · 2 comments
techxplorer commented
The attached patch includes a number of small fixes that our internal code review process discovered. Including:
- Using the new events API instead of the deprecated add_to_log function
- A missing variable declaration
- Other minor deprecated functions
- An updated high resolution icon, using an icon already in the public domain
- Incorrect paths
- Missing optional_param function call.
I hope this patch proves useful.
From 89a81698c2706ee650221948efabf22d88c250d2 Mon Sep 17 00:00:00 2001
From: Corey Wallis <corey.wallis@blackboard.com>
Date: Tue, 23 Jun 2015 14:33:04 +0930
Subject: [PATCH] Various fixes
---
.../event/course_module_instance_list_viewed.php | 50 ++++++++++++
classes/event/course_module_viewed.php | 33 ++++++++
index.php | 9 ++-
mod_form.php | 14 +++-
pix/icon.png | Bin 0 -> 1026 bytes
pix/icon.svg | 85 +++++++++++++++++++++
view.php | 16 +++-
7 files changed, 195 insertions(+), 12 deletions(-)
create mode 100644 classes/event/course_module_instance_list_viewed.php
create mode 100644 classes/event/course_module_viewed.php
create mode 100644 pix/icon.png
create mode 100644 pix/icon.svg
diff --git a/classes/event/course_module_instance_list_viewed.php b/classes/event/course_module_instance_list_viewed.php
new file mode 100644
index 0000000..e95b590
--- /dev/null
+++ b/classes/event/course_module_instance_list_viewed.php
@@ -0,0 +1,50 @@
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * The mod_peerassess instance list viewed event.
+ *
+ * @package mod_adaptivequiz
+ * @author Corey Wallis <corey.wallis@blackboard.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+namespace mod_adaptivequiz\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * The mod_adaptivequiz instance list viewed event class.
+ *
+ * @package mod_adaptivequiz
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+class course_module_instance_list_viewed extends \core\event\course_module_instance_list_viewed {
+ /**
+ * Create the event from course record.
+ *
+ * @param \stdClass $course
+ * @return course_module_instance_list_viewed
+ */
+ public static function create_from_course(\stdClass $course) {
+ $params = array(
+ 'context' => \context_course::instance($course->id)
+ );
+ $event = self::create($params);
+ $event->add_record_snapshot('course', $course);
+ return $event;
+ }
+}
diff --git a/classes/event/course_module_viewed.php b/classes/event/course_module_viewed.php
new file mode 100644
index 0000000..20bbdb9
--- /dev/null
+++ b/classes/event/course_module_viewed.php
@@ -0,0 +1,33 @@
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Defines the course module viewed event.
+ *
+ * @package mod_adaptivequiz
+ * @author Corey Wallis <corey.wallis@blackboard.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+namespace mod_adaptivequiz\event;
+defined('MOODLE_INTERNAL') || die();
+
+class course_module_viewed extends \core\event\course_module_viewed {
+ protected function init() {
+ $this->data['objecttable'] = 'adaptivequiz';
+ parent::init();
+ }
+}
diff --git a/index.php b/index.php
index b4a4bb3..4766e5e 100644
--- a/index.php
+++ b/index.php
@@ -25,7 +25,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-require_once(dirname(__FILE__).'/../..config.php');
+require_once(dirname(__FILE__).'/../../config.php');
require_once($CFG->dirroot.'/mod/adaptivequiz/lib.php');
$id = required_param('id', PARAM_INT); // Course.
@@ -34,7 +34,7 @@ $course = $DB->get_record('course', array('id' => $id), '*', MUST_EXIST);
require_course_login($course);
-add_to_log($course->id, 'adaptivequiz', 'view all', 'index.php?id='.$course->id, '');
+\mod_adaptivequiz\event\course_module_instance_list_viewed::create_from_course($course)->trigger();
$coursecontext = context_course::instance($course->id);
@@ -49,6 +49,7 @@ if (!$adaptivequizinstances = get_all_instances_in_course('adaptivequiz', $cours
notice(get_string('nonewmodules', 'adaptivequiz'), new moodle_url('/course/view.php', array('id' => $course->id)));
}
+$table = new html_table();
if ($course->format == 'weeks') {
$table->head = array(get_string('week'), get_string('name'));
$table->align = array('center', 'left');
@@ -63,12 +64,12 @@ if ($course->format == 'weeks') {
foreach ($adaptivequizinstances as $adaptivequizinstance) {
if (!$adaptivequizinstance->visible) {
$link = html_writer::link(
- new moodle_url('/mod/adaptivequiz.php', array('id' => $adaptivequizinstance->coursemodule)),
+ new moodle_url('/mod/adaptivequiz/view.php', array('id' => $adaptivequizinstance->coursemodule)),
format_string($adaptivequizinstance->name, true),
array('class' => 'dimmed'));
} else {
$link = html_writer::link(
- new moodle_url('/mod/adaptivequiz.php', array('id' => $adaptivequizinstance->coursemodule)),
+ new moodle_url('/mod/adaptivequiz/view.php', array('id' => $adaptivequizinstance->coursemodule)),
format_string($adaptivequizinstance->name, true));
}
diff --git a/mod_form.php b/mod_form.php
index 24b4a9e..8f8b129 100644
--- a/mod_form.php
+++ b/mod_form.php
@@ -49,14 +49,20 @@ class mod_adaptivequiz_mod_form extends moodleform_mod {
if (!empty($CFG->formatstringstriptags)) {
$mform->setType('name', PARAM_TEXT);
} else {
- $mform->setType('name', PARAM_CLEAN);
+ $mform->setType('name', PARAM_CLEANHTML);
}
$mform->addRule('name', null, 'required', null, 'client');
$mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
$mform->addHelpButton('name', 'adaptivequizname', 'adaptivequiz');
- // Adding the standard "intro" and "introformat" fields.
- $this->add_intro_editor();
+ // Adding the standard "intro" and "introformat" fields...
+ // Use the non deprecated function if it exists.
+ if (method_exists($this, 'standard_intro_elements')) {
+ $this->standard_intro_elements();
+ } else {
+ // Deprecated as of Moodle 2.9
+ $this->add_intro_editor();
+ }
// Number of attempts.
$attemptoptions = array('0' => get_string('unlimited'));
@@ -137,7 +143,7 @@ class mod_adaptivequiz_mod_form extends moodleform_mod {
$mform->addRule('standarderror', get_string('formelementempty', 'adaptivequiz'), 'required', null, 'client');
$mform->addRule('standarderror', get_string('formelementdecimal', 'adaptivequiz'), 'numeric', null, 'client');
$mform->setDefault('standarderror', 5.0);
- $mform->setType('standarderror', PARAM_NUMBER);
+ $mform->setType('standarderror', PARAM_FLOAT);
// Grade settings.
$this->standard_grading_coursemodule_elements();
diff --git a/pix/icon.png b/pix/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..4ed0c6eca6501b1187188b03166bd95fa969f90e
GIT binary patch
literal 1026
zcmV+d1pWJoP)<h;3K|Lk000e1NJLTq000yK000;W1^@s6`b*t*00006VoOIv0RI60
z0RN!9r;`8x010qNS#tmY3ljhU3ljkVnw%H_00W{)L_t(I%Z-%HPh4db#((eSGIQHu
zKFWu}U`(lvDO4Cuq#ATFn<lujRazHrL>F#c_&@j$xG*u%RilZ~Zj1|)sxc%sel(U$
zP^O_xpp~|Oq)r(q^Yy;xxVV>L1}gO==f3y8$@|>rdCzl>;UO{o&h)1zhlfvzI#5s)
zQAI^jRaAwA>o*FYUHE(&kk+$4z<a03W|HYw3>^mJ`@Olbw<aei{c5F(6Nj@F>m1@7
z);T(TpHw<CGFbll7pz!=Xr*5L_QOl8_yA829lLn$-47=IzQ0Ya=J@LS0(Vz(*hU>|
z9nRU^)j2%lvA9t1&zyVz<4(`g9SB#h{QNtYE|2>F@gR2S+O0K?KKClU@ffFLLwxb&
zMFz72Ac|9mh&1!|$|`TZah{<QC#cnHEd2Np>F$AKQ!*-4%n{P*6y=RFPYw=pe(E(!
zr42v{Z!vsLBog#J)<<@rA5|q0>moKV&V%wd+5}W5s0s!{@mi5T{+#2#;_R8TB$G*0
z6##<)6{OLig`tKCoEm?D@#n{*&u~w}Qb(&naYSff!pb|bEezG6Dk#eG?OUv^ukT<*
zu^;&OvEwAV4zqJ*xHdqEQrX(tV&(1~9u-d=9cundL~&wiD+&^Vj*L9R*yvabFPf~H
z*Pu$hQO7xl8bY(TF^s@el)~IBOG}IU<hI7d#7kt3WKh7Uq6p44b^#@lEUIJ&vIIeJ
zpxi_v5xGf2h9Zb<sj^1KRTY9mar*q;JrKJ4RHag_P^oN_=<32#FSJc7!_YQ@h%#R+
zQY_B%e`4zODdIsKQNg)ZhT<a0LN50#W23nPfug>_7*Nqro$RwsIF?pdS16TA2Lmef
z_diZ1lR@x66lt^-#f6epC~uTmTwHvl+)O%+W)###jp15+=%T?X%J9h%#&S7K^QhTV
zlyJ9JuhNJrE24<FcF8-|Db5$Ub9?zfb`9%LRl2*oiFNwi+jNMvv;m^wnD6Q72`9(_
zQLEMPIy^>4N12_yO6s2<SZ`$*>amD8lBq6I>13PWz5P<F*0_0diMhD~n^!*}YYVKl
z`4I5eX1H-ZN4%{|%tK9Mt>v%fWxCeB<B7&^cpV0fhJ(rH^TErhUoZ3|&4lX+d`#dg
z#sHpzr;67KXAELMFh;$4sR1gU!QFeHKV826;@fQ$^7*{Kxw#pu#$v%?YhyrX6*@g*
wB73O~paC?teZL;m>(yj3S)ZAiu{#+50s@Rrmo1+$?f?J)07*qoM6N<$f@2})mjD0&
literal 0
HcmV?d00001
diff --git a/pix/icon.svg b/pix/icon.svg
new file mode 100644
index 0000000..c5d2ac6
--- /dev/null
+++ b/pix/icon.svg
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--part of the rodentia icon theme by sixsixfive released under CC0 (https://creativecommons.org/publicdomain/zero/1.0/) on openclipart-->
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 48 48" width="24px" height="24px">
+ <defs id="0">
+ <linearGradient id="2">
+ <stop id="Y" stop-color="#888a85"/>
+ <stop id="Z" offset="1" stop-color="#2e3436"/>
+ </linearGradient>
+ <linearGradient id="3">
+ <stop id="a" stop-color="#eeeeec"/>
+ <stop id="b" offset="1" stop-color="#888a85"/>
+ </linearGradient>
+ <linearGradient id="4">
+ <stop id="c" stop-color="#2e3436"/>
+ <stop id="d" offset="1" stop-color="#2e3436" stop-opacity="0"/>
+ </linearGradient>
+ <linearGradient id="5">
+ <stop id="e" stop-color="#fff"/>
+ <stop id="f" offset="1" stop-color="#fff" stop-opacity="0"/>
+ </linearGradient>
+ <linearGradient id="6">
+ <stop id="g" stop-color="#fff" stop-opacity="0.8"/>
+ <stop id="h" offset="1" stop-color="#fff" stop-opacity="0"/>
+ </linearGradient>
+ <linearGradient id="7">
+ <stop id="i" stop-color="#e9b96e"/>
+ <stop id="j" offset="1" stop-color="#c17d11"/>
+ </linearGradient>
+ <filter x="-0.16" y="-0.151" width="1.321" height="1.302" color-interpolation-filters="sRGB" id="8">
+ <feGaussianBlur stdDeviation="0.5327" id="k"/>
+ </filter>
+ <linearGradient id="9">
+ <stop id="l" stop-color="#eeeeec"/>
+ <stop id="m" offset="1" stop-color="#d3d7cf"/>
+ </linearGradient>
+ <radialGradient cx="23.903" cy="47.23" r="23.442" id="A" xlink:href="#4" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1,0,0,0.0852459,0,43.205123)"/>
+ <radialGradient cx="10.598" cy="14.524" r="18.475" id="B" xlink:href="#7" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.2047255,1.9462005,-2.6136959,0.2850988,46.782408,-21.224234)"/>
+ <linearGradient y1="3.333" x2="0" y2="46.667" id="C" xlink:href="#6" gradientUnits="userSpaceOnUse"/>
+ <linearGradient x1="-7.177" y1="-22.618" x2="17.775" y2="18.539" id="D" xlink:href="#5" gradientUnits="userSpaceOnUse"/>
+ <radialGradient cx="24.293" cy="13.388" r="16.219" id="E" xlink:href="#9" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.5533713,-2.2948164,-3.3955484,-0.8188024,46.75215,79.261928)"/>
+ <linearGradient y1="43.531" x2="0" y2="2.25" id="F" xlink:href="#6" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.896238,0,0,-0.896238,2.5072529,45.322604)"/>
+ <radialGradient cx="34.13" cy="8.609" r="3.03" id="G" xlink:href="#9" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.792476,-1.8567779e-7,-1.9429172e-7,-1.8756322,-28.076861,53.568907)"/>
+ <linearGradient x1="34.13" y1="8.75" x2="36.533" y2="6.363" id="H" xlink:href="#6" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.896238,0,0,-0.896238,2.5072529,45.262984)"/>
+ <linearGradient x1="55.936" y1="14.994" x2="59.847" y2="31.394" id="I" xlink:href="#3" gradientUnits="userSpaceOnUse"/>
+ <linearGradient y1="16.19" x2="0" y2="26.631" id="J" xlink:href="#6" gradientUnits="userSpaceOnUse"/>
+ <linearGradient y1="16.38" x2="0" y2="28.03" id="K" xlink:href="#2" gradientUnits="userSpaceOnUse"/>
+ </defs>
+ <g id="1">
+ <path d="m 47.345411,47.231407 a 23.442127,1.9983453 0 1 1 -46.88425415,0 23.442127,1.9983453 0 1 1 46.88425415,0 z" transform="matrix(0.9125654,0,0,0.963088,2.1866908,0.08741362)" id="L" opacity="0.8" fill="url(#A)"/>
+ <path d="m 7.40625,2.875 c -0.7554285,0 -1.375,0.7312174 -1.375,1.59375 l 0,41.0625 c 0,0.862533 0.6195719,1.593749 1.375,1.59375 l 33.1875,0 c 0.755428,0 1.374999,-0.731215 1.375,-1.59375 l 0,-41.0625 c 0,-0.8625327 -0.619571,-1.59375 -1.375,-1.59375 l -33.1875,0 z" transform="matrix(0.9593462,0,0,0.942101,0.9756909,1.1222877)" id="M" fill="url(#B)" fill-rule="evenodd" stroke="#683f00" stroke-width="1.013"/>
+ <path d="M 7.40625,3.84375 C 7.2707325,3.84375 7,4.0662537 7,4.46875 l 0,41.0625 c 0,0.402497 0.2707314,0.625 0.40625,0.625 l 33.1875,0 c 0.135519,0 0.40625,-0.222499 0.40625,-0.625 l 0,-41.0625 c 0,-0.4024968 -0.270732,-0.625 -0.40625,-0.625 l -33.1875,0 z" transform="matrix(0.9593462,0,0,0.942101,0.9756909,1.1222877)" id="N" opacity="0.8" fill="none" stroke="url(#C)" stroke-width="1.013"/>
+ <path d="m 7.46875,2.84375 c -0.4294846,-10e-8 -0.875,0.4682617 -0.875,1.0625 l 0,25.3125 c 9.489422,-5.867753 22.865809,-12.260207 34.8125,-17.3125 l 0,-8 c 10e-7,-0.5942378 -0.445514,-1.0625 -0.875,-1.0625 l -33.0625,0 z" transform="matrix(0.963088,0,0,0.963088,0.885888,1.5606998)" id="O" opacity="0.6" fill="url(#D)" fill-rule="evenodd"/>
+ <path d="m 11.329596,44.230313 c -1.5391991,0 -2.7727366,-1.233537 -2.7727366,-2.772736 l 0,-33.3008434 c 0,-1.5391995 1.2335375,-2.7727371 2.7727366,-2.7727361 l 25.374739,0 c 1.539199,0 2.772737,1.2335375 2.772737,2.7727361 l 0,29.7719064 -6.049608,6.301673 -22.097868,0 0,0 z" id="P" fill="#888a85"/>
+ <path d="m 11.329596,43.306068 c -1.038393,0 -1.8484909,-0.810098 -1.8484909,-1.848491 l 0,-33.3008434 c 0,-1.0383938 0.8100979,-1.8484924 1.8484909,-1.8484914 l 25.374739,0 c 1.038393,0 1.848491,0.8100995 1.848491,1.8484914 l 0,29.3798024 -5.517466,5.769532 -21.705764,0 z" id="Q" fill="url(#E)"/>
+ <g transform="matrix(0.896238,0,0,0.896238,2.5072535,3.7104971)" id="R">
+ <g transform="translate(0,0.9997506)" id="n" fill="#fff">
+ <rect width="21.968" height="3" x="11.5" y="12.539" id="t"/>
+ <rect width="17.353" height="3" x="11.5" y="6.539" id="u"/>
+ <rect width="19.726" height="3" x="11.5" y="18.539" id="v"/>
+ <rect width="23.813" height="3" x="11.5" y="24.539" id="w"/>
+ <rect width="22.363" height="3" x="11.5" y="30.539" id="x"/>
+ <rect width="25" height="3" x="11.5" y="36.539" id="y"/>
+ </g>
+ <g id="o" fill="#888a85">
+ <rect width="21.968" height="3" x="11.5" y="12.539" id="z"/>
+ <rect width="17.353" height="3" x="11.5" y="6.539" id="10"/>
+ <rect width="19.726" height="3" x="11.5" y="18.539" id="11"/>
+ <rect width="23.813" height="3" x="11.5" y="24.539" id="12"/>
+ <rect width="22.363" height="3" x="11.5" y="30.539" id="13"/>
+ <rect width="25" height="3" x="11.5" y="36.539" id="14"/>
+ </g>
+ </g>
+ <path d="m 11.329596,42.857949 c -0.80458,0 -1.4003719,-0.595792 -1.4003719,-1.400372 l 0,-33.3008434 c 0,-0.804582 0.5957919,-1.4003733 1.4003719,-1.4003723 l 25.374739,0 c 0.804581,0 1.400372,0.5957922 1.400372,1.4003723 l 0,29.2397654 -5.265399,5.46145 -21.509712,0 0,0 z" id="S" opacity="0.8" fill="none" stroke="url(#F)" stroke-linejoin="round" stroke-linecap="square" stroke-width="0.896"/>
+ <path d="m 77.133371,16.968067 0,6.875 c 0,0.956611 0.676661,1.593751 1.71875,1.59375 l 6.25,0 0,-1.8125 -6.9375,-6.65625 -1.03125,0 0,0 z" transform="matrix(0.896238,0,0,-0.8100394,-37.71893,56.964667)" id="T" opacity="0.16" fill="#2e3436" filter="url(#8)"/>
+ <path d="m 32.194916,44.127263 0,-5.657503 c -2e-6,-1.038393 0.810097,-1.848491 1.848491,-1.84849 l 5.433443,0 0,1.204319 -6.049607,6.301674 -1.232327,0 0,0 z" id="U" fill="#888a85"/>
+ <path d="m 33.091375,43.10639 0,-4.733258 c -10e-7,-0.574219 0.378033,-0.952253 0.952254,-0.952252 l 4.481189,0 -5.433443,5.68551 0,0 z" id="V" fill="url(#G)"/>
+ <path d="m 33.539495,41.958106 0,-3.584953 c -1e-6,-0.338155 0.165977,-0.504133 0.504134,-0.504133 l 3.444914,0 -3.949048,4.089086 z" id="W" opacity="0.8" fill="none" stroke="url(#H)" stroke-linecap="square" stroke-width="0.896"/>
+ <g transform="matrix(0.9180102,0,0,0.7524892,1.9677556,0.3657735)" id="X">
+ <path d="m 13.031712,3.3127153 1.924751,6.239505 c 0.36426,1.1075167 1.256004,1.5413677 2.198945,1.5392607 l 13.715919,0 c 1.007931,0.0023 1.839587,-0.474167 2.198945,-1.5667475 L 34.807069,3.8899382 C 34.633248,2.1321559 15.660167,1.5897175 13.031712,3.3127153 z" id="p" opacity="0.5" fill="#2e3436"/>
+ <path d="m 53.96875,16.40625 c -0.227234,0.03412 -1.169585,0.322383 -1.6875,0.96875 -0.508043,0.633965 -0.640226,0.979171 -0.5625,1.8125 0.02228,0.238917 0.08782,0.486655 0.15625,0.65625 0.03422,0.0848 0.04294,0.150533 0.0625,0.1875 l 2.09375,6.25 c 0.414131,1.259146 1.427962,1.752395 2.5,1.75 l 15.59375,0 c 1.145925,0.0026 2.091442,-0.539085 2.5,-1.78125 l 2.15625,-6.40625 C 76.877759,19.556327 76.99918,19.123868 76.9375,18.625 76.87582,18.126132 76.621473,17.629376 76.28125,17.25 75.923221,16.850594 75.438162,16.544609 75,16.4375 74.561838,16.330391 74.171214,16.406634 74.28125,16.40625 l -19.75,0 -0.125,0 c -0.01061,-7.09e-4 -0.02063,5.67e-4 -0.03125,0 -0.04246,-0.0023 -0.0825,0 -0.125,0 -0.05313,0 -0.103206,-0.0035 -0.15625,0 a 1.4526884,1.4526884 0 0 0 -0.125,0 z" transform="matrix(0.879578,0,0,0.879578,-32.568236,-14.229)" id="q" fill="url(#K)"/>
+ <path d="m 54.1875,17.84375 c -0.23626,0.03548 -0.487536,0.07094 -0.78125,0.4375 -0.169064,0.210968 -0.268989,0.577663 -0.25,0.78125 0.01899,0.203587 0.08524,0.287616 0.09375,0.3125 l 2.15625,6.40625 c 0.0048,0.0146 0.02578,0.017 0.03125,0.03125 0.182908,0.477016 0.696142,0.782138 1.09375,0.78125 l 15.59375,0 c 0.397612,8.88e-4 0.910837,-0.304231 1.09375,-0.78125 l 0.03125,0 c 0.0029,-0.0081 -0.0027,-0.02309 0,-0.03125 L 75.40625,19.375 c 0.125813,-0.374698 0.156742,-0.737546 -0.21875,-1.15625 -0.402647,-0.449181 -0.729514,-0.375617 -0.90625,-0.375 l -19.90625,0 c -0.0093,1.44e-4 -0.02192,1.44e-4 -0.03125,0 0.007,-5.4e-5 -0.03824,-5.4e-5 -0.03125,0 a 0.93763029,0.93763029 0 0 0 -0.125,0 z" transform="matrix(0.879578,0,0,0.879578,-32.576961,-14.229)" id="r" fill="url(#I)"/>
+ <path d="m 54.28125,18.625 c -0.09007,0.01353 -0.199043,0.05365 -0.28125,0.15625 -0.04601,0.05741 -0.03664,0.129698 -0.03125,0.1875 0.0044,0.04669 0.0209,0.0957 0.03125,0.125 l 0,0.03125 2.15625,6.40625 c 0.0536,0.162973 0.207402,0.281624 0.375,0.28125 l 15.59375,0 c 0.167596,3.75e-4 0.321397,-0.118276 0.375,-0.28125 l 2.15625,-6.4375 c 0.04088,-0.121739 0.03423,-0.23589 -0.0625,-0.34375 -0.100933,-0.112598 -0.213867,-0.125344 -0.3125,-0.125 l -19.90625,0 c -0.0125,1.93e-4 -0.01875,1.93e-4 -0.03125,0 -0.0044,3.5e-5 -0.02681,3.5e-5 -0.03125,0 a 0.14577079,0.14577079 0 0 0 -0.03125,0 z" transform="matrix(0.879578,0,0,0.879578,-32.583902,-14.229)" id="s" opacity="0.8" fill="none" stroke="url(#J)" stroke-width="1.41"/>
+ </g>
+ </g>
+</svg>
diff --git a/view.php b/view.php
index f8e6c6c..d23f3c7 100644
--- a/view.php
+++ b/view.php
@@ -29,8 +29,7 @@ require_once(dirname(__FILE__).'/../../config.php');
require_once($CFG->dirroot.'/mod/adaptivequiz/locallib.php');
$id = optional_param('id', 0, PARAM_INT);
-
-global $USER;
+$n = optional_param('n', 0, PARAM_INT);
if ($id) {
$cm = get_coursemodule_from_id('adaptivequiz', $id, 0, false, MUST_EXIST);
@@ -41,13 +40,22 @@ if ($id) {
$course = $DB->get_record('course', array('id' => $adaptivequiz->course), '*', MUST_EXIST);
$cm = get_coursemodule_from_instance('adaptivequiz', $adaptivequiz->id, $course->id, false, MUST_EXIST);
} else {
- error('You must specify a course_module ID or an instance ID');
+ print_error('invalidarguments');
}
require_login($course, true, $cm);
$context = context_module::instance($cm->id);
-add_to_log($course->id, 'adaptivequiz', 'view', "view.php?id={$cm->id}", $adaptivequiz->name, $cm->id);
+$event = \mod_adaptivequiz\event\course_module_viewed::create(
+ array(
+ 'objectid' => $PAGE->cm->instance,
+ 'context' => $PAGE->context,
+ )
+);
+
+$event->add_record_snapshot('course', $PAGE->course);
+$event->add_record_snapshot($PAGE->cm->modname, $adaptivequiz);
+$event->trigger();
// Print the page header.
$PAGE->set_url('/mod/adaptivequiz/view.php', array('id' => $cm->id));
--
2.4.3
adamfranco commented
Thanks for this, Cory. I'll review these fixes as soon as I get a chance. Best, Adam
adamfranco commented
Thanks for these fixes!