From 3d1147be42659633b252ef6b5a4a73eced2039f6 Mon Sep 17 00:00:00 2001
From: LeonOfTheNap <95309331+LeonOfTheNap@users.noreply.github.com>
Date: Fri, 10 Mar 2023 14:22:48 +0100
Subject: [PATCH 02/27] Updated as required per review
(removed $USER, changed camel case in idNumber to idnumber, count instead of sizeof)
---
classes/exporter.php | 4 ++--
classes/jazzquiz_session.php | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/classes/exporter.php b/classes/exporter.php
index 98fbe2f..6822be0 100755
--- a/classes/exporter.php
+++ b/classes/exporter.php
@@ -157,12 +157,12 @@ public function export_attendance_csv(jazzquiz_session $session) {
foreach ($attendances as $attendance) {
$idnumber = $attendance['idnumber'];
$userFirstLastName = explode(', ', $attendance['name']);
- if(sizeof($userFirstLastName)){
+ if(count($userFirstLastName) >= 2){
$lastName = $userFirstLastName[0];
$firstName = $userFirstLastName[1];
} else {
$lastName = $userFirstLastName[0];
- $firstName = $userFirstLastName[0]; //for anonymous, but it doesn't even make sense since if it's anon, not name should display
+ $firstName = $userFirstLastName[0]; //for anonymous, but it doesn't even make sense since if it's anon, no name should display
}
$count = $attendance['count'];
echo "$idnumber\t$lastName\t$firstName\t$count\r\n";
diff --git a/classes/jazzquiz_session.php b/classes/jazzquiz_session.php
index 16d953b..e4ea04a 100755
--- a/classes/jazzquiz_session.php
+++ b/classes/jazzquiz_session.php
@@ -144,7 +144,7 @@ public function user_name_for_answer($userid) {
}
public function user_name_for_attendance($userid) {
- global $DB, $USER;
+ global $DB;
if ($this->requires_anonymous_attendance() || is_null($userid)) {
return get_string('anonymous', 'jazzquiz');
}
@@ -156,8 +156,8 @@ public function user_name_for_attendance($userid) {
return $userFirstLastName;
}
- public function user_idNumber_for_attendance($userid) {
- global $DB, $USER;
+ public function user_idnumber_for_attendance($userid) {
+ global $DB;
if ($this->requires_anonymous_attendance() || is_null($userid)) {
return get_string('anonymous', 'jazzquiz');
}
@@ -489,7 +489,7 @@ public function get_attendances() : array {
$records = $DB->get_records('jazzquiz_attendance', ['sessionid' => $this->data->id]);
foreach ($records as $record) {
$attendances[] = [
- 'idnumber' => $this->user_idNumber_for_attendance($record->userid),
+ 'idnumber' => $this->user_idnumber_for_attendance($record->userid),
'name' => $this->user_name_for_attendance($record->userid),
'count' => $record->numresponses
];
From b0bfd01398262cc4ccb6e66315285e0c0e79fc9f Mon Sep 17 00:00:00 2001
From: LeonOfTheNap <95309331+LeonOfTheNap@users.noreply.github.com>
Date: Sun, 12 Mar 2023 23:04:45 +0100
Subject: [PATCH 03/27] Update exporter.php
Added spaces around ()
---
classes/exporter.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/classes/exporter.php b/classes/exporter.php
index 6822be0..761143c 100755
--- a/classes/exporter.php
+++ b/classes/exporter.php
@@ -157,7 +157,7 @@ public function export_attendance_csv(jazzquiz_session $session) {
foreach ($attendances as $attendance) {
$idnumber = $attendance['idnumber'];
$userFirstLastName = explode(', ', $attendance['name']);
- if(count($userFirstLastName) >= 2){
+ if (count($userFirstLastName) >= 2) {
$lastName = $userFirstLastName[0];
$firstName = $userFirstLastName[1];
} else {
From 2fc50b37a9a1e0ceca13d772b39e91d4ab82f950 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B8rgen=20Finsveen?=
Date: Thu, 8 Jun 2023 12:34:18 +0200
Subject: [PATCH 04/27] implemented better guest feedback
---
CHANGELOG.md | 5 +++
classes/output/renderer.php | 12 +++++++
lang/en/jazzquiz.php | 1 +
templates/guests_not_allowed.mustache | 3 ++
view.php | 48 ++++++++++++++++++++++-----
5 files changed, 60 insertions(+), 9 deletions(-)
create mode 100644 templates/guests_not_allowed.mustache
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a017f0c..4c0293f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org).
### Changed
-
+## [1.2.1] - 2023-06-08
+
+- Improvement of guest user feedback upon trying to attend a quiz which doesn't allow guests to attend
+- Added new template for "guests_not_allowed" feedback
+
## [1.2.0] - 2023-03-31
- Prepared for Moodle 4.0
diff --git a/classes/output/renderer.php b/classes/output/renderer.php
index e1f2ca9..d1b93df 100755
--- a/classes/output/renderer.php
+++ b/classes/output/renderer.php
@@ -156,6 +156,18 @@ public function quiz_not_running($cmid) {
]);
}
+
+ /**
+ * Shows the "guests not allowed" page when trying to access a
+ * quiz which does not allow guests in guest mode.
+ * @throws \moodle_exception
+ */
+ public function guests_not_allowed() {
+ echo $this->render_from_template('jazzquiz/guests_not_allowed', []);
+ }
+
+
+
/**
* Renders the quiz to the page
* @param jazzquiz_session $session
diff --git a/lang/en/jazzquiz.php b/lang/en/jazzquiz.php
index 861d6ee..a20a0cd 100755
--- a/lang/en/jazzquiz.php
+++ b/lang/en/jazzquiz.php
@@ -139,6 +139,7 @@
$string['x_seconds_left'] = '{$a}s left';
$string['error_saving_vote'] = 'There was an error saving your vote.';
$string['you_already_voted'] = 'Sorry, but you have already voted.';
+$string['no_guests'] = 'This quiz does not allow guests to participate.';
// Instructor Controls.
$string['startquiz'] = 'Start quiz';
diff --git a/templates/guests_not_allowed.mustache b/templates/guests_not_allowed.mustache
new file mode 100644
index 0000000..bc4872c
--- /dev/null
+++ b/templates/guests_not_allowed.mustache
@@ -0,0 +1,3 @@
+
+
{{# str }} no_guests, jazzquiz {{/ str }}
+
\ No newline at end of file
diff --git a/view.php b/view.php
index 55cbeb6..fb7686e 100755
--- a/view.php
+++ b/view.php
@@ -25,6 +25,7 @@
*/
namespace mod_jazzquiz;
+use Exception;
require_once("../../config.php");
require_once($CFG->dirroot . '/mod/jazzquiz/lib.php');
@@ -156,6 +157,7 @@ function jazzquiz_view_default(jazzquiz $jazzquiz) {
}
}
+
/**
* Entry point for viewing a quiz.
*/
@@ -168,12 +170,21 @@ function jazzquiz_view() {
header('Location: /');
exit;
}
+
$action = optional_param('action', '', PARAM_ALPHANUM);
$jazzquiz = new jazzquiz($cmid);
$session = $jazzquiz->load_open_session();
- if (!$session || !$session->data->allowguests) {
- require_capability('mod/jazzquiz:attempt', $jazzquiz->context);
+ $isCapable = true;
+
+ // Checks capability if the session doesn't allow for guests.
+ if (!$session || $session->data->allowguests != 1) {
+ try {
+ require_capability('mod/jazzquiz:attempt', $jazzquiz->context);
+ } catch (Exception $e) {
+ $isCapable = false;
+ }
}
+
$PAGE->set_pagelayout('incourse');
$PAGE->set_context($jazzquiz->context);
$PAGE->set_cm($jazzquiz->cm);
@@ -187,14 +198,33 @@ function jazzquiz_view() {
$url->param('action', $action);
$PAGE->set_url($url);
- if ($jazzquiz->is_instructor()) {
- $improviser = new improviser($jazzquiz);
- $improviser->insert_default_improvised_question_definitions();
- }
- if ($action === 'quizstart') {
- jazzquiz_view_start_quiz($jazzquiz);
+ if ($isCapable) {
+ if ($jazzquiz->is_instructor()) {
+ $improviser = new improviser($jazzquiz);
+ $improviser->insert_default_improvised_question_definitions();
+ }
+ if ($action === 'quizstart') {
+ jazzquiz_view_start_quiz($jazzquiz);
+ } else {
+ jazzquiz_view_default($jazzquiz);
+ }
} else {
- jazzquiz_view_default($jazzquiz);
+ // Shows "guests_not_allowed" if capability is false and
+ // session doesn't allow for guests to attend.
+ global $PAGE;
+ $studentstartform = new forms\view\student_start_form($PAGE->url);
+ $data = $studentstartform->get_data();
+ if ($data) {
+ $quizstarturl = clone($PAGE->url);
+ $quizstarturl->param('action', 'quizstart');
+ redirect($quizstarturl, null, 0);
+ }
+
+ /** @var output\renderer $renderer */
+ $renderer = $jazzquiz->renderer;
+ $renderer->header($jazzquiz, 'view');
+ $renderer->guests_not_allowed();
+ $renderer->footer();
}
}
From 6d43b7fc562c030514121463d42e6ffb3c64997b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B8rgen=20Finsveen?=
Date: Thu, 8 Jun 2023 13:45:52 +0200
Subject: [PATCH 05/27] simplified the code and made better comments
---
view.php | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/view.php b/view.php
index fb7686e..b721417 100755
--- a/view.php
+++ b/view.php
@@ -179,8 +179,10 @@ function jazzquiz_view() {
// Checks capability if the session doesn't allow for guests.
if (!$session || $session->data->allowguests != 1) {
try {
+ // Throws exception if capabilities are not satisfied.
require_capability('mod/jazzquiz:attempt', $jazzquiz->context);
} catch (Exception $e) {
+ // Indicates that the guest user is not allowed to access this session.
$isCapable = false;
}
}
@@ -211,15 +213,6 @@ function jazzquiz_view() {
} else {
// Shows "guests_not_allowed" if capability is false and
// session doesn't allow for guests to attend.
- global $PAGE;
- $studentstartform = new forms\view\student_start_form($PAGE->url);
- $data = $studentstartform->get_data();
- if ($data) {
- $quizstarturl = clone($PAGE->url);
- $quizstarturl->param('action', 'quizstart');
- redirect($quizstarturl, null, 0);
- }
-
/** @var output\renderer $renderer */
$renderer = $jazzquiz->renderer;
$renderer->header($jazzquiz, 'view');
From b08c7b92f83ceee541cda5746fdcd7b43423cc9b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B8rgen=20Finsveen?=
Date: Thu, 8 Jun 2023 14:31:07 +0200
Subject: [PATCH 06/27] added some elaboration regarding the conditional in
view:191
---
view.php | 33 ++++++++++++++++++++++++++++-----
1 file changed, 28 insertions(+), 5 deletions(-)
diff --git a/view.php b/view.php
index b721417..221c054 100755
--- a/view.php
+++ b/view.php
@@ -175,11 +175,28 @@ function jazzquiz_view() {
$jazzquiz = new jazzquiz($cmid);
$session = $jazzquiz->load_open_session();
$isCapable = true;
-
- // Checks capability if the session doesn't allow for guests.
+
+ /*
+ * Checks capability if the session doesn't allow for guests.
+ * If this if-condition is not present, it will not be possible to
+ * determine whether a guest is allowed to access the session regardless
+ * of whether or not the session allows for guests.
+ *
+ * If the session does allow guests, it will not be necessary to perform
+ * the require_capability check, but if the session does not allow guests,
+ * the require_capability check will determine whether the user is a guest
+ * or not, which will be used to determine whether the user should be granted
+ * access or not.
+ */
if (!$session || $session->data->allowguests != 1) {
try {
- // Throws exception if capabilities are not satisfied.
+ /*
+ * Throws exception if capabilities are not satisfied. Meaning
+ * that the user has a guest status rather than student status
+ * or higher in the role hierarchy. If an exception is not thrown,
+ * it indicates that the user has the required role to attend the
+ * session.
+ */
require_capability('mod/jazzquiz:attempt', $jazzquiz->context);
} catch (Exception $e) {
// Indicates that the guest user is not allowed to access this session.
@@ -211,8 +228,14 @@ function jazzquiz_view() {
jazzquiz_view_default($jazzquiz);
}
} else {
- // Shows "guests_not_allowed" if capability is false and
- // session doesn't allow for guests to attend.
+ /*
+ * Shows "guests_not_allowed" if capability is false and
+ * session doesn't allow for guests to attend.
+ *
+ * This is triggered when the session does not allow for guests
+ * to attend, and the user trying to attend is a guest.
+ */
+
/** @var output\renderer $renderer */
$renderer = $jazzquiz->renderer;
$renderer->header($jazzquiz, 'view');
From 15c7c17a9489c80526650b314332d803f2afa306 Mon Sep 17 00:00:00 2001
From: Hans Georg Schaathun
Date: Fri, 9 Jun 2023 11:05:52 +0200
Subject: [PATCH 07/27] Rewritten comments
---
view.php | 22 ++++++++--------------
1 file changed, 8 insertions(+), 14 deletions(-)
diff --git a/view.php b/view.php
index 221c054..49c8e9a 100755
--- a/view.php
+++ b/view.php
@@ -177,25 +177,19 @@ function jazzquiz_view() {
$isCapable = true;
/*
- * Checks capability if the session doesn't allow for guests.
- * If this if-condition is not present, it will not be possible to
- * determine whether a guest is allowed to access the session regardless
- * of whether or not the session allows for guests.
- *
- * If the session does allow guests, it will not be necessary to perform
- * the require_capability check, but if the session does not allow guests,
- * the require_capability check will determine whether the user is a guest
- * or not, which will be used to determine whether the user should be granted
+ * Checks that the user is authorised for he quiz.
* access or not.
+ * The require_capability() method checks this for students
+ * and teacher, but it cannot handle the case where guest
+ * access is allowed. Hence, if guests are allowed, no
+ * further check is made.
*/
if (!$session || $session->data->allowguests != 1) {
try {
/*
- * Throws exception if capabilities are not satisfied. Meaning
- * that the user has a guest status rather than student status
- * or higher in the role hierarchy. If an exception is not thrown,
- * it indicates that the user has the required role to attend the
- * session.
+ * require_capability() throws an exception if the user does not
+ * have the required capabilities. Usually this means that the student
+ * or teacher is not enrolled on the course.
*/
require_capability('mod/jazzquiz:attempt', $jazzquiz->context);
} catch (Exception $e) {
From 5ce911a4451f6f4f2fefd299bf4e493780c382cc Mon Sep 17 00:00:00 2001
From: Hans Georg Schaathun
Date: Fri, 9 Jun 2023 11:21:14 +0200
Subject: [PATCH 08/27] Fixed page text for guests
---
lang/en/jazzquiz.php | 4 +++-
templates/guests_not_allowed.mustache | 4 +++-
version.php | 2 +-
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/lang/en/jazzquiz.php b/lang/en/jazzquiz.php
index a20a0cd..446b9e9 100755
--- a/lang/en/jazzquiz.php
+++ b/lang/en/jazzquiz.php
@@ -139,7 +139,9 @@
$string['x_seconds_left'] = '{$a}s left';
$string['error_saving_vote'] = 'There was an error saving your vote.';
$string['you_already_voted'] = 'Sorry, but you have already voted.';
-$string['no_guests'] = 'This quiz does not allow guests to participate.';
+$string['guest_login'] = 'You are not enrolled on the course, and there is no quiz session open to guests at the moment.' ;
+$string['no_guests'] = 'It is possible that the teacher has not yet started a quiz session, and that you may try again later. It is also possible that you have to log in as a student and enrol on the course to be allowed to take part.' ;
+$string['ask_teacher'] = 'If in doubt, ask the teacher.' ;
// Instructor Controls.
$string['startquiz'] = 'Start quiz';
diff --git a/templates/guests_not_allowed.mustache b/templates/guests_not_allowed.mustache
index bc4872c..112769b 100644
--- a/templates/guests_not_allowed.mustache
+++ b/templates/guests_not_allowed.mustache
@@ -1,3 +1,5 @@
+
{{# str }} guest_login, jazzquiz {{/ str }}
{{# str }} no_guests, jazzquiz {{/ str }}
-
\ No newline at end of file
+
{{# str }} ask_teacher, jazzquiz {{/ str }}
+
diff --git a/version.php b/version.php
index 62ee98d..11ed2c5 100755
--- a/version.php
+++ b/version.php
@@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2023033100; // The current module version (Date: YYYYMMDDXX).
+$plugin->version = 2023033102; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2022041900; // Moodle 4.0 (or above).
$plugin->cron = 0; // Period in seconds for cron to run.
$plugin->component = 'mod_jazzquiz';
From 22f476b51170404d2adf776fb9d85a0eb6e3e8ce Mon Sep 17 00:00:00 2001
From: Hans Georg Schaathun
Date: Fri, 9 Jun 2023 14:04:13 +0200
Subject: [PATCH 09/27] New doc's link in README
---
README.md | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 682d970..2736d36 100755
--- a/README.md
+++ b/README.md
@@ -20,9 +20,14 @@ The teacher can, at a later date, go back through the results and, for each ques
The repolls are treated as separate questions, and you will get a correct order in the review page.
## Documentation
-Documentation is available [here](https://github.com/KQMATH/moodle-mod_jazzquiz/wiki), including [installation instructions](https://github.com/KQMATH/moodle-mod_jazzquiz/wiki/Installation-instructions).
+
+
+Documentation is available on
+[github pages](https://kqmath.github.io/) at
+[https://kqmath.github.io/docs/jazzquiz/](https://kqmath.github.io/docs/jazzquiz/)
## Feedback:
+
**Project lead:** Hans Georg Schaathun:
**Developer:** Sebastian S. Gundersen:
From 630856c7abb38679df1ce541b73e825c5a207b73 Mon Sep 17 00:00:00 2001
From: Hans Georg Schaathun
Date: Fri, 9 Jun 2023 14:05:05 +0200
Subject: [PATCH 10/27] gramar
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 2736d36..f4a4548 100755
--- a/README.md
+++ b/README.md
@@ -22,7 +22,7 @@ The repolls are treated as separate questions, and you will get a correct order
## Documentation
-Documentation is available on
+Documentation is available as
[github pages](https://kqmath.github.io/) at
[https://kqmath.github.io/docs/jazzquiz/](https://kqmath.github.io/docs/jazzquiz/)
From 6c21bbfc2483ad8d482335fc66a8b3c4f5bbbb21 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B8rgen=20Finsveen?=
Date: Mon, 26 Jun 2023 12:02:20 +0200
Subject: [PATCH 11/27] resolved issue with swapping of first- and lastname in
csv export
---
classes/bank/jazzquiz_question_bank_view.php | 7 ++++---
classes/exporter.php | 4 ++--
edit.php | 3 ++-
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/classes/bank/jazzquiz_question_bank_view.php b/classes/bank/jazzquiz_question_bank_view.php
index e425430..81659a1 100755
--- a/classes/bank/jazzquiz_question_bank_view.php
+++ b/classes/bank/jazzquiz_question_bank_view.php
@@ -45,7 +45,8 @@ class jazzquiz_question_bank_view extends \core_question\local\bank\view {
/**
* Define the columns we want to be displayed on the question bank
- * @return array
+ * @return array core_question\local\bank\view::$requiredcolumns which are to
+ * be displayed.
*/
protected function wanted_columns(): array {
// Full class names for question bank columns.
@@ -64,8 +65,8 @@ protected function wanted_columns(): array {
/**
* Shows the question bank editing interface.
- * @param string $tabname
- * @param array $pagevars
+ * @param string $tabname question bank edit tab name
+ * @param array $pagevars list of page variables
* @throws \coding_exception
*/
public function display($pagevars, $tabname): void {
diff --git a/classes/exporter.php b/classes/exporter.php
index 761143c..71cd0d6 100755
--- a/classes/exporter.php
+++ b/classes/exporter.php
@@ -158,8 +158,8 @@ public function export_attendance_csv(jazzquiz_session $session) {
$idnumber = $attendance['idnumber'];
$userFirstLastName = explode(', ', $attendance['name']);
if (count($userFirstLastName) >= 2) {
- $lastName = $userFirstLastName[0];
- $firstName = $userFirstLastName[1];
+ $lastName = $userFirstLastName[1];
+ $firstName = $userFirstLastName[0];
} else {
$lastName = $userFirstLastName[0];
$firstName = $userFirstLastName[0]; //for anonymous, but it doesn't even make sense since if it's anon, no name should display
diff --git a/edit.php b/edit.php
index 888c3c2..1400079 100755
--- a/edit.php
+++ b/edit.php
@@ -163,7 +163,7 @@ function jazzquiz_edit() {
$pagevars) = question_edit_setup('editq', '/mod/jazzquiz/edit.php', true);
$jazzquiz = new jazzquiz($cmid);
- $renderer = $jazzquiz->renderer;
+ $renderer = $jazzquiz->renderer; // Todo: Flytt ned til hvor variabelen blir brukt
$modulename = get_string('modulename', 'jazzquiz');
$quizname = format_string($jazzquiz->data->name, true);
@@ -182,6 +182,7 @@ function jazzquiz_edit() {
// Process moving, deleting and unhiding questions...
$questionbank = new \core_question\local\bank\view($contexts, $url, $COURSE, $cm);
+
switch ($action) {
case 'order':
From c3e8eaa52a45c51cfc700adcac4c9a71085c4a3a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B8rgen=20Finsveen?=
Date: Mon, 26 Jun 2023 12:32:34 +0200
Subject: [PATCH 12/27] removed unrelated change of comments in another file
and updated changelog
---
CHANGELOG.md | 5 +++++
classes/bank/jazzquiz_question_bank_view.php | 7 +++----
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4c0293f..f3a1004 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org).
### Changed
-
+## [1.2.1] - 2023-06-26
+
+- Swapped the order of firstname and lastname in csv export of attendance list
+
+
## [1.2.1] - 2023-06-08
- Improvement of guest user feedback upon trying to attend a quiz which doesn't allow guests to attend
diff --git a/classes/bank/jazzquiz_question_bank_view.php b/classes/bank/jazzquiz_question_bank_view.php
index 81659a1..e425430 100755
--- a/classes/bank/jazzquiz_question_bank_view.php
+++ b/classes/bank/jazzquiz_question_bank_view.php
@@ -45,8 +45,7 @@ class jazzquiz_question_bank_view extends \core_question\local\bank\view {
/**
* Define the columns we want to be displayed on the question bank
- * @return array core_question\local\bank\view::$requiredcolumns which are to
- * be displayed.
+ * @return array
*/
protected function wanted_columns(): array {
// Full class names for question bank columns.
@@ -65,8 +64,8 @@ protected function wanted_columns(): array {
/**
* Shows the question bank editing interface.
- * @param string $tabname question bank edit tab name
- * @param array $pagevars list of page variables
+ * @param string $tabname
+ * @param array $pagevars
* @throws \coding_exception
*/
public function display($pagevars, $tabname): void {
From 723f4f9304a955771a8da80d5d233379feba635e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B8rgen=20Finsveen?=
Date: Fri, 28 Jul 2023 11:56:00 +0200
Subject: [PATCH 13/27] added spacing between dropdown and add to quiz button
and a help text icon
---
classes/bank/jazzquiz_question_bank_view.php | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/classes/bank/jazzquiz_question_bank_view.php b/classes/bank/jazzquiz_question_bank_view.php
index e425430..8896830 100755
--- a/classes/bank/jazzquiz_question_bank_view.php
+++ b/classes/bank/jazzquiz_question_bank_view.php
@@ -109,7 +109,13 @@ public function display($pagevars, $tabname): void {
private function display_add_selected_questions_button() {
$straddtoquiz = get_string('add_to_quiz', 'jazzquiz');
- echo '';
+ echo
+ '
+
+
+ ';
}
/**
From 9dbdfad96c2eb0c4ccdfc63dc00ed4ae5536f546 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B8rgen=20Finsveen?=
Date: Fri, 28 Jul 2023 14:20:40 +0200
Subject: [PATCH 14/27] added question text column and logic for toggling it on
and off
---
CHANGELOG.md | 4 ++++
classes/bank/jazzquiz_question_bank_view.php | 22 +++++++++++++++++++-
2 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f3a1004..64c06e9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org).
### Changed
-
+## [1.2.2] - 2023-07-28
+
+- Added column in qbank view for displaying question text/media
+
## [1.2.1] - 2023-06-26
- Swapped the order of firstname and lastname in csv export of attendance list
diff --git a/classes/bank/jazzquiz_question_bank_view.php b/classes/bank/jazzquiz_question_bank_view.php
index e425430..6dd8a51 100755
--- a/classes/bank/jazzquiz_question_bank_view.php
+++ b/classes/bank/jazzquiz_question_bank_view.php
@@ -54,8 +54,28 @@ protected function wanted_columns(): array {
'core_question\\local\\bank\\checkbox_column',
'qbank_viewquestiontype\\question_type_column',
'qbank_viewquestionname\\viewquestionname_column_helper',
- 'qbank_previewquestion\\preview_action_column'
+ 'qbank_previewquestion\\preview_action_column',
];
+
+ // Needs to check qbshowtext parameter manually from baseurl in order
+ // to determine whether to display the question text row below questions
+ $queryparams = explode(';', $this->baseurl);
+
+ foreach ($queryparams as $value) {
+ $value = str_replace('&', '', $value);
+ $value = str_replace('amp', '', $value);
+ $param = explode('=', $value);
+
+ if ($param[0] == 'qbshowtext') {
+ if ((int)$param[1] != 0) {
+ array_push($columns, 'qbank_viewquestiontext\\question_text_row');
+ }
+ break;
+ }
+ }
+
+
+
foreach ($columns as $column) {
$this->requiredcolumns[$column] = new $column($this);
}
From 1494058852bc777ec041aac0c26c4eee0519bdbf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B8rgen=20Finsveen?=
Date: Fri, 28 Jul 2023 15:24:08 +0200
Subject: [PATCH 15/27] resolved deprecation issue
---
classes/output/renderer.php | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/classes/output/renderer.php b/classes/output/renderer.php
index d1b93df..c8b76da 100755
--- a/classes/output/renderer.php
+++ b/classes/output/renderer.php
@@ -385,7 +385,20 @@ public function require_core(jazzquiz_session $session) {
*/
public function require_quiz(jazzquiz_session $session) {
$this->require_core($session);
- $this->page->requires->js('/question/qengine.js');
+
+ // question/qengine.js is deprecated for Moodle versions after 401.
+ // Checks moodle version in order to determine which question engine
+ // to use, making the jazzquiz independent of the Moodle version.
+ global $CFG;
+ include $CFG->dirroot.'/version.php';
+ $branch = $CFG->branch;
+
+ if ( (int) $branch <= 401 ) {
+ $this->page->requires->js('/question/qengine.js');
+ } else {
+ $this->page->requires->js_call_amd('core_question/question_engine', 'initialize');
+ }
+
if ($session->jazzquiz->is_instructor()) {
$count = count($session->jazzquiz->questions);
$params = [$count, false, []];
From e635f1b11bb5c8d6e665c48cd5289ef49f56fca8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B8rgen=20Finsveen?=
Date: Mon, 31 Jul 2023 10:51:56 +0200
Subject: [PATCH 16/27] Switched Ubuntu version in moodle-ci.yml (old one was
deprecated)
---
.github/workflows/moodle-ci.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/moodle-ci.yml b/.github/workflows/moodle-ci.yml
index 2dc7996..56f79f9 100644
--- a/.github/workflows/moodle-ci.yml
+++ b/.github/workflows/moodle-ci.yml
@@ -4,7 +4,7 @@ on: [push, pull_request]
jobs:
test:
- runs-on: ubuntu-18.04
+ runs-on: ubuntu-20.04
services:
postgres:
From 065e652e63590a892b37cdacaee7cfe8c266c8b2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B8rgen=20Finsveen?=
Date: Mon, 31 Jul 2023 12:47:26 +0200
Subject: [PATCH 17/27] refactored code after workflow lint feedback
---
amd/src/core.js | 18 ++++++++----------
amd/src/edit.js | 29 ++++++++++++++++++++---------
amd/src/instructor.js | 29 +++++++++++++++--------------
amd/src/student.js | 20 +++++++++++---------
4 files changed, 54 insertions(+), 42 deletions(-)
diff --git a/amd/src/core.js b/amd/src/core.js
index ee9436a..4e7f989 100755
--- a/amd/src/core.js
+++ b/amd/src/core.js
@@ -14,14 +14,14 @@
// along with Moodle. If not, see .
/**
- * @package mod_jazzquiz
+ * @module mod_jazzquiz
* @author Sebastian S. Gundersen
* @copyright 2014 University of Wisconsin - Madison
* @copyright 2018 NTNU
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-define(['jquery', 'core/config', 'core/str', 'core/yui', 'core/event'], function ($, mConfig, mString, Y, mEvent) {
+define(['jquery', 'core/config', 'core/str', 'core/yui', 'core/event'], function($, mConfig, mString, Y, mEvent) {
// Contains the needed values for using the ajax script.
let session = {
@@ -56,10 +56,7 @@ define(['jquery', 'core/config', 'core/str', 'core/yui', 'core/event'], function
url: url,
data: data,
dataType: 'json',
- success: success,
- error: function (xhr, status, error) {
- //console.error('XHR Error: ' + error + '. Status: ' + status);
- }
+ success: success
}).fail(() => setText(Quiz.info, 'error_with_request'));
}
@@ -126,6 +123,7 @@ define(['jquery', 'core/config', 'core/str', 'core/yui', 'core/event'], function
return;
}
Quiz.show(Question.box.html(data.html));
+ // eslint-disable-next-line no-eval
eval(data.js);
data.css.forEach(cssUrl => {
let head = document.getElementsByTagName('head')[0];
@@ -265,7 +263,7 @@ define(['jquery', 'core/config', 'core/str', 'core/yui', 'core/event'], function
changeQuizState(state, data) {
this.isNewState = (this.state !== state);
this.state = state;
- this.role.onStateChange(state);
+ this.role.onStateChange();
const event = this.events[state];
this.role[event](data);
}
@@ -342,7 +340,7 @@ define(['jquery', 'core/config', 'core/str', 'core/yui', 'core/event'], function
static renderMaximaEquation(input, targetId) {
const target = document.getElementById(targetId);
if (target === null) {
- //console.error('Target element #' + targetId + ' not found.');
+ // Log error to console: 'Target element #' + targetId + ' not found.'.
return;
}
if (cache[input] !== undefined) {
@@ -359,10 +357,10 @@ define(['jquery', 'core/config', 'core/str', 'core/yui', 'core/event'], function
/**
* Retrieve a language string that was sent along with the page.
- * @param $element
+ * @param {*} $element
* @param {string} key Which string in the language file we want.
* @param {string} [from=jazzquiz] Which language file we want the string from. Default is jazzquiz.
- * @param [args] This is {$a} in the string for the key.
+ * @param {array} args This is {$a} in the string for the key.
*/
function setText($element, key, from, args) {
from = (from !== undefined) ? from : 'jazzquiz';
diff --git a/amd/src/edit.js b/amd/src/edit.js
index 622cdbc..5c0d631 100755
--- a/amd/src/edit.js
+++ b/amd/src/edit.js
@@ -13,15 +13,18 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+
+import Sortable from '../../js/sortable.min.js';
+
/**
- * @package mod_jazzquiz
+ * @module mod_jazzquiz
* @author Sebastian S. Gundersen
* @copyright 2015 University of Wisconsin - Madison
* @copyright 2018 NTNU
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-define(['jquery'], function ($) {
+define(['jquery'], function($) {
/**
* Submit the question order to the server. An empty array will delete all questions.
@@ -41,7 +44,7 @@ define(['jquery'], function ($) {
*/
function getQuestionOrder() {
let order = [];
- $('.questionlist li').each(function () {
+ $('.questionlist li').each(function() {
order.push($(this).data('question-id'));
});
return order;
@@ -69,8 +72,12 @@ define(['jquery'], function ($) {
return order;
}
+ /**
+ * Add click-listener to a quiz by module id.
+ * @param {number} courseModuleId
+ */
function listenAddToQuiz(courseModuleId) {
- $('.jazzquiz-add-selected-questions').on('click', function () {
+ $('.jazzquiz-add-selected-questions').on('click', function() {
const $checkboxes = $('#categoryquestions td input[type=checkbox]:checked');
let questionIds = '';
for (const checkbox of $checkboxes) {
@@ -86,26 +93,30 @@ define(['jquery'], function ($) {
return {
initialize: courseModuleId => {
- $('.edit-question-action').on('click', function () {
+ $('.edit-question-action').on('click', function() {
const action = $(this).data('action');
const questionId = $(this).data('question-id');
let order = [];
switch (action) {
- case 'up':
+ case 'up': {
order = offsetQuestion(questionId, 1);
break;
- case 'down':
+ }
+ case 'down': {
order = offsetQuestion(questionId, -1);
break;
- case 'delete':
+ }
+ case 'delete': {
order = getQuestionOrder();
const index = order.indexOf(questionId);
if (index !== -1) {
order.splice(index, 1);
}
break;
- default:
+ }
+ default: {
return;
+ }
}
submitQuestionOrder(order, courseModuleId);
});
diff --git a/amd/src/instructor.js b/amd/src/instructor.js
index 117044b..514373b 100755
--- a/amd/src/instructor.js
+++ b/amd/src/instructor.js
@@ -14,14 +14,14 @@
// along with Moodle. If not, see .
/**
- * @package mod_jazzquiz
+ * @module mod_jazzquiz
* @author Sebastian S. Gundersen
* @copyright 2014 University of Wisconsin - Madison
* @copyright 2018 NTNU
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-define(['jquery', 'mod_jazzquiz/core'], function ($, Jazz) {
+define(['jquery', 'mod_jazzquiz/core'], function($, Jazz) {
const Quiz = Jazz.Quiz;
const Question = Jazz.Question;
@@ -140,7 +140,7 @@ define(['jquery', 'mod_jazzquiz/core'], function ($, Jazz) {
}
$row.addClass('merge-from');
let $table = $row.parent().parent();
- $table.find('tr').each(function () {
+ $table.find('tr').each(function() {
const $cells = $(this).find('td');
if ($cells[1].id !== $barCell.attr('id')) {
$(this).addClass('merge-into');
@@ -233,7 +233,7 @@ define(['jquery', 'mod_jazzquiz/core'], function ($, Jazz) {
// Add rows.
for (let i = 0; i < responses.length; i++) {
- //const percent = (parseInt(responses[i].count) / total) * 100;
+ // Const percent = (parseInt(responses[i].count) / total) * 100;
const percent = (parseInt(responses[i].count) / highestResponseCount) * 100;
// Check if row with same response already exists.
@@ -262,7 +262,7 @@ define(['jquery', 'mod_jazzquiz/core'], function ($, Jazz) {
const countHtml = '' + responses[i].count + '';
let responseCell = row.insertCell(0);
- responseCell.onclick = function () {
+ responseCell.onclick = function() {
$(this).parent().toggleClass('selected-vote-option');
};
@@ -299,7 +299,7 @@ define(['jquery', 'mod_jazzquiz/core'], function ($, Jazz) {
}
}
}
- };
+ }
/**
* Sort the responses in the graph by how many had the same response.
@@ -440,7 +440,7 @@ define(['jquery', 'mod_jazzquiz/core'], function ($, Jazz) {
}
/**
- * refresh() equivalent for votes.
+ * Method refresh() equivalent for votes.
*/
refreshVotes() {
// Should we show the results?
@@ -687,7 +687,7 @@ define(['jquery', 'mod_jazzquiz/core'], function ($, Jazz) {
this.quiz.question.isRunning = false;
}
- onSessionClosed(data) {
+ onSessionClosed() {
Quiz.hide(Instructor.side);
Quiz.hide(Instructor.correctAnswer);
Instructor.enableControls([]);
@@ -695,7 +695,7 @@ define(['jquery', 'mod_jazzquiz/core'], function ($, Jazz) {
this.quiz.question.isRunning = false;
}
- onVoting(data) {
+ onVoting() {
if (!this.responses.showResponses) {
this.responses.hide();
}
@@ -704,7 +704,7 @@ define(['jquery', 'mod_jazzquiz/core'], function ($, Jazz) {
this.responses.refreshVotes();
}
- onStateChange(state) {
+ onStateChange() {
$('#region-main').find('ul.nav.nav-tabs').css('display', 'none');
$('#region-main-settings-menu').css('display', 'none');
$('.region_main_settings_menu_proxy').css('display', 'none');
@@ -776,7 +776,7 @@ define(['jquery', 'mod_jazzquiz/core'], function ($, Jazz) {
'jazzquiz-question-id': questions[i].jazzquizquestionid
});
$questionButton.data('test', 1);
- $questionButton.on('click', function () {
+ $questionButton.on('click', function() {
const questionId = $(this).data('question-id');
const time = $(this).data('time');
const jazzQuestionId = $(this).data('jazzquiz-question-id');
@@ -871,6 +871,7 @@ define(['jquery', 'mod_jazzquiz/core'], function ($, Jazz) {
Quiz.hide(Question.box);
Quiz.hide(Instructor.controls);
setText(Quiz.info, 'closing_session');
+ // eslint-disable-next-line no-restricted-globals
Ajax.post('close_session', {}, () => window.location = location.href.split('&')[0]);
}
@@ -947,7 +948,7 @@ define(['jquery', 'mod_jazzquiz/core'], function ($, Jazz) {
}
static addReportEventHandlers() {
- $(document).on('click', '#report_overview_controls button', function () {
+ $(document).on('click', '#report_overview_controls button', function() {
const action = $(this).data('action');
if (action === 'attendance') {
$('#report_overview_responded').fadeIn();
@@ -962,7 +963,7 @@ define(['jquery', 'mod_jazzquiz/core'], function ($, Jazz) {
}
return {
- initialize: function (totalQuestions, reportView, slots) {
+ initialize: function(totalQuestions, reportView, slots) {
let quiz = new Quiz(Instructor);
quiz.role.totalQuestions = totalQuestions;
if (reportView) {
@@ -978,6 +979,6 @@ define(['jquery', 'mod_jazzquiz/core'], function ($, Jazz) {
quiz.poll(500);
}
}
- }
+ };
});
diff --git a/amd/src/student.js b/amd/src/student.js
index 2846f21..e148218 100755
--- a/amd/src/student.js
+++ b/amd/src/student.js
@@ -14,14 +14,14 @@
// along with Moodle. If not, see .
/**
- * @package mod_jazzquiz
+ * @module mod_jazzquiz
* @author Sebastian S. Gundersen
* @copyright 2014 University of Wisconsin - Madison
* @copyright 2018 NTNU
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-define(['jquery', 'mod_jazzquiz/core'], function ($, Jazz) {
+define(['jquery', 'mod_jazzquiz/core'], function($, Jazz) {
const Quiz = Jazz.Quiz;
const Question = Jazz.Question;
@@ -47,11 +47,11 @@ define(['jquery', 'mod_jazzquiz/core'], function ($, Jazz) {
});
}
- onNotRunning(data) {
+ onNotRunning() {
setText(Quiz.info, 'instructions_for_student');
}
- onPreparing(data) {
+ onPreparing() {
setText(Quiz.info, 'wait_for_instructor');
}
@@ -65,7 +65,7 @@ define(['jquery', 'mod_jazzquiz/core'], function ($, Jazz) {
}
}
- onReviewing(data) {
+ onReviewing() {
this.quiz.question.isVoteRunning = false;
this.quiz.question.isRunning = false;
this.quiz.question.hideTimer();
@@ -73,7 +73,7 @@ define(['jquery', 'mod_jazzquiz/core'], function ($, Jazz) {
setText(Quiz.info, 'wait_for_instructor');
}
- onSessionClosed(data) {
+ onSessionClosed() {
window.location = location.href.split('&')[0];
}
@@ -93,7 +93,7 @@ define(['jquery', 'mod_jazzquiz/core'], function ($, Jazz) {
this.quiz.question.isVoteRunning = true;
}
- onStateChange(state) {
+ onStateChange() {
}
@@ -104,7 +104,7 @@ define(['jquery', 'mod_jazzquiz/core'], function ($, Jazz) {
onTimerTick(timeLeft) {
setText(Question.timer, 'question_will_end_in_x_seconds', 'jazzquiz', timeLeft);
}
-
+ // eslint-disable-next-line no-unused-vars
onQuestionRefreshed(data) {
}
@@ -118,7 +118,9 @@ define(['jquery', 'mod_jazzquiz/core'], function ($, Jazz) {
return;
}
this.quiz.question.isSaving = true;
+ // eslint-disable-next-line no-undef
if (typeof tinyMCE !== 'undefined') {
+ // eslint-disable-next-line no-undef
tinyMCE.triggerSave();
}
const serialized = Question.form.serializeArray();
@@ -165,6 +167,6 @@ define(['jquery', 'mod_jazzquiz/core'], function ($, Jazz) {
let quiz = new Quiz(Student);
quiz.poll(2000);
}
- }
+ };
});
From 9206509158ec213e037f3d2738c47663a99bdb29 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B8rgen=20Finsveen?=
Date: Mon, 31 Jul 2023 12:49:21 +0200
Subject: [PATCH 18/27] refactored code after workflow lint feedback pt.2
---
classes/bank/jazzquiz_question_bank_view.php | 2 +-
classes/exporter.php | 15 ++++++-------
classes/improviser.php | 22 ++++++++++----------
classes/jazzquiz_session.php | 6 ++----
classes/output/renderer.php | 2 +-
edit.php | 17 +++++++++------
lang/en/jazzquiz.php | 9 ++++----
styles.css | 4 ++--
templates/continue_session.mustache | 3 +++
templates/edit_question_list.mustache | 3 +++
templates/guests_not_allowed.mustache | 3 +++
templates/join_session.mustache | 3 +++
templates/no_session.mustache | 3 +++
templates/question.mustache | 3 +++
templates/quiz.mustache | 3 +++
templates/report.mustache | 3 +++
templates/start_session.mustache | 3 +++
view.php | 14 ++++++-------
18 files changed, 75 insertions(+), 43 deletions(-)
diff --git a/classes/bank/jazzquiz_question_bank_view.php b/classes/bank/jazzquiz_question_bank_view.php
index e425430..e762027 100755
--- a/classes/bank/jazzquiz_question_bank_view.php
+++ b/classes/bank/jazzquiz_question_bank_view.php
@@ -100,7 +100,7 @@ public function display($pagevars, $tabname): void {
$cat,
null,
$page,
- $perpage,
+ $perpage,
$this->contexts->having_cap('moodle/question:add')
);
$this->display_add_selected_questions_button();
diff --git a/classes/exporter.php b/classes/exporter.php
index 71cd0d6..b7a379c 100755
--- a/classes/exporter.php
+++ b/classes/exporter.php
@@ -156,16 +156,17 @@ public function export_attendance_csv(jazzquiz_session $session) {
echo "IdNumber\tFirst Name\tLast Name\tResponses\r\n";
foreach ($attendances as $attendance) {
$idnumber = $attendance['idnumber'];
- $userFirstLastName = explode(', ', $attendance['name']);
- if (count($userFirstLastName) >= 2) {
- $lastName = $userFirstLastName[1];
- $firstName = $userFirstLastName[0];
+ $userfirstlastname = explode(', ', $attendance['name']);
+ if (count($userfirstlastname) >= 2) {
+ $lastname = $userfirstlastname[1];
+ $firstname = $userfirstlastname[0];
} else {
- $lastName = $userFirstLastName[0];
- $firstName = $userFirstLastName[0]; //for anonymous, but it doesn't even make sense since if it's anon, no name should display
+ $lastname = $userfirstlastname[0];
+ // For anonymous, but it doesn't even make sense since if it's anon, no name should display.
+ $firstname = $userfirstlastname[0];
}
$count = $attendance['count'];
- echo "$idnumber\t$lastName\t$firstName\t$count\r\n";
+ echo "$idnumber\t$lastname\t$firstname\t$count\r\n";
}
}
diff --git a/classes/improviser.php b/classes/improviser.php
index cab8960..98550c6 100755
--- a/classes/improviser.php
+++ b/classes/improviser.php
@@ -60,10 +60,10 @@ public function get_all_improvised_question_definitions() {
$questions = [];
$context = \context_module::instance($this->jazzquiz->cm->id);
$parts = explode('/', $context->path);
- debugging( "get_all_improvised: ".$parts ) ;
+ debugging( "get_all_improvised: ".$parts );
foreach ($parts as $part) {
// Selecting name first, to prevent duplicate improvise questions.
- debugging( "get_all_improvised: ".$part ) ;
+ debugging( "get_all_improvised: ".$part );
$sql = "SELECT q.name,
q.id
FROM {question} q
@@ -256,7 +256,7 @@ private function insert_multichoice_question_definition(string $name, array $ans
}
$question->id = $DB->insert_record('question', $question);
$qbankentry->id = $DB->insert_record('question_bank_entries', $qbankentry);
- $this->insert_question_version( $qbankentry->id, $question->id ) ;
+ $this->insert_question_version( $qbankentry->id, $question->id );
// Add options.
$options = $this->make_multichoice_options($question->id);
$DB->insert_record('qtype_multichoice_options', $options);
@@ -269,17 +269,17 @@ private function insert_multichoice_question_definition(string $name, array $ans
}
/* Create a question version database object, linking the given question
- * and question bank entry.
- * @param int $qbankid The ID of the question banke entry
- * @param int $qid The ID of the question
+ * and question bank entry.
+ * @param int $qbankid The ID of the question banke entry
+ * @param int $qid The ID of the question
* @return \stdClass
*/
private function insert_question_version(int $qbankid, int $qid) {
global $DB;
$qv = new \stdClass();
- $qv->questionbankentryid = $qbankid ;
- $qv->version = 1 ;
- $qv->questionid = $qid ;
+ $qv->questionbankentryid = $qbankid;
+ $qv->version = 1;
+ $qv->questionid = $qid;
$qv->id = $DB->insert_record('question_versions', $qv);
return $qv;
}
@@ -301,7 +301,7 @@ private function insert_shortanswer_question_definition(string $name) {
}
$question->id = $DB->insert_record('question', $question);
$qbankentry->id = $DB->insert_record('question_bank_entries', $qbankentry);
- $this->insert_question_version( $qbankentry->id, $question->id ) ;
+ $this->insert_question_version( $qbankentry->id, $question->id );
// Add options.
$options = $this->make_shortanswer_options($question->id);
@@ -324,7 +324,7 @@ private function insert_shortmath_question_definition(string $name) {
}
$question->id = $DB->insert_record('question', $question);
$qbankentry->id = $DB->insert_record('question_bank_entries', $qbankentry);
- $this->insert_question_version( $qbankentry->id, $question->id ) ;
+ $this->insert_question_version( $qbankentry->id, $question->id );
// Add options. Important: If shortmath changes options table in the future, this must be changed too.
$options = $this->make_shortanswer_options($question->id);
$DB->insert_record('qtype_shortmath_options', $options);
diff --git a/classes/jazzquiz_session.php b/classes/jazzquiz_session.php
index e4ea04a..b2bbe27 100755
--- a/classes/jazzquiz_session.php
+++ b/classes/jazzquiz_session.php
@@ -139,8 +139,7 @@ public function user_name_for_answer($userid) {
if (!$user) {
return '?';
}
- $userFirstLastName = $user->lastname . ', ' . $user->firstname;
- return $userFirstLastName;
+ return $user->lastname . ', ' . $user->firstname;
}
public function user_name_for_attendance($userid) {
@@ -152,8 +151,7 @@ public function user_name_for_attendance($userid) {
if (!$user) {
return '?';
}
- $userFirstLastName = $user->lastname . ', ' . $user->firstname;
- return $userFirstLastName;
+ return $user->lastname . ', ' . $user->firstname;
}
public function user_idnumber_for_attendance($userid) {
diff --git a/classes/output/renderer.php b/classes/output/renderer.php
index d1b93df..55d0e1e 100755
--- a/classes/output/renderer.php
+++ b/classes/output/renderer.php
@@ -158,7 +158,7 @@ public function quiz_not_running($cmid) {
/**
- * Shows the "guests not allowed" page when trying to access a
+ * Shows the "guests not allowed" page when trying to access a
* quiz which does not allow guests in guest mode.
* @throws \moodle_exception
*/
diff --git a/edit.php b/edit.php
index 1400079..b4f69fa 100755
--- a/edit.php
+++ b/edit.php
@@ -60,7 +60,7 @@ function jazzquiz_session_open($jazzquizid) {
function get_qbank_view(\core_question\local\bank\question_edit_contexts $contexts, jazzquiz $jazzquiz, \moodle_url $url, array $pagevars) {
$qperpage = optional_param('qperpage', 10, PARAM_INT);
$qpage = optional_param('qpage', 0, PARAM_INT);
- $new_pagevars = [
+ $newpagevars = [
'qpage' => $qpage,
'qperpage' => $qperpage,
'cat' => $pagevars['cat'],
@@ -71,7 +71,7 @@ function get_qbank_view(\core_question\local\bank\question_edit_contexts $contex
// Capture question bank display in buffer to have the renderer render output.
ob_start();
$questionbank = new bank\jazzquiz_question_bank_view($contexts, $url, $jazzquiz->course, $jazzquiz->cm);
- $questionbank->display($new_pagevars, 'editq');
+ $questionbank->display($newpagevars, 'editq');
return ob_get_clean();
}
@@ -84,7 +84,10 @@ function get_qbank_view(\core_question\local\bank\question_edit_contexts $contex
* @throws \coding_exception
* @throws \moodle_exception
*/
-function list_questions(\core_question\local\bank\question_edit_contexts $contexts, jazzquiz $jazzquiz, \moodle_url $url, array $pagevars) {
+function list_questions(
+ \core_question\local\bank\question_edit_contexts $contexts,
+ jazzquiz $jazzquiz, \moodle_url $url, array $pagevars)
+{
$qbankview = get_qbank_view($contexts, $jazzquiz, $url, $pagevars);
$jazzquiz->renderer->list_questions($jazzquiz, $jazzquiz->questions, $qbankview, $url);
}
@@ -133,7 +136,10 @@ function jazzquiz_edit_edit_question(jazzquiz $jazzquiz) {
* @throws \coding_exception
* @throws \moodle_exception
*/
-function jazzquiz_edit_qlist(jazzquiz $jazzquiz, \core_question\local\bank\question_edit_contexts $contexts, \moodle_url $url, array $pagevars) {
+function jazzquiz_edit_qlist(
+ jazzquiz $jazzquiz, \core_question\local\bank\question_edit_contexts $contexts,
+ \moodle_url $url, array $pagevars)
+{
$jazzquiz->renderer->header($jazzquiz, 'edit');
list_questions($contexts, $jazzquiz, $url, $pagevars);
$jazzquiz->renderer->footer();
@@ -163,7 +169,7 @@ function jazzquiz_edit() {
$pagevars) = question_edit_setup('editq', '/mod/jazzquiz/edit.php', true);
$jazzquiz = new jazzquiz($cmid);
- $renderer = $jazzquiz->renderer; // Todo: Flytt ned til hvor variabelen blir brukt
+ $renderer = $jazzquiz->renderer;
$modulename = get_string('modulename', 'jazzquiz');
$quizname = format_string($jazzquiz->data->name, true);
@@ -182,7 +188,6 @@ function jazzquiz_edit() {
// Process moving, deleting and unhiding questions...
$questionbank = new \core_question\local\bank\view($contexts, $url, $COURSE, $cm);
-
switch ($action) {
case 'order':
diff --git a/lang/en/jazzquiz.php b/lang/en/jazzquiz.php
index 446b9e9..0c0f145 100755
--- a/lang/en/jazzquiz.php
+++ b/lang/en/jazzquiz.php
@@ -139,9 +139,9 @@
$string['x_seconds_left'] = '{$a}s left';
$string['error_saving_vote'] = 'There was an error saving your vote.';
$string['you_already_voted'] = 'Sorry, but you have already voted.';
-$string['guest_login'] = 'You are not enrolled on the course, and there is no quiz session open to guests at the moment.' ;
-$string['no_guests'] = 'It is possible that the teacher has not yet started a quiz session, and that you may try again later. It is also possible that you have to log in as a student and enrol on the course to be allowed to take part.' ;
-$string['ask_teacher'] = 'If in doubt, ask the teacher.' ;
+$string['guest_login'] = 'You are not enrolled on the course, and there is no quiz session open to guests at the moment.';
+$string['no_guests'] = 'It is possible that the teacher has not yet started a quiz session, and that you may try again later. It is also possible that you have to log in as a student and enrol on the course to be allowed to take part.';
+$string['ask_teacher'] = 'If in doubt, ask the teacher.';
// Instructor Controls.
$string['startquiz'] = 'Start quiz';
@@ -165,7 +165,8 @@
$string['a_students_answered'] = '{$a} students answered at least one question.';
$string['no_attempts_found'] = 'No attempts found.';
$string['student'] = 'Student';
-// $string['student_id'] = 'StudentID'; //not working in report.mustache, not sure why
+
+// Problem: $string['student_id'] = 'StudentID'; //not working in report.mustache, not sure why
$string['select_session'] = 'Select session to review:';
$string['attendance_list'] = 'Attendance list';
$string['download_report'] = 'Download report';
diff --git a/styles.css b/styles.css
index 8bfe2c3..99996c3 100755
--- a/styles.css
+++ b/styles.css
@@ -409,11 +409,11 @@
position: absolute;
right: 32px;
margin-top: 4px;
- color: #ff5555;
+ color: #f55;
}
#report_overview_controls a:last-child:hover {
- color: #cc3333;
+ color: #c33;
}
#report_overview_responded table tr {
diff --git a/templates/continue_session.mustache b/templates/continue_session.mustache
index 467de12..39f2230 100755
--- a/templates/continue_session.mustache
+++ b/templates/continue_session.mustache
@@ -1,3 +1,6 @@
+{{!
+ @template continue_session
+}}