19 declare(strict_types=1);
30 public function __construct(
object $a_parent_obj,
string $a_parent_cmd,
int $a_category_id)
35 $this->cat_id = $a_category_id;
36 $this->is_editable = $this->categories->isEditable($this->cat_id);
38 $this->
setId(
'calcalapps');
41 $this->
lng->loadLanguageModule(
'dateplaner');
45 $this->
addColumn($this->
lng->txt(
'cal_start'),
'dt_sort',
"30%");
46 $this->
addColumn($this->
lng->txt(
'title'),
'title',
"60%");
47 $this->
addColumn($this->
lng->txt(
'cal_duration'),
'duration',
"20%");
48 $this->
addColumn($this->
lng->txt(
'cal_recurrences'),
'frequence',
"10%");
50 if ($this->is_editable) {
52 $this->
enable(
'select_all');
58 $this->
setRowTemplate(
"tpl.show_appointment_row.html",
"components/ILIAS/Calendar");
69 protected function fillRow(array $a_set): void
71 if ($a_set[
'deletable']) {
72 $this->tpl->setVariable(
'VAL_ID', $a_set[
'id']);
75 $this->tpl->setVariable(
'VAL_DESCRIPTION', $a_set[
'description']);
77 $this->tpl->setVariable(
'VAL_TITLE_LINK', $a_set[
'title']);
78 $this->
ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id', $a_set[
'id']);
79 $this->tpl->setVariable(
'VAL_LINK', $this->
ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'edit'));
81 switch ($a_set[
'frequence']) {
83 $this->tpl->setVariable(
'VAL_FREQUENCE', $this->
lng->txt(
'cal_daily'));
87 $this->tpl->setVariable(
'VAL_FREQUENCE', $this->
lng->txt(
'cal_weekly'));
91 $this->tpl->setVariable(
'VAL_FREQUENCE', $this->
lng->txt(
'cal_monthly'));
95 $this->tpl->setVariable(
'VAL_FREQUENCE', $this->
lng->txt(
'cal_yearly'));
100 $this->tpl->setVariable(
'VAL_FREQUENCE',
'');
103 $this->tpl->setVariable(
'VAL_BEGIN', $a_set[
'dt']);
104 if ($a_set[
'duration']) {
107 $this->tpl->setVariable(
'VAL_DURATION',
'');
120 foreach ($a_apps as $cal_entry_id) {
129 $title = $entry->getTitle();
130 if ($book->isOwner()) {
131 $max = $book->getNumberOfBookings();
132 $current = $book->getCurrentNumberOfBookings($entry->getEntryId());
134 $title .=
' (' . $current .
'/' . $max .
')';
135 } elseif ($current == $max) {
136 $title .=
' (' . $this->
lng->txt(
'cal_booked_out') .
')';
138 $title .=
' (' . $this->
lng->txt(
'cal_book_free') .
')';
140 } elseif ($book->hasBooked($entry->getEntryId())) {
141 $title .=
' (' . $this->
lng->txt(
'cal_date_booked') .
')';
145 $title = $entry->getPresentationTitle();
148 $tmp_arr[
'id'] = $entry->getEntryId();
149 $tmp_arr[
'title'] =
$title;
150 $tmp_arr[
'description'] = $entry->getDescription();
151 $tmp_arr[
'fullday'] = $entry->isFullday();
152 $tmp_arr[
'begin'] = $entry->getStart()->get(
IL_CAL_UNIX);
153 $tmp_arr[
'end'] = $entry->getEnd()->get(
IL_CAL_UNIX);
155 $tmp_arr[
'dt_sort'] = $entry->getStart()->get(
IL_CAL_UNIX);
161 $tmp_arr[
'duration'] = $tmp_arr[
'end'] - $tmp_arr[
'begin'];
162 if ($tmp_arr[
'fullday']) {
163 $tmp_arr[
'duration'] += (60 * 60 * 24);
166 if (!$tmp_arr[
'fullday'] and $tmp_arr[
'end'] == $tmp_arr[
'begin']) {
167 $tmp_arr[
'duration'] =
'';
169 $tmp_arr[
'frequence'] = $rec->getFrequenceType();
172 $appointments[] = $tmp_arr;
class for calendar categories
ilCalendarCategories $categories
enable(string $a_module_name)
setFormAction(string $a_form_action, bool $a_multipart=false)
static _getFirstRecurrence($a_cal_id)
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
Stores calendar categories.
setFormName(string $a_name="")
static secondsToString(int $seconds, bool $force_with_seconds=false, ?ilLanguage $a_lng=null)
converts seconds to string: Long: 7 days 4 hour(s) ...
setShowRowsSelector(bool $a_value)
Toggle rows-per-page selector.
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
__construct(object $a_parent_obj, string $a_parent_cmd, int $a_category_id)
static _getInstance($a_usr_id=0)
get singleton instance
__construct(Container $dic, ilPlugin $plugin)
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)
disable(string $a_module_name)
setAppointments(array $a_apps)
set appointments
addMultiCommand(string $a_cmd, string $a_text)
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false, ?ilObjUser $user=null)
Format a period of two dates Shows: 14.