1<?php
2include_once './Services/Calendar/interfaces/interface.ilCalendarAppointmentPresentation.php';
3include_once './Services/Calendar/classes/AppointmentPresentation/class.ilAppointmentPresentationGUI.php';
4
5/**
6 *
7 * @author Jesús López Reyes <lopez@leifos.com>
8 * @version $Id$
9 *
10 * @ilCtrl_IsCalledBy ilAppointmentPresentationSessionGUI: ilCalendarAppointmentPresentationGUI
11 *
12 * @ingroup ServicesCalendar
13 */
14class ilAppointmentPresentationSessionGUI extends ilAppointmentPresentationGUI implements ilCalendarAppointmentPresentation
15{
16    public function collectPropertiesAndActions()
17    {
18        global $DIC;
19
20        $f = $DIC->ui()->factory();
21        $r = $DIC->ui()->renderer();
22        $this->lng->loadLanguageModule("sess");
23        $this->lng->loadLanguageModule("crs");
24        /**
25         * @var ilCalendarEntry
26         */
27        $a_app = $this->appointment;
28        include_once "./Modules/Session/classes/class.ilObjSession.php";
29
30        $cat_info = $this->getCatInfo();
31
32        $refs = $this->getReadableRefIds($this->getObjIdForAppointment());
33        $ref_id = current($refs);
34
35        // event title
36        $this->addInfoSection($a_app["event"]->getTitle());
37
38        // event description
39        $this->addEventDescription($a_app);
40
41        // event location
42        $this->addEventLocation($a_app);
43
44        //Contained in:
45        $this->addContainerInfo($this->getObjIdForAppointment());
46
47        //SESSION INFORMATION
48        $this->addInfoSection(
49            $this->lng->txt("cal_sess_info")
50        );
51
52        $session_obj = new ilObjSession($this->getObjIdForAppointment(), false);
53
54        //location
55        if ($session_obj->getLocation()) {
56            $this->addInfoProperty($this->lng->txt("event_location"), ilUtil::makeClickable(nl2br($session_obj->getLocation())));
57            $this->addListItemProperty($this->lng->txt("event_location"), ilUtil::makeClickable(nl2br($session_obj->getLocation())));
58        }
59        //details/workflow
60        if ($session_obj->getDetails()) {
61            $this->addInfoProperty($this->lng->txt("event_details_workflow"), ilUtil::makeClickable(nl2br($session_obj->getDetails())));
62        }
63        //lecturer name
64        $str_lecturer = array();
65        if ($session_obj->getName()) {
66            $str_lecturer[] = $session_obj->getName();
67        }
68        //lecturer email
69        if ($session_obj->getEmail()) {
70            $str_lecturer[] = $session_obj->getEmail();
71        }
72        if ($session_obj->getPhone()) {
73            $str_lecturer[] = $this->lng->txt("phone") . ": " . $session_obj->getPhone();
74        }
75        if (count($str_lecturer) > 0) {
76            $this->addInfoProperty($this->lng->txt("event_tutor_data"), implode("<br>", $str_lecturer));
77            $this->addListItemProperty($this->lng->txt("event_tutor_data"), implode(", ", $str_lecturer));
78        }
79
80        $eventItems = ilObjectActivation::getItemsByEvent($this->getObjIdForAppointment());
81        if (count($eventItems)) {
82            include_once('./Services/Link/classes/class.ilLink.php');
83            $str = array();
84            foreach ($eventItems as $file) {
85                if ($file['type'] == "file") {
86                    $this->has_files = true;
87                    $href = ilLink::_getStaticLink($file['ref_id'], "file", true, "download");
88                    $link = $f->link()->standard($file['title'], $href);
89                    require_once('Modules/File/classes/class.ilObjFileAccess.php');
90                    if (ilObjFileAccess::_isFileInline($file["title"])) {
91                        $link = $link->withOpenInNewViewport(true);
92                    }
93                    $str[$file['title']] = $r->render($link);
94                }
95            }
96            if ($this->has_files) {
97                ksort($str, SORT_NATURAL | SORT_FLAG_CASE);
98                $this->addInfoProperty($this->lng->txt("files"), implode("<br>", $str));
99                $this->addListItemProperty($this->lng->txt("files"), implode(", ", $str));
100            }
101        }
102
103        $this->addAction($this->lng->txt("sess_open"), ilLink::_getStaticLink($ref_id));
104
105        $this->addMetaData('sess', $this->getObjIdForAppointment());
106    }
107}
108