3 declare(strict_types=1);
78 $this->
language->loadLanguageModule(
'cal');
84 if ($this->
http->wrapper()->query()->has(
'ref_id')) {
85 $ref_id = $this->
http->wrapper()->query()->retrieve(
95 $backClass = strtolower(ilObjEmployeeTalkGUI::class);
96 $this->controlFlow->setParameterByClass($backClass,
'ref_id',
$ref_id);
97 $this->
tabs->setBackTarget(
99 $this->controlFlow->getLinkTargetByClass(strtolower(ilObjEmployeeTalkGUI::class), ControlFlowCommand::UPDATE)
103 case self::EDIT_MODE_SERIES:
106 case self::EDIT_MODE_APPOINTMENT:
110 $this->controlFlow->redirectByClass(strtolower(ilObjEmployeeTalkGUI::class), ControlFlowCommand::UPDATE);
117 $this->
template->setTitle($this->
language->txt(
'etal_date_series_edit'));
120 case ControlFlowCommand::UPDATE_INDEX:
123 case ControlFlowCommand::UPDATE:
133 $this->
template->setTitle($this->
language->txt(
'etal_date_appointment_edit'));
136 case ControlFlowCommand::UPDATE_INDEX:
139 case ControlFlowCommand::UPDATE:
140 $this->updateAppointment();
151 $this->
template->setOnScreenMessage(
'info',
$message . $dates_string);
155 $this->
template->setContent($form->getHTML());
160 $parent = $this->talk->getParent();
164 $a = $a->
getData()->getStartDate()->getUnixTime();
165 $b = $b->
getData()->getStartDate()->getUnixTime();
169 return $a < $b ? -1 : 1;
175 foreach ($talks as $talk) {
185 if ($form->checkInput()) {
187 $parent = $this->talk->getParent();
189 $this->createRecurringTalks($form, $reoccurrence, $parent);
192 $this->
template->setOnScreenMessage(
'success', $this->
language->txt(
'saved_successfully'),
true);
195 $this->controlFlow->redirectToURL(
196 $this->controlFlow->getLinkTargetByClass(
197 strtolower(ilEmployeeTalkMyStaffListGUI::class),
198 ControlFlowCommand::UPDATE_INDEX
207 $form->setFormAction($this->controlFlow->getFormActionByClass(
208 strtolower(self::class)
212 $header->setTitle($this->
language->txt(
'appointment'));
213 $form->addItem($header);
216 $dur->setRequired(
true);
217 $dur->setShowTime(
true);
219 if ($employeeTalk !== null) {
220 $dur->enableToggleFullTime(
221 $this->
language->txt(
'cal_fullday_title'),
222 $employeeTalk->isAllDay()
225 $dur->setStart($employeeTalk->getStartDate());
226 $dur->setEnd($employeeTalk->getEndDate());
229 $form->addItem($dur);
230 $form->addCommandButton(ControlFlowCommand::UPDATE, $this->
language->txt(
'save'),
'etal_date_save');
239 $form->setFormAction($this->controlFlow->getFormActionByClass(
240 strtolower(self::class)
244 $header->setTitle($this->
language->txt(
'appointments'));
245 $form->addItem($header);
248 $dur->setRequired(
true);
249 $dur->setShowTime(
true);
251 if ($employeeTalk !== null) {
252 $dur->enableToggleFullTime(
253 $this->
language->txt(
'cal_fullday_title'),
254 $employeeTalk->isAllDay()
257 $dur->setStart($employeeTalk->getStartDate());
258 $dur->setEnd($employeeTalk->getEndDate());
261 $form->addItem($dur);
267 $cal->allowUnlimitedRecurrences(
false);
268 $cal->setRecurrence($event);
270 $form->addItem($cal);
271 $form->addCommandButton(ControlFlowCommand::UPDATE, $this->
language->txt(
'save'),
'etal_series_save');
280 $this->
template->setContent($form->getHTML());
283 private function updateAppointment():
void 286 $form->setValuesByPost();
287 if ($form->checkInput()) {
291 $dateTimeInput = $form->getItemByPostVar(
'event');
292 $tgl = $form->getInput(
'event')[
'tgl'] ?? 0;
293 [
'start' => $start,
'end' => $end] = $dateTimeInput->getValue();
302 $data = $this->talk->getData();
303 $data->setAllDay(boolval(intval($tgl)));
304 $data->setStartDate($start_date);
305 $data->setEndDate($end_date);
306 $data->setStandalone(
true);
308 $this->talk->setData(
$data);
309 $this->talk->update();
313 $this->
template->setOnScreenMessage(
'success', $this->
language->txt(
'saved_successfully'),
true);
317 $this->controlFlow->redirectToURL(
318 $this->controlFlow->getLinkTargetByClass(
319 strtolower(self::class),
320 ControlFlowCommand::UPDATE_INDEX
327 $this->notif_handler->send(NotificationType::UPDATE, ...$talks);
333 if ($this->
http->wrapper()->query()->has(self::EDIT_MODE)) {
334 $mode = $this->
http->wrapper()->query()->retrieve(
336 $this->
refinery->kindlyTo()->string()
339 if ($mode === self::EDIT_MODE_SERIES || $mode === self::EDIT_MODE_APPOINTMENT) {
360 switch ($form->
getInput(
'frequence')) {
362 $rec->setFrequenceType($form->
getInput(
'frequence'));
363 $rec->setInterval((
int) $form->
getInput(
'count_DAILY'));
367 $rec->setFrequenceType($form->
getInput(
'frequence'));
368 $rec->setInterval((
int) $form->
getInput(
'count_WEEKLY'));
369 if (is_array($form->
getInput(
'byday_WEEKLY'))) {
375 $rec->setFrequenceType($form->
getInput(
'frequence'));
376 $rec->setInterval((
int) $form->
getInput(
'count_MONTHLY'));
377 switch ((
int) $form->
getInput(
'subtype_MONTHLY')) {
383 switch ((
int) $form->
getInput(
'monthly_byday_day')) {
386 $rec->setBYSETPOS($form->
getInput(
'monthly_byday_num'));
387 $rec->setBYDAY(
'MO,TU,WE,TH,FR');
392 $rec->setBYMONTHDAY($form->
getInput(
'monthly_byday_num'));
396 $rec->setBYDAY(($form->
getInput(
'monthly_byday_num') . $form->
getInput(
'monthly_byday_day')));
402 $rec->setBYMONTHDAY($form->
getInput(
'monthly_bymonthday'));
408 $rec->setFrequenceType($form->
getInput(
'frequence'));
409 $rec->setInterval((
int) $form->
getInput(
'count_YEARLY'));
410 switch ((
int) $form->
getInput(
'subtype_YEARLY')) {
416 $rec->setBYMONTH($form->
getInput(
'yearly_bymonth_byday'));
417 $rec->setBYDAY(($form->
getInput(
'yearly_byday_num') . $form->
getInput(
'yearly_byday')));
421 $rec->setBYMONTH($form->
getInput(
'yearly_bymonth_by_monthday'));
422 $rec->setBYMONTHDAY($form->
getInput(
'yearly_bymonthday'));
429 switch ((
int) $form->
getInput(
'until_type')) {
431 $rec->setFrequenceUntilDate(null);
436 $rec->setFrequenceUntilDate(null);
437 $rec->setFrequenceUntilCount((
int) $form->
getInput(
'count'));
442 $end = $frequence->getRecurrence()->getFrequenceUntilDate();
443 $rec->setFrequenceUntilCount(0);
444 $rec->setFrequenceUntilDate($end);
462 $data = $this->loadEtalkData($form);
465 $data->getStartDate(),
471 $periodStart = clone
$data->getStartDate();
473 $periodEnd = clone
$data->getStartDate();
475 $dateIterator = $calc->calculateDateList($periodStart, $periodEnd);
481 $talkSession->setTitle($this->talk->getTitle());
482 $talkSession->setDescription($this->talk->getLongDescription());
484 $talkSession->setOwner($series->
getOwner());
485 $talkSession->create();
487 $talkSession->createReference();
488 $talkSession->putInTree($series->
getRefId());
490 $data->setObjectId($talkSession->getId());
491 $talkSession->setData(
$data);
492 $talkSession->update();
495 $talks[] = $talkSession;
503 $dateIterator->removeByDAY($periodStart);
504 $dateIterator->rewind();
509 foreach ($dateIterator as $date) {
510 $cloneObject = $talkSession->cloneObject($series->
getRefId());
511 $cloneData = $cloneObject->getData();
513 $cloneData->setStartDate($date);
515 if ($cloneData->isAllDay()) {
520 $cloneObject->setData($cloneData);
521 $cloneObject->update();
523 $cloneObject->setOwner($series->
getOwner());
524 $cloneObject->updateOwner();
526 $talks[] = $cloneObject;
542 foreach ($subItems as $subItem) {
543 if ($subItem[
'type'] ===
'etal') {
544 $refId = intval($subItem[
'ref_id']);
547 if ($talk_data->isStandalone() || $talk_data->isCompleted()) {
562 foreach ($talks as $talk) {
569 $data = $this->talk->getData();
570 $tgl = $form->
getInput(
'event')[
'tgl'] ?? 0;
576 [
'start' => $start,
'end' => $end] = $dateTimeInput->getValue();
589 boolval(intval($tgl)),
591 $data->getLocation(),
592 $data->getEmployee(),
595 $data->getTemplateId()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(ilGlobalTemplateInterface $template, ilLanguage $language, ilCtrl $controlFlow, HttpServices $http, Refinery $refinery, ilTabsGUI $tabs, NotificationHandlerInterface $notif_handler, ilObjEmployeeTalk $talk)
ilEmployeeTalkAppointmentGUI constructor.
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getPendingTalksInSeries(ilObjEmployeeTalkSeries $series)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
deleteTalks(array $talks)
static useRelativeDates()
getEditModeParameter(string $mode)
const EDIT_MODE_APPOINTMENT
getFrequenceType()
Get Frequence type of recurrence.
loadRecurrenceSettings(ilPropertyFormGUI $form)
load recurrence settings
static http()
Fetches the global http state from ILIAS.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
sendNotification(ilObjEmployeeTalk ... $talks)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
executeAppointmentCommand(string $cmd)
executeSeriesCommand(string $cmd)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
initSeriesEditForm(?EmployeeTalk $employeeTalk=null)
NotificationHandlerInterface $notif_handler
getSubItems(bool $a_admin_panel_enabled=false, bool $a_include_side_block=false, int $a_get_single=0, ilContainerUserFilter $container_user_filter=null)
Class ilEmployeeTalkAppointmentGUI.
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
initTalkEditForm(?EmployeeTalk $employeeTalk=null)
static setUseRelativeDates(bool $a_status)
set use relative dates
ilGlobalTemplateInterface $template
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...