ILIAS  release_7 Revision v7.30-3-g800a261c036
ilCalendarAgendaListGUI Class Reference

Calendar agenda list. More...

+ Inheritance diagram for ilCalendarAgendaListGUI:
+ Collaboration diagram for ilCalendarAgendaListGUI:

Public Member Functions

 __construct (ilDate $seed)
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 getHTML ()
 Get output. More...
 
 getPluginAgendaItem ($a_item, $appointment)
 
- Public Member Functions inherited from ilCalendarViewGUI
 __construct (ilDate $seed, $presentation_type)
 
 setConsulationHoursUserId ($a_user_id)
 
 getConsultationHoursUserId ()
 
 initialize ($a_calendar_presentation_type)
 View initialization. More...
 
 getCurrentApp ()
 Get app for id. More...
 
 getEvents ()
 Get events. More...
 
 getDatesForItem ($item)
 Get start/end date for item. More...
 
 getModalForApp ()
 Get modal for appointment (see similar code in ilCalendarBlockGUI) More...
 
 getAppointmentShyButton ($a_calendar_entry, $a_dstart, $a_title_forced="")
 
 getActivePlugins ($a_slot_id)
 
 getModalTitleByPlugins ($a_current_title)
 
 getContentByPlugins ($a_cal_entry, $a_start_date, $a_content, $a_tpl)
 
 addToolbarActions ()
 Add download link to toolbar. More...
 
 downloadFiles ()
 Download files related to the appointments showed in the current calendar view (day,week,month,list). More...
 
 getBucketTitle ()
 get proper label to add in the background task popover More...
 
 countEventsInView ()
 get the events starting between 2 dates based in seed + view options. More...
 

Static Public Member Functions

static getPeriod ()
 needed in CalendarInboxGUI to get events using a proper period. More...
 

Data Fields

const PERIOD_DAY = 1
 
const PERIOD_WEEK = 2
 
const PERIOD_MONTH = 3
 
const PERIOD_HALF_YEAR = 4
 
- Data Fields inherited from ilCalendarViewGUI
const CAL_PRESENTATION_DAY = 1
 
const CAL_PRESENTATION_WEEK = 2
 
const CAL_PRESENTATION_MONTH = 3
 
const CAL_PRESENTATION_AGENDA_LIST = 9
 

Protected Member Functions

 initPeriod ()
 Initialises time Period for calendar list view. More...
 
 initEndPeriod ()
 Initialises end date for calendar list view. More...
 

Protected Attributes

 $ctrl
 
 $user
 
 $lng
 
 $period = self::PERIOD_WEEK
 
 $period_end_day = null
 
- Protected Attributes inherited from ilCalendarViewGUI
 $ui_factory
 
 $ui_renderer
 
 $ctrl
 
 $presentation_type
 
 $toolbar
 
 $logger
 
 $ui
 
 $view_with_appointments
 
 $lng
 
 $user
 
 $seed
 
 $ch_user_id = 0
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilCalendarAgendaListGUI::__construct ( ilDate  $seed)

Constructor.

Parameters
ilDate$seed
Todo:
make parent constructor (initialize) and init also seed and other common stuff

Definition at line 52 of file class.ilCalendarAgendaListGUI.php.

53 {
55
56 $this->ctrl->saveParameter($this, "cal_agenda_per");
57
58 $this->initPeriod();
59
60 $this->ctrl->setParameterByClass("ilcalendarinboxgui", "seed", $this->seed->get(IL_CAL_DATE));
61
62 $this->initEndPeriod();
63 }
const IL_CAL_DATE
initPeriod()
Initialises time Period for calendar list view.
initEndPeriod()
Initialises end date for calendar list view.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ilCalendarViewGUI\$seed, ILIAS\GlobalScreen\Provider\__construct(), ilCalendarViewGUI\CAL_PRESENTATION_AGENDA_LIST, IL_CAL_DATE, initEndPeriod(), and initPeriod().

+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilCalendarAgendaListGUI::executeCommand ( )

Execute command.

Definition at line 116 of file class.ilCalendarAgendaListGUI.php.

117 {
118 $next_class = $this->ctrl->getNextClass($this);
119 $cmd = $this->ctrl->getCmd("getHTML");
120
121 switch ($next_class) {
122 case "ilcalendarappointmentpresentationgui":
123 $this->ctrl->setReturn($this, "");
124 include_once("./Services/Calendar/classes/class.ilCalendarAppointmentPresentationGUI.php");
125 $gui = ilCalendarAppointmentPresentationGUI::_getInstance(new ilDate($this->seed->get(IL_CAL_DATE), IL_CAL_DATE), $this->getCurrentApp());
126 $this->ctrl->forwardCommand($gui);
127 break;
128
129 default:
130 $this->ctrl->setReturn($this, "");
131 if (in_array($cmd, array("getHTML", "getModalForApp"))) {
132 return $this->$cmd();
133 }
134 }
135 }
static _getInstance(ilDate $seed, $a_app)
get singleton instance
Class for single dates.

References ilCalendarAppointmentPresentationGUI\_getInstance(), and IL_CAL_DATE.

+ Here is the call graph for this function:

◆ getHTML()

ilCalendarAgendaListGUI::getHTML ( )

Get output.

Parameters

return

Definition at line 143 of file class.ilCalendarAgendaListGUI.php.

