~ubuntu-branches/ubuntu/utopic/moodle/utopic

« back to all changes in this revision

Viewing changes to lib/classes/event/course_updated.php

  • Committer: Package Import Robot
  • Author(s): Thijs Kinkhorst
  • Date: 2014-05-12 16:10:38 UTC
  • mfrom: (36.1.3 sid)
  • Revision ID: package-import@ubuntu.com-20140512161038-puyqf65k4e0s8ytz
Tags: 2.6.3-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
// This file is part of Moodle - http://moodle.org/
 
3
//
 
4
// Moodle is free software: you can redistribute it and/or modify
 
5
// it under the terms of the GNU General Public License as published by
 
6
// the Free Software Foundation, either version 3 of the License, or
 
7
// (at your option) any later version.
 
8
//
 
9
// Moodle is distributed in the hope that it will be useful,
 
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
// GNU General Public License for more details.
 
13
//
 
14
// You should have received a copy of the GNU General Public License
 
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
16
 
 
17
namespace core\event;
 
18
 
 
19
defined('MOODLE_INTERNAL') || die();
 
20
 
 
21
/**
 
22
 * Course updated event.
 
23
 *
 
24
 * @package    core
 
25
 * @since      Moodle 2.6
 
26
 * @copyright  2013 Mark Nelson <markn@moodle.com>
 
27
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 
28
 */
 
29
class course_updated extends base {
 
30
 
 
31
    /** @var array The legacy log data. */
 
32
    private $legacylogdata;
 
33
 
 
34
    /**
 
35
     * Initialise the event data.
 
36
     */
 
37
    protected function init() {
 
38
        $this->data['objecttable'] = 'course';
 
39
        $this->data['crud'] = 'u';
 
40
        $this->data['level'] = self::LEVEL_TEACHING;
 
41
    }
 
42
 
 
43
    /**
 
44
     * Returns localised general event name.
 
45
     *
 
46
     * @return string
 
47
     */
 
48
    public static function get_name() {
 
49
        return get_string('eventcourseupdated');
 
50
    }
 
51
 
 
52
    /**
 
53
     * Returns non-localised description of what happened.
 
54
     *
 
55
     * @return string
 
56
     */
 
57
    public function get_description() {
 
58
        return "Course {$this->courseid} was updated by user {$this->userid}";
 
59
    }
 
60
 
 
61
    /**
 
62
     * Returns relevant URL.
 
63
     *
 
64
     * @return \moodle_url
 
65
     */
 
66
    public function get_url() {
 
67
        return new \moodle_url('/course/view.php', array('id' => $this->objectid));
 
68
    }
 
69
 
 
70
    /**
 
71
     * Returns the name of the legacy event.
 
72
     *
 
73
     * @return string legacy event name
 
74
     */
 
75
    public static function get_legacy_eventname() {
 
76
        return 'course_updated';
 
77
    }
 
78
 
 
79
    /**
 
80
     * Returns the legacy event data.
 
81
     *
 
82
     * @return \stdClass the course that was updated
 
83
     */
 
84
    protected function get_legacy_eventdata() {
 
85
        return $this->get_record_snapshot('course', $this->objectid);
 
86
    }
 
87
 
 
88
    /**
 
89
     * Set the legacy data used for add_to_log().
 
90
     *
 
91
     * @param array $logdata
 
92
     */
 
93
    public function set_legacy_logdata($logdata) {
 
94
        $this->legacylogdata = $logdata;
 
95
    }
 
96
 
 
97
    /**
 
98
     * Return legacy data for add_to_log().
 
99
     *
 
100
     * @return array
 
101
     */
 
102
    protected function get_legacy_logdata() {
 
103
        return $this->legacylogdata;
 
104
    }
 
105
}