MDL-40054 mod_lesson: replaced 'view all' add_to_log call with an event

This commit is contained in:
Mark Nelson
2014-01-02 19:44:39 -08:00
parent 7edf27c48e
commit 3f08c95ade
2 changed files with 37 additions and 2 deletions
@@ -0,0 +1,31 @@
<?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/>.
/**
* Event for when all lesson instances for a course are viewed.
*
* @package mod_lesson
* @copyright 2013 Mark Nelson <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace mod_lesson\event;
defined('MOODLE_INTERNAL') || die();
class course_module_instance_list_viewed extends \core\event\course_module_instance_list_viewed {
// No code required here as the parent class handles it all.
}
+6 -2
View File
@@ -39,8 +39,12 @@ if (!$course = $DB->get_record("course", array("id" => $id))) {
require_login($course);
$PAGE->set_pagelayout('incourse');
add_to_log($course->id, "lesson", "view all", "index.php?id=$course->id", "");
// Trigger instances list viewed event.
$params = array(
'context' => context_course::instance($course->id)
);
$event = \mod_lesson\event\course_module_instance_list_viewed::create($params);
$event->trigger();
/// Get all required strings