MDL-53700 competency: Migrating events to core

Leaving comments behind for now as it's a tricky one.
This commit is contained in:
Frederic Massart 2016-04-05 19:15:21 +08:00
parent 81de839f37
commit 5a1a685c28
43 changed files with 270 additions and 270 deletions

View file

@ -1,111 +0,0 @@
<?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/>.
/**
* Competency created event.
*
* @package tool_lp
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\competency;
defined('MOODLE_INTERNAL') || die();
/**
* Competency created event class.
*
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class competency_created extends base {
/**
* Convenience method to instantiate the event.
*
* @param competency $competency The competency.
* @return self
*/
public static function create_from_competency(competency $competency) {
if (!$competency->get_id()) {
throw new \coding_exception('The competency ID must be set.');
}
$event = static::create(array(
'contextid' => $competency->get_context()->id,
'objectid' => $competency->get_id()
));
$event->add_record_snapshot(competency::TABLE, $competency->to_record());
return $event;
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' created the competency with id '$this->objectid'";
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventcompetencycreated', 'tool_lp');
}
/**
* Get URL related to the action
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/lp/editcompetency.php', array(
'id' => $this->objectid,
'pagecontextid' => $this->contextid
));
}
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['crud'] = 'c';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = competency::TABLE;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
}

View file

@ -1,116 +0,0 @@
<?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/>.
/**
* Competency deleted event.
*
* @package tool_lp
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\competency;
defined('MOODLE_INTERNAL') || die();
/**
* Competency deleted event class.
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class competency_deleted extends base {
/**
* Convenience method to instantiate the event.
*
* @param competency $competency The competency.
* @return self
*/
public static function create_from_competency(competency $competency) {
if (!$competency->get_id()) {
throw new \coding_exception('The competency ID must be set.');
}
$event = static::create(array(
'contextid' => $competency->get_context()->id,
'objectid' => $competency->get_id(),
));
$event->add_record_snapshot(competency::TABLE, $competency->to_record());
return $event;
}
/**
* Instantiate events from competency ids.
*
* @param array $competencyids Array of competency ids.
* @param int $contextid The context id.
* @return self[] Array of events.
*/
public static function create_multiple_from_competencyids($competencyids, $contextid) {
$events = array();
foreach ($competencyids as $id) {
$events[$id] = static::create(array(
'contextid' => $contextid,
'objectid' => $id
));
}
return $events;
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' deleted the competency with id '$this->objectid'";
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventcompetencydeleted', 'tool_lp');
}
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['crud'] = 'd';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = competency::TABLE;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
}

View file

@ -1,109 +0,0 @@
<?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/>.
/**
* Competency framework created event.
*
* @package tool_lp
* @copyright 2016 Serge Gauthier <serge.gauthier.2@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\competency_framework;
defined('MOODLE_INTERNAL') || die();
/**
* Competency framework created event class.
*
* @property-read array $other {
* Extra information about event.
* }
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Serge Gauthier <serge.gauthier.2@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class competency_framework_created extends base {
/**
* Convenience method to instantiate the event.
*
* @param competency_framework $framework The framework.
* @return self
*/
public static final function create_from_framework(competency_framework $framework) {
if (!$framework->get_id()) {
throw new \coding_exception('The competency framework ID must be set.');
}
$event = static::create(array(
'contextid' => $framework->get_contextid(),
'objectid' => $framework->get_id()
));
$event->add_record_snapshot(competency_framework::TABLE, $framework->to_record());
return $event;
}
/**
* Returns localised general event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventcompetencyframeworkcreated', 'tool_lp');
}
/**
* Returns non-localised description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' created the competency framework with id '$this->objectid'.";
}
/**
* Returns relevant URL.
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/lp/editcompetencyframework.php',
array('id' => $this->objectid, 'pagecontextid' => $this->contextid));
}
/**
* Initialise the event data.
*/
protected function init() {
$this->data['objecttable'] = competency_framework::TABLE;
$this->data['crud'] = 'c';
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
}

View file

@ -1,102 +0,0 @@
<?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/>.
/**
* Competency framework deleted event.
*
* @package tool_lp
* @copyright 2016 Serge Gauthier
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\competency_framework;
defined('MOODLE_INTERNAL') || die();
/**
* Competency framework deleted event class.
*
* @property-read array $other {
* Extra information about event.
* }
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Serge Gauthier <serge.gauthier.2@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class competency_framework_deleted extends base {
/**
* Convenience method to instantiate the event.
*
* @param competency_framework $framework The framework.
* @return self
*/
public static final function create_from_framework(competency_framework $framework) {
if (!$framework->get_id()) {
throw new \coding_exception('The competency framework ID must be set.');
}
$event = static::create(array(
'contextid' => $framework->get_contextid(),
'objectid' => $framework->get_id()
));
$event->add_record_snapshot(competency_framework::TABLE, $framework->to_record());
return $event;
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' deleted the competency framework with id '$this->objectid'.";
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventcompetencyframeworkdeleted', 'tool_lp');
}
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['crud'] = 'd';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = competency_framework::TABLE;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
}

View file

@ -1,112 +0,0 @@
<?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/>.
/**
* Competency framework updated event.
*
* @package tool_lp
* @copyright 2016 Serge Gauthier <serge.gauthier.2@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\competency_framework;
defined('MOODLE_INTERNAL') || die();
/**
* Competency framework updated event class.
*
* @property-read array $other {
* Extra information about event.
* }
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Serge Gauthier <serge.gauthier.2@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class competency_framework_updated extends base {
/**
* Convenience method to instantiate the event.
*
* @param competency_framework $framework The framework.
* @return self
*/
public static final function create_from_framework(competency_framework $framework) {
if (!$framework->get_id()) {
throw new \coding_exception('The competency framework ID must be set.');
}
$event = static::create(array(
'contextid' => $framework->get_contextid(),
'objectid' => $framework->get_id()
));
$event->add_record_snapshot(competency_framework::TABLE, $framework->to_record());
return $event;
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' updated the competency framework with id '$this->objectid'.";
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventcompetencyframeworkupdated', 'tool_lp');
}
/**
* Get URL related to the action
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/lp/editcompetencyframework.php',
array('id' => $this->objectid, 'pagecontextid' => $this->contextid));
}
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = competency_framework::TABLE;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
}

View file

@ -1,110 +0,0 @@
<?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/>.
/**
* Competency framework viewed event.
*
* @package tool_lp
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\competency_framework;
defined('MOODLE_INTERNAL') || die();
/**
* Competency framework viewed event class.
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class competency_framework_viewed extends base {
/**
* Convenience method to instantiate the event.
*
* @param competency_framework $framework The framework.
* @return self
*/
public static function create_from_framework(competency_framework $framework) {
if (!$framework->get_id()) {
throw new \coding_exception('The competency framework ID must be set.');
}
$event = static::create(array(
'contextid' => $framework->get_contextid(),
'objectid' => $framework->get_id()
));
$event->add_record_snapshot(competency_framework::TABLE, $framework->to_record());
return $event;
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' viewed the competency framework with id '$this->objectid'";
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventcompetencyframeworkviewed', 'tool_lp');
}
/**
* Returns relevant URL.
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/lp/competencies.php', array(
'competencyframeworkid' => $this->objectid,
'pagecontextid' => $this->contextid
));
}
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['crud'] = 'r';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = competency_framework::TABLE;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
}

View file

@ -1,111 +0,0 @@
<?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/>.
/**
* Competency updated event.
*
* @package tool_lp
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\competency;
defined('MOODLE_INTERNAL') || die();
/**
* Competency updated event class.
*
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class competency_updated extends base {
/**
* Convenience method to instantiate the event.
*
* @param competency $competency The competency.
* @return self
*/
public static function create_from_competency(competency $competency) {
if (!$competency->get_id()) {
throw new \coding_exception('The competency ID must be set.');
}
$event = static::create(array(
'contextid' => $competency->get_context()->id,
'objectid' => $competency->get_id()
));
$event->add_record_snapshot(competency::TABLE, $competency->to_record());
return $event;
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' updated the competency with id '$this->objectid'";
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventcompetencyupdated', 'tool_lp');
}
/**
* Get URL related to the action
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/lp/editcompetency.php', array(
'id' => $this->objectid,
'pagecontextid' => $this->contextid
));
}
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = competency::TABLE;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
}

View file

@ -1,111 +0,0 @@
<?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/>.
/**
* Competency viewed event.
*
* @package tool_lp
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\competency;
defined('MOODLE_INTERNAL') || die();
/**
* Competency viewed event class.
*
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class competency_viewed extends base {
/**
* Convenience method to instantiate the event.
*
* @param competency $competency The competency.
* @return self
*/
public static function create_from_competency(competency $competency) {
if (!$competency->get_id()) {
throw new \coding_exception('The competency ID must be set.');
}
$event = static::create(array(
'contextid' => $competency->get_context()->id,
'objectid' => $competency->get_id()
));
$event->add_record_snapshot(competency::TABLE, $competency->to_record());
return $event;
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' viewed the competency with id '$this->objectid'";
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventcompetencyviewed', 'tool_lp');
}
/**
* Get URL related to the action
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/lp/editcompetency.php', array(
'id' => $this->objectid,
'pagecontextid' => $this->contextid
));
}
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['crud'] = 'r';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = competency::TABLE;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
}

View file

@ -1,174 +0,0 @@
<?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/>.
/**
* Evidence created event.
*
* @package tool_lp
* @copyright 2016 Jun Pataleta <jun@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\evidence;
use core_competency\user_competency;
defined('MOODLE_INTERNAL') || die();
/**
* Evidence created event class.
*
* @property-read array $other {
* Extra information about event.
*
* - int usercompetencyid: The user_competency ID linked to the evidence.
* - int competencyid: The competency ID linked to the evidence from user_competency.
* - int action: The action constant.
* - bool recommend: The recommend flag.
* }
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Jun Pataleta <jun@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class evidence_created extends base {
/**
* Convenience method to instantiate the event.
*
* @param evidence $evidence The evidence.
* @param user_competency $usercompetency The user competency object linked to the evidence.
* @param bool $recommend The recommend flag.
* @return evidence_created
* @throws \coding_exception
*/
public static final function create_from_evidence(evidence $evidence, user_competency $usercompetency, $recommend) {
// Make sure we have a valid evidence.
if (!$evidence->get_id()) {
throw new \coding_exception('The evidence ID must be set.');
}
// Make sure we have a valid user competency.
if (!$usercompetency->get_id()) {
throw new \coding_exception('The user competency ID must be set.');
}
// Make sure that the a proper user competecy is linked to the evidence.
if ($evidence->get_usercompetencyid() != $usercompetency->get_id()) {
throw new \coding_exception('The user competency linked with this evidence is invalid.');
}
$event = static::create([
'contextid' => $evidence->get_contextid(),
'objectid' => $evidence->get_id(),
'userid' => $evidence->get_actionuserid(),
'relateduserid' => $usercompetency->get_userid(),
'other' => [
'usercompetencyid' => $usercompetency->get_id(),
'competencyid' => $usercompetency->get_competencyid(),
'action' => $evidence->get_action(),
'recommend' => $recommend
]
]);
// Add record snapshot for the evidence.
$event->add_record_snapshot(evidence::TABLE, $evidence->to_record());
// Add record snapshot for the user competency.
$event->add_record_snapshot(user_competency::TABLE, $usercompetency->to_record());
return $event;
}
/**
* Returns localised general event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventevidencecreated', 'tool_lp');
}
/**
* Returns non-localised description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' created an evidence with id '$this->objectid'.";
}
/**
* Returns relevant URL.
*
* @return \moodle_url
*/
public function get_url() {
$urlparams = [
'id' => $this->other['usercompetencyid']
];
return new \moodle_url('/admin/tool/lp/user_competency.php', $urlparams);
}
/**
* Initialise the event data.
*/
protected function init() {
$this->data['objecttable'] = evidence::TABLE;
$this->data['crud'] = 'c';
$this->data['edulevel'] = self::LEVEL_TEACHING;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
/**
* Validate the data.
*
* @throws \coding_exception
*/
protected function validate_data() {
parent::validate_data();
if (!isset($this->relateduserid)) {
throw new \coding_exception('The \'relateduserid\' must be set.');
}
if (!isset($this->other['usercompetencyid'])) {
throw new \coding_exception('The \'usercompetencyid\' data in \'other\' must be set.');
}
if (!isset($this->other['competencyid'])) {
throw new \coding_exception('The \'competencyid\' data in \'other\' must be set.');
}
if (!isset($this->other['action'])) {
throw new \coding_exception('The \'action\' data in \'other\' must be set.');
}
if (!isset($this->other['recommend'])) {
throw new \coding_exception('The \'recommend\' data in \'other\' must be set.');
}
}
}

View file

@ -1,114 +0,0 @@
<?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/>.
/**
* Plan approved event.
*
* @package tool_lp
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\plan;
defined('MOODLE_INTERNAL') || die();
/**
* Plan approved event class.
*
* @property-read array $other {
* Extra information about event.
* }
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class plan_approved extends base {
/**
* Convenience method to instantiate the plan approved event.
*
*
* @param plan $plan The plan.
* @return self
*/
public static final function create_from_plan(plan $plan) {
if (!$plan->get_id()) {
throw new \coding_exception('The plan ID must be set.');
}
$event = static::create(array(
'contextid' => $plan->get_context()->id,
'objectid' => $plan->get_id(),
'relateduserid' => $plan->get_userid(),
));
$event->add_record_snapshot(plan::TABLE, $plan->to_record());
return $event;
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' approved the learning plan with id '$this->objectid'.";
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventplanapproved', 'tool_lp');
}
/**
* Get URL related to the action
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/lp/plan.php',
array('id' => $this->objectid, 'pagecontextid' => $this->contextid));
}
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = plan::TABLE;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
}

View file

@ -1,114 +0,0 @@
<?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/>.
/**
* Plan completed event.
*
* @package tool_lp
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\plan;
defined('MOODLE_INTERNAL') || die();
/**
* Plan completed event class.
*
* @property-read array $other {
* Extra information about event.
* }
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class plan_completed extends base {
/**
* Convenience method to instantiate the plan completed event.
*
*
* @param plan $plan The plan.
* @return self
*/
public static final function create_from_plan(plan $plan) {
if (!$plan->get_id()) {
throw new \coding_exception('The plan ID must be set.');
}
$event = static::create(array(
'contextid' => $plan->get_context()->id,
'objectid' => $plan->get_id(),
'relateduserid' => $plan->get_userid(),
));
$event->add_record_snapshot(plan::TABLE, $plan->to_record());
return $event;
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' completed the learning plan with id '$this->objectid'.";
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventplancompleted', 'tool_lp');
}
/**
* Get URL related to the action
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/lp/plan.php',
array('id' => $this->objectid, 'pagecontextid' => $this->contextid));
}
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = plan::TABLE;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
}

View file

@ -1,109 +0,0 @@
<?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/>.
/**
* Plan created event.
*
* @package tool_lp
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\plan;
defined('MOODLE_INTERNAL') || die();
/**
* Plan created event class.
*
* @property-read array $other {
* Extra information about event.
* }
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class plan_created extends base {
/**
* Convenience method to instantiate the event.
*
* @param plan $plan The plan.
* @return self
*/
public static final function create_from_plan(plan $plan) {
if (!$plan->get_id()) {
throw new \coding_exception('The plan ID must be set.');
}
$event = static::create(array(
'contextid' => $plan->get_context()->id,
'objectid' => $plan->get_id()
));
$event->add_record_snapshot(plan::TABLE, $plan->to_record());
return $event;
}
/**
* Returns localised general event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventplancreated', 'tool_lp');
}
/**
* Returns non-localised description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' created the learning plan with id '$this->objectid'.";
}
/**
* Returns relevant URL.
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/lp/plan.php',
array('id' => $this->objectid, 'pagecontextid' => $this->contextid));
}
/**
* Initialise the event data.
*/
protected function init() {
$this->data['objecttable'] = plan::TABLE;
$this->data['crud'] = 'c';
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
}

View file

@ -1,102 +0,0 @@
<?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/>.
/**
* Plan deleted event.
*
* @package tool_lp
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\plan;
defined('MOODLE_INTERNAL') || die();
/**
* Plan deleted event class.
*
* @property-read array $other {
* Extra information about event.
* }
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class plan_deleted extends base {
/**
* Convenience method to instantiate the event.
*
* @param plan $plan The plan.
* @return self
*/
public static final function create_from_plan(plan $plan) {
if (!$plan->get_id()) {
throw new \coding_exception('The plan ID must be set.');
}
$event = static::create(array(
'contextid' => $plan->get_context()->id,
'objectid' => $plan->get_id()
));
$event->add_record_snapshot(plan::TABLE, $plan->to_record());
return $event;
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' deleted the learning plan with id '$this->objectid'.";
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventplandeleted', 'tool_lp');
}
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['crud'] = 'd';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = plan::TABLE;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
}

View file

