Commit 45faf15d authored by Ankit Agarwal's avatar Ankit Agarwal
Browse files

MDL-43044 events: Deprecate and remove code duplication from instances_list_viewed events

parent c4b0d6dc
......@@ -4,6 +4,11 @@ information provided here is intended especially for developers.
=== 2.7 ===
* Abstract class \core\event\course_module_instances_list_viewed is deprecated now, use \core\event\instances_list_viewed instead.
* mod_book\event\instances_list_viewed has been deprecated. Please use mod_book\event\course_module_instance_list_viewed instead.
* mod_chat\event\instances_list_viewed has been deprecated. Please use mod_chat\event\course_module_instance_list_viewed instead.
* mod_choice\event\instances_list_viewed has been deprecated. Please use mod_choice\event\course_module_instance_list_viewed instead.
* mod_feedback\event\instances_list_viewed has been deprecated. Please use mod_feedback\event\course_module_instance_list_viewed instead.
* mod_page\event\instances_list_viewed has been deprecated. Please use mod_page\event\course_module_instance_list_viewed instead.
=== 2.6 ===
......
......@@ -15,10 +15,10 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* mod_book instances list viewed event.
* mod_book course module instance list viewed event.
*
* @package mod_book
* @copyright 2013 Frédéric Massart
* @copyright 2013 Ankit Agarwal
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
......@@ -26,48 +26,12 @@ namespace mod_book\event;
defined('MOODLE_INTERNAL') || die();
/**
* mod_book instances list viewed event class.
* mod_book course module instance list viewed event class.
*
* @package mod_book
* @copyright 2013 Frédéric Massart
* @copyright 2013 onwards Ankit Agarwal
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class instances_list_viewed extends \core\event\course_module_instances_list_viewed {
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "User $this->userid viewed the list of book activities in the course $this->courseid.";
}
/**
* Return the legacy event log data.
*
* @return array|null
*/
protected function get_legacy_logdata() {
return array($this->courseid, 'book', 'view all', 'index.php?id=' . $this->courseid, '');
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('event_instances_list_viewed', 'mod_book');
}
/**
* Get URL related to the action
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/mod/book/index.php', array('id' => $this->courseid));
}
class course_module_instance_list_viewed extends \core\event\course_module_instance_list_viewed {
}
......@@ -50,7 +50,7 @@ echo $OUTPUT->header();
$params = array(
'context' => context_course::instance($course->id)
);
$event = \mod_book\event\instances_list_viewed::create($params);
$event = \mod_book\event\course_module_instance_list_viewed::create($params);
$event->trigger();
// Get all the appropriate data
......
......@@ -50,7 +50,6 @@ $string['event_chapter_created'] = 'Chapter created';
$string['event_chapter_deleted'] = 'Chapter deleted';
$string['event_chapter_updated'] = 'Chapter updated';
$string['event_chapter_viewed'] = 'Chapter viewed';
$string['event_instances_list_viewed'] = 'Instances list viewed';
$string['subchapter'] = 'Subchapter';
$string['nocontent'] = 'No content has been added to this book yet.';
$string['numbering'] = 'Chapter formatting';
......
......@@ -15,10 +15,10 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* mod_chat instances list viewed event.
* mod_chat course module instance list viewed event.
*
* @package mod_chat
* @copyright 2013 Frédéric Massart
* @copyright 2013 onwards Ankit Agarwal
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
......@@ -26,48 +26,12 @@ namespace mod_chat\event;
defined('MOODLE_INTERNAL') || die();
/**
* mod_chat instances list viewed event class.
* mod_chat course module instance list viewed event class.
*
* @package mod_chat
* @copyright 2013 Frédéric Massart
* @copyright 2013 onwards Ankit Agarwal
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class instances_list_viewed extends \core\event\course_module_instances_list_viewed {
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "User $this->userid viewed the list of chat activities in the course $this->courseid.";
}
/**
* Return the legacy event log data.
*
* @return array|null
*/
protected function get_legacy_logdata() {
return array($this->courseid, 'chat', 'view all', 'index.php?id=' . $this->courseid, '');
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('event_instances_list_viewed', 'mod_chat');
}
/**
* Get URL related to the action
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/mod/chat/index.php', array('id' => $this->courseid));
}
class course_module_instance_list_viewed extends \core\event\course_module_instance_list_viewed {
}
......@@ -17,7 +17,7 @@ $PAGE->set_pagelayout('incourse');
$params = array(
'context' => context_course::instance($id)
);
$event = \mod_chat\event\instances_list_viewed::create($params);
$event = \mod_chat\event\course_module_instance_list_viewed::create($params);
$event->trigger();
/// Get all required strings
......
......@@ -64,7 +64,6 @@ $string['chatreport'] = 'Chat sessions';
$string['chat:talk'] = 'Talk in a chat';
$string['chattime'] = 'Next chat time';
$string['entermessage'] = "Enter your message";
$string['event_instances_list_viewed'] = 'Instances list viewed';
$string['event_message_sent'] = 'Message sent';
$string['event_sessions_viewed'] = 'Sessions viewed';
$string['idle'] = 'Idle';
......
......@@ -15,10 +15,10 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Course module instances list_viewed event.
* mod_choice course module instance list viewed event.
*
* @package mod_choice
* @copyright 2013 Adrian Greeve
* @copyright 2013 Ankit Agarwal
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
......@@ -26,47 +26,12 @@ namespace mod_choice\event;
defined('MOODLE_INTERNAL') || die();
/**
* Course module instances list viewed event class for mod_choice.
* mod_choice course module instance list event class.
*
* @package mod_choice
* @copyright 2013 Adrian Greeve
* @copyright 2013 onwards Ankit Agarwal
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class instances_list_viewed extends \core\event\course_module_instances_list_viewed {
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "User $this->userid viewed the list of choice activities in the course $this->courseid.";
}
/**
* Return the legacy event log data.
*
* @return array
*/
protected function get_legacy_logdata() {
return array($this->courseid, 'choice', 'view all', 'index.php?id=' . $this->courseid, '');
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('event_instances_list_viewed', 'mod_choice');
}
/**
* Get URL related to the action
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/mod/choice/index.php', array('id' => $this->courseid));
}
class course_module_instance_list_viewed extends \core\event\course_module_instance_list_viewed {
}
......@@ -15,7 +15,7 @@
$PAGE->set_pagelayout('incourse');
$eventdata = array('context' => context_course::instance($id));
$event = \mod_choice\event\instances_list_viewed::create($eventdata);
$event = \mod_choice\event\course_module_instance_list_viewed::create($eventdata);
$event->trigger();
$strchoice = get_string("modulename", "choice");
......
......@@ -33,7 +33,6 @@ $string['displayvertical'] = 'Display vertically';
$string['event_answer_created'] = 'Choice made';
$string['event_answer_updated'] = 'Choice updated';
$string['event_report_viewed'] = 'Choice report viewed';
$string['event_instances_list_viewed'] = 'Instances list viewed';
$string['expired'] = 'Sorry, this activity closed on {$a} and is no longer available';
$string['atleastoneoption'] = 'You need to provide at least one possible answer.';
$string['full'] = '(Full)';
......
......@@ -15,7 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* mod_feedback instances list viewed event.
* mod_feedback course module instance list viewed event.
*
* @package mod_feedback
* @copyright 2013 Ankit Agarwal
......@@ -26,49 +26,12 @@ namespace mod_feedback\event;
defined('MOODLE_INTERNAL') || die();
/**
* mod_feedback instances list viewed event class.
* mod_feedback course module instance list event class.
*
* @package mod_feedback
* @copyright 2013 Ankit Agarwal
* @copyright 2013 onwards Ankit Agarwal
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class instances_list_viewed extends \core\event\course_module_instances_list_viewed {
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "User $this->userid viewed the list of feedback activities in the course $this->courseid.";
}
/**
* Return the legacy event log data.
*
* @return array
*/
protected function get_legacy_logdata() {
return array($this->courseid, 'feedback', 'view all', 'index.php?id=' . $this->courseid, '');
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventinstanceslistviewed', 'mod_feedback');
}
/**
* Get URL related to the action
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/mod/feedback/index.php', array('id' => $this->courseid));
}
class course_module_instance_list_viewed extends \core\event\course_module_instance_list_viewed {
}
......@@ -41,7 +41,7 @@ require_login($course);
$PAGE->set_pagelayout('incourse');
// Trigger instances list viewed event.
$event = \mod_feedback\event\instances_list_viewed::create(array('context' => $context));
$event = \mod_feedback\event\course_module_instance_list_viewed::create(array('context' => $context));
$event->trigger();
/// Print the page header
......
......@@ -104,7 +104,6 @@ $string['export_questions'] = 'Export questions';
$string['export_to_excel'] = 'Export to Excel';
$string['eventresponsedeleted'] = 'Response deleted';
$string['eventresponsesubmitted'] = 'Response submitted';
$string['eventinstanceslistviewed'] = 'Instances list viewed';
$string['feedback:addinstance'] = 'Add a new feedback';
$string['feedbackclose'] = 'Allow answers to';
$string['feedback:complete'] = 'Complete a feedback';
......
......@@ -15,7 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* mod_page instances list viewed event.
* mod_page course module instance list viewed event.
*
* @package mod_page
* @copyright 2013 Ankit Agarwal
......@@ -26,49 +26,12 @@ namespace mod_page\event;
defined('MOODLE_INTERNAL') || die();
/**
* mod_page instances list viewed event class.
* mod_page course module instance list event class.
*
* @package mod_page
* @copyright 2013 Ankit Agarwal
* @copyright 2013 onwards Ankit Agarwal
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class instances_list_viewed extends \core\event\course_module_instances_list_viewed {
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "User $this->userid viewed the list of page activities in the course $this->courseid.";
}
/**
* Return the legacy event log data.
*
* @return array
*/
protected function get_legacy_logdata() {
return array($this->courseid, 'page', 'view all', 'index.php?id=' . $this->courseid, '');
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventinstanceslistviewed', 'mod_page');
}
/**
* Get URL related to the action
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/mod/page/index.php', array('id' => $this->courseid));
}
class course_module_instance_list_viewed extends \core\event\course_module_instance_list_viewed {
}
......@@ -34,7 +34,7 @@ require_course_login($course, true);
$PAGE->set_pagelayout('incourse');
// Trigger instances list viewed event.
$event = \mod_page\event\instances_list_viewed::create(array('context' => context_course::instance($course->id)));
$event = \mod_page\event\course_module_instance_list_viewed::create(array('context' => context_course::instance($course->id)));
$event->trigger();
$strpage = get_string('modulename', 'page');
......
......@@ -31,7 +31,6 @@ $string['displayoptions'] = 'Available display options';
$string['displayselect'] = 'Display';
$string['displayselectexplain'] = 'Select display type.';
$string['legacyfiles'] = 'Migration of old course file';
$string['eventinstanceslistviewed'] = 'Page instances list viewed';
$string['legacyfilesactive'] = 'Active';
$string['legacyfilesdone'] = 'Finished';
$string['modulename'] = 'Page';
......
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