Files
moodle/mod/wiki/classes/event/comments_viewed.php
T
Petr Škoda 578645aadf MDL-44715 use parent::validate_data() consistently in all events
Includes some minor PHPDocs typo fixes.
2014-03-28 14:09:31 +08:00

89 lines
2.5 KiB
PHP

<?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_wiki comments viewed event.
*
* @package mod_wiki
* @copyright 2013 Rajesh Taneja <rajesh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace mod_wiki\event;
defined('MOODLE_INTERNAL') || die();
/**
* mod_wiki comments viewed event.
*
* @package mod_wiki
* @copyright 2013 Rajesh Taneja <rajesh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class comments_viewed extends \core\event\comments_viewed {
/**
* Init method.
*
* @return void
*/
protected function init() {
parent::init();
$this->data['objecttable'] = 'wiki_pages';
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return 'User with id ' . $this->userid . ' viewed comments for wiki page id ' .
$this->objectid;
}
/**
* Return the legacy event log data.
*
* @return array
*/
protected function get_legacy_logdata() {
return(array($this->courseid, 'wiki', 'comments',
'comments.php?pageid=' . $this->objectid, $this->objectid, $this->contextinstanceid));
}
/**
* Get URL related to the action.
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/mod/wiki/comments.php', array('pageid' => $this->objectid));
}
/**
* Custom validation.
*
* @throws \coding_exception
* @return void
*/
protected function validate_data() {
parent::validate_data();
if (empty($this->objectid) || empty($this->objecttable)) {
throw new \coding_exception('The objectid and objecttable need to be set in $other');
}
}
}