@ -1,114 +0,0 @@
<?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/>.
/**
* Plan reopened event.
*
* @package tool_lp
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\plan;
defined('MOODLE_INTERNAL') || die();
/**
* Plan reopened event class.
*
* @property-read array $other {
* Extra information about event.
* }
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class plan_reopened extends base {
/**
* Convenience method to instantiate the plan reopened event.
*
*
* @param plan $plan The plan.
* @return self
*/
public static final function create_from_plan(plan $plan) {
if (!$plan->get_id()) {
throw new \coding_exception('The plan ID must be set.');
}
$event = static::create(array(
'contextid' => $plan->get_context()->id,
'objectid' => $plan->get_id(),
'relateduserid' => $plan->get_userid(),
));
$event->add_record_snapshot(plan::TABLE, $plan->to_record());
return $event;
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' reopened the learning plan with id '$this->objectid'.";
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventplanreopened', 'tool_lp');
}
/**
* Get URL related to the action
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/lp/plan.php',
array('id' => $this->objectid, 'pagecontextid' => $this->contextid));
}
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = plan::TABLE;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
}

View file

@ -1,114 +0,0 @@
<?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/>.
/**
* Plan review request cancelled event.
*
* @package tool_lp
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\plan;
defined('MOODLE_INTERNAL') || die();
/**
* Plan review request cancelled event class.
*
* @property-read array $other {
* Extra information about event.
* }
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class plan_review_request_cancelled extends base {
/**
* Convenience method to instantiate the plan review request cancelled event.
*
*
* @param plan $plan The plan.
* @return self
*/
public static final function create_from_plan(plan $plan) {
if (!$plan->get_id()) {
throw new \coding_exception('The plan ID must be set.');
}
$event = static::create(array(
'contextid' => $plan->get_context()->id,
'objectid' => $plan->get_id(),
'relateduserid' => $plan->get_userid(),
));
$event->add_record_snapshot(plan::TABLE, $plan->to_record());
return $event;
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' cancelled a review request for the learning plan with id '$this->objectid'.";
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventplanreviewrequestcancelled', 'tool_lp');
}
/**
* Get URL related to the action
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/lp/plan.php',
array('id' => $this->objectid, 'pagecontextid' => $this->contextid));
}
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = plan::TABLE;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
}

View file

@ -1,114 +0,0 @@
<?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/>.
/**
* Plan review requested event.
*
* @package tool_lp
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\plan;
defined('MOODLE_INTERNAL') || die();
/**
* Plan review requested event class.
*
* @property-read array $other {
* Extra information about event.
* }
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class plan_review_requested extends base {
/**
* Convenience method to instantiate the plan review requested event.
*
*
* @param plan $plan The plan.
* @return self
*/
public static final function create_from_plan(plan $plan) {
if (!$plan->get_id()) {
throw new \coding_exception('The plan ID must be set.');
}
$event = static::create(array(
'contextid' => $plan->get_context()->id,
'objectid' => $plan->get_id(),
'relateduserid' => $plan->get_userid(),
));
$event->add_record_snapshot(plan::TABLE, $plan->to_record());
return $event;
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' sent a review request for the learning plan with id '$this->objectid'.";
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventplanreviewrequested', 'tool_lp');
}
/**
* Get URL related to the action
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/lp/plan.php',
array('id' => $this->objectid, 'pagecontextid' => $this->contextid));
}
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = plan::TABLE;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
}

View file

@ -1,114 +0,0 @@
<?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/>.
/**
* Plan review started event.
*
* @package tool_lp
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\plan;
defined('MOODLE_INTERNAL') || die();
/**
* Plan review started event class.
*
* @property-read array $other {
* Extra information about event.
* }
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class plan_review_started extends base {
/**
* Convenience method to instantiate the plan review started event.
*
*
* @param plan $plan The plan.
* @return self
*/
public static final function create_from_plan(plan $plan) {
if (!$plan->get_id()) {
throw new \coding_exception('The plan ID must be set.');
}
$event = static::create(array(
'contextid' => $plan->get_context()->id,
'objectid' => $plan->get_id(),
'relateduserid' => $plan->get_userid(),
));
$event->add_record_snapshot(plan::TABLE, $plan->to_record());
return $event;
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' started a review for the learning plan with id '$this->objectid'.";
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventplanreviewstarted', 'tool_lp');
}
/**
* Get URL related to the action
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/lp/plan.php',
array('id' => $this->objectid, 'pagecontextid' => $this->contextid));
}
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = plan::TABLE;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
}

View file

@ -1,114 +0,0 @@
<?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/>.
/**
* Plan review stopped event.
*
* @package tool_lp
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\plan;
defined('MOODLE_INTERNAL') || die();
/**
* Plan review stopped event class.
*
* @property-read array $other {
* Extra information about event.
* }
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class plan_review_stopped extends base {
/**
* Convenience method to instantiate the plan review stopped event.
*
*
* @param plan $plan The plan.
* @return self
*/
public static final function create_from_plan(plan $plan) {
if (!$plan->get_id()) {
throw new \coding_exception('The plan ID must be set.');
}
$event = static::create(array(
'contextid' => $plan->get_context()->id,
'objectid' => $plan->get_id(),
'relateduserid' => $plan->get_userid(),
));
$event->add_record_snapshot(plan::TABLE, $plan->to_record());
return $event;
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' stopped a review for the learning plan with id '$this->objectid'.";
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventplanreviewstopped', 'tool_lp');
}
/**
* Get URL related to the action
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/lp/plan.php',
array('id' => $this->objectid, 'pagecontextid' => $this->contextid));
}
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = plan::TABLE;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
}

View file

@ -1,114 +0,0 @@
<?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/>.
/**
* Plan unapproved event.
*
* @package tool_lp
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\plan;
defined('MOODLE_INTERNAL') || die();
/**
* Plan unapproved event class.
*
* @property-read array $other {
* Extra information about event.
* }
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class plan_unapproved extends base {
/**
* Convenience method to instantiate the plan unapproved event.
*
*
* @param plan $plan The plan.
* @return self
*/
public static final function create_from_plan(plan $plan) {
if (!$plan->get_id()) {
throw new \coding_exception('The plan ID must be set.');
}
$event = static::create(array(
'contextid' => $plan->get_context()->id,
'objectid' => $plan->get_id(),
'relateduserid' => $plan->get_userid(),
));
$event->add_record_snapshot(plan::TABLE, $plan->to_record());
return $event;
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' unapproved the learning plan with id '$this->objectid'.";
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventplanunapproved', 'tool_lp');
}
/**
* Get URL related to the action
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/lp/plan.php',
array('id' => $this->objectid, 'pagecontextid' => $this->contextid));
}
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = plan::TABLE;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
}

View file

@ -1,111 +0,0 @@
<?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/>.
/**
* Plan unlinked event.
*
* @package tool_lp
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\plan;
defined('MOODLE_INTERNAL') || die();
/**
* Plan unlinked event class.
*
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class plan_unlinked extends base {
/**
* Convenience method to instantiate the plan unlinked event.
*
*
* @param plan $plan The plan.
* @return self
*/
public static final function create_from_plan(plan $plan) {
if (!$plan->get_id()) {
throw new \coding_exception('The plan ID must be set.');
}
$event = static::create(array(
'contextid' => $plan->get_context()->id,
'objectid' => $plan->get_id(),
'relateduserid' => $plan->get_userid(),
));
$event->add_record_snapshot(plan::TABLE, $plan->to_record());
return $event;
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' unlinked the learning plan with id '$this->objectid'.";
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventplanunlinked', 'tool_lp');
}
/**
* Get URL related to the action
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/lp/plan.php',
array('id' => $this->objectid, 'pagecontextid' => $this->contextid));
}
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = plan::TABLE;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
}

View file

@ -1,114 +0,0 @@
<?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/>.
/**
* Plan updated event.
*
* @package tool_lp
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\plan;
defined('MOODLE_INTERNAL') || die();
/**
* Plan updated event class.
*
* @property-read array $other {
* Extra information about event.
* }
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class plan_updated extends base {
/**
* Convenience method to instantiate the event.
*
* Actions triggering this event will NOT trigger the underlying plan_updated for related plans.
*
* @param plan $plan The plan.
* @return self
*/
public static final function create_from_plan(plan $plan) {
if (!$plan->get_id()) {
throw new \coding_exception('The plan ID must be set.');
}
$event = static::create(array(
'contextid' => $plan->get_context()->id,
'objectid' => $plan->get_id()
));
$event->add_record_snapshot(plan::TABLE, $plan->to_record());
return $event;
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' updated the learning plan with id '$this->objectid'.";
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventplanupdated', 'tool_lp');
}
/**
* Get URL related to the action
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/lp/plan.php',
array('id' => $this->objectid, 'pagecontextid' => $this->contextid));
}
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = plan::TABLE;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
}

View file

@ -1,109 +0,0 @@
<?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/>.
/**
* Plan viewed event.
*
* @package tool_lp
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\plan;
defined('MOODLE_INTERNAL') || die();
/**
* Plan viewed event class.
*
* @property-read array $other {
* Extra information about event.
* }
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class plan_viewed extends base {
/**
* Convenience method to instantiate the event.
*
* @param plan $plan The plan.
* @return self
*/
public static function create_from_plan(plan $plan) {
if (!$plan->get_id()) {
throw new \coding_exception('The plan ID must be set.');
}
$event = static::create(array(
'contextid' => $plan->get_context()->id,
'objectid' => $plan->get_id()
));
$event->add_record_snapshot(plan::TABLE, $plan->to_record());
return $event;
}
/**
* Returns localised general event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventplanviewed', 'tool_lp');
}
/**
* Returns non-localised description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' viewed the learning plan with id '$this->objectid'.";
}
/**
* Returns relevant URL.
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/lp/plan.php',
array('id' => $this->objectid, 'pagecontextid' => $this->contextid));
}
/**
* Initialise the event data.
*/
protected function init() {
$this->data['objecttable'] = plan::TABLE;
$this->data['crud'] = 'r';
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
}

View file

@ -1,109 +0,0 @@
<?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/>.
/**
* Template created event.
*
* @package tool_lp
* @copyright 2016 Serge Gauthier <serge.gauthier.2@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\template;
defined('MOODLE_INTERNAL') || die();
/**
* Template created event class.
*
* @property-read array $other {
* Extra information about event.
* }
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Serge Gauthier <serge.gauthier.2@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class template_created extends base {
/**
* Convenience method to instantiate the event.
*
* @param template $template The template.
* @return self
*/
public static final function create_from_template(template $template) {
if (!$template->get_id()) {
throw new \coding_exception('The template ID must be set.');
}
$event = static::create(array(
'contextid' => $template->get_contextid(),
'objectid' => $template->get_id()
));
$event->add_record_snapshot(template::TABLE, $template->to_record());
return $event;
}
/**
* Returns localised general event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventtemplatecreated', 'tool_lp');
}
/**
* Returns non-localised description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' created the template with id '$this->objectid'.";
}
/**
* Returns relevant URL.
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/lp/edittemplate.php',
array('id' => $this->objectid, 'pagecontextid' => $this->contextid));
}
/**
* Initialise the event data.
*/
protected function init() {
$this->data['objecttable'] = template::TABLE;
$this->data['crud'] = 'c';
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
}

