ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilCalendarSharedListTableGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
26{
27 protected int $calendar_id;
28
29 public function __construct(object $parent_obj, string $parent_cmd)
30 {
32
33 $this->setRowTemplate('tpl.calendar_shared_list_row.html', 'components/ILIAS/Calendar');
34 $this->setFormAction($this->ctrl->getFormAction($this->getParentObject()));
35
36 $this->addColumn('', 'id', '1px');
37 $this->addColumn($this->lng->txt('type'), 'type', '1px');
38 $this->addColumn($this->lng->txt('title'), 'title', '80%');
39 $this->addColumn($this->lng->txt('cal_shared_access_table_col'), 'access', '20%');
40
41 $this->addMultiCommand('shareDeassign', $this->lng->txt('cal_unshare_cal'));
42 $this->setPrefix('shared');
43 $this->setSelectAllCheckbox('obj_ids');
44 }
45
49 public function setCalendarId(int $a_calendar_id): void
50 {
51 $this->calendar_id = $a_calendar_id;
52 }
53
57 protected function fillRow(array $a_set): void
58 {
59 $this->tpl->setVariable('VAL_ID', $a_set['obj_id']);
60 $this->tpl->setVariable('NAME', $a_set['title']);
61
62 if (strlen($a_set['description'])) {
63 $this->tpl->setVariable('DESCRIPTION', $a_set['description']);
64 }
65
66 $this->tpl->setVariable('TYPE_IMG', ilUtil::getImagePath('standard/icon_' . $a_set['type'] . '.svg'));
67 $this->tpl->setVariable('ALT_IMG', $this->lng->txt('obj_' . $a_set['type']));
68
69 if ($a_set['writable']) {
70 $this->tpl->setVariable('CAL_ACCESS', $this->lng->txt('cal_shared_access_read_write'));
71 } else {
72 $this->tpl->setVariable('CAL_ACCESS', $this->lng->txt('cal_shared_access_read_only'));
73 }
74 }
75
76 public function parse(): void
77 {
78 $shared = new ilCalendarShared($this->calendar_id);
79 $items = array();
80 foreach ($shared->getShared() as $item) {
81 switch ($item['obj_type']) {
83 $data['type'] = 'usr';
84
85 $name = ilObjUser::_lookupName($item['obj_id']);
86 $data['title'] = $name['lastname'] . ', ' . $name['firstname'];
87 $data['description'] = '';
88 break;
89
91 $data['type'] = 'role';
92 $data['title'] = ilObject::_lookupTitle($item['obj_id']);
93 $data['description'] = ilObject::_lookupDescription($item['obj_id']);
94 break;
95 }
96 $data['obj_id'] = $item['obj_id'];
97 $data['create_date'] = $item['create_date'];
98 $data['writable'] = $item['writable'];
99
100 $items[] = $data;
101 }
102 $this->setData($items);
103 }
104}
__construct(object $parent_obj, string $parent_cmd)
Handles shared calendars.
static _lookupName(int $a_user_id)
static _lookupTitle(int $obj_id)
static _lookupDescription(int $obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addMultiCommand(string $a_cmd, string $a_text)
setPrefix(string $a_prefix)
set prefix for sort and offset fields (if you have two or more tables on a page that you want to sort...
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)
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setData(array $a_data)
Set table data.
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc