Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 25... Línea 25...
25
namespace core_calendar\external;
25
namespace core_calendar\external;
Línea 26... Línea 26...
26
 
26
 
Línea 27... Línea 27...
27
defined('MOODLE_INTERNAL') || die();
27
defined('MOODLE_INTERNAL') || die();
-
 
28
 
28
 
29
use core\external\exporter;
29
use core\external\exporter;
30
use core_calendar\output\humantimeperiod;
30
use renderer_base;
31
use renderer_base;
Línea 31... Línea 32...
31
use moodle_url;
32
use core\url;
32
use \core_calendar\local\event\container;
33
use core_calendar\local\event\container;
33
 
34
 
34
/**
35
/**
Línea 43... Línea 44...
43
     * @var \calendar_information $calendar The calendar to be rendered.
44
     * @var \calendar_information $calendar The calendar to be rendered.
44
     */
45
     */
45
    protected $calendar;
46
    protected $calendar;
Línea 46... Línea 47...
46
 
47
 
47
    /**
48
    /**
48
     * @var moodle_url $url The URL for the upcoming view page.
49
     * @var url $url The URL for the upcoming view page.
49
     */
50
     */
Línea 50... Línea 51...
50
    protected $url;
51
    protected $url;
51
 
52
 
Línea 104... Línea 105...
104
     */
105
     */
105
    protected function get_other_values(renderer_base $output) {
106
    protected function get_other_values(renderer_base $output) {
106
        $timestamp = $this->calendar->time;
107
        $timestamp = $this->calendar->time;
Línea 107... Línea 108...
107
 
108
 
108
        $cache = $this->related['cache'];
109
        $cache = $this->related['cache'];
109
        $url = new moodle_url('/calendar/view.php', [
110
        $url = new url('/calendar/view.php', [
110
            'view' => 'upcoming',
111
            'view' => 'upcoming',
111
            'time' => $timestamp,
112
            'time' => $timestamp,
112
            'course' => $this->calendar->course->id,
113
            'course' => $this->calendar->course->id,
113
        ]);
114
        ]);
Línea 129... Línea 130...
129
            $data = $exporter->export($output);
130
            $data = $exporter->export($output);
Línea 130... Línea 131...
130
 
131
 
131
            // We need to override default formatted time because it differs from day view.
132
            // We need to override default formatted time because it differs from day view.
132
            // Formatted time for upcoming view adds a link to the day view.
133
            // Formatted time for upcoming view adds a link to the day view.
-
 
134
            $legacyevent = container::get_event_mapper()->from_event_to_legacy_event($event);
-
 
135
            $humanperiod = humantimeperiod::create_from_timestamp(
-
 
136
                starttimestamp: $legacyevent->timestart,
-
 
137
                endtimestamp: $legacyevent->timestart + $legacyevent->timeduration,
-
 
138
                link: new url(CALENDAR_URL . 'view.php'),
133
            $legacyevent = container::get_event_mapper()->from_event_to_legacy_event($event);
139
            );
Línea 134... Línea 140...
134
            $data->formattedtime = calendar_format_event_time($legacyevent, time(), null);
140
            $data->formattedtime = $output->render($humanperiod);
135
 
141
 
Línea 136... Línea 142...
136
            return $data;
142
            return $data;