ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ilEmployeeTalkAppointmentGUI Class Reference

Class ilEmployeeTalkAppointmentGUI. More...

+ Inheritance diagram for ilEmployeeTalkAppointmentGUI:
+ Collaboration diagram for ilEmployeeTalkAppointmentGUI:

Public Member Functions

 __construct (ilGlobalTemplateInterface $template, ilLanguage $language, ilCtrl $ctrl, HttpServices $http, Refinery $refinery, ilTabsGUI $tabs, NotificationHandlerInterface $notif_handler, ilTree $tree, ilObjEmployeeTalk $talk)
 
 executeCommand ()
 
 executeCommand ()
 

Data Fields

const string EDIT_MODE_APPOINTMENT = 'appointment'
 
const string EDIT_MODE_SERIES = 'series'
 
const string EDIT_MODE = 'edit-mode'
 

Protected Member Functions

 getPendingTalkDates ()
 

Protected Attributes

NotificationHandlerInterface $notif_handler
 

Private Member Functions

 executeSeriesCommand (string $cmd)
 
 executeAppointmentCommand (string $cmd)
 
 editSeries ()
 
 updateSeries ()
 
 initTalkEditForm (?EmployeeTalk $employeeTalk=null)
 
 initSeriesEditForm (?EmployeeTalk $employeeTalk=null)
 
 editAppointment ()
 
 sendNotification (ilObjEmployeeTalk ... $talks)
 
 editMode ()
 
 getEditModeParameter (string $mode)
 
 loadRecurrenceSettings (ilPropertyFormGUI $form)
 
 getPendingTalksInSeries (ilObjEmployeeTalkSeries $series)
 
 deleteTalks (array $talks)
 

Private Attributes

ilGlobalTemplateInterface $template
 
ilLanguage $language
 
ilCtrl $ctrl
 
HttpServices $http
 
Refinery $refinery
 
ilTabsGUI $tabs
 
ilTree $tree
 
ilObjEmployeeTalk $talk
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilEmployeeTalkAppointmentGUI::__construct ( ilGlobalTemplateInterface  $template,
ilLanguage  $language,
ilCtrl  $ctrl,
HttpServices  $http,
Refinery  $refinery,
ilTabsGUI  $tabs,
NotificationHandlerInterface  $notif_handler,
ilTree  $tree,
ilObjEmployeeTalk  $talk 
)

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

62 {
63 $this->template = $template;
64 $this->language = $language;
65 $this->ctrl = $ctrl;
66 $this->http = $http;
67 $this->refinery = $refinery;
68 $this->tabs = $tabs;
69 $this->notif_handler = $notif_handler;
70 $this->tree = $tree;
71 $this->talk = $talk;
72
73 $this->language->loadLanguageModule('cal');
74 }
static http()
Fetches the global http state from ILIAS.

References $ctrl, $http, $language, $notif_handler, $refinery, $tabs, $talk, $template, $tree, ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\UI\examples\Symbol\Glyph\Language\language(), ILIAS\Repository\refinery(), and ILIAS\Repository\tabs().

+ Here is the call graph for this function:

Member Function Documentation

◆ deleteTalks()

ilEmployeeTalkAppointmentGUI::deleteTalks ( array  $talks)
private
Parameters
ilObjEmployeeTalk[]$talks

Definition at line 537 of file class.ilEmployeeTalkAppointmentGUI.php.

