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/**
18 * Calendar action event class.
19 *
20 * @package    core_calendar
21 * @copyright  2017 Cameron Ball <cameron@cameron1729.xyz>
22 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23 */
24
25namespace core_calendar\local\event\entities;
26
27defined('MOODLE_INTERNAL') || die();
28
29use core_calendar\local\event\factories\action_factory_interface;
30
31/**
32 * Class representing an actionable event.
33 *
34 * An actionable event can be thought of as an embellished event. That is,
35 * it does everything a regular event does, but has some extra information
36 * attached to it. For example, the URL a user needs to visit to complete
37 * an action, the number of actionable items, etc.
38 *
39 * @copyright 2017 Cameron Ball <cameron@cameron1729.xyz>
40 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
41 */
42class action_event implements action_event_interface {
43    /**
44     * @var event_interface $event The event to delegate to.
45     */
46    protected $event;
47
48    /**
49     * @var action_interface $action The action associated with this event.
50     */
51    protected $action;
52
53    /**
54     * @var proxy_interface $category Category for this event.
55     */
56    protected $category;
57
58    /**
59     * Constructor.
60     *
61     * @param event_interface  $event  The event to delegate to.
62     * @param action_interface $action The action associated with this event.
63     */
64    public function __construct(event_interface $event, action_interface $action) {
65        $this->event = $event;
66        $this->action = $action;
67    }
68
69    public function get_id() {
70        return $this->event->get_id();
71    }
72
73    public function get_name() {
74        return $this->event->get_name();
75    }
76
77    public function get_description() {
78        return $this->event->get_description();
79    }
80
81    public function get_location() {
82        return $this->event->get_location();
83    }
84
85    public function get_category() {
86        return $this->event->get_category();
87    }
88
89    public function get_course() {
90        return $this->event->get_course();
91    }
92
93    public function get_course_module() {
94        return $this->event->get_course_module();
95    }
96
97    public function get_group() {
98        return $this->event->get_group();
99    }
100
101    public function get_user() {
102        return $this->event->get_user();
103    }
104
105    public function get_type() {
106        return $this->event->get_type();
107    }
108
109    public function get_times() {
110        return $this->event->get_times();
111    }
112
113    public function get_repeats() {
114        return $this->event->get_repeats();
115    }
116
117    public function get_subscription() {
118        return $this->event->get_subscription();
119    }
120
121    public function is_visible() {
122        return $this->event->is_visible();
123    }
124
125    public function get_action() {
126        return $this->action;
127    }
128
129    /**
130     * Event component
131     * @return string
132     */
133    public function get_component() {
134        return $this->event->get_component();
135    }
136}
137