View file

@ -1,102 +0,0 @@
<?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/>.
/**
* Template deleted event.
*
* @package tool_lp
* @copyright 2016 Serge Gauthier
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\template;
defined('MOODLE_INTERNAL') || die();
/**
* Template deleted event class.
*
* @property-read array $other {
* Extra information about event.
* }
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Serge Gauthier <serge.gauthier.2@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class template_deleted extends base {
/**
* Convenience method to instantiate the event.
*
* @param template $template The template.
* @return self
*/
public static final function create_from_template(template $template) {
if (!$template->get_id()) {
throw new \coding_exception('The template ID must be set.');
}
$event = static::create(array(
'contextid' => $template->get_contextid(),
'objectid' => $template->get_id()
));
$event->add_record_snapshot(template::TABLE, $template->to_record());
return $event;
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' deleted the template with id '$this->objectid'.";
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventtemplatedeleted', 'tool_lp');
}
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['crud'] = 'd';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = template::TABLE;;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
}

View file

@ -1,114 +0,0 @@
<?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/>.
/**
* Template updated event.
*
* @package tool_lp
* @copyright 2016 Serge Gauthier <serge.gauthier.2@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\template;
defined('MOODLE_INTERNAL') || die();
/**
* Template updated event class.
*
* @property-read array $other {
* Extra information about event.
* }
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Serge Gauthier <serge.gauthier.2@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class template_updated extends base {
/**
* Convenience method to instantiate the event.
*
* Actions triggering this event will NOT trigger the underlying plan_updated for related plans.
*
* @param template $template The template.
* @return self
*/
public static final function create_from_template(template $template) {
if (!$template->get_id()) {
throw new \coding_exception('The template ID must be set.');
}
$event = static::create(array(
'contextid' => $template->get_contextid(),
'objectid' => $template->get_id()
));
$event->add_record_snapshot(template::TABLE, $template->to_record());
return $event;
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' updated the template with id '$this->objectid'.";
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventtemplateupdated', 'tool_lp');
}
/**
* Get URL related to the action
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/lp/edittemplate.php',
array('id' => $this->objectid, 'pagecontextid' => $this->contextid));
}
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = template::TABLE;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
}

View file

@ -1,109 +0,0 @@
<?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/>.
/**
* Template viewed event.
*
* @package tool_lp
* @copyright 2016 Serge Gauthier <serge.gauthier.2@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\template;
defined('MOODLE_INTERNAL') || die();
/**
* Template viewed event class.
*
* @property-read array $other {
* Extra information about event.
* }
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Serge Gauthier <serge.gauthier.2@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class template_viewed extends base {
/**
* Convenience method to instantiate the event.
*
* @param template $template The template.
* @return self
*/
public static function create_from_template(template $template) {
if (!$template->get_id()) {
throw new \coding_exception('The template ID must be set.');
}
$event = static::create(array(
'contextid' => $template->get_contextid(),
'objectid' => $template->get_id()
));
$event->add_record_snapshot(template::TABLE, $template->to_record());
return $event;
}
/**
* Returns localised general event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventtemplateviewed', 'tool_lp');
}
/**
* Returns non-localised description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' viewed the template with id '$this->objectid'.";
}
/**
* Returns relevant URL.
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/lp/templatecompetencies.php',
array('templateid' => $this->objectid, 'pagecontextid' => $this->contextid));
}
/**
* Initialise the event data.
*/
protected function init() {
$this->data['objecttable'] = template::TABLE;
$this->data['crud'] = 'r';
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
}

View file

@ -1,137 +0,0 @@
<?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/>.
/**
* User competency grade rated event.
*
* @package tool_lp
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\user_competency;
defined('MOODLE_INTERNAL') || die();
/**
* User competency grade rated event class.
*
* @property-read array $other {
* Extra information about event.
*
* - int grade: grade name of the user competency
* }
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class user_competency_grade_rated extends base {
/**
* Convenience method to instantiate the event.
*
* @param user_competency $usercompetency The user competency.
* @return self
*/
public static function create_from_user_competency(user_competency $usercompetency) {
if (!$usercompetency->get_id()) {
throw new \coding_exception('The user competency ID must be set.');
}
$params = array(
'contextid' => $usercompetency->get_context()->id,
'objectid' => $usercompetency->get_id(),
'relateduserid' => $usercompetency->get_userid(),
'other' => array(
'grade' => $usercompetency->get_grade()
)
);
$event = static::create($params);
$event->add_record_snapshot(user_competency::TABLE, $usercompetency->to_record());
return $event;
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' rated the user competency with id '$this->objectid' "
. "with '" . $this->other['grade'] . "' grade";
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventusercompetencygraderated', 'tool_lp');
}
/**
* Get URL related to the action
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/lp/user_competency.php', array(
'id' => $this->objectid
));
}
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['edulevel'] = self::LEVEL_TEACHING;
$this->data['objecttable'] = user_competency::TABLE;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
/**
* Custom validation.
*
* Throw \coding_exception notice in case of any problems.
*/
protected function validate_data() {
if (!$this->relateduserid) {
throw new \coding_exception('The \'relateduserid\' value must be set.');
}
if (!isset($this->other) || !isset($this->other['grade'])) {
throw new \coding_exception('The \'grade\' value must be set.');
}
}
}

View file

@ -1,153 +0,0 @@
<?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/>.
/**
* User competency grade rated in course event.
*
* @package tool_lp
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\user_competency_course;
use context_course;
defined('MOODLE_INTERNAL') || die();
/**
* User competency grade rated in course event class.
*
* @property-read array $other {
* Extra information about event.
*
* - int competencyid: id of competency.
* - int grade: grade name of the user competency
* }
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class user_competency_grade_rated_in_course extends base {
/**
* Convenience method to instantiate the event.
*
* @param user_competency_course $usercompetencycourse The user competency course.
* @return self
*/
public static function create_from_user_competency_course(user_competency_course $usercompetencycourse) {
if (!$usercompetencycourse->get_id()) {
throw new \coding_exception('The user competency course ID must be set.');
}
$params = array(
'objectid' => $usercompetencycourse->get_id(),
'relateduserid' => $usercompetencycourse->get_userid(),
'other' => array(
'competencyid' => $usercompetencycourse->get_competencyid(),
'grade' => $usercompetencycourse->get_grade()
)
);
$coursecontext = context_course::instance($usercompetencycourse->get_courseid());
$params['contextid'] = $coursecontext->id;
$params['courseid'] = $usercompetencycourse->get_courseid();
$event = static::create($params);
$event->add_record_snapshot(user_competency_course::TABLE, $usercompetencycourse->to_record());
return $event;
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' rated the user competency with id '$this->objectid' with "
. "'" . $this->other['grade'] . "' grade "
. "in course with id '$this->courseid'";
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventusercompetencygraderatedincourse', 'tool_lp');
}
/**
* Get URL related to the action
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/lp/user_competency_in_course.php', array(
'competencyid' => $this->other['competencyid'],
'userid' => $this->relateduserid,
'courseid' => $this->courseid
));
}
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['edulevel'] = self::LEVEL_TEACHING;
$this->data['objecttable'] = user_competency_course::TABLE;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
/**
* Custom validation.
*
* Throw \coding_exception notice in case of any problems.
*/
protected function validate_data() {
if (!isset($this->other) || !isset($this->other['competencyid'])) {
throw new \coding_exception('The \'competencyid\' value must be set.');
}
if (!$this->courseid) {
throw new \coding_exception('The \'courseid\' value must be set.');
}
if (!$this->relateduserid) {
throw new \coding_exception('The \'relateduserid\' value must be set.');
}
if (!isset($this->other['grade'])) {
throw new \coding_exception('The \'grade\' value must be set.');
}
}
}

View file

@ -1,153 +0,0 @@
<?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/>.
/**
* User competency grade rated in course event.
*
* @package tool_lp
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\user_competency;
defined('MOODLE_INTERNAL') || die();
/**
* User competency grade rated in plan event class.
*
* @property-read array $other {
* Extra information about event.
*
* - int competencyid: id of competency.
* - int grade: grade name of the user competency
* - int planid: the plan id
* }
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class user_competency_grade_rated_in_plan extends base {
/**
* Convenience method to instantiate the event.
*
* @param user_competency $usercompetency The user competency.
* @param int $planid The plan ID
* @return self
*/
public static function create_from_user_competency(user_competency $usercompetency, $planid) {
if (!$usercompetency->get_id()) {
throw new \coding_exception('The user competency ID must be set.');
}
$params = array(
'contextid' => $usercompetency->get_context()->id,
'objectid' => $usercompetency->get_id(),
'relateduserid' => $usercompetency->get_userid(),
'other' => array(
'competencyid' => $usercompetency->get_competencyid(),
'grade' => $usercompetency->get_grade(),
'planid' => $planid
)
);
$event = static::create($params);
$event->add_record_snapshot(user_competency::TABLE, $usercompetency->to_record());
return $event;
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' rated the user competency with id '$this->objectid' with "
. "'" . $this->other['grade'] . "' grade "
. "in plan with id '" . $this->other['grade'] . "'";
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventusercompetencygraderatedinplan', 'tool_lp');
}
/**
* Get URL related to the action
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/lp/user_competency_in_plan.php', array(
'competencyid' => $this->other['competencyid'],
'userid' => $this->relateduserid,
'planid' => $this->other['planid']
));
}
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['edulevel'] = self::LEVEL_TEACHING;
$this->data['objecttable'] = user_competency::TABLE;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
/**
* Custom validation.
*
* Throw \coding_exception notice in case of any problems.
*/
protected function validate_data() {
if (!isset($this->other) || !isset($this->other['competencyid'])) {
throw new \coding_exception('The \'competencyid\' value must be set.');
}
if (!isset($this->other['planid'])) {
throw new \coding_exception('The \'planid\' value must be set.');
}
if (!$this->relateduserid) {
throw new \coding_exception('The \'relateduserid\' value must be set.');
}
if (!isset($this->other['grade'])) {
throw new \coding_exception('The \'grade\' value must be set.');
}
}
}

View file

@ -1,142 +0,0 @@
<?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/>.
/**
* User competency plan viewed event.
*
* @package tool_lp
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\user_competency_plan;
defined('MOODLE_INTERNAL') || die();
/**
* User competency plan viewed event class.
*
* @property-read array $other {
* Extra information about event.
*
* - int planid: id of plan for which competency is associated.
* - int competencyid: id of the competency.
* }
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class user_competency_plan_viewed extends base {
/**
* Convenience method to instantiate the event.
*
* @param user_competency_plan $usercompetencyplan The user competency plan.
* @return self
*/
public static function create_from_user_competency_plan(user_competency_plan $usercompetencyplan) {
if (!$usercompetencyplan->get_id()) {
throw new \coding_exception('The user competency plan ID must be set.');
}
$event = static::create(array(
'contextid' => $usercompetencyplan->get_context()->id,
'objectid' => $usercompetencyplan->get_id(),
'relateduserid' => $usercompetencyplan->get_userid(),
'other' => array(
'planid' => $usercompetencyplan->get_planid(),
'competencyid' => $usercompetencyplan->get_competencyid()
)
));
$event->add_record_snapshot(user_competency_plan::TABLE, $usercompetencyplan->to_record());
return $event;
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' viewed the user competency plan with id '$this->objectid'";
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventusercompetencyplanviewed', 'tool_lp');
}
/**
* Get URL related to the action
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/lp/user_competency_in_plan.php', array(
'competencyid' => $this->other['competencyid'],
'userid' => $this->relateduserid,
'planid' => $this->other['planid']
));
}
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['crud'] = 'r';
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
$this->data['objecttable'] = user_competency_plan::TABLE;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
/**
* Custom validation.
*
* Throw \coding_exception notice in case of any problems.
*/
protected function validate_data() {
if ($this->other === null) {
throw new \coding_exception('The \'competencyid\' and \'planid\' values must be set.');
}
if (!isset($this->other['competencyid'])) {
throw new \coding_exception('The \'competencyid\' value must be set.');
}
if (!isset($this->other['planid'])) {
throw new \coding_exception('The \'planid\' value must be set.');
}
}
}

View file

@ -1,123 +0,0 @@
<?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/>.
/**
* User competency review requested event.
*
* @package tool_lp
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\user_competency;
defined('MOODLE_INTERNAL') || die();
/**
* User competency review requested event class.
*
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class user_competency_review_request_cancelled extends base {
/**
* Convenience method to instantiate the event.
*
* @param user_competency $usercompetency The user competency.
* @return self
*/
public static function create_from_user_competency(user_competency $usercompetency) {
if (!$usercompetency->get_id()) {
throw new \coding_exception('The user competency ID must be set.');
}
$params = array(
'contextid' => $usercompetency->get_context()->id,
'objectid' => $usercompetency->get_id(),
'relateduserid' => $usercompetency->get_userid()
);
$event = static::create($params);
$event->add_record_snapshot(user_competency::TABLE, $usercompetency->to_record());
return $event;
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' cancelled a review request for the user competency with id '$this->objectid'";
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventusercompetencyreviewrequestcancelled', 'tool_lp');
}
/**
* Get URL related to the action
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/lp/user_competency.php', array(
'id' => $this->objectid
));
}
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
$this->data['objecttable'] = user_competency::TABLE;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
/**
* Custom validation.
*
* Throw \coding_exception notice in case of any problems.
*/
protected function validate_data() {
if (!$this->relateduserid) {
throw new \coding_exception('The \'relateduserid\' value must be set.');
}
}
}

View file

@ -1,123 +0,0 @@
<?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/>.
/**
* User competency review requested event.
*
* @package tool_lp
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\user_competency;
defined('MOODLE_INTERNAL') || die();
/**
* User competency review requested event class.
*
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class user_competency_review_requested extends base {
/**
* Convenience method to instantiate the event.
*
* @param user_competency $usercompetency The user competency.
* @return self
*/
public static function create_from_user_competency(user_competency $usercompetency) {
if (!$usercompetency->get_id()) {
throw new \coding_exception('The user competency ID must be set.');
}
$params = array(
'contextid' => $usercompetency->get_context()->id,
'objectid' => $usercompetency->get_id(),
'relateduserid' => $usercompetency->get_userid()
);
$event = static::create($params);
$event->add_record_snapshot(user_competency::TABLE, $usercompetency->to_record());
return $event;
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' sent a review request for the user competency with id '$this->objectid'";
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventusercompetencyreviewrequested', 'tool_lp');
}
/**
* Get URL related to the action
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/lp/user_competency.php', array(
'id' => $this->objectid
));
}
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
$this->data['objecttable'] = user_competency::TABLE;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
/**
* Custom validation.
*
* Throw \coding_exception notice in case of any problems.
*/
protected function validate_data() {
if (!$this->relateduserid) {
throw new \coding_exception('The \'relateduserid\' value must be set.');
}
}
}

View file

@ -1,123 +0,0 @@
<?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/>.
/**
* User competency review started event.
*
* @package tool_lp
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\user_competency;
defined('MOODLE_INTERNAL') || die();
/**
* User competency review started event class.
*
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class user_competency_review_started extends base {
/**
* Convenience method to instantiate the event.
*
* @param user_competency $usercompetency The user competency.
* @return self
*/
public static function create_from_user_competency(user_competency $usercompetency) {
if (!$usercompetency->get_id()) {
throw new \coding_exception('The user competency ID must be set.');
}
$params = array(
'contextid' => $usercompetency->get_context()->id,
'objectid' => $usercompetency->get_id(),
'relateduserid' => $usercompetency->get_userid()
);
$event = static::create($params);
$event->add_record_snapshot(user_competency::TABLE, $usercompetency->to_record());
return $event;
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' started a review for the user competency with id '$this->objectid'";
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventusercompetencyreviewstarted', 'tool_lp');
}
/**
* Get URL related to the action
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/lp/user_competency.php', array(
'id' => $this->objectid
));
}
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['edulevel'] = self::LEVEL_TEACHING;
$this->data['objecttable'] = user_competency::TABLE;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
/**
* Custom validation.
*
* Throw \coding_exception notice in case of any problems.
*/
protected function validate_data() {
if (!$this->relateduserid) {
throw new \coding_exception('The \'relateduserid\' value must be set.');
}
}
}

View file

@ -1,123 +0,0 @@
<?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/>.
/**
* User competency review stopped event.
*
* @package tool_lp
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\user_competency;
defined('MOODLE_INTERNAL') || die();
/**
* User competency review stopped event class.
*
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class user_competency_review_stopped extends base {
/**
* Convenience method to instantiate the event.
*
* @param user_competency $usercompetency The user competency.
* @return self
*/
public static function create_from_user_competency(user_competency $usercompetency) {
if (!$usercompetency->get_id()) {
throw new \coding_exception('The user competency ID must be set.');
}
$params = array(
'contextid' => $usercompetency->get_context()->id,
'objectid' => $usercompetency->get_id(),
'relateduserid' => $usercompetency->get_userid()
);
$event = static::create($params);
$event->add_record_snapshot(user_competency::TABLE, $usercompetency->to_record());
return $event;
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' stopped a review for the user competency with id '$this->objectid'";
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventusercompetencyreviewstopped', 'tool_lp');
}
/**
* Get URL related to the action
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/lp/user_competency.php', array(
'id' => $this->objectid
));
}
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['edulevel'] = self::LEVEL_TEACHING;
$this->data['objecttable'] = user_competency::TABLE;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
/**
* Custom validation.
*
* Throw \coding_exception notice in case of any problems.
*/
protected function validate_data() {
if (!$this->relateduserid) {
throw new \coding_exception('The \'relateduserid\' value must be set.');
}
}
}

View file

@ -1,132 +0,0 @@
<?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/>.
/**
* User competency viewed event.
*
* @package tool_lp
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\user_competency;
use context_course;
defined('MOODLE_INTERNAL') || die();
/**
* User competency viewed event class.
*
* @property-read array $other {
* Extra information about event.
*
* - int competencyid: id of competency.
* }
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class user_competency_viewed extends base {
/**
* Convenience method to instantiate the event.
*
* @param user_competency $usercompetency The user competency.
* @return self
*/
public static function create_from_user_competency_viewed(user_competency $usercompetency) {
if (!$usercompetency->get_id()) {
throw new \coding_exception('The user competency ID must be set.');
}
$params = array(
'contextid' => $usercompetency->get_context()->id,
'objectid' => $usercompetency->get_id(),
'relateduserid' => $usercompetency->get_userid(),
'other' => array(
'competencyid' => $usercompetency->get_competencyid()
)
);
$event = static::create($params);
$event->add_record_snapshot(user_competency::TABLE, $usercompetency->to_record());
return $event;
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' viewed the user competency with id '$this->objectid'";
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventusercompetencyviewed', 'tool_lp');
}
/**
* Get URL related to the action
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/lp/user_competency.php', array(
'id' => $this->objectid
));
}
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['crud'] = 'r';
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
$this->data['objecttable'] = user_competency::TABLE;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
/**
* Custom validation.
*
* Throw \coding_exception notice in case of any problems.
*/
protected function validate_data() {
if (!isset($this->other) || !isset($this->other['competencyid'])) {
throw new \coding_exception('The \'competencyid\' value must be set.');
}
}
}

View file

@ -1,141 +0,0 @@
<?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/>.
/**
* User competency viewed event.
*
* @package tool_lp
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\user_competency_course;
use context_course;
defined('MOODLE_INTERNAL') || die();
/**
* User competency viewed in course event class.
*
* @property-read array $other {
* Extra information about event.
*
* - int competencyid: id of competency.
* }
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class user_competency_viewed_in_course extends base {
/**
* Convenience method to instantiate the event in course.
*
* @param user_competency_course $usercompetencycourse The user competency for the course.
* @return self
*/
public static function create_from_user_competency_viewed_in_course(user_competency_course $usercompetencycourse) {
if (!$usercompetencycourse->get_id()) {
throw new \coding_exception('The user competency course ID must be set.');
}
$params = array(
'objectid' => $usercompetencycourse->get_id(),
'relateduserid' => $usercompetencycourse->get_userid(),
'other' => array(
'competencyid' => $usercompetencycourse->get_competencyid()
)
);
$coursecontext = context_course::instance($usercompetencycourse->get_courseid());
$params['contextid'] = $coursecontext->id;
$params['courseid'] = $usercompetencycourse->get_courseid();
$event = static::create($params);
$event->add_record_snapshot(user_competency_course::TABLE, $usercompetencycourse->to_record());
return $event;
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' viewed the user course competency with id '$this->objectid' "
. "in course with id '$this->courseid'";
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventusercompetencyviewedincourse', 'tool_lp');
}
/**
* Get URL related to the action
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/lp/user_competency_in_course.php', array(
'competencyid' => $this->other['competencyid'],
'userid' => $this->relateduserid,
'courseid' => $this->courseid
));
}
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['crud'] = 'r';
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
$this->data['objecttable'] = user_competency_course::TABLE;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
/**
* Custom validation.
*
* Throw \coding_exception notice in case of any problems.
*/
protected function validate_data() {
if (!$this->courseid) {
throw new \coding_exception('The \'courseid\' value must be set.');
}
if (!isset($this->other) || !isset($this->other['competencyid'])) {
throw new \coding_exception('The \'competencyid\' value must be set.');
}
}
}

View file

@ -1,146 +0,0 @@
<?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/>.
/**
* User competency viewed event.
*
* @package tool_lp
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\user_competency;
use context_course;
defined('MOODLE_INTERNAL') || die();
/**
* User competency viewed in plan event class.
*
* @property-read array $other {
* Extra information about event.
*
* - int planid: id of plan for which competency is associated.
* - int competencyid: id of competency.
* }
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class user_competency_viewed_in_plan extends base {
/**
* Convenience method to instantiate the event in plan.
*
* @param user_competency $usercompetency The user competency.
* @param int $planid The pland ID
* @return self
*/
public static function create_from_user_competency_viewed_in_plan(user_competency $usercompetency, $planid) {
if (!$usercompetency->get_id()) {
throw new \coding_exception('The user competency ID must be set.');
}
$params = array(
'contextid' => $usercompetency->get_context()->id,
'objectid' => $usercompetency->get_id(),
'relateduserid' => $usercompetency->get_userid(),
'other' => array(
'competencyid' => $usercompetency->get_competencyid(),
'planid' => $planid
)
);
$event = static::create($params);
$event->add_record_snapshot(user_competency::TABLE, $usercompetency->to_record());
return $event;
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' viewed the user competency with id '$this->objectid' "
. "in plan with id '" . $this->other['planid'] . "'";
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventusercompetencyviewedinplan', 'tool_lp');
}
/**
* Get URL related to the action
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/lp/user_competency_in_plan.php', array(
'competencyid' => $this->other['competencyid'],
'userid' => $this->relateduserid,
'planid' => $this->other['planid']
));
}
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['crud'] = 'r';
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
$this->data['objecttable'] = user_competency::TABLE;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
/**
* Custom validation.
*
* Throw \coding_exception notice in case of any problems.
*/
protected function validate_data() {
if ($this->other === null) {
throw new \coding_exception('The \'competencyid\' and \'planid\' values must be set.');
}
if (!isset($this->other['competencyid'])) {
throw new \coding_exception('The \'competencyid\' value must be set.');
}
if (!isset($this->other['planid'])) {
throw new \coding_exception('The \'planid\' value must be set.');
}
}
}

View file

@ -1,110 +0,0 @@
<?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/>.
/**
* Evidence of prior learning created event.
*
* @package tool_lp
* @copyright 2016 Serge Gauthier <serge.gauthier.2@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\user_evidence;
defined('MOODLE_INTERNAL') || die();
/**
* Evidence of prior learning created event class.
*
* @property-read array $other {
* Extra information about event.
* }
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Serge Gauthier <serge.gauthier.2@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class user_evidence_created extends base {
/**
* Convenience method to instantiate the event.
*
* @param user_evidence $userevidence The evidence of prior learning.
* @return self
*/
public static final function create_from_user_evidence(user_evidence $userevidence) {
if (!$userevidence->get_id()) {
throw new \coding_exception('The evidence of prior learning ID must be set.');
}
$event = static::create(array(
'contextid' => $userevidence->get_context()->id,
'objectid' => $userevidence->get_id(),
'relateduserid' => $userevidence->get_userid()
));
$event->add_record_snapshot(user_evidence::TABLE, $userevidence->to_record());
return $event;
}
/**
* Returns localised general event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventuserevidencecreated', 'tool_lp');
}
/**
* Returns non-localised description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' created the evidence of prior learning with id '$this->objectid'.";
}
/**
* Returns relevant URL.
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/lp/user_evidence.php',
array('id' => $this->objectid));
}
/**
* Initialise the event data.
*/
protected function init() {
$this->data['objecttable'] = user_evidence::TABLE;
$this->data['crud'] = 'c';
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
}

View file

@ -1,100 +0,0 @@
<?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/>.
/**
* Evidence of prior learning deleted event.
*
* @package tool_lp
* @copyright 2016 Serge Gauthier <serge.gauthier.2@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\user_evidence;
defined('MOODLE_INTERNAL') || die();
/**
* Evidence of prior learning deleted event class.
*
* @property-read array $other {
* Extra information about event.
* }
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Serge Gauthier <serge.gauthier.2@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class user_evidence_deleted extends base {
/**
* Convenience method to instantiate the event.
*
* @param user_evidence $userevidence The evidence of prior learning.
* @return self
*/
public static final function create_from_user_evidence(user_evidence $userevidence) {
if (!$userevidence->get_id()) {
throw new \coding_exception('The evidence of prior learning ID must be set.');
}
$event = static::create(array(
'contextid' => $userevidence->get_context()->id,
'objectid' => $userevidence->get_id(),
'relateduserid' => $userevidence->get_userid()
));
$event->add_record_snapshot(user_evidence::TABLE, $userevidence->to_record());
return $event;
}
/**
* Returns localised general event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventuserevidencedeleted', 'tool_lp');
}
/**
* Returns non-localised description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' deleted the evidence of prior learning with id '$this->objectid'.";
}
/**
* Initialise the event data.
*/
protected function init() {
$this->data['objecttable'] = user_evidence::TABLE;
$this->data['crud'] = 'd';
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
}

View file

@ -1,110 +0,0 @@
<?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/>.
/**
* Evidence of prior learning updated event.
*
* @package tool_lp
* @copyright 2016 Serge Gauthier <serge.gauthier.2@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_lp\event;
use core\event\base;
use core_competency\user_evidence;
defined('MOODLE_INTERNAL') || die();
/**
* Evidence of prior learning updated event class.
*
* @property-read array $other {
* Extra information about event.
* }
*
* @package tool_lp
* @since Moodle 3.1
* @copyright 2016 Serge Gauthier <serge.gauthier.2@umontreal.ca>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class user_evidence_updated extends base {
/**
* Convenience method to instantiate the event.
*
* @param user_evidence $userevidence The evidence of prior learning.
* @return self
*/
public static final function create_from_user_evidence(user_evidence $userevidence) {
if (!$userevidence->get_id()) {
throw new \coding_exception('The evidence of prior learning ID must be set.');
}
$event = static::create(array(
'contextid' => $userevidence->get_context()->id,
'objectid' => $userevidence->get_id(),
'relateduserid' => $userevidence->get_userid()
));
$event->add_record_snapshot(user_evidence::TABLE, $userevidence->to_record());
return $event;
}
/**
* Returns localised general event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventuserevidenceupdated', 'tool_lp');
}
/**
* Returns non-localised description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' updated the evidence of prior learning with id '$this->objectid'.";
}
/**
* Returns relevant URL.
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/lp/user_evidence.php',
array('id' => $this->objectid));
}
/**
* Initialise the event data.
*/
protected function init() {
$this->data['objecttable'] = user_evidence::TABLE;
$this->data['crud'] = 'u';
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**
* Get_objectid_mapping method.
*
* @return string the name of the restore mapping the objectid links to
*/
public static function get_objectid_mapping() {
return base::NOT_MAPPED;
}
}

File diff suppressed because it is too large Load diff