3 declare(strict_types=0);
40 object $a_parent_class,
47 $this->
http = $DIC->http();
50 $this->container = $a_container_obj;
51 $this->main_container = $a_main_container;
68 $this->user_id = $a_usr_id;
76 public function init(): void
79 $this->
setRowTemplate(
'tpl.crs_personal_timings_row.html',
'Modules/Course');
80 $this->
setTitle($this->
lng->txt(
'crs_timings_edit_personal'));
82 $this->
addColumn($this->
lng->txt(
'crs_timings_short_start_end'),
'');
83 $this->
addColumn($this->
lng->txt(
'crs_timings_short_end'),
'');
84 $this->
addColumn($this->
lng->txt(
'crs_timings_short_changeable'),
'');
99 protected function fillRow(array $a_set): void
101 if ($a_set[
'error'] ??
false) {
102 $this->tpl->setVariable(
'TD_CLASS',
'warning');
104 $this->tpl->setVariable(
'TD_CLASS',
'std');
108 if (strlen($a_set[
'title_link'] ??
'')) {
109 $this->tpl->setCurrentBlock(
'title_link');
110 $this->tpl->setVariable(
'TITLE_LINK', $a_set[
'title_link']);
111 $this->tpl->setVariable(
'TITLE_LINK_NAME', $a_set[
'title']);
112 $this->tpl->parseCurrentBlock();
114 $this->tpl->setCurrentBlock(
'title_plain');
115 $this->tpl->setVariable(
'TITLE', $a_set[
'title']);
116 $this->tpl->parseCurrentBlock();
118 if (strlen($a_set[
'desc'] ??
'')) {
119 $this->tpl->setCurrentBlock(
'item_description');
120 $this->tpl->setVariable(
'DESC', $a_set[
'desc']);
121 $this->tpl->parseCurrentBlock();
123 if ($a_set[
'failure'] ??
false) {
124 $this->tpl->setCurrentBlock(
'alert');
126 $this->tpl->setVariable(
'ALT_ALERT', $this->
lng->txt(
"alert"));
127 $this->tpl->setVariable(
"TXT_ALERT", $this->
lng->txt($a_set[
'failure']));
128 $this->tpl->parseCurrentBlock();
132 $this->tpl->setVariable(
'NAME_ACTIVE',
'item[' . $a_set[
'ref_id'] .
'][active]');
133 $this->tpl->setVariable(
138 $error_post_item = (array) ($this->
http->request()->getParsedBody()[
'item'] ?? []);
144 $dt_input->setDate(
new ilDate($error_post_item[$a_set[
'ref_id']][
'sug_start'] ??
'',
IL_CAL_DATE));
147 if (!($a_set[
'item'][
'changeable'] ??
false)) {
148 $dt_input->setDisabled(
true);
151 $this->tpl->setVariable(
'start_abs');
152 $this->tpl->setVariable(
'SUG_START', $dt_input->render());
153 $this->tpl->parseCurrentBlock();
159 $dt_end->setDate(
new ilDate($error_post_item[$a_set[
'ref_id']][
'sug_end'] ??
'',
IL_CAL_DATE));
162 if (!($a_set[
'item'][
'changeable'] ??
false)) {
163 $dt_end->setDisabled(
true);
165 $this->tpl->setVariable(
'end_abs');
166 $this->tpl->setVariable(
'SUG_END', $dt_end->render());
167 $this->tpl->parseCurrentBlock();
170 $this->tpl->setVariable(
172 $a_set[
'item'][
'changeable'] ? $this->
lng->txt(
'yes') : $this->
lng->txt(
'no')
176 public function parse(array $a_item_data, array $failed = array()): void
179 foreach ($a_item_data as $item) {
185 $current_row = array();
188 if ($item[
'type'] ==
'itgr') {
191 $current_row[
'ref_id'] = $item[
'ref_id'];
193 $current_row = $this->
parseTitle($current_row, $item);
196 $current_row[
'start'] = $item[
'suggestion_start'];
198 if (array_key_exists($item[
'ref_id'], $failed)) {
199 $current_row[
'failed'] =
true;
200 $current_row[
'failure'] = $failed[$item[
'ref_id']];
202 $current_row[
'item'] = $item;
203 $rows[] = $current_row;
217 $a_item[
'suggestion_start'] = $tu->getStart()->get(
IL_CAL_UNIX);
220 $a_item[
'suggestion_end'] = $tu->getEnd()->get(
IL_CAL_UNIX);
226 protected function parseTitle(array $current_row, array $item): array
228 switch ($item[
'type']) {
231 $current_row[
'title'] = $item[
'title'];
232 $current_row[
'title_link'] =
ilLink::_getLink($item[
'ref_id'], $item[
'type']);
236 if (strlen($item[
'title'])) {
237 $current_row[
'title'] = $item[
'title'];
243 (
bool) $app_info[
'fullday']
246 $current_row[
'title_link'] =
ilLink::_getLink($item[
'ref_id'], $item[
'type']);
250 $current_row[
'title'] = $item[
'title'];
251 $current_row[
'title_link'] =
'';
255 $current_row[
'desc'] = $item[
'desc'];
ilObjCourse $main_container
setFormAction(string $a_form_action, bool $a_multipart=false)
parse(array $a_item_data, array $failed=array())
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
__construct(object $a_parent_class, string $a_parent_cmd, ilObject $a_container_obj, ilObjCourse $a_main_container)
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
parseUserTimings(array $a_item)
parseTitle(array $current_row, array $item)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupObjId(int $ref_id)
setShowRowsSelector(bool $a_value)
Toggle rows-per-page selector.
static _lookupAppointment(int $a_obj_id)
static http()
Fetches the global http state from ILIAS.
setFailureStatus(bool $a_status)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
static _getLink(?int $a_ref_id, string $a_type='', array $a_params=array(), string $append="")
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
static _appointmentToString(int $start, int $end, bool $fulltime)
__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)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)