-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from sbourget/ACTIVITY_COMPLETION_GDPR
Activity completion support, improved scoring and logging with GDPR support
- Loading branch information
Showing
31 changed files
with
1,811 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,8 +25,9 @@ | |
* @copyright 2016 John Okely <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
define(['jquery'], function($) { | ||
define(['jquery','core/yui', 'core/notification', 'core/ajax'], function($, Y, notification, ajax) { | ||
var questions; | ||
var quizgame; | ||
var stage; | ||
var score = 0; | ||
var particles = []; | ||
|
@@ -171,6 +172,11 @@ define(['jquery'], function($) { | |
} | ||
|
||
function endGame() { | ||
ajax.call([{ | ||
methodname: 'mod_quizgame_update_score', | ||
args: {quizgameid: quizgame, score: Math.trunc(score)}, | ||
fail: notification.exception | ||
}]); | ||
menuEvents(); | ||
} | ||
|
||
|
@@ -196,6 +202,13 @@ define(['jquery'], function($) { | |
touchDown = false; | ||
mouseDown = false; | ||
|
||
// Queue & trigger the game_started event. | ||
ajax.call([{ | ||
methodname: 'mod_quizgame_start_game', | ||
args: {quizgameid: quizgame}, | ||
fail: notification.exception | ||
}]); | ||
|
||
player = new Player("pix/ship.png", 0, 0); | ||
player.x = displayRect.width / 2; | ||
player.y = displayRect.height / 2; | ||
|
@@ -858,8 +871,9 @@ define(['jquery'], function($) { | |
return array; | ||
} | ||
|
||
function doInitialize(q) { | ||
function doInitialize(q, qid) { | ||
questions = q; | ||
quizgame = qid; | ||
if (document.addEventListener) { | ||
document.addEventListener('fullscreenchange', fschange, false); | ||
document.addEventListener('MSFullscreenChange', fschange, false); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?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_quizgame game_score_added event. | ||
* | ||
* @package mod_quizgame | ||
* @copyright 2018 Stephen Bourget | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
namespace mod_quizgame\event; | ||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
/** | ||
* The mod_quizgame game_score_added class. | ||
* | ||
* @package mod_quizgame | ||
* @copyright 2018 Stephen Bourget | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class game_score_added extends \core\event\base { | ||
|
||
/** | ||
* Set basic properties for the event. | ||
*/ | ||
protected function init() { | ||
$this->data['objecttable'] = 'quizgame_scores'; | ||
$this->data['crud'] = 'c'; | ||
$this->data['edulevel'] = self::LEVEL_PARTICIPATING; | ||
} | ||
|
||
/** | ||
* Returns localised general event name. | ||
* | ||
* @return string | ||
*/ | ||
public static function get_name() { | ||
return get_string('eventgamescoreadded', 'mod_quizgame'); | ||
} | ||
|
||
/** | ||
* Get URL related to the action. | ||
* | ||
* @return \moodle_url | ||
*/ | ||
public function get_url() { | ||
return new \moodle_url('/mod/quizgame/view.php', array('id' => $this->contextinstanceid)); | ||
} | ||
|
||
/** | ||
* Returns non-localised event description with id's for admin use only. | ||
* | ||
* @return string | ||
*/ | ||
public function get_description() { | ||
return "The user with id '$this->userid' scored ".$this->other['score'] . | ||
" in the quizventure with course module id '$this->contextinstanceid'."; | ||
} | ||
|
||
|
||
public static function get_objectid_mapping() { | ||
return array('db' => 'quizgame_scores', 'restore' => 'quizgame_scores'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?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_quizgame game_scores_viewed event. | ||
* | ||
* @package mod_quizgame | ||
* @copyright 2018 Stephen Bourget | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
namespace mod_quizgame\event; | ||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
/** | ||
* The mod_quizgame game_scores_viewed event class. | ||
* | ||
* @package mod_quizgame | ||
* @copyright 2018 Stephen Bourget | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class game_scores_viewed extends \core\event\base { | ||
|
||
/** | ||
* Set basic properties for the event. | ||
*/ | ||
protected function init() { | ||
$this->data['objecttable'] = 'quizgame'; | ||
$this->data['crud'] = 'r'; | ||
$this->data['edulevel'] = self::LEVEL_TEACHING; | ||
} | ||
|
||
/** | ||
* Returns localised general event name. | ||
* | ||
* @return string | ||
*/ | ||
public static function get_name() { | ||
return get_string('eventgamescoresviewed', 'mod_quizgame'); | ||
} | ||
|
||
/** | ||
* Get URL related to the action. | ||
* | ||
* @return \moodle_url | ||
*/ | ||
public function get_url() { | ||
return new \moodle_url('/mod/quizgame/scores.php', array('id' => $this->objectid)); | ||
} | ||
|
||
/** | ||
* Returns non-localised event description with id's for admin use only. | ||
* | ||
* @return string | ||
*/ | ||
public function get_description() { | ||
return "The user with id '$this->userid' viewed all of the player scores for the quizventure with" | ||
. " course module id '$this->contextinstanceid'."; | ||
} | ||
|
||
|
||
public static function get_objectid_mapping() { | ||
return array('db' => 'quizgame', 'restore' => 'quizgame'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?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_quizgame game_started event. | ||
* | ||
* @package mod_quizgame | ||
* @copyright 2018 Stephen Bourget | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
namespace mod_quizgame\event; | ||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
/** | ||
* The mod_quizgame game_started event class. | ||
* | ||
* @package mod_quizgame | ||
* @copyright 2018 Stephen Bourget | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class game_started extends \core\event\base { | ||
|
||
/** | ||
* Set basic properties for the event. | ||
*/ | ||
protected function init() { | ||
$this->data['objecttable'] = 'quizgame'; | ||
$this->data['crud'] = 'r'; | ||
$this->data['edulevel'] = self::LEVEL_PARTICIPATING; | ||
} | ||
|
||
/** | ||
* Returns localised general event name. | ||
* | ||
* @return string | ||
*/ | ||
public static function get_name() { | ||
return get_string('eventgamestarted', 'mod_quizgame'); | ||
} | ||
|
||
/** | ||
* Get URL related to the action. | ||
* | ||
* @return \moodle_url | ||
*/ | ||
public function get_url() { | ||
return new \moodle_url('/mod/quizgame/view.php', array('id' => $this->contextinstanceid)); | ||
} | ||
|
||
/** | ||
* Returns non-localised event description with id's for admin use only. | ||
* | ||
* @return string | ||
*/ | ||
public function get_description() { | ||
return "The user with id '$this->userid' started the quizventure with course module id '$this->contextinstanceid'."; | ||
} | ||
|
||
|
||
public static function get_objectid_mapping() { | ||
return array('db' => 'quizgame', 'restore' => 'quizgame'); | ||
} | ||
} |
Oops, something went wrong.