144 {
145 $navigation = new ilCalendarHeaderNavigationGUI($this, new ilDate($this->seed->get(IL_CAL_DATE), IL_CAL_DATE), ilDateTime::DAY);
146 $navigation->getHTML();
147
148 // set return now (after header navigation) to the list (e.g. for profile links)
149 $this->ctrl->setReturn($this, "");
150
151 // get events
152 $events = $this->getEvents();
153 $events = ilUtil::sortArray($events, "dstart", "asc", true);
154
155 $df = new \ILIAS\Data\Factory();
156 $items = array();
157 $groups = array();
158 $modals = array();
159 $group_date = new ilDate(0, IL_CAL_UNIX);
160 $end_day = new ilDate($this->period_end_day, IL_CAL_DATE);
161 $end_day->increment(ilDateTime::DAY, -1);
162 foreach ($events as $e) {
163 if ($e['event']->isFullDay()) {
164 // begin/end is Date (without timzone)
165 $begin = new ilDate($e['dstart'], IL_CAL_UNIX);
166 $end = new ilDate($e['dend'], IL_CAL_UNIX);
167 } else {
168 // begin/end is DateTime (with timezone conversion)
169 $begin = new ilDateTime($e['dstart'], IL_CAL_UNIX);
170 $end = new ilDateTime($e['dend'], IL_CAL_UNIX);
171 }
172
173 // if the begin is before seed date (due to timezone conversion) => continue
175 $begin,
176 $this->seed,
178 $GLOBALS['DIC']->user()->getTimezone()
179 )) {
180 continue;
181 }
182
184 $begin,
185 $end_day,
187 $GLOBALS['DIC']->user()->getTimezone()
188 )
189 ) {
190 break;
191 }
192
193
194 // initialize group date for first iteration
195 if ($group_date->isNull()) {
196 $group_date = new ilDate(
197 $begin->get(IL_CAL_DATE, '', $GLOBALS['DIC']->user()->getTimezone()),
199 );
200 }
201
202 if (!ilDateTime::_equals($group_date, $begin, IL_CAL_DAY, $GLOBALS['DIC']->user()->getTimezone())) {
203 // create new group
204 $groups[] = $this->ui_factory->item()->group(
205 ilDatePresentation::formatDate($group_date, false, true),
206 $items
207 );
208
209 $group_date = new ilDate(
210 $begin->get(IL_CAL_DATE, '', $GLOBALS['DIC']->user()->getTimezone()),
212 );
213 $items = [];
214 }
215
216 // get calendar
217 $cat_id = ilCalendarCategoryAssignments::_lookupCategory($e["event"]->getEntryId());
218 $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat_id);
219
220 $properties = array();
221
222 /*TODO:
223 * All this code related with the ctrl and shy button can be centralized in
224 * ilCalendarViewGUI refactoring the method getAppointmentShyButton or
225 * if we want extend this class from ilCalendarInboxGUI we can just keep it here.
226 */
227
228 // shy button for title
229 $this->ctrl->setParameter($this, 'app_id', $e["event"]->getEntryId());
230 $this->ctrl->setParameter($this, 'dt', $e['dstart']);
231 $this->ctrl->setParameter($this, 'seed', $this->seed->get(IL_CAL_DATE));
232
233 $url = $this->ctrl->getLinkTarget($this, "getModalForApp", "", true, false);
234 $this->ctrl->setParameter($this, "app_id", $_GET["app_id"]);
235 $this->ctrl->setParameter($this, "dt", $_GET["dt"]);
236 $this->ctrl->setParameter($this, 'modal_title', $_GET["modal_title"]);
237 $modal = $this->ui_factory->modal()->roundtrip('', [])->withAsyncRenderUrl($url);
238 $shy = $this->ui_factory->button()->shy($e["event"]->getPresentationTitle(false), "")->withOnClick($modal->getShowSignal());
239
240 $modals[] = $modal;
241 if ($e['event']->isFullDay()) {
242 $lead_text = $this->lng->txt("cal_all_day");
243 } else {
244 $lead_text = ilDatePresentation::formatPeriod($begin, $end, true);
245 }
246 $li = $this->ui_factory->item()->standard($shy)
247 ->withDescription("" . nl2br(strip_tags($e["event"]->getDescription())))
248 ->withLeadText($lead_text)
249 ->withProperties($properties)
250 ->withColor($df->color('#' . $cat_info["color"]));
251
252 if ($li_edited_by_plugin = $this->getPluginAgendaItem($li, $e['event'])) {
253 $li = $li_edited_by_plugin;
254 }
255
256 // add type specific actions/properties
257 include_once("./Services/Calendar/classes/class.ilCalendarAppointmentPresentationGUI.php");
259 $app_gui->setListItemMode($li);
260 $this->ctrl->getHTML($app_gui);
261 $items[] = $app_gui->getListItem();
262 }
263 // terminate last group
264 if (!$group_date->isNull()) {
265 $groups[] = $this->ui_factory->item()->group(
266 ilDatePresentation::formatDate($group_date, false, true),
267 $items
268 );
269 }
270
271 // list actions
272 $images = array_fill(1, 4, "<span class=\"ilAdvNoImg\"></span>");
273 if ($cal_agenda_per = (int) $_GET['cal_agenda_per']) {
274 $images[$cal_agenda_per] = "<img src='./templates/default/images/icon_checked.svg' alt='Month'>";
275 } else {
276 $images[$this->period] = "<img src='./templates/default/images/icon_checked.svg' alt='Month'>";
277 }
278
279 #21479 Set seed if the view does not contain any event.
280 $this->ctrl->setParameter($this, 'seed', $this->seed->get(IL_CAL_DATE));
281
282 $items = array();
283 $this->ctrl->setParameter($this, "cal_agenda_per", self::PERIOD_DAY);
284 $items[] = $this->ui_factory->button()->shy($images[1] . "1 " . $this->lng->txt("day"), $this->ctrl->getLinkTarget($this, "getHTML"));
285 $this->ctrl->setParameter($this, "cal_agenda_per", self::PERIOD_WEEK);
286 $items[] = $this->ui_factory->button()->shy($images[2] . "1 " . $this->lng->txt("week"), $this->ctrl->getLinkTarget($this, "getHTML"));
287 $this->ctrl->setParameter($this, "cal_agenda_per", self::PERIOD_MONTH);
288 $items[] = $this->ui_factory->button()->shy($images[3] . "1 " . $this->lng->txt("month"), $this->ctrl->getLinkTarget($this, "getHTML"));
289 $this->ctrl->setParameter($this, "cal_agenda_per", self::PERIOD_HALF_YEAR);
290 $items[] = $this->ui_factory->button()->shy($images[4] . "6 " . $this->lng->txt("months"), $this->ctrl->getLinkTarget($this, "getHTML"));
291 $this->ctrl->setParameter($this, "cal_agenda_per", $this->period);
292
293
294 $actions = $this->ui_factory->dropdown()->standard($items)->withLabel($this->lng->txt("cal_period"));
295
296 $list_title =
297 $this->lng->txt("cal_agenda") . ": " . ilDatePresentation::formatDate(new ilDate($this->seed->get(IL_CAL_DATE), IL_CAL_DATE));
298 if ($this->period != self::PERIOD_DAY) {
299 $end_day = new ilDate($this->period_end_day, IL_CAL_DATE);
300 $end_day->increment(ilDateTime::DAY, -1);
301 $list_title .= " - " . ilDatePresentation::formatDate($end_day);
302 }
303
304 $list = $this->ui_factory->panel()->listing()->standard($list_title, $groups)
305 ->withActions($actions);
306
307
308 $comps = array_merge($modals, array($list));
309
310 $html = $this->ui_renderer->render($comps);
311
312 if (count($groups) == 0) {
313 $html .= ilUtil::getSystemMessageHTML($this->lng->txt("cal_no_events_info"));
314 }
315
316 return $html;
317 }
user()
Definition: user.php:4
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
$_GET["client_id"]
const IL_CAL_UNIX
const IL_CAL_DAY
getPluginAgendaItem($a_item, $appointment)
static _getInstance($a_usr_id=0)
get singleton instance
static _lookupCategory($a_cal_id)
Lookup category id.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
@classDescription Date and time handling
static _equals(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
Check if two date are equal.
static _after(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
compare two dates and check start is after end This method does not consider tz offsets.
static _before(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
compare two dates and check start is before end This method does not consider tz offsets.
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static getSystemMessageHTML($a_txt, $a_type="info")
Get HTML for a system message.
$url

References $_GET, Vendor\Package\$e, $GLOBALS, $period, $url, ilDateTime\_after(), ilDateTime\_before(), ilDateTime\_equals(), ilCalendarCategories\_getInstance(), ilCalendarAppointmentPresentationGUI\_getInstance(), ilCalendarCategoryAssignments\_lookupCategory(), ilDateTime\DAY, ilDatePresentation\formatDate(), ilDatePresentation\formatPeriod(), ilCalendarViewGUI\getEvents(), getPluginAgendaItem(), ilUtil\getSystemMessageHTML(), IL_CAL_DATE, IL_CAL_DAY, IL_CAL_UNIX, ilUtil\sortArray(), and user().

+ Here is the call graph for this function:

◆ getPeriod()

static ilCalendarAgendaListGUI::getPeriod ( )
static

needed in CalendarInboxGUI to get events using a proper period.

todo define default period only once (self::PERIOD_WEEK, protected $period = self::PERIOD_WEEK)

Returns
int|mixed

Definition at line 339 of file class.ilCalendarAgendaListGUI.php.

340 {
341 global $DIC;
342
344 $ilUser = $DIC->user();
345
346 $qp = $DIC->http()->request()->getQueryParams();
347 if ((int) $qp["cal_agenda_per"] > 0 && (int) $qp["cal_agenda_per"] <= 4) {
348 return $qp["cal_agenda_per"];
349 } elseif ($period = $ilUser->getPref('cal_list_view')) {
350 return $period;
351 } else {
352 return $settings->getDefaultPeriod();
353 }
354 }
static _getInstance()
get singleton instance
global $DIC
Definition: goto.php:24
$ilUser
Definition: imgupload.php:18

References $DIC, $ilUser, $period, and ilCalendarSettings\_getInstance().

Referenced by ilCalendarViewGUI\countEventsInView(), and ilCalendarViewGUI\getEvents().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPluginAgendaItem()

ilCalendarAgendaListGUI::getPluginAgendaItem (   $a_item,
  $appointment 
)
Parameters
$a_itemILIAS\UI\Component\Item\Item
$appointment
Returns
$li ILIAS\UI\Component\Item\Item

Definition at line 324 of file class.ilCalendarAgendaListGUI.php.

325 {
326 //"capg" is the plugin slot id for AppointmentCustomGrid
327 foreach ($this->getActivePlugins("capg") as $plugin) {
328 $plugin->setAppointment($appointment, $appointment->getStart());
329 $li = $plugin->editAgendaItem($a_item);
330 }
331 return $li;
332 }

References XapiProxy\$plugin, and ilCalendarViewGUI\getActivePlugins().

Referenced by getHTML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initEndPeriod()

ilCalendarAgendaListGUI::initEndPeriod ( )
protected

Initialises end date for calendar list view.

Definition at line 89 of file class.ilCalendarAgendaListGUI.php.

90 {
91 $end_date = clone $this->seed;
92
93 switch ($this->period) {
95 $end_date->increment(IL_CAL_DAY, 1);
96 break;
97
99 $end_date->increment(IL_CAL_WEEK, 1);
100 break;
101
103 $end_date->increment(IL_CAL_MONTH, 1);
104 break;
105
107 $end_date->increment(IL_CAL_MONTH, 6);
108 break;
109 }
110 $this->period_end_day = $end_date->get(IL_CAL_DATE);
111 }
const IL_CAL_WEEK
const IL_CAL_MONTH

References ilCalendarViewGUI\$seed, IL_CAL_DATE, IL_CAL_DAY, IL_CAL_MONTH, IL_CAL_WEEK, PERIOD_DAY, PERIOD_HALF_YEAR, PERIOD_MONTH, and PERIOD_WEEK.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ initPeriod()

ilCalendarAgendaListGUI::initPeriod ( )
protected

Initialises time Period for calendar list view.

Definition at line 68 of file class.ilCalendarAgendaListGUI.php.

69 {
70 global $DIC;
71
72 $cal_setting = ilCalendarSettings::_getInstance();
73
74 $qp = $DIC->http()->request()->getQueryParams();
75 if ((int) $qp["cal_agenda_per"] > 0 && (int) $qp["cal_agenda_per"] <= 4) {
76 $this->period = $qp["cal_agenda_per"];
77 } elseif (!empty($this->user->getPref('cal_list_view'))) {
78 $this->period = intval($this->user->getPref('cal_list_view'));
79 } else {
80 $this->period = $cal_setting->getDefaultPeriod();
81 }
82
83 $this->user->writePref('cal_list_view', $this->period);
84 }

References $DIC, ilCalendarSettings\_getInstance(), and user().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilCalendarAgendaListGUI::$ctrl
protected

Definition at line 22 of file class.ilCalendarAgendaListGUI.php.

◆ $lng

ilCalendarAgendaListGUI::$lng
protected

Definition at line 32 of file class.ilCalendarAgendaListGUI.php.

◆ $period

ilCalendarAgendaListGUI::$period = self::PERIOD_WEEK
protected

Definition at line 37 of file class.ilCalendarAgendaListGUI.php.

Referenced by getHTML(), and getPeriod().

◆ $period_end_day

ilCalendarAgendaListGUI::$period_end_day = null
protected

Definition at line 42 of file class.ilCalendarAgendaListGUI.php.

◆ $user

ilCalendarAgendaListGUI::$user
protected

Definition at line 27 of file class.ilCalendarAgendaListGUI.php.

◆ PERIOD_DAY

◆ PERIOD_HALF_YEAR

◆ PERIOD_MONTH

◆ PERIOD_WEEK


The documentation for this class was generated from the following file: