ILIAS  trunk Revision v12.0_alpha-1540-g00f839d5fa1
class.ilCalendarChangedAppointmentsTableGUI.php
Go to the documentation of this file.
1<?php
2
25{
26 private int $cat_id = 0;
27 private bool $is_editable = false;
29
30 public function __construct(?object $a_parent_obj, string $a_parent_cmd)
31 {
32 global $DIC;
33
34 $this->user = $DIC->user();
35 $this->lng = $DIC->language();
36 $this->lng->loadLanguageModule('dateplaner');
37 $this->ctrl = $DIC->ctrl();
38
39 $this->setId('calinbox');
40
41 parent::__construct($a_parent_obj, $a_parent_cmd);
42 $this->setFormName('appointments');
43 $this->addColumn($this->lng->txt('date'), 'begin', "30%");
44 $this->addColumn($this->lng->txt('title'), 'title', "40%");
45 #$this->addColumn($this->lng->txt('cal_duration'),'duration',"15%");
46 $this->addColumn($this->lng->txt('cal_recurrences'), 'frequence', "15%");
47 $this->addColumn($this->lng->txt('last_update'), 'last_update', "15%");
48
49 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
50 $this->setRowTemplate("tpl.show_changed_appointment_row.html", "components/ILIAS/Calendar");
51
52 $this->setShowRowsSelector(true);
53 $this->enable('sort');
54 $this->enable('header');
55 $this->enable('numinfo');
56
57 $this->setDefaultOrderField('begin');
58 $this->setDefaultOrderDirection('asc');
59 }
60
61 protected function fillRow(array $a_set): void
62 {
63 $this->tpl->setVariable('VAL_DESCRIPTION', $a_set['description']);
64
65 $this->tpl->setVariable('VAL_TITLE_LINK', $a_set['title']);
66 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_set['id']);
67 $this->tpl->setVariable('VAL_LINK', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'edit'));
68
69 switch ($a_set['frequence']) {
71 $this->tpl->setVariable('VAL_FREQUENCE', $this->lng->txt('cal_daily'));
72 break;
73
75 $this->tpl->setVariable('VAL_FREQUENCE', $this->lng->txt('cal_weekly'));
76 break;
77
79 $this->tpl->setVariable('VAL_FREQUENCE', $this->lng->txt('cal_monthly'));
80 break;
81
83 $this->tpl->setVariable('VAL_FREQUENCE', $this->lng->txt('cal_yearly'));
84 break;
85
86 default:
87 #$this->tpl->setVariable('VAL_FREQUENCE',$this->lng->txt('cal_no_recurrence'));
88 break;
89 }
90 if ($a_set['fullday']) {
92 new ilDate($a_set['begin'], IL_CAL_UNIX),
93 new ilDate($a_set['end'], IL_CAL_UNIX)
94 );
95 } else {
97 new ilDateTime($a_set['begin'], IL_CAL_UNIX),
98 new ilDateTime($a_set['end'], IL_CAL_UNIX)
99 );
100 }
101 $this->tpl->setVariable('VAL_BEGIN', $date);
102 $update = new ilDateTime($a_set['last_update'], IL_CAL_UNIX, $this->user->getTimeZone());
103 $this->tpl->setVariable('VAL_LAST_UPDATE', ilDatePresentation::formatDate($update));
104 }
105
106 public function setAppointments(array $a_apps): void
107 {
108 $appointments = [];
109 foreach ($a_apps as $event) {
110 $entry = $event['event'];
111
112 $rec = ilCalendarRecurrences::_getFirstRecurrence($entry->getEntryId());
113
114 $tmp_arr['id'] = $entry->getEntryId();
115 $tmp_arr['title'] = $entry->getPresentationTitle();
116 $tmp_arr['description'] = $entry->getDescription();
117 $tmp_arr['fullday'] = $entry->isFullday();
118
119 $tmp_arr['begin'] = $event['dstart'];
120 $tmp_arr['end'] = $event['dend'];
121
122 $tmp_arr['duration'] = $tmp_arr['end'] - $tmp_arr['begin'];
123 if ($tmp_arr['fullday']) {
124 $tmp_arr['duration'] += (60 * 60 * 24);
125 }
126 if (!$tmp_arr['fullday'] and $tmp_arr['end'] == $tmp_arr['begin']) {
127 $tmp_arr['duration'] = '';
128 }
129
130 $tmp_arr['last_update'] = $entry->getLastUpdate()->get(IL_CAL_UNIX);
131 $tmp_arr['frequence'] = $rec->getFrequenceType();
132
133 $appointments[] = $tmp_arr;
134 }
135
136 //cuts appointments array after Limit
137 $appointments = array_slice($appointments, 0, $this->getLimit());
138 $this->setData($appointments);
139 }
140}
const IL_CAL_UNIX
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(?object $a_parent_obj, string $a_parent_cmd)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false, ?ilObjUser $user=null)
Format a period of two dates Shows: 14.
@classDescription Date and time handling
Class for single dates.
User class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setShowRowsSelector(bool $a_value)
Toggle rows-per-page selector.
setFormName(string $a_name="")
setFormAction(string $a_form_action, bool $a_multipart=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
setDefaultOrderDirection(string $a_defaultorderdirection)
setData(array $a_data)
Set table data.
enable(string $a_module_name)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26