537 : void
538 {
539 foreach ($talks as $talk) {
540 $ref_id = $talk->getRefId();
541 $node_data = $this->tree->getNodeData($talk->getRefId());
542 $talk->delete();
543 $this->tree->deleteNode($node_data['tree'], $ref_id);
544 }
545 }
delete()
delete object or referenced object (in the case of a referenced object, object data is only deleted i...

References $talk, ilObject\delete(), and ilObject\getRefId().

Referenced by updateSeries().

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

◆ editAppointment()

ilEmployeeTalkAppointmentGUI::editAppointment ( )
private

Definition at line 267 of file class.ilEmployeeTalkAppointmentGUI.php.

267 : void
268 {
269 $form = $this->initTalkEditForm($this->talk->getData());
270
271 $this->template->setContent($form->getHTML());
272 }
initTalkEditForm(?EmployeeTalk $employeeTalk=null)

References initTalkEditForm().

Referenced by executeAppointmentCommand().

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

◆ editMode()

ilEmployeeTalkAppointmentGUI::editMode ( )
private

Definition at line 321 of file class.ilEmployeeTalkAppointmentGUI.php.

321 : string
322 {
323 $mode = '';
324 if ($this->http->wrapper()->query()->has(self::EDIT_MODE)) {
325 $mode = $this->http->wrapper()->query()->retrieve(
326 self::EDIT_MODE,
327 $this->refinery->kindlyTo()->string()
328 );
329 }
330 if ($mode === self::EDIT_MODE_SERIES || $mode === self::EDIT_MODE_APPOINTMENT) {
331 return $mode;
332 }
333 return 'invalid';
334 }

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by executeCommand().

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

◆ editSeries()

ilEmployeeTalkAppointmentGUI::editSeries ( )
private

Definition at line 138 of file class.ilEmployeeTalkAppointmentGUI.php.

138 : void
139 {
140 if (($dates_string = $this->getPendingTalkDates()) !== '') {
141 $message = $this->language->txt('pending_talks_warning');
142 $this->template->setOnScreenMessage('info', $message . $dates_string);
143 }
144 $form = $this->initSeriesEditForm($this->talk->getData());
145
146 $this->template->setContent($form->getHTML());
147 }
initSeriesEditForm(?EmployeeTalk $employeeTalk=null)

References $message, getPendingTalkDates(), initSeriesEditForm(), and ILIAS\UI\examples\Symbol\Glyph\Language\language().

Referenced by executeSeriesCommand().

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

◆ executeAppointmentCommand()

ilEmployeeTalkAppointmentGUI::executeAppointmentCommand ( string  $cmd)
private

Definition at line 124 of file class.ilEmployeeTalkAppointmentGUI.php.

124 : void
125 {
126 $this->template->setTitle($this->language->txt('etal_date_appointment_edit'));
127
128 switch ($cmd) {
129 case ControlFlowCommand::UPDATE_INDEX:
130 $this->editAppointment();
131 return;
132 case ControlFlowCommand::UPDATE:
133 $this->updateAppointment();
134 return;
135 }
136 }

References editAppointment(), and ILIAS\UI\examples\Symbol\Glyph\Language\language().

Referenced by executeCommand().

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

◆ executeCommand()

ilEmployeeTalkAppointmentGUI::executeCommand ( )

Implements ILIAS\EmployeeTalk\UI\ControlFlowCommandHandler.

Definition at line 76 of file class.ilEmployeeTalkAppointmentGUI.php.

76 : void
77 {
78 $cmd = $this->ctrl->getCmd(ControlFlowCommand::DEFAULT);
79 if ($this->http->wrapper()->query()->has('ref_id')) {
80 $ref_id = $this->http->wrapper()->query()->retrieve(
81 'ref_id',
82 $this->refinery->kindlyTo()->int()
83 );
84 } else {
86 'No ref_id found'
87 );
88 }
89
90 $backClass = strtolower(ilObjEmployeeTalkGUI::class);
91 $this->ctrl->setParameterByClass($backClass, 'ref_id', $ref_id);
92 $this->tabs->setBackTarget(
93 $this->language->txt('back'),
94 $this->ctrl->getLinkTargetByClass(strtolower(ilObjEmployeeTalkGUI::class), ControlFlowCommand::UPDATE)
95 );
96
97 switch ($this->editMode()) {
99 $this->executeSeriesCommand($cmd);
100 break;
102 $this->executeAppointmentCommand($cmd);
103 break;
104 default:
105 $this->ctrl->redirectByClass(strtolower(ilObjEmployeeTalkGUI::class), ControlFlowCommand::UPDATE);
106 break;
107 }
108 }

References ILIAS\Repository\ctrl(), ILIAS\Forum\Notification\DEFAULT, EDIT_MODE_APPOINTMENT, EDIT_MODE_SERIES, editMode(), executeAppointmentCommand(), executeSeriesCommand(), ILIAS\FileDelivery\http(), ILIAS\UI\examples\Symbol\Glyph\Language\language(), ILIAS\Repository\refinery(), and ILIAS\Repository\tabs().

+ Here is the call graph for this function:

◆ executeSeriesCommand()

ilEmployeeTalkAppointmentGUI::executeSeriesCommand ( string  $cmd)
private

Definition at line 110 of file class.ilEmployeeTalkAppointmentGUI.php.

110 : void
111 {
112 $this->template->setTitle($this->language->txt('etal_date_series_edit'));
113
114 switch ($cmd) {
115 case ControlFlowCommand::UPDATE_INDEX:
116 $this->editSeries();
117 return;
118 case ControlFlowCommand::UPDATE:
119 $this->updateSeries();
120 return;
121 }
122 }

References editSeries(), ILIAS\UI\examples\Symbol\Glyph\Language\language(), and updateSeries().

Referenced by executeCommand().

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

◆ getEditModeParameter()

ilEmployeeTalkAppointmentGUI::getEditModeParameter ( string  $mode)
private

Definition at line 336 of file class.ilEmployeeTalkAppointmentGUI.php.

336 : string
337 {
338 return '&' . ilEmployeeTalkAppointmentGUI::EDIT_MODE . '=' . $mode;
339 }

References EDIT_MODE.

Referenced by initSeriesEditForm(), initTalkEditForm(), and updateSeries().

+ Here is the caller graph for this function:

◆ getPendingTalkDates()

ilEmployeeTalkAppointmentGUI::getPendingTalkDates ( )
protected

Definition at line 149 of file class.ilEmployeeTalkAppointmentGUI.php.

149 : string
150 {
151 $parent = $this->talk->getParent();
152 $talks = $this->getPendingTalksInSeries($parent);
153
154 usort($talks, function (ilObjEmployeeTalk $a, ilObjEmployeeTalk $b) {
155 $a = $a->getData()->getStartDate()->getUnixTime();
156 $b = $b->getData()->getStartDate()->getUnixTime();
157 if ($a === $b) {
158 return 0;
159 }
160 return $a < $b ? -1 : 1;
161 });
162
163 $dates = '';
166 foreach ($talks as $talk) {
167 $dates .= "</br>" . ilDatePresentation::formatDate($talk->getData()->getStartDate());
168 }
170 return $dates;
171 }
static setUseRelativeDates(bool $a_status)
set use relative dates
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
getPendingTalksInSeries(ilObjEmployeeTalkSeries $series)
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples

References Vendor\Package\$a, Vendor\Package\$b, $talk, ilDatePresentation\formatDate(), ilObjEmployeeTalk\getData(), getPendingTalksInSeries(), ilDatePresentation\setUseRelativeDates(), and ilDatePresentation\useRelativeDates().

Referenced by editSeries().

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

◆ getPendingTalksInSeries()

ilEmployeeTalkAppointmentGUI::getPendingTalksInSeries ( ilObjEmployeeTalkSeries  $series)
private
Returns
ilObjEmployeeTalk[]

Definition at line 514 of file class.ilEmployeeTalkAppointmentGUI.php.

514 : array
515 {
516 $talks = [];
517 $subItems = $series->getSubItems()['_all'];
518
519 foreach ($subItems as $subItem) {
520 if ($subItem['type'] === 'etal') {
521 $refId = intval($subItem['ref_id']);
522 $talk = new ilObjEmployeeTalk($refId, true);
523 $talk_data = $talk->getData();
524 if ($talk_data->isStandalone() || $talk_data->isCompleted()) {
525 continue;
526 }
527 $talks[] = $talk;
528 }
529 }
530
531 return $talks;
532 }
getSubItems(bool $a_admin_panel_enabled=false, bool $a_include_side_block=false, int $a_get_single=0, ?ilContainerUserFilter $container_user_filter=null)
$refId
Definition: xapitoken.php:58

References $refId, $talk, ilObjEmployeeTalk\getData(), and ilContainer\getSubItems().

Referenced by getPendingTalkDates(), and updateSeries().

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

◆ initSeriesEditForm()

ilEmployeeTalkAppointmentGUI::initSeriesEditForm ( ?EmployeeTalk  $employeeTalk = null)
private

Definition at line 226 of file class.ilEmployeeTalkAppointmentGUI.php.

227 {
228 $form = new ilPropertyFormGUI();
230 $form->setFormAction($this->ctrl->getFormActionByClass(
231 strtolower(self::class)
232 ) . $editMode);
233
234 $header = new ilFormSectionHeaderGUI();
235 $header->setTitle($this->language->txt('appointments'));
236 $form->addItem($header);
237
238 $dur = new ilDateDurationInputGUI($this->language->txt('cal_fullday'), 'event');
239 $dur->setRequired(true);
240 $dur->setShowTime(true);
241
242 if ($employeeTalk !== null) {
243 $dur->enableToggleFullTime(
244 $this->language->txt('cal_fullday_title'),
245 $employeeTalk->isAllDay()
246 );
247
248 $dur->setStart($employeeTalk->getStartDate());
249 $dur->setEnd($employeeTalk->getEndDate());
250 }
251
252 $form->addItem($dur);
253
254 // Recurrence
255 $cal = new ilRecurrenceInputGUI($this->language->txt('cal_recurrences'), "frequence");
256 $event = new ilCalendarRecurrence();
257
258 $cal->allowUnlimitedRecurrences(false);
259 $cal->setRecurrence($event);
260
261 $form->addItem($cal);
262 $form->addCommandButton(ControlFlowCommand::UPDATE, $this->language->txt('save'), 'etal_series_save');
263
264 return $form;
265 }
Model of calendar entry recurrcences based on iCalendar-RFC-5545.
input GUI for a time span (start and end date)
This class represents a section header in a property form.
This class represents a property form user interface.
This class represents an input GUI for recurring events/appointments (course events or calendar appoi...

References ILIAS\Repository\ctrl(), EDIT_MODE_SERIES, getEditModeParameter(), and ILIAS\UI\examples\Symbol\Glyph\Language\language().

Referenced by editSeries(), and updateSeries().

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

◆ initTalkEditForm()

ilEmployeeTalkAppointmentGUI::initTalkEditForm ( ?EmployeeTalk  $employeeTalk = null)
private

Definition at line 194 of file class.ilEmployeeTalkAppointmentGUI.php.

195 {
196 $form = new ilPropertyFormGUI();
198 $form->setFormAction($this->ctrl->getFormActionByClass(
199 strtolower(self::class)
200 ) . $editMode);
201
202 $header = new ilFormSectionHeaderGUI();
203 $header->setTitle($this->language->txt('appointment'));
204 $form->addItem($header);
205
206 $dur = new ilDateDurationInputGUI($this->language->txt('cal_fullday'), 'event');
207 $dur->setRequired(true);
208 $dur->setShowTime(true);
209
210 if ($employeeTalk !== null) {
211 $dur->enableToggleFullTime(
212 $this->language->txt('cal_fullday_title'),
213 $employeeTalk->isAllDay()
214 );
215
216 $dur->setStart($employeeTalk->getStartDate());
217 $dur->setEnd($employeeTalk->getEndDate());
218 }
219
220 $form->addItem($dur);
221 $form->addCommandButton(ControlFlowCommand::UPDATE, $this->language->txt('save'), 'etal_date_save');
222
223 return $form;
224 }

References ILIAS\Repository\ctrl(), EDIT_MODE_APPOINTMENT, getEditModeParameter(), and ILIAS\UI\examples\Symbol\Glyph\Language\language().

Referenced by editAppointment().

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

◆ loadRecurrenceSettings()

ilEmployeeTalkAppointmentGUI::loadRecurrenceSettings ( ilPropertyFormGUI  $form)
private

Definition at line 341 of file class.ilEmployeeTalkAppointmentGUI.php.

342 {
343 $rec = new ilCalendarRecurrence();
344
345 switch ($form->getInput('frequence')) {
347 $rec->setFrequenceType($form->getInput('frequence'));
348 $rec->setInterval((int) $form->getInput('count_DAILY'));
349 break;
350
352 $rec->setFrequenceType($form->getInput('frequence'));
353 $rec->setInterval((int) $form->getInput('count_WEEKLY'));
354 if (is_array($form->getInput('byday_WEEKLY'))) {
355 $rec->setBYDAY(ilUtil::stripSlashes(implode(',', $form->getInput('byday_WEEKLY'))));
356 }
357 break;
358
360 $rec->setFrequenceType($form->getInput('frequence'));
361 $rec->setInterval((int) $form->getInput('count_MONTHLY'));
362 switch ((int) $form->getInput('subtype_MONTHLY')) {
363 case 0:
364 // nothing to do;
365 break;
366
367 case 1:
368 switch ((int) $form->getInput('monthly_byday_day')) {
369 case 8:
370 // Weekday
371 $rec->setBYSETPOS($form->getInput('monthly_byday_num'));
372 $rec->setBYDAY('MO,TU,WE,TH,FR');
373 break;
374
375 case 9:
376 // Day of month
377 $rec->setBYMONTHDAY($form->getInput('monthly_byday_num'));
378 break;
379
380 default:
381 $rec->setBYDAY(($form->getInput('monthly_byday_num') . $form->getInput('monthly_byday_day')));
382 break;
383 }
384 break;
385
386 case 2:
387 $rec->setBYMONTHDAY($form->getInput('monthly_bymonthday'));
388 break;
389 }
390 break;
391
393 $rec->setFrequenceType($form->getInput('frequence'));
394 $rec->setInterval((int) $form->getInput('count_YEARLY'));
395 switch ((int) $form->getInput('subtype_YEARLY')) {
396 case 0:
397 // nothing to do;
398 break;
399
400 case 1:
401 $rec->setBYMONTH($form->getInput('yearly_bymonth_byday'));
402 $rec->setBYDAY(($form->getInput('yearly_byday_num') . $form->getInput('yearly_byday')));
403 break;
404
405 case 2:
406 $rec->setBYMONTH($form->getInput('yearly_bymonth_by_monthday'));
407 $rec->setBYMONTHDAY($form->getInput('yearly_bymonthday'));
408 break;
409 }
410 break;
411 }
412
413 // UNTIL
414 switch ((int) $form->getInput('until_type')) {
415 case 1:
416 $rec->setFrequenceUntilDate(null);
417 // nothing to do
418 break;
419
420 case 2:
421 $rec->setFrequenceUntilDate(null);
422 $rec->setFrequenceUntilCount((int) $form->getInput('count'));
423 break;
424
425 case 3:
426 $frequence = $form->getItemByPostVar('frequence');
427 $end = $frequence->getRecurrence()->getFrequenceUntilDate();
428 $rec->setFrequenceUntilCount(0);
429 $rec->setFrequenceUntilDate($end);
430 break;
431 }
432
433 return $rec;
434 }
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
getItemByPostVar(string $a_post_var)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")

References ilCalendarRecurrence\FREQ_DAILY, ilCalendarRecurrence\FREQ_MONTHLY, ilCalendarRecurrence\FREQ_WEEKLY, ilCalendarRecurrence\FREQ_YEARLY, ilPropertyFormGUI\getInput(), ilPropertyFormGUI\getItemByPostVar(), and ilUtil\stripSlashes().

Referenced by updateSeries().

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

◆ sendNotification()

ilEmployeeTalkAppointmentGUI::sendNotification ( ilObjEmployeeTalk ...  $talks)
private

Definition at line 316 of file class.ilEmployeeTalkAppointmentGUI.php.

316 : void
317 {
318 $this->notif_handler->send(NotificationType::UPDATE, ...$talks);
319 }

◆ updateSeries()

ilEmployeeTalkAppointmentGUI::updateSeries ( )
private

Definition at line 173 of file class.ilEmployeeTalkAppointmentGUI.php.

173 : void
174 {
175 $form = $this->initSeriesEditForm();
176 if ($form->checkInput()) {
177 $reoccurrence = $this->loadRecurrenceSettings($form);
178 $parent = $this->talk->getParent();
179 $old_talks = $this->getPendingTalksInSeries($parent);
180 $this->createRecurringTalks($form, $reoccurrence, $parent);
181 $this->deleteTalks($old_talks);
182
183 $this->template->setOnScreenMessage('success', $this->language->txt('saved_successfully'), true);
184 }
185
186 $this->ctrl->redirectToURL(
187 $this->ctrl->getLinkTargetByClass(
188 strtolower(ilEmployeeTalkMyStaffListGUI::class),
189 ControlFlowCommand::UPDATE_INDEX
191 );
192 }

References ILIAS\Repository\ctrl(), deleteTalks(), EDIT_MODE_SERIES, getEditModeParameter(), getPendingTalksInSeries(), initSeriesEditForm(), ILIAS\UI\examples\Symbol\Glyph\Language\language(), and loadRecurrenceSettings().

Referenced by executeSeriesCommand().

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

Field Documentation

◆ $ctrl

ilCtrl ilEmployeeTalkAppointmentGUI::$ctrl
private

Definition at line 44 of file class.ilEmployeeTalkAppointmentGUI.php.

Referenced by __construct().

◆ $http

HttpServices ilEmployeeTalkAppointmentGUI::$http
private

Definition at line 45 of file class.ilEmployeeTalkAppointmentGUI.php.

Referenced by __construct().

◆ $language

ilLanguage ilEmployeeTalkAppointmentGUI::$language
private

Definition at line 43 of file class.ilEmployeeTalkAppointmentGUI.php.

Referenced by __construct().

◆ $notif_handler

NotificationHandlerInterface ilEmployeeTalkAppointmentGUI::$notif_handler
protected

Definition at line 48 of file class.ilEmployeeTalkAppointmentGUI.php.

Referenced by __construct().

◆ $refinery

Refinery ilEmployeeTalkAppointmentGUI::$refinery
private

Definition at line 46 of file class.ilEmployeeTalkAppointmentGUI.php.

Referenced by __construct().

◆ $tabs

ilTabsGUI ilEmployeeTalkAppointmentGUI::$tabs
private

Definition at line 47 of file class.ilEmployeeTalkAppointmentGUI.php.

Referenced by __construct().

◆ $talk

ilObjEmployeeTalk ilEmployeeTalkAppointmentGUI::$talk
private

◆ $template

ilGlobalTemplateInterface ilEmployeeTalkAppointmentGUI::$template
private

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

Referenced by __construct().

◆ $tree

ilTree ilEmployeeTalkAppointmentGUI::$tree
private

Definition at line 49 of file class.ilEmployeeTalkAppointmentGUI.php.

Referenced by __construct().

◆ EDIT_MODE

const string ilEmployeeTalkAppointmentGUI::EDIT_MODE = 'edit-mode'

◆ EDIT_MODE_APPOINTMENT

const string ilEmployeeTalkAppointmentGUI::EDIT_MODE_APPOINTMENT = 'appointment'

◆ EDIT_MODE_SERIES

const string ilEmployeeTalkAppointmentGUI::EDIT_MODE_SERIES = 'series'

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