Commit 48f871e0 authored by Rajesh Taneja's avatar Rajesh Taneja Committed by Marina Glancy
Browse files

MDL-40058 mod_wiki: Replaced add_to_log for course_module_viewed with event

parent 8ac1d224
<?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 course module 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 course module viewed event class.
*
* @package mod_wiki
* @copyright 2013 Rajesh Taneja <rajesh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class course_module_viewed extends \core\event\course_module_viewed {
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['crud'] = 'r';
$this->data['level'] = self::LEVEL_PARTICIPATING;
$this->data['objecttable'] = 'wiki';
}
}
......@@ -298,7 +298,14 @@ if($pageid) {
$event->add_record_snapshot('wiki_pages', $page);
$event->trigger();
} else if($id) {
add_to_log($course->id, 'wiki', 'view', "view.php?id=".$id, $id, $cm->id);
$event = \mod_wiki\event\course_module_viewed::create(
array(
'context' => $context,
'objectid' => $wiki->id
)
);
$event->add_record_snapshot('wiki', $wiki);
$event->trigger();
} else if($wid && $title) {
$event = \mod_wiki\event\page_viewed::create(
array(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment