mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
Merge branch 'w06_MDL-40921_m27_workshopevents' of https://github.com/skodak/moodle
This commit is contained in:
commit
5c219bbc84
27 changed files with 1465 additions and 68 deletions
|
@ -53,7 +53,6 @@ if ($settingsdata = $settingsform->get_data()) {
|
||||||
$workshop->aggregate_submission_grades(); // updates 'grade' in {workshop_submissions}
|
$workshop->aggregate_submission_grades(); // updates 'grade' in {workshop_submissions}
|
||||||
$evaluator->update_grading_grades($settingsdata); // updates 'gradinggrade' in {workshop_assessments}
|
$evaluator->update_grading_grades($settingsdata); // updates 'gradinggrade' in {workshop_assessments}
|
||||||
$workshop->aggregate_grading_grades(); // updates 'gradinggrade' in {workshop_aggregations}
|
$workshop->aggregate_grading_grades(); // updates 'gradinggrade' in {workshop_aggregations}
|
||||||
$workshop->log('update aggregate grades');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
redirect(new moodle_url($workshop->view_url(), compact('page', 'sortby', 'sorthow')));
|
redirect(new moodle_url($workshop->view_url(), compact('page', 'sortby', 'sorthow')));
|
||||||
|
|
|
@ -161,11 +161,6 @@ if (is_null($assessment->grade) and !$assessmenteditable) {
|
||||||
if ($mform->is_cancelled()) {
|
if ($mform->is_cancelled()) {
|
||||||
redirect($workshop->view_url());
|
redirect($workshop->view_url());
|
||||||
} elseif ($assessmenteditable and ($data = $mform->get_data())) {
|
} elseif ($assessmenteditable and ($data = $mform->get_data())) {
|
||||||
if (is_null($assessment->grade)) {
|
|
||||||
$workshop->log('add assessment', $workshop->assess_url($assessment->id), $assessment->submissionid);
|
|
||||||
} else {
|
|
||||||
$workshop->log('update assessment', $workshop->assess_url($assessment->id), $assessment->submissionid);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Let the grading strategy subplugin save its data.
|
// Let the grading strategy subplugin save its data.
|
||||||
$rawgrade = $strategy->save_assessment($assessment, $data);
|
$rawgrade = $strategy->save_assessment($assessment, $data);
|
||||||
|
@ -194,6 +189,24 @@ if (is_null($assessment->grade) and !$assessmenteditable) {
|
||||||
// Update the assessment data if there is something other than just the 'id'.
|
// Update the assessment data if there is something other than just the 'id'.
|
||||||
if (count((array)$coredata) > 1 ) {
|
if (count((array)$coredata) > 1 ) {
|
||||||
$DB->update_record('workshop_assessments', $coredata);
|
$DB->update_record('workshop_assessments', $coredata);
|
||||||
|
$params = array(
|
||||||
|
'objectid' => $assessment->id,
|
||||||
|
'context' => $workshop->context,
|
||||||
|
'other' => array(
|
||||||
|
'workshopid' => $workshop->id,
|
||||||
|
'submissionid' => $assessment->submissionid
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (is_null($assessment->grade)) {
|
||||||
|
// All workshop_assessments are created when allocations are made. The create event is of more use located here.
|
||||||
|
$event = \mod_workshop\event\submission_assessed::create($params);
|
||||||
|
$event->trigger();
|
||||||
|
} else {
|
||||||
|
$params['other']['grade'] = $assessment->grade;
|
||||||
|
$event = \mod_workshop\event\submission_reassessed::create($params);
|
||||||
|
$event->trigger();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// And finally redirect the user's browser.
|
// And finally redirect the user's browser.
|
||||||
|
|
|
@ -101,7 +101,7 @@ class assessable_uploaded extends \core\event\assessable_uploaded {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function get_name() {
|
public static function get_name() {
|
||||||
return get_string('event_assessable_uploaded', 'mod_workshop');
|
return get_string('eventassessableuploaded', 'mod_workshop');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
83
mod/workshop/classes/event/assessment_evaluated.php
Normal file
83
mod/workshop/classes/event/assessment_evaluated.php
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
<?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/>.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mod_workshop assessment evaluated event.
|
||||||
|
*
|
||||||
|
* @package mod_workshop
|
||||||
|
* @category event
|
||||||
|
* @copyright 2013 Adrian Greeve
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace mod_workshop\event;
|
||||||
|
defined('MOODLE_INTERNAL') || die();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mod_workshop assessment evaluated event class.
|
||||||
|
*
|
||||||
|
* @property-read array $other {
|
||||||
|
* Extra information about the event.
|
||||||
|
*
|
||||||
|
* @type string currentgrade current saved grade.
|
||||||
|
* @type string finalgrade final grade.
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* @package mod_workshop
|
||||||
|
* @category event
|
||||||
|
* @copyright 2013 Adrian Greeve
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
class assessment_evaluated extends \core\event\base {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init method.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function init() {
|
||||||
|
$this->data['crud'] = 'c';
|
||||||
|
$this->data['edulevel'] = self::LEVEL_TEACHING;
|
||||||
|
$this->data['objecttable'] = 'workshop_aggregations';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns description of what happened.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function get_description() {
|
||||||
|
return 'An assessment has been evaluated ' . $this->objectid . '.';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return localised event name.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function get_name() {
|
||||||
|
return get_string('eventassessmentevaluated', 'mod_workshop');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get URL related to the action.
|
||||||
|
*
|
||||||
|
* @return \moodle_url
|
||||||
|
*/
|
||||||
|
public function get_url() {
|
||||||
|
return new \moodle_url('/mod/workshop/view.php', array('id' => $this->contextinstanceid));
|
||||||
|
}
|
||||||
|
}
|
86
mod/workshop/classes/event/assessment_evaluations_reset.php
Normal file
86
mod/workshop/classes/event/assessment_evaluations_reset.php
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
<?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/>.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mod_workshop assessment_evaluations reset event.
|
||||||
|
*
|
||||||
|
* @package mod_workshop
|
||||||
|
* @category event
|
||||||
|
* @copyright 2013 Adrian Greeve
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace mod_workshop\event;
|
||||||
|
defined('MOODLE_INTERNAL') || die();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mod_workshop assessment_evaluations reset event class.
|
||||||
|
*
|
||||||
|
* @package mod_workshop
|
||||||
|
* @category event
|
||||||
|
* @copyright 2013 Adrian Greeve
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
class assessment_evaluations_reset extends \core\event\base {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init method.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function init() {
|
||||||
|
$this->data['crud'] = 'u';
|
||||||
|
$this->data['edulevel'] = self::LEVEL_TEACHING;
|
||||||
|
$this->data['objecttable'] = 'workshop_aggregations';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns description of what happened.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function get_description() {
|
||||||
|
return 'The assessment evaluations have been reset ' . $this->objectid . '.';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the legacy event log data.
|
||||||
|
*
|
||||||
|
* @return array|null
|
||||||
|
*/
|
||||||
|
protected function get_legacy_logdata() {
|
||||||
|
return array($this->courseid, 'workshop', 'update clear aggregated grade', 'view.php?id=' . $this->contextinstanceid,
|
||||||
|
$this->objectid, $this->contextinstanceid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return localised event name.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function get_name() {
|
||||||
|
return get_string('eventassessmentevaluationsreset', 'mod_workshop');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get URL related to the action.
|
||||||
|
*
|
||||||
|
* @return \moodle_url
|
||||||
|
*/
|
||||||
|
public function get_url() {
|
||||||
|
return new \moodle_url('/mod/workshop/view.php', array('id' => $this->contextinstanceid));
|
||||||
|
}
|
||||||
|
}
|
93
mod/workshop/classes/event/assessment_reevaluated.php
Normal file
93
mod/workshop/classes/event/assessment_reevaluated.php
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
<?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/>.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mod_workshop assessment_reevaluated event.
|
||||||
|
*
|
||||||
|
* @package mod_workshop
|
||||||
|
* @category event
|
||||||
|
* @copyright 2013 Adrian Greeve
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace mod_workshop\event;
|
||||||
|
defined('MOODLE_INTERNAL') || die();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mod_workshop assessment_reevaluated event class.
|
||||||
|
*
|
||||||
|
* @property-read array $other {
|
||||||
|
* Extra information about the event.
|
||||||
|
*
|
||||||
|
* @type float currentgrade current saved grade.
|
||||||
|
* @type float finalgrade final grade.
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* @package mod_workshop
|
||||||
|
* @category event
|
||||||
|
* @copyright 2013 Adrian Greeve
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
class assessment_reevaluated extends \core\event\base {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init method.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function init() {
|
||||||
|
$this->data['crud'] = 'u';
|
||||||
|
$this->data['edulevel'] = self::LEVEL_TEACHING;
|
||||||
|
$this->data['objecttable'] = 'workshop_aggregations';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns description of what happened.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function get_description() {
|
||||||
|
return 'The assessment has been re-evaluated ' . $this->objectid . '.';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the legacy event log data.
|
||||||
|
*
|
||||||
|
* @return array|null
|
||||||
|
*/
|
||||||
|
protected function get_legacy_logdata() {
|
||||||
|
return array($this->courseid, 'workshop', 'update aggregate grade', 'view.php?id=' . $this->contextinstanceid,
|
||||||
|
$this->objectid, $this->contextinstanceid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return localised event name.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function get_name() {
|
||||||
|
return get_string('eventassessmentreevaluated', 'mod_workshop');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get URL related to the action.
|
||||||
|
*
|
||||||
|
* @return \moodle_url
|
||||||
|
*/
|
||||||
|
public function get_url() {
|
||||||
|
return new \moodle_url('/mod/workshop/view.php', array('id' => $this->contextinstanceid));
|
||||||
|
}
|
||||||
|
}
|
86
mod/workshop/classes/event/assessments_reset.php
Normal file
86
mod/workshop/classes/event/assessments_reset.php
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
<?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/>.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mod_workshop submission assessments reset event.
|
||||||
|
*
|
||||||
|
* @package mod_workshop
|
||||||
|
* @category event
|
||||||
|
* @copyright 2013 Adrian Greeve
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace mod_workshop\event;
|
||||||
|
defined('MOODLE_INTERNAL') || die();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mod_workshop submission assessments reset event class.
|
||||||
|
*
|
||||||
|
* @package mod_workshop
|
||||||
|
* @category event
|
||||||
|
* @copyright 2013 Adrian Greeve
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
class submission_assessments_reset extends \core\event\base {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init method.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function init() {
|
||||||
|
$this->data['crud'] = 'u';
|
||||||
|
$this->data['edulevel'] = self::LEVEL_TEACHING;
|
||||||
|
$this->data['objecttable'] = 'workshop_assessments';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns description of what happened.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function get_description() {
|
||||||
|
return 'The submission assessments of the workshop ' . $this->objectid . ' have been cleared.';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the legacy event log data.
|
||||||
|
*
|
||||||
|
* @return array|null
|
||||||
|
*/
|
||||||
|
protected function get_legacy_logdata() {
|
||||||
|
return array($this->courseid, 'workshop', 'update clear assessments', 'view.php?id=' . $this->contextinstanceid,
|
||||||
|
$this->objectid, $this->contextinstanceid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return localised event name.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function get_name() {
|
||||||
|
return get_string('eventsubmissionassessmentsreset', 'mod_workshop');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get URL related to the action.
|
||||||
|
*
|
||||||
|
* @return \moodle_url
|
||||||
|
*/
|
||||||
|
public function get_url() {
|
||||||
|
return new \moodle_url('/mod/workshop/view.php', array('id' => $this->contextinstanceid));
|
||||||
|
}
|
||||||
|
}
|
|
@ -23,8 +23,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace mod_workshop\event;
|
namespace mod_workshop\event;
|
||||||
|
|
||||||
defined('MOODLE_INTERNAL') || die();
|
defined('MOODLE_INTERNAL') || die();
|
||||||
|
|
||||||
|
global $CFG;
|
||||||
|
require_once("$CFG->dirroot/mod/workshop/locallib.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event for when a workshop activity is viewed.
|
* Event for when a workshop activity is viewed.
|
||||||
*
|
*
|
||||||
|
|
75
mod/workshop/classes/event/instances_list_viewed.php
Normal file
75
mod/workshop/classes/event/instances_list_viewed.php
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
<?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/>.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mod_workshop instances list viewed event.
|
||||||
|
*
|
||||||
|
* @package mod_workshop
|
||||||
|
* @category event
|
||||||
|
* @copyright 2013 Adrian Greeve
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace mod_workshop\event;
|
||||||
|
defined('MOODLE_INTERNAL') || die();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mod_workshop instances list viewed event class.
|
||||||
|
*
|
||||||
|
* @package mod_workshop
|
||||||
|
* @category event
|
||||||
|
* @copyright 2013 Adrian Greeve
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
class instances_list_viewed extends \core\event\course_module_instance_list_viewed {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns description of what happened.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function get_description() {
|
||||||
|
return 'User ' . $this->userid . ' viewed the list of workshop activities in the course ' . $this->courseid . '.';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the legacy event log data.
|
||||||
|
*
|
||||||
|
* @return array|null
|
||||||
|
*/
|
||||||
|
protected function get_legacy_logdata() {
|
||||||
|
return array($this->courseid, 'workshop', 'view all', 'index.php?id=' . $this->courseid, '');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return localised event name.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function get_name() {
|
||||||
|
return get_string('eventinstanceslistviewed', 'mod_workshop');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get URL related to the action
|
||||||
|
*
|
||||||
|
* @return \moodle_url
|
||||||
|
*/
|
||||||
|
public function get_url() {
|
||||||
|
return new \moodle_url('/mod/workshop/index.php', array('id' => $this->courseid));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
92
mod/workshop/classes/event/phase_switched.php
Normal file
92
mod/workshop/classes/event/phase_switched.php
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
<?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/>.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mod_workshop phase switched event.
|
||||||
|
*
|
||||||
|
* @package mod_workshop
|
||||||
|
* @category event
|
||||||
|
* @copyright 2013 Adrian Greeve
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace mod_workshop\event;
|
||||||
|
defined('MOODLE_INTERNAL') || die();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mod_workshop phase switched event class.
|
||||||
|
*
|
||||||
|
* @property-read array $other {
|
||||||
|
* Extra information about the event.
|
||||||
|
*
|
||||||
|
* @type int workshopphase Workshop phase.
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* @package mod_workshop
|
||||||
|
* @category event
|
||||||
|
* @copyright 2013 Adrian Greeve
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
class phase_switched extends \core\event\base {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init method.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function init() {
|
||||||
|
$this->data['crud'] = 'u';
|
||||||
|
$this->data['edulevel'] = self::LEVEL_TEACHING;
|
||||||
|
$this->data['objecttable'] = 'workshop';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns description of what happened.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function get_description() {
|
||||||
|
return 'The phase of the workshop ' . $this->objectid . ' has been switched to ' . $this->other['workshopphase']. '.';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the legacy event log data.
|
||||||
|
*
|
||||||
|
* @return array|null
|
||||||
|
*/
|
||||||
|
protected function get_legacy_logdata() {
|
||||||
|
return array($this->courseid, 'workshop', 'update switch phase', 'view.php?id=' . $this->contextinstanceid,
|
||||||
|
$this->other['workshopphase'], $this->contextinstanceid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return localised event name.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function get_name() {
|
||||||
|
return get_string('eventphaseswitched', 'mod_workshop');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get URL related to the action.
|
||||||
|
*
|
||||||
|
* @return \moodle_url
|
||||||
|
*/
|
||||||
|
public function get_url() {
|
||||||
|
return new \moodle_url('/mod/workshop/view.php', array('id' => $this->contextinstanceid));
|
||||||
|
}
|
||||||
|
}
|
93
mod/workshop/classes/event/submission_assessed.php
Normal file
93
mod/workshop/classes/event/submission_assessed.php
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
<?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/>.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mod_workshop submission_assessed event.
|
||||||
|
*
|
||||||
|
* @package mod_workshop
|
||||||
|
* @category event
|
||||||
|
* @copyright 2013 Adrian Greeve
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace mod_workshop\event;
|
||||||
|
defined('MOODLE_INTERNAL') || die();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mod_workshop submission_assessed event class.
|
||||||
|
*
|
||||||
|
* @property-read array $other {
|
||||||
|
* Extra information about the event.
|
||||||
|
*
|
||||||
|
* @type int workshopid Workshop ID.
|
||||||
|
* @type int submissionid Submission ID.
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* @package mod_workshop
|
||||||
|
* @category event
|
||||||
|
* @copyright 2013 Adrian Greeve
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
class submission_assessed extends \core\event\base {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init method.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function init() {
|
||||||
|
$this->data['crud'] = 'c';
|
||||||
|
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
|
||||||
|
$this->data['objecttable'] = 'workshop_assessments';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns description of what happened.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function get_description() {
|
||||||
|
return 'A submission has been assessed in the workshop ' . $this->other['workshopid'] . '.';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the legacy event log data.
|
||||||
|
*
|
||||||
|
* @return array|null
|
||||||
|
*/
|
||||||
|
protected function get_legacy_logdata() {
|
||||||
|
return array($this->courseid, 'workshop', 'add assessment ', 'assessment.php?asid=' . $this->objectid,
|
||||||
|
$this->other['submissionid'], $this->contextinstanceid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return localised event name.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function get_name() {
|
||||||
|
return get_string('eventsubmissionassessed', 'mod_workshop');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get URL related to the action.
|
||||||
|
*
|
||||||
|
* @return \moodle_url
|
||||||
|
*/
|
||||||
|
public function get_url() {
|
||||||
|
return new \moodle_url('/mod/workshop/assessment.php', array('asid' => $this->objectid));
|
||||||
|
}
|
||||||
|
}
|
91
mod/workshop/classes/event/submission_created.php
Normal file
91
mod/workshop/classes/event/submission_created.php
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
<?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/>.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file contains an event for when a workshop submission is created.
|
||||||
|
*
|
||||||
|
* @package mod_workshop
|
||||||
|
* @category event
|
||||||
|
* @copyright 2013 Adrian Greeve <adrian@moodle.com>
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace mod_workshop\event;
|
||||||
|
defined('MOODLE_INTERNAL') || die();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event for when a workshop submission is created.
|
||||||
|
*
|
||||||
|
* @property-read array $other {
|
||||||
|
* Extra information about the event.
|
||||||
|
*
|
||||||
|
* @type string submissiontitle Submission title.
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* @package mod_workshop
|
||||||
|
* @category event
|
||||||
|
* @copyright 2013 Adrian Greeve
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
class submission_created extends \core\event\base {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init method.
|
||||||
|
*/
|
||||||
|
protected function init() {
|
||||||
|
$this->data['crud'] = 'c';
|
||||||
|
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
|
||||||
|
$this->data['objecttable'] = 'workshop_submissions';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns non-localised description of what happened.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function get_description() {
|
||||||
|
return 'A user with an id of ' . $this->userid . ' created a workshop submission with an id of ' . $this->objectid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns localised general event name.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function get_name() {
|
||||||
|
return get_string('eventsubmissioncreated', 'workshop');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns relevant URL.
|
||||||
|
* @return \moodle_url
|
||||||
|
*/
|
||||||
|
public function get_url() {
|
||||||
|
return new \moodle_url('/mod/workshop/submission.php',
|
||||||
|
array('cmid' => $this->contextinstanceid, 'id' => $this->objectid));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* replace add_to_log() statement.
|
||||||
|
*
|
||||||
|
* @return array of parameters to be passed to legacy add_to_log() function.
|
||||||
|
*/
|
||||||
|
protected function get_legacy_logdata() {
|
||||||
|
return array($this->courseid, 'workshop', 'add submission',
|
||||||
|
'submission.php?cmid=' . $this->contextinstanceid . '&id=' . $this->objectid,
|
||||||
|
$this->objectid, $this->contextinstanceid);
|
||||||
|
}
|
||||||
|
}
|
94
mod/workshop/classes/event/submission_reassessed.php
Normal file
94
mod/workshop/classes/event/submission_reassessed.php
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
<?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/>.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mod_workshop submission_reassessed event.
|
||||||
|
*
|
||||||
|
* @package mod_workshop
|
||||||
|
* @category event
|
||||||
|
* @copyright 2013 Adrian Greeve
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace mod_workshop\event;
|
||||||
|
defined('MOODLE_INTERNAL') || die();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mod_workshop submission_reassessed event class.
|
||||||
|
*
|
||||||
|
* @property-read array $other {
|
||||||
|
* Extra information about the event.
|
||||||
|
*
|
||||||
|
* @type int workshopid Workshop ID.
|
||||||
|
* @type int submissionid Submission ID.
|
||||||
|
* @type float grade Assessment grade.
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* @package mod_workshop
|
||||||
|
* @category event
|
||||||
|
* @copyright 2013 Adrian Greeve
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
class submission_reassessed extends \core\event\base {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init method.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function init() {
|
||||||
|
$this->data['crud'] = 'u';
|
||||||
|
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
|
||||||
|
$this->data['objecttable'] = 'workshop_assessment';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns description of what happened.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function get_description() {
|
||||||
|
return 'A submission was re-assessed in the workshop ' . $this->other['workshopid'] . '.';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the legacy event log data.
|
||||||
|
*
|
||||||
|
* @return array|null
|
||||||
|
*/
|
||||||
|
protected function get_legacy_logdata() {
|
||||||
|
return array($this->courseid, 'workshop', 'update assessment', 'assessment.php?asid=' . $this->objectid,
|
||||||
|
$this->other['submissionid'], $this->contextinstanceid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return localised event name.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function get_name() {
|
||||||
|
return get_string('eventsubmissionreassessed', 'mod_workshop');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get URL related to the action.
|
||||||
|
*
|
||||||
|
* @return \moodle_url
|
||||||
|
*/
|
||||||
|
public function get_url() {
|
||||||
|
return new \moodle_url('/mod/workshop/assessment.php?', array('asid' => $this->objectid));
|
||||||
|
}
|
||||||
|
}
|
91
mod/workshop/classes/event/submission_updated.php
Normal file
91
mod/workshop/classes/event/submission_updated.php
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
<?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/>.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file contains an event for when a workshop submission is updated.
|
||||||
|
*
|
||||||
|
* @package mod_workshop
|
||||||
|
* @category event
|
||||||
|
* @copyright 2013 Adrian Greeve <adrian@moodle.com>
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace mod_workshop\event;
|
||||||
|
defined('MOODLE_INTERNAL') || die();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event for when a workshop submission is updated.
|
||||||
|
*
|
||||||
|
* @property-read array $other {
|
||||||
|
* Extra information about the event.
|
||||||
|
*
|
||||||
|
* @type string submissiontitle Submission title.
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* @package mod_workshop
|
||||||
|
* @category event
|
||||||
|
* @copyright 2013 Adrian Greeve
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
class submission_updated extends \core\event\base {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init method.
|
||||||
|
*/
|
||||||
|
protected function init() {
|
||||||
|
$this->data['crud'] = 'u';
|
||||||
|
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
|
||||||
|
$this->data['objecttable'] = 'workshop_submissions';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns non-localised description of what happened.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function get_description() {
|
||||||
|
return 'A user with an id of ' . $this->userid . ' updated a workshop submission with an id of ' . $this->objectid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns localised general event name.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function get_name() {
|
||||||
|
return get_string('eventsubmissionupdated', 'workshop');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns relevant URL.
|
||||||
|
* @return \moodle_url
|
||||||
|
*/
|
||||||
|
public function get_url() {
|
||||||
|
return new \moodle_url('/mod/workshop/submission.php',
|
||||||
|
array('cmid' => $this->contextinstanceid, 'id' => $this->objectid));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* replace add_to_log() statement.
|
||||||
|
*
|
||||||
|
* @return array of parameters to be passed to legacy add_to_log() function.
|
||||||
|
*/
|
||||||
|
protected function get_legacy_logdata() {
|
||||||
|
return array($this->courseid, 'workshop', 'update submission',
|
||||||
|
'submission.php?cmid=' . $this->contextinstanceid . '&id=' . $this->objectid,
|
||||||
|
$this->objectid, $this->contextinstanceid);
|
||||||
|
}
|
||||||
|
}
|
91
mod/workshop/classes/event/submission_viewed.php
Normal file
91
mod/workshop/classes/event/submission_viewed.php
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
<?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/>.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file contains an event for when a workshop submission is viewed.
|
||||||
|
*
|
||||||
|
* @package mod_workshop
|
||||||
|
* @category event
|
||||||
|
* @copyright 2013 Adrian Greeve <adrian@moodle.com>
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace mod_workshop\event;
|
||||||
|
defined('MOODLE_INTERNAL') || die();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event for when a workshop submission is viewed.
|
||||||
|
*
|
||||||
|
* @property-read array $other {
|
||||||
|
* Extra information about the event.
|
||||||
|
*
|
||||||
|
* @type int workshopid workshop ID.
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* @package mod_workshop
|
||||||
|
* @category event
|
||||||
|
* @copyright 2013 Adrian Greeve
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
class submission_viewed extends \core\event\base {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init method.
|
||||||
|
*/
|
||||||
|
protected function init() {
|
||||||
|
$this->data['crud'] = 'r';
|
||||||
|
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
|
||||||
|
$this->data['objecttable'] = 'workshop_submissions';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns non-localised description of what happened.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function get_description() {
|
||||||
|
return 'A user with an id of ' . $this->userid . ' viewed a workshop submission with an id of ' . $this->objectid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns localised general event name.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function get_name() {
|
||||||
|
return get_string('eventsubmissionviewed', 'workshop');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns relevant URL.
|
||||||
|
* @return \moodle_url
|
||||||
|
*/
|
||||||
|
public function get_url() {
|
||||||
|
return new \moodle_url('/mod/workshop/submission.php',
|
||||||
|
array('cmid' => $this->contextinstanceid, 'id' => $this->objectid));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* replace add_to_log() statement.
|
||||||
|
*
|
||||||
|
* @return array of parameters to be passed to legacy add_to_log() function.
|
||||||
|
*/
|
||||||
|
protected function get_legacy_logdata() {
|
||||||
|
return array($this->courseid, 'workshop', 'view submission',
|
||||||
|
'submission.php?cmid=' . $this->contextinstanceid . '&id=' . $this->objectid,
|
||||||
|
$this->objectid, $this->contextinstanceid);
|
||||||
|
}
|
||||||
|
}
|
|
@ -87,19 +87,6 @@ $mform->set_data($currentdata);
|
||||||
if ($mform->is_cancelled()) {
|
if ($mform->is_cancelled()) {
|
||||||
redirect($workshop->view_url());
|
redirect($workshop->view_url());
|
||||||
} elseif ($assessmenteditable and ($data = $mform->get_data())) {
|
} elseif ($assessmenteditable and ($data = $mform->get_data())) {
|
||||||
if ($canmanage) {
|
|
||||||
if (is_null($assessment->grade)) {
|
|
||||||
$workshop->log('add reference assessment', $workshop->exassess_url($assessment->id), $assessment->submissionid);
|
|
||||||
} else {
|
|
||||||
$workshop->log('update reference assessment', $workshop->exassess_url($assessment->id), $assessment->submissionid);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (is_null($assessment->grade)) {
|
|
||||||
$workshop->log('add example assessment', $workshop->exassess_url($assessment->id), $assessment->submissionid);
|
|
||||||
} else {
|
|
||||||
$workshop->log('update example assessment', $workshop->exassess_url($assessment->id), $assessment->submissionid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Let the grading strategy subplugin save its data.
|
// Let the grading strategy subplugin save its data.
|
||||||
$rawgrade = $strategy->save_assessment($assessment, $data);
|
$rawgrade = $strategy->save_assessment($assessment, $data);
|
||||||
|
|
|
@ -57,8 +57,6 @@ $output = $PAGE->get_renderer('mod_workshop');
|
||||||
|
|
||||||
if ($id) { // example is specified
|
if ($id) { // example is specified
|
||||||
$example = $workshop->get_example_by_id($id);
|
$example = $workshop->get_example_by_id($id);
|
||||||
$workshop->log('view example', $workshop->exsubmission_url($example->id), $example->id);
|
|
||||||
|
|
||||||
} else { // no example specified - create new one
|
} else { // no example specified - create new one
|
||||||
require_capability('mod/workshop:manageexamples', $workshop->context);
|
require_capability('mod/workshop:manageexamples', $workshop->context);
|
||||||
$example = new stdclass();
|
$example = new stdclass();
|
||||||
|
@ -162,9 +160,7 @@ if ($edit and $canmanage) {
|
||||||
$formdata->contenttrust = 0; // updated later
|
$formdata->contenttrust = 0; // updated later
|
||||||
if (is_null($example->id)) {
|
if (is_null($example->id)) {
|
||||||
$example->id = $formdata->id = $DB->insert_record('workshop_submissions', $formdata);
|
$example->id = $formdata->id = $DB->insert_record('workshop_submissions', $formdata);
|
||||||
$workshop->log('add example', $workshop->exsubmission_url($example->id), $example->id);
|
|
||||||
} else {
|
} else {
|
||||||
$workshop->log('update example', $workshop->exsubmission_url($example->id), $example->id);
|
|
||||||
if (empty($formdata->id) or empty($example->id) or ($formdata->id != $example->id)) {
|
if (empty($formdata->id) or empty($example->id) or ($formdata->id != $example->id)) {
|
||||||
throw new moodle_exception('err_examplesubmissionid', 'workshop');
|
throw new moodle_exception('err_examplesubmissionid', 'workshop');
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,8 +33,6 @@ $course = $DB->get_record('course', array('id' => $id), '*', MUST_EXIST);
|
||||||
|
|
||||||
require_course_login($course);
|
require_course_login($course);
|
||||||
|
|
||||||
add_to_log($course->id, 'workshop', 'view all', "index.php?id=$course->id", '');
|
|
||||||
|
|
||||||
$PAGE->set_pagelayout('incourse');
|
$PAGE->set_pagelayout('incourse');
|
||||||
$PAGE->set_url('/mod/workshop/index.php', array('id' => $course->id));
|
$PAGE->set_url('/mod/workshop/index.php', array('id' => $course->id));
|
||||||
$PAGE->set_title($course->fullname);
|
$PAGE->set_title($course->fullname);
|
||||||
|
@ -45,6 +43,10 @@ $PAGE->navbar->add(get_string('modulenameplural', 'workshop'));
|
||||||
|
|
||||||
echo $OUTPUT->header();
|
echo $OUTPUT->header();
|
||||||
|
|
||||||
|
$params = array('context' => context_course::instance($course->id));
|
||||||
|
$event = \mod_workshop\event\instances_list_viewed::create($params);
|
||||||
|
$event->trigger();
|
||||||
|
|
||||||
/// Get all the appropriate data
|
/// Get all the appropriate data
|
||||||
|
|
||||||
if (! $workshops = get_all_instances_in_course('workshop', $course)) {
|
if (! $workshops = get_all_instances_in_course('workshop', $course)) {
|
||||||
|
|
|
@ -106,6 +106,18 @@ $string['evaluation'] = 'Grading evaluation';
|
||||||
$string['evaluationmethod'] = 'Grading evaluation method';
|
$string['evaluationmethod'] = 'Grading evaluation method';
|
||||||
$string['evaluationmethod_help'] = 'The grading evaluation method determines how the grade for assessment is calculated. You can let it re-calculate grades repeatedly with different settings unless you are happy with the result.';
|
$string['evaluationmethod_help'] = 'The grading evaluation method determines how the grade for assessment is calculated. You can let it re-calculate grades repeatedly with different settings unless you are happy with the result.';
|
||||||
$string['evaluationsettings'] = 'Grading evaluation settings';
|
$string['evaluationsettings'] = 'Grading evaluation settings';
|
||||||
|
$string['eventassessmentevaluationsreset'] = 'Assessment evaluations reset';
|
||||||
|
$string['eventassessableuploaded'] = 'Assessable uploaded';
|
||||||
|
$string['eventassessmentevaluated'] = 'Assessment evaluated';
|
||||||
|
$string['eventassessmentreevaluated'] = 'Assessment re-evaluated';
|
||||||
|
$string['eventinstanceslistviewed'] = 'Workshop instance list viewed';
|
||||||
|
$string['eventsubmissionassessed'] = 'Submission assessed';
|
||||||
|
$string['eventsubmissionassessmentsreset'] = 'Submission assessments cleared';
|
||||||
|
$string['eventsubmissioncreated'] = 'Submission created';
|
||||||
|
$string['eventsubmissionreassessed'] = 'Submission re-assessed';
|
||||||
|
$string['eventsubmissionupdated'] = 'Submission updated';
|
||||||
|
$string['eventsubmissionviewed'] = 'Submission viewed';
|
||||||
|
$string['eventphaseswitched'] = 'Phase switched';
|
||||||
$string['event_assessable_uploaded'] = 'A submission has been uploaded.';
|
$string['event_assessable_uploaded'] = 'A submission has been uploaded.';
|
||||||
$string['example'] = 'Example submission';
|
$string['example'] = 'Example submission';
|
||||||
$string['exampleadd'] = 'Add example submission';
|
$string['exampleadd'] = 'Add example submission';
|
||||||
|
@ -235,8 +247,8 @@ $string['strategy_help'] = 'The grading strategy determines the assessment form
|
||||||
* Rubric - A level assessment is given regarding specified criteria';
|
* Rubric - A level assessment is given regarding specified criteria';
|
||||||
$string['strategyhaschanged'] = 'The workshop grading strategy has changed since the form was opened for editing.';
|
$string['strategyhaschanged'] = 'The workshop grading strategy has changed since the form was opened for editing.';
|
||||||
$string['submission'] = 'Submission';
|
$string['submission'] = 'Submission';
|
||||||
$string['submissionby'] = 'Submission by {$a}';
|
|
||||||
$string['submissionattachment'] = 'Attachment';
|
$string['submissionattachment'] = 'Attachment';
|
||||||
|
$string['submissionby'] = 'Submission by {$a}';
|
||||||
$string['submissioncontent'] = 'Submission content';
|
$string['submissioncontent'] = 'Submission content';
|
||||||
$string['submissionend'] = 'Submissions deadline';
|
$string['submissionend'] = 'Submissions deadline';
|
||||||
$string['submissionendbeforestart'] = 'Submissions deadline can not be specified before the open for submissions date';
|
$string['submissionendbeforestart'] = 'Submissions deadline can not be specified before the open for submissions date';
|
||||||
|
|
|
@ -938,7 +938,18 @@ function workshop_cron() {
|
||||||
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
|
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
|
||||||
$workshop = new workshop($workshop, $cm, $course);
|
$workshop = new workshop($workshop, $cm, $course);
|
||||||
$workshop->switch_phase(workshop::PHASE_ASSESSMENT);
|
$workshop->switch_phase(workshop::PHASE_ASSESSMENT);
|
||||||
$workshop->log('update switch phase', $workshop->view_url(), $workshop->phase);
|
|
||||||
|
$params = array(
|
||||||
|
'objectid' => $workshop->id,
|
||||||
|
'context' => $workshop->context,
|
||||||
|
'courseid' => $workshop->course->id,
|
||||||
|
'other' => array(
|
||||||
|
'workshopphase' => $workshop->phase
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$event = \mod_workshop\event\phase_switched::create($params);
|
||||||
|
$event->trigger();
|
||||||
|
|
||||||
// disable the automatic switching now so that it is not executed again by accident
|
// disable the automatic switching now so that it is not executed again by accident
|
||||||
// if the teacher changes the phase back to the submission one
|
// if the teacher changes the phase back to the submission one
|
||||||
$DB->set_field('workshop', 'phaseswitchassessment', 0, array('id' => $workshop->id));
|
$DB->set_field('workshop', 'phaseswitchassessment', 0, array('id' => $workshop->id));
|
||||||
|
|
|
@ -2451,8 +2451,22 @@ class workshop {
|
||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
$finalgrade = grade_floatval($sumgrades / $count);
|
$finalgrade = grade_floatval($sumgrades / $count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Event information.
|
||||||
|
$params = array(
|
||||||
|
'context' => $this->context,
|
||||||
|
'courseid' => $this->course->id,
|
||||||
|
'relateduserid' => $reviewerid
|
||||||
|
);
|
||||||
|
|
||||||
// check if the new final grade differs from the one stored in the database
|
// check if the new final grade differs from the one stored in the database
|
||||||
if (grade_floats_different($finalgrade, $current)) {
|
if (grade_floats_different($finalgrade, $current)) {
|
||||||
|
$params['other'] = array(
|
||||||
|
'currentgrade' => $current,
|
||||||
|
'finalgrade' => $finalgrade
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// we need to save new calculation into the database
|
// we need to save new calculation into the database
|
||||||
if (is_null($agid)) {
|
if (is_null($agid)) {
|
||||||
// no aggregation record yet
|
// no aggregation record yet
|
||||||
|
@ -2461,13 +2475,19 @@ class workshop {
|
||||||
$record->userid = $reviewerid;
|
$record->userid = $reviewerid;
|
||||||
$record->gradinggrade = $finalgrade;
|
$record->gradinggrade = $finalgrade;
|
||||||
$record->timegraded = $timegraded;
|
$record->timegraded = $timegraded;
|
||||||
$DB->insert_record('workshop_aggregations', $record);
|
$record->id = $DB->insert_record('workshop_aggregations', $record);
|
||||||
|
$params['objectid'] = $record->id;
|
||||||
|
$event = \mod_workshop\event\assessment_evaluated::create($params);
|
||||||
|
$event->trigger();
|
||||||
} else {
|
} else {
|
||||||
$record = new stdclass();
|
$record = new stdclass();
|
||||||
$record->id = $agid;
|
$record->id = $agid;
|
||||||
$record->gradinggrade = $finalgrade;
|
$record->gradinggrade = $finalgrade;
|
||||||
$record->timegraded = $timegraded;
|
$record->timegraded = $timegraded;
|
||||||
$DB->update_record('workshop_aggregations', $record);
|
$DB->update_record('workshop_aggregations', $record);
|
||||||
|
$params['objectid'] = $agid;
|
||||||
|
$event = \mod_workshop\event\assessment_reevaluated::create($params);
|
||||||
|
$event->trigger();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,19 @@ if ($edit) {
|
||||||
|
|
||||||
if ($id) { // submission is specified
|
if ($id) { // submission is specified
|
||||||
$submission = $workshop->get_submission_by_id($id);
|
$submission = $workshop->get_submission_by_id($id);
|
||||||
$workshop->log('view submission', $workshop->submission_url($submission->id), $submission->id);
|
|
||||||
|
$params = array(
|
||||||
|
'objectid' => $submission->id,
|
||||||
|
'context' => $workshop->context,
|
||||||
|
'courseid' => $workshop->course->id,
|
||||||
|
'relateduserid' => $submission->authorid,
|
||||||
|
'other' => array(
|
||||||
|
'workshopid' => $workshop->id
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$event = \mod_workshop\event\submission_viewed::create($params);
|
||||||
|
$event->trigger();
|
||||||
|
|
||||||
} else { // no submission specified
|
} else { // no submission specified
|
||||||
if (!$submission = $workshop->get_submission_by_author($USER->id)) {
|
if (!$submission = $workshop->get_submission_by_author($USER->id)) {
|
||||||
|
@ -188,16 +200,27 @@ if ($edit) {
|
||||||
if ($workshop->phase == workshop::PHASE_ASSESSMENT) {
|
if ($workshop->phase == workshop::PHASE_ASSESSMENT) {
|
||||||
$formdata->late = $formdata->late | 0x2;
|
$formdata->late = $formdata->late | 0x2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Event information.
|
||||||
|
$params = array(
|
||||||
|
'context' => $workshop->context,
|
||||||
|
'courseid' => $workshop->course->id,
|
||||||
|
'other' => array(
|
||||||
|
'submissiontitle' => $formdata->title
|
||||||
|
)
|
||||||
|
);
|
||||||
$logdata = null;
|
$logdata = null;
|
||||||
if (is_null($submission->id)) {
|
if (is_null($submission->id)) {
|
||||||
$submission->id = $formdata->id = $DB->insert_record('workshop_submissions', $formdata);
|
$submission->id = $formdata->id = $DB->insert_record('workshop_submissions', $formdata);
|
||||||
$logdata = $workshop->log('add submission', $workshop->submission_url($submission->id), $submission->id, true);
|
$params['objectid'] = $submission->id;
|
||||||
|
$event = \mod_workshop\event\submission_created::create($params);
|
||||||
|
$event->trigger();
|
||||||
} else {
|
} else {
|
||||||
$logdata = $workshop->log('update submission', $workshop->submission_url($submission->id), $submission->id, true);
|
|
||||||
if (empty($formdata->id) or empty($submission->id) or ($formdata->id != $submission->id)) {
|
if (empty($formdata->id) or empty($submission->id) or ($formdata->id != $submission->id)) {
|
||||||
throw new moodle_exception('err_submissionid', 'workshop');
|
throw new moodle_exception('err_submissionid', 'workshop');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$params['objectid'] = $submission->id;
|
||||||
// save and relink embedded images and save attachments
|
// save and relink embedded images and save attachments
|
||||||
$formdata = file_postupdate_standard_editor($formdata, 'content', $contentopts, $workshop->context,
|
$formdata = file_postupdate_standard_editor($formdata, 'content', $contentopts, $workshop->context,
|
||||||
'mod_workshop', 'submission_content', $submission->id);
|
'mod_workshop', 'submission_content', $submission->id);
|
||||||
|
@ -209,19 +232,17 @@ if ($edit) {
|
||||||
}
|
}
|
||||||
// store the updated values or re-save the new submission (re-saving needed because URLs are now rewritten)
|
// store the updated values or re-save the new submission (re-saving needed because URLs are now rewritten)
|
||||||
$DB->update_record('workshop_submissions', $formdata);
|
$DB->update_record('workshop_submissions', $formdata);
|
||||||
|
$event = \mod_workshop\event\submission_updated::create($params);
|
||||||
|
$event->add_record_snapshot('workshop_submissions', $formdata);
|
||||||
|
$event->trigger();
|
||||||
|
|
||||||
// send submitted content for plagiarism detection
|
// send submitted content for plagiarism detection
|
||||||
$fs = get_file_storage();
|
$fs = get_file_storage();
|
||||||
$files = $fs->get_area_files($workshop->context->id, 'mod_workshop', 'submission_attachment', $submission->id);
|
$files = $fs->get_area_files($workshop->context->id, 'mod_workshop', 'submission_attachment', $submission->id);
|
||||||
|
|
||||||
$params = array(
|
$params['other']['content'] = $formdata->content;
|
||||||
'context' => $workshop->context,
|
$params['other']['pathnamehashes'] = array_keys($files);
|
||||||
'objectid' => $submission->id,
|
|
||||||
'other' => array(
|
|
||||||
'content' => $formdata->content,
|
|
||||||
'pathnamehashes' => array_keys($files)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
$event = \mod_workshop\event\assessable_uploaded::create($params);
|
$event = \mod_workshop\event\assessable_uploaded::create($params);
|
||||||
$event->set_legacy_logdata($logdata);
|
$event->set_legacy_logdata($logdata);
|
||||||
$event->trigger();
|
$event->trigger();
|
||||||
|
|
312
mod/workshop/tests/events_test.php
Normal file
312
mod/workshop/tests/events_test.php
Normal file
|
@ -0,0 +1,312 @@
|
||||||
|
<?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/>.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit tests for workshop events.
|
||||||
|
*
|
||||||
|
* @package mod_workshop
|
||||||
|
* @category phpunit
|
||||||
|
* @copyright 2013 Adrian Greeve <adrian@moodle.com>
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('MOODLE_INTERNAL') || die();
|
||||||
|
|
||||||
|
global $CFG;
|
||||||
|
require_once($CFG->dirroot . '/mod/workshop/lib.php'); // Include the code to test.
|
||||||
|
require_once($CFG->dirroot . '/mod/workshop/locallib.php'); // Include the code to test.
|
||||||
|
require_once($CFG->dirroot . '/lib/cronlib.php'); // Include the code to test.
|
||||||
|
require_once(__DIR__ . '/fixtures/testable.php');
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test cases for the internal workshop api
|
||||||
|
*/
|
||||||
|
class mod_workshop_events_testcase extends advanced_testcase {
|
||||||
|
|
||||||
|
/** @var stdClass $workshop Basic workshop data stored in an object. */
|
||||||
|
protected $workshop;
|
||||||
|
/** @var stdClass $course Generated Random Course. */
|
||||||
|
protected $course;
|
||||||
|
/** @var stdClass mod info */
|
||||||
|
protected $cm;
|
||||||
|
/** @var context $context Course module context. */
|
||||||
|
protected $context;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set up the testing environment.
|
||||||
|
*/
|
||||||
|
protected function setUp() {
|
||||||
|
parent::setUp();
|
||||||
|
$this->setAdminUser();
|
||||||
|
|
||||||
|
// Create a workshop activity.
|
||||||
|
$this->course = $this->getDataGenerator()->create_course();
|
||||||
|
$this->workshop = $this->getDataGenerator()->create_module('workshop', array('course' => $this->course));
|
||||||
|
$this->cm = get_coursemodule_from_instance('workshop', $this->workshop->id);
|
||||||
|
$this->context = context_module::instance($this->cm->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function tearDown() {
|
||||||
|
$this->workshop = null;
|
||||||
|
$this->course = null;
|
||||||
|
$this->cm = null;
|
||||||
|
$this->context = null;
|
||||||
|
parent::tearDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This event is triggered in view.php and workshop/lib.php through the function workshop_cron().
|
||||||
|
*/
|
||||||
|
public function test_phase_switched_event() {
|
||||||
|
$this->resetAfterTest();
|
||||||
|
$this->setAdminUser();
|
||||||
|
|
||||||
|
// Add additional workshop information.
|
||||||
|
$this->workshop->phase = 20;
|
||||||
|
$this->workshop->phaseswitchassessment = 1;
|
||||||
|
$this->workshop->submissionend = time() - 1;
|
||||||
|
|
||||||
|
$event = \mod_workshop\event\phase_switched::create(array(
|
||||||
|
'objectid' => $this->workshop->id,
|
||||||
|
'context' => $this->context,
|
||||||
|
'courseid' => $this->course->id,
|
||||||
|
'other' => array('workshopphase' => $this->workshop->phase)
|
||||||
|
));
|
||||||
|
|
||||||
|
// Trigger and capture the event.
|
||||||
|
$sink = $this->redirectEvents();
|
||||||
|
$event->trigger();
|
||||||
|
$events = $sink->get_events();
|
||||||
|
$event = reset($events);
|
||||||
|
|
||||||
|
// Check that the legacy log data is valid.
|
||||||
|
$expected = array($this->course->id, 'workshop', 'update switch phase', 'view.php?id=' . $this->workshop->id,
|
||||||
|
$this->workshop->phase, $this->cm->id);
|
||||||
|
$this->assertEventLegacyLogData($expected, $event);
|
||||||
|
|
||||||
|
$sink->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_assessment_evaluated() {
|
||||||
|
$this->resetAfterTest();
|
||||||
|
$this->setAdminUser();
|
||||||
|
|
||||||
|
$cm = get_coursemodule_from_instance('workshop', $this->workshop->id, $this->course->id, false, MUST_EXIST);
|
||||||
|
|
||||||
|
$workshop = new testable_workshop($this->workshop, $cm, $this->course);
|
||||||
|
|
||||||
|
$assessments = array();
|
||||||
|
$assessments[] = (object)array('reviewerid' => 2, 'gradinggrade' => null,
|
||||||
|
'gradinggradeover' => null, 'aggregationid' => null, 'aggregatedgrade' => 12);
|
||||||
|
|
||||||
|
// Trigger and capture the event.
|
||||||
|
$sink = $this->redirectEvents();
|
||||||
|
$workshop->aggregate_grading_grades_process($assessments);
|
||||||
|
$events = $sink->get_events();
|
||||||
|
$event = reset($events);
|
||||||
|
|
||||||
|
$this->assertInstanceOf('\mod_workshop\event\assessment_evaluated', $event);
|
||||||
|
$this->assertEquals('workshop_aggregations', $event->objecttable);
|
||||||
|
$this->assertEquals(context_module::instance($cm->id), $event->get_context());
|
||||||
|
|
||||||
|
$sink->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_assessment_reevaluated() {
|
||||||
|
$this->resetAfterTest();
|
||||||
|
$this->setAdminUser();
|
||||||
|
|
||||||
|
$cm = get_coursemodule_from_instance('workshop', $this->workshop->id, $this->course->id, false, MUST_EXIST);
|
||||||
|
|
||||||
|
$workshop = new testable_workshop($this->workshop, $cm, $this->course);
|
||||||
|
|
||||||
|
$assessments = array();
|
||||||
|
$assessments[] = (object)array('reviewerid' => 2, 'gradinggrade' => null, 'gradinggradeover' => null,
|
||||||
|
'aggregationid' => 2, 'aggregatedgrade' => 12);
|
||||||
|
|
||||||
|
// Trigger and capture the event.
|
||||||
|
$sink = $this->redirectEvents();
|
||||||
|
$workshop->aggregate_grading_grades_process($assessments);
|
||||||
|
$events = $sink->get_events();
|
||||||
|
$event = reset($events);
|
||||||
|
|
||||||
|
$this->assertInstanceOf('\mod_workshop\event\assessment_reevaluated', $event);
|
||||||
|
$this->assertEquals('workshop_aggregations', $event->objecttable);
|
||||||
|
$this->assertEquals(context_module::instance($cm->id), $event->get_context());
|
||||||
|
$expected = array($this->course->id, 'workshop', 'update aggregate grade',
|
||||||
|
'view.php?id=' . $event->get_context()->instanceid, $event->objectid, $event->get_context()->instanceid);
|
||||||
|
$this->assertEventLegacyLogData($expected, $event);
|
||||||
|
|
||||||
|
$sink->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* There is no api involved so the best we can do is test legacy data by triggering event manually.
|
||||||
|
*/
|
||||||
|
public function test_aggregate_grades_reset_event() {
|
||||||
|
$this->resetAfterTest();
|
||||||
|
$this->setAdminUser();
|
||||||
|
|
||||||
|
$event = \mod_workshop\event\assessment_evaluations_reset::create(array(
|
||||||
|
'objectid' => $this->workshop->id,
|
||||||
|
'context' => $this->context,
|
||||||
|
'courseid' => $this->course->id,
|
||||||
|
));
|
||||||
|
|
||||||
|
// Trigger and capture the event.
|
||||||
|
$sink = $this->redirectEvents();
|
||||||
|
$event->trigger();
|
||||||
|
$events = $sink->get_events();
|
||||||
|
$event = reset($events);
|
||||||
|
|
||||||
|
// Check that the legacy log data is valid.
|
||||||
|
$expected = array($this->course->id, 'workshop', 'update clear aggregated grade', 'view.php?id=' . $this->workshop->id,
|
||||||
|
$this->workshop->id, $this->cm->id);
|
||||||
|
$this->assertEventLegacyLogData($expected, $event);
|
||||||
|
|
||||||
|
$sink->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* There is no api involved so the best we can do is test legacy data by triggering event manually.
|
||||||
|
*/
|
||||||
|
public function test_instances_list_viewed_event() {
|
||||||
|
$this->resetAfterTest();
|
||||||
|
$this->setAdminUser();
|
||||||
|
|
||||||
|
$context = context_course::instance($this->course->id);
|
||||||
|
|
||||||
|
$event = \mod_workshop\event\instances_list_viewed::create(array('context' => $context));
|
||||||
|
|
||||||
|
// Trigger and capture the event.
|
||||||
|
$sink = $this->redirectEvents();
|
||||||
|
$event->trigger();
|
||||||
|
$events = $sink->get_events();
|
||||||
|
$event = reset($events);
|
||||||
|
|
||||||
|
// Check that the legacy log data is valid.
|
||||||
|
$expected = array($this->course->id, 'workshop', 'view all', 'index.php?id=' . $this->course->id, '');
|
||||||
|
$this->assertEventLegacyLogData($expected, $event);
|
||||||
|
|
||||||
|
$sink->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* There is no api involved so the best we can do is test legacy data by triggering event manually.
|
||||||
|
*/
|
||||||
|
public function test_submission_created_event() {
|
||||||
|
$this->resetAfterTest();
|
||||||
|
$this->setAdminUser();
|
||||||
|
|
||||||
|
$user = $this->getDataGenerator()->create_user();
|
||||||
|
$submissionid = 48;
|
||||||
|
|
||||||
|
$event = \mod_workshop\event\submission_created::create(array(
|
||||||
|
'objectid' => $submissionid,
|
||||||
|
'context' => $this->context,
|
||||||
|
'courseid' => $this->course->id,
|
||||||
|
'relateduserid' => $user->id,
|
||||||
|
'other' => array(
|
||||||
|
'workshopid' => $this->workshop->id
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Trigger and capture the event.
|
||||||
|
$sink = $this->redirectEvents();
|
||||||
|
$event->trigger();
|
||||||
|
$events = $sink->get_events();
|
||||||
|
$event = reset($events);
|
||||||
|
|
||||||
|
// Check that the legacy log data is valid.
|
||||||
|
$expected = array($this->course->id, 'workshop', 'add submission',
|
||||||
|
'submission.php?cmid=' . $this->workshop->id . '&id=' . $submissionid, $submissionid, $this->cm->id);
|
||||||
|
$this->assertEventLegacyLogData($expected, $event);
|
||||||
|
|
||||||
|
$sink->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* There is no api involved so the best we can do is test legacy data by triggering event manually.
|
||||||
|
*/
|
||||||
|
public function test_submission_updated_event() {
|
||||||
|
$this->resetAfterTest();
|
||||||
|
$this->setAdminUser();
|
||||||
|
|
||||||
|
$user = $this->getDataGenerator()->create_user();
|
||||||
|
$submissionid = 48;
|
||||||
|
|
||||||
|
$event = \mod_workshop\event\submission_updated::create(array(
|
||||||
|
'objectid' => $submissionid,
|
||||||
|
'context' => $this->context,
|
||||||
|
'courseid' => $this->course->id,
|
||||||
|
'relateduserid' => $user->id,
|
||||||
|
'other' => array(
|
||||||
|
'workshopid' => $this->workshop->id
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Trigger and capture the event.
|
||||||
|
$sink = $this->redirectEvents();
|
||||||
|
$event->trigger();
|
||||||
|
$events = $sink->get_events();
|
||||||
|
$event = reset($events);
|
||||||
|
|
||||||
|
// Check that the legacy log data is valid.
|
||||||
|
$expected = array($this->course->id, 'workshop', 'update submission',
|
||||||
|
'submission.php?cmid=' . $this->workshop->id . '&id=' . $submissionid, $submissionid, $this->cm->id);
|
||||||
|
$this->assertEventLegacyLogData($expected, $event);
|
||||||
|
|
||||||
|
$sink->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* There is no api involved so the best we can do is test legacy data by triggering event manually.
|
||||||
|
*/
|
||||||
|
public function test_submission_viewed_event() {
|
||||||
|
$this->resetAfterTest();
|
||||||
|
$this->setAdminUser();
|
||||||
|
|
||||||
|
$user = $this->getDataGenerator()->create_user();
|
||||||
|
$submissionid = 48;
|
||||||
|
|
||||||
|
$event = \mod_workshop\event\submission_viewed::create(array(
|
||||||
|
'objectid' => $submissionid,
|
||||||
|
'context' => $this->context,
|
||||||
|
'courseid' => $this->course->id,
|
||||||
|
'relateduserid' => $user->id,
|
||||||
|
'other' => array(
|
||||||
|
'workshopid' => $this->workshop->id
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Trigger and capture the event.
|
||||||
|
$sink = $this->redirectEvents();
|
||||||
|
$event->trigger();
|
||||||
|
$events = $sink->get_events();
|
||||||
|
$event = reset($events);
|
||||||
|
|
||||||
|
// Check that the legacy log data is valid.
|
||||||
|
$expected = array($this->course->id, 'workshop', 'view submission',
|
||||||
|
'submission.php?cmid=' . $this->workshop->id . '&id=' . $submissionid, $submissionid, $this->cm->id);
|
||||||
|
$this->assertEventLegacyLogData($expected, $event);
|
||||||
|
|
||||||
|
$sink->close();
|
||||||
|
}
|
||||||
|
}
|
41
mod/workshop/tests/fixtures/testable.php
vendored
Normal file
41
mod/workshop/tests/fixtures/testable.php
vendored
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
<?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/>.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mod_workshop fixtures
|
||||||
|
*
|
||||||
|
* @package mod_workshop
|
||||||
|
* @category phpunit
|
||||||
|
* @copyright 2014 Petr Skoda
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('MOODLE_INTERNAL') || die();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test subclass that makes all the protected methods we want to test public.
|
||||||
|
*/
|
||||||
|
class testable_workshop extends workshop {
|
||||||
|
|
||||||
|
public function aggregate_submission_grades_process(array $assessments) {
|
||||||
|
parent::aggregate_submission_grades_process($assessments);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function aggregate_grading_grades_process(array $assessments, $timegraded = null) {
|
||||||
|
parent::aggregate_grading_grades_process($assessments, $timegraded);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -27,6 +27,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||||
|
|
||||||
global $CFG;
|
global $CFG;
|
||||||
require_once($CFG->dirroot . '/mod/workshop/locallib.php'); // Include the code to test
|
require_once($CFG->dirroot . '/mod/workshop/locallib.php'); // Include the code to test
|
||||||
|
require_once(__DIR__ . '/fixtures/testable.php');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -40,8 +41,11 @@ class mod_workshop_internal_api_testcase extends advanced_testcase {
|
||||||
/** setup testing environment */
|
/** setup testing environment */
|
||||||
protected function setUp() {
|
protected function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
$this->setAdminUser();
|
||||||
$this->workshop = new testable_workshop();
|
$course = $this->getDataGenerator()->create_course();
|
||||||
|
$workshop = $this->getDataGenerator()->create_module('workshop', array('course' => $course));
|
||||||
|
$cm = get_coursemodule_from_instance('workshop', $workshop->id, $course->id, false, MUST_EXIST);
|
||||||
|
$this->workshop = new testable_workshop($workshop, $cm, $course);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function tearDown() {
|
protected function tearDown() {
|
||||||
|
@ -50,6 +54,8 @@ class mod_workshop_internal_api_testcase extends advanced_testcase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_aggregate_submission_grades_process_notgraded() {
|
public function test_aggregate_submission_grades_process_notgraded() {
|
||||||
|
$this->resetAfterTest(true);
|
||||||
|
|
||||||
// fixture set-up
|
// fixture set-up
|
||||||
$batch = array(); // batch of a submission's assessments
|
$batch = array(); // batch of a submission's assessments
|
||||||
$batch[] = (object)array('submissionid' => 12, 'submissiongrade' => null, 'weight' => 1, 'grade' => null);
|
$batch[] = (object)array('submissionid' => 12, 'submissiongrade' => null, 'weight' => 1, 'grade' => null);
|
||||||
|
@ -126,6 +132,8 @@ class mod_workshop_internal_api_testcase extends advanced_testcase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_aggregate_submission_grades_process_mean_nochange() {
|
public function test_aggregate_submission_grades_process_mean_nochange() {
|
||||||
|
$this->resetAfterTest(true);
|
||||||
|
|
||||||
// fixture set-up
|
// fixture set-up
|
||||||
$batch = array(); // batch of a submission's assessments
|
$batch = array(); // batch of a submission's assessments
|
||||||
$batch[] = (object)array('submissionid' => 45, 'submissiongrade' => 19.67750, 'weight' => 1, 'grade' => 56.12000);
|
$batch[] = (object)array('submissionid' => 45, 'submissiongrade' => 19.67750, 'weight' => 1, 'grade' => 56.12000);
|
||||||
|
@ -167,6 +175,7 @@ class mod_workshop_internal_api_testcase extends advanced_testcase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_aggregate_grading_grades_process_nograding() {
|
public function test_aggregate_grading_grades_process_nograding() {
|
||||||
|
$this->resetAfterTest(true);
|
||||||
// fixture set-up
|
// fixture set-up
|
||||||
$batch = array();
|
$batch = array();
|
||||||
$batch[] = (object)array('reviewerid'=>2, 'gradinggrade'=>null, 'gradinggradeover'=>null, 'aggregationid'=>null, 'aggregatedgrade'=>null);
|
$batch[] = (object)array('reviewerid'=>2, 'gradinggrade'=>null, 'gradinggradeover'=>null, 'aggregationid'=>null, 'aggregatedgrade'=>null);
|
||||||
|
@ -205,6 +214,7 @@ class mod_workshop_internal_api_testcase extends advanced_testcase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_aggregate_grading_grades_process_single_grade_uptodate() {
|
public function test_aggregate_grading_grades_process_single_grade_uptodate() {
|
||||||
|
$this->resetAfterTest(true);
|
||||||
// fixture set-up
|
// fixture set-up
|
||||||
$batch = array();
|
$batch = array();
|
||||||
$batch[] = (object)array('reviewerid'=>3, 'gradinggrade'=>90.00000, 'gradinggradeover'=>null, 'aggregationid'=>1, 'aggregatedgrade'=>90.00000);
|
$batch[] = (object)array('reviewerid'=>3, 'gradinggrade'=>90.00000, 'gradinggradeover'=>null, 'aggregationid'=>1, 'aggregatedgrade'=>90.00000);
|
||||||
|
@ -297,6 +307,7 @@ class mod_workshop_internal_api_testcase extends advanced_testcase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_percent_to_value() {
|
public function test_percent_to_value() {
|
||||||
|
$this->resetAfterTest(true);
|
||||||
// fixture setup
|
// fixture setup
|
||||||
$total = 185;
|
$total = 185;
|
||||||
$percent = 56.6543;
|
$percent = 56.6543;
|
||||||
|
@ -307,6 +318,7 @@ class mod_workshop_internal_api_testcase extends advanced_testcase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_percent_to_value_negative() {
|
public function test_percent_to_value_negative() {
|
||||||
|
$this->resetAfterTest(true);
|
||||||
// fixture setup
|
// fixture setup
|
||||||
$total = 185;
|
$total = 185;
|
||||||
$percent = -7.098;
|
$percent = -7.098;
|
||||||
|
@ -317,6 +329,7 @@ class mod_workshop_internal_api_testcase extends advanced_testcase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_percent_to_value_over_hundred() {
|
public function test_percent_to_value_over_hundred() {
|
||||||
|
$this->resetAfterTest(true);
|
||||||
// fixture setup
|
// fixture setup
|
||||||
$total = 185;
|
$total = 185;
|
||||||
$percent = 121.08;
|
$percent = 121.08;
|
||||||
|
@ -327,6 +340,7 @@ class mod_workshop_internal_api_testcase extends advanced_testcase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_lcm() {
|
public function test_lcm() {
|
||||||
|
$this->resetAfterTest(true);
|
||||||
// fixture setup + exercise SUT + verify in one step
|
// fixture setup + exercise SUT + verify in one step
|
||||||
$this->assertEquals(workshop::lcm(1,4), 4);
|
$this->assertEquals(workshop::lcm(1,4), 4);
|
||||||
$this->assertEquals(workshop::lcm(2,4), 4);
|
$this->assertEquals(workshop::lcm(2,4), 4);
|
||||||
|
@ -336,6 +350,7 @@ class mod_workshop_internal_api_testcase extends advanced_testcase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_lcm_array() {
|
public function test_lcm_array() {
|
||||||
|
$this->resetAfterTest(true);
|
||||||
// fixture setup
|
// fixture setup
|
||||||
$numbers = array(5,3,15);
|
$numbers = array(5,3,15);
|
||||||
// excersise SUT
|
// excersise SUT
|
||||||
|
@ -345,6 +360,7 @@ class mod_workshop_internal_api_testcase extends advanced_testcase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_prepare_example_assessment() {
|
public function test_prepare_example_assessment() {
|
||||||
|
$this->resetAfterTest(true);
|
||||||
// fixture setup
|
// fixture setup
|
||||||
$fakerawrecord = (object)array(
|
$fakerawrecord = (object)array(
|
||||||
'id' => 42,
|
'id' => 42,
|
||||||
|
@ -374,6 +390,7 @@ class mod_workshop_internal_api_testcase extends advanced_testcase {
|
||||||
|
|
||||||
public function test_prepare_example_reference_assessment() {
|
public function test_prepare_example_reference_assessment() {
|
||||||
global $USER;
|
global $USER;
|
||||||
|
$this->resetAfterTest(true);
|
||||||
// fixture setup
|
// fixture setup
|
||||||
$fakerawrecord = (object)array(
|
$fakerawrecord = (object)array(
|
||||||
'id' => 38,
|
'id' => 38,
|
||||||
|
@ -400,26 +417,3 @@ class mod_workshop_internal_api_testcase extends advanced_testcase {
|
||||||
$a = $this->workshop->prepare_example_reference_assessment($fakerawrecord);
|
$a = $this->workshop->prepare_example_reference_assessment($fakerawrecord);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test subclass that makes all the protected methods we want to test public.
|
|
||||||
*/
|
|
||||||
class testable_workshop extends workshop {
|
|
||||||
|
|
||||||
public function __construct() {
|
|
||||||
$this->id = 16;
|
|
||||||
$this->cm = new stdclass();
|
|
||||||
$this->course = new stdclass();
|
|
||||||
$this->context = new stdclass();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function aggregate_submission_grades_process(array $assessments) {
|
|
||||||
parent::aggregate_submission_grades_process($assessments);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function aggregate_grading_grades_process(array $assessments, $timegraded = null) {
|
|
||||||
parent::aggregate_grading_grades_process($assessments, $timegraded);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -38,18 +38,26 @@ require_login($course, false, $cm);
|
||||||
$workshop = new workshop($workshop, $cm, $course);
|
$workshop = new workshop($workshop, $cm, $course);
|
||||||
require_sesskey();
|
require_sesskey();
|
||||||
|
|
||||||
|
$params = array(
|
||||||
|
'objectid' => $workshop->id,
|
||||||
|
'context' => $workshop->context,
|
||||||
|
'courseid' => $course->id
|
||||||
|
);
|
||||||
|
|
||||||
switch ($tool) {
|
switch ($tool) {
|
||||||
case 'clearaggregatedgrades':
|
case 'clearaggregatedgrades':
|
||||||
require_capability('mod/workshop:overridegrades', $workshop->context);
|
require_capability('mod/workshop:overridegrades', $workshop->context);
|
||||||
$workshop->log('update clear aggregated grades');
|
|
||||||
$workshop->clear_submission_grades();
|
$workshop->clear_submission_grades();
|
||||||
$workshop->clear_grading_grades();
|
$workshop->clear_grading_grades();
|
||||||
|
$event = \mod_workshop\event\assessment_evaluations_reset::create($params);
|
||||||
|
$event->trigger();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'clearassessments':
|
case 'clearassessments':
|
||||||
require_capability('mod/workshop:overridegrades', $workshop->context);
|
require_capability('mod/workshop:overridegrades', $workshop->context);
|
||||||
$workshop->log('update clear assessments');
|
|
||||||
$workshop->clear_assessments();
|
$workshop->clear_assessments();
|
||||||
|
$event = \mod_workshop\event\submission_assessments_reset::create($params);
|
||||||
|
$event->trigger();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,9 @@ $event->trigger();
|
||||||
if ($workshop->phase == workshop::PHASE_SUBMISSION and $workshop->phaseswitchassessment
|
if ($workshop->phase == workshop::PHASE_SUBMISSION and $workshop->phaseswitchassessment
|
||||||
and $workshop->submissionend > 0 and $workshop->submissionend < time()) {
|
and $workshop->submissionend > 0 and $workshop->submissionend < time()) {
|
||||||
$workshop->switch_phase(workshop::PHASE_ASSESSMENT);
|
$workshop->switch_phase(workshop::PHASE_ASSESSMENT);
|
||||||
$workshop->log('update switch phase', $workshop->view_url(), $workshop->phase);
|
$eventdata['other']['workshopphase'] = $workshop->phase;
|
||||||
|
$event = \mod_workshop\event\phase_switched::create($eventdata);
|
||||||
|
$event->trigger();
|
||||||
// Disable the automatic switching now so that it is not executed again by accident
|
// Disable the automatic switching now so that it is not executed again by accident
|
||||||
// if the teacher changes the phase back to the submission one.
|
// if the teacher changes the phase back to the submission one.
|
||||||
$DB->set_field('workshop', 'phaseswitchassessment', 0, array('id' => $workshop->id));
|
$DB->set_field('workshop', 'phaseswitchassessment', 0, array('id' => $workshop->id));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue