19declare(strict_types=0);
60 $this->main_tpl =
$DIC->ui()->mainTemplate();
61 $this->tpl =
$DIC->ui()->mainTemplate();
62 $this->
ctrl = $DIC->ctrl();
63 $this->
lng = $DIC->language();
64 $this->
tabs = $DIC->tabs();
66 $this->
access = $DIC->access();
67 $this->
error = $DIC[
'ilErr'];
68 $this->
user = $DIC->user();
70 $this->tree =
$DIC->repositoryTree();
71 $this->
http = $DIC->http();
73 $this->ui_factory =
$DIC->ui()->factory();
74 $this->ui_renderer =
$DIC->ui()->renderer();
75 $this->lom_services =
$DIC->learningObjectMetadata();
77 $this->container_gui = $container_gui_obj;
78 $this->container_obj = $this->container_gui->
getObject();
84 if (!$this->
access->checkAccess(
'read',
'', $this->container_obj->getRefId())) {
85 $this->
error->raiseError($this->
lng->txt(
'msg_no_perm_read'), $this->error->WARNING);
89 $this->
tabs->setTabActive(
'view_content');
90 $cmd = $this->
ctrl->getCmd();
92 switch ($this->
ctrl->getNextClass($this)) {
100 throw new RuntimeException(
'Missing ctrl command.');
109 if ($this->
http->wrapper()->query()->has(
'member_id')) {
110 return $this->
http->wrapper()->query()->retrieve(
125 if ($this->
access->checkAccess(
'write',
'', $this->course_obj->getRefId())) {
128 $start_obj =
new ilCourseStart($this->course_obj->getRefId(), $this->course_obj->getId());
129 if (count($start_obj->getStartObjects()) && !$start_obj->allFullfilled($this->user->getId())) {
137 $this->
tabs->setSubTabActive(
'crs_content');
139 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.crs_start_view.html",
'components/ILIAS/Course');
140 $this->tpl->setVariable(
"INFO_STRING", $this->
lng->txt(
'crs_info_start'));
141 $this->tpl->setVariable(
"TBL_TITLE_START", $this->
lng->txt(
'crs_table_start_objects'));
142 $this->tpl->setVariable(
"HEADER_NR", $this->
lng->txt(
'crs_nr'));
143 $this->tpl->setVariable(
"HEADER_DESC", $this->
lng->txt(
'description'));
144 $this->tpl->setVariable(
"HEADER_EDITED", $this->
lng->txt(
'crs_objective_accomplished'));
146 $lm_continue =
new ilCourseLMHistory($this->course_obj->getRefId(), $this->user->getId());
147 $continue_data = $lm_continue->getLMHistory();
152 $ref_id = $start[
'item_ref_id'];
161 $obj_frame =
$type ==
'tst' ?
'' : $obj_frame;
164 $this->tpl->setCurrentBlock(
"start_read");
166 $this->tpl->setVariable(
"READ_TARGET_START", $obj_frame);
167 $this->tpl->setVariable(
169 $obj_link .
'&crs_show_result=' . $this->course_obj->getRefId()
171 $this->tpl->parseCurrentBlock();
173 $this->tpl->setCurrentBlock(
"start_visible");
175 $this->tpl->parseCurrentBlock();
179 if (isset($continue_data[
$ref_id])) {
180 $this->tpl->setCurrentBlock(
"link");
181 $this->tpl->setVariable(
"LINK_HREF", ilLink::_getLink(
$ref_id,
'', array(
'obj_id',
182 $continue_data[
$ref_id][
'lm_page_id']
184 #$this->tpl->setVariable("CONTINUE_LINK_TARGET",$target);
185 $this->tpl->setVariable(
"LINK_NAME", $this->
lng->txt(
'continue_work'));
186 $this->tpl->parseCurrentBlock();
190 if ($this->course_obj->getAboStatus()) {
191 if (!$this->fav_manager->ifIsFavourite($this->user->getId(),
$ref_id)) {
192 if ($this->
access->checkAccess(
'read',
'', $ref_id)) {
193 $this->tpl->setCurrentBlock(
"link");
194 $this->
ctrl->setParameterByClass(get_class($this->container_gui),
'item_ref_id',
$ref_id);
195 $this->
ctrl->setParameterByClass(get_class($this->container_gui),
'item_id',
$ref_id);
196 $this->
ctrl->setParameterByClass(get_class($this->container_gui),
'type',
$type);
198 $this->tpl->setVariable(
200 $this->
ctrl->getLinkTarget($this->container_gui,
'addToDesk')
202 $this->tpl->setVariable(
"LINK_NAME", $this->
lng->txt(
"rep_add_to_favourites"));
203 $this->tpl->parseCurrentBlock();
206 $this->tpl->setCurrentBlock(
"link");
207 $this->
ctrl->setParameterByClass(get_class($this->container_gui),
'item_ref_id',
$ref_id);
208 $this->
ctrl->setParameterByClass(get_class($this->container_gui),
'item_id',
$ref_id);
209 $this->
ctrl->setParameterByClass(get_class($this->container_gui),
'type',
$type);
211 $this->tpl->setVariable(
213 $this->
ctrl->getLinkTarget($this->container_gui,
'removeFromDesk')
215 $this->tpl->setVariable(
"LINK_NAME", $this->
lng->txt(
"rep_remove_from_favourites"));
216 $this->tpl->parseCurrentBlock();
222 $this->tpl->setCurrentBlock(
"start_description");
224 $this->tpl->parseCurrentBlock();
228 $accomplished =
'accomplished';
231 $accomplished =
'not_accomplished';
234 $this->tpl->setCurrentBlock(
"start_row");
235 $this->tpl->setVariable(
"EDITED_IMG", $icon);
236 $this->tpl->setVariable(
"EDITED_ALT", $this->
lng->txt(
'crs_objective_' . $accomplished));
237 $this->tpl->setVariable(
"ROW_CLASS",
'option_value');
238 $this->tpl->setVariable(
"ROW_CLASS_CENTER",
'option_value_center');
239 $this->tpl->setVariable(
"OBJ_NR_START", ++
$counter .
'.');
240 $this->tpl->parseCurrentBlock();
249 if (!$this->
access->checkAccess(
'write',
'', $this->container_obj->getRefId())) {
250 $this->
error->raiseError($this->
lng->txt(
'msg_no_perm_write'), $this->error->WARNING);
252 $this->
tabs->setTabActive(
'timings_timings');
253 $this->
tabs->clearSubTabs();
261 if ($failed_items !== []) {
262 $table->setFailureStatus(
true);
269 $this->tpl->setContent($table->getHTML());
279 if (!$this->
access->checkAccess(
'read',
'', $this->container_obj->getRefId())) {
280 $this->
error->raiseError($this->
lng->txt(
'msg_no_perm_read'), $ilErr->WARNING);
282 $this->
tabs->setTabActive(
'timings_timings');
283 $this->
tabs->clearSubTabs();
287 'managePersonalTimings',
291 $table->setFailureStatus((
bool) count($failed));
292 $table->setUserId($this->
user->getId());
301 $this->tpl->setContent($table->getHTML());
309 if (!$this->
access->checkAccess(
'read',
'', $this->container_obj->getRefId())) {
310 $this->
error->raiseError($this->
lng->txt(
'msg_no_perm_write'), $this->error->WARNING);
312 $this->
tabs->clearSubTabs();
315 $post_item = (array) ($this->
http->request()->getParsedBody()[
'item'] ?? []);
320 if ($sug_start_dt instanceof
ilDate && $sug_end_dt instanceof
ilDate) {
322 $failed[
$ref_id] =
'crs_timing_err_start_end';
331 $failed[
'ref_id'] =
'crs_timing_err_valid_dates';
334 if ($failed === []) {
335 $this->main_tpl->setOnScreenMessage(
'success',
$GLOBALS[
'lng']->txt(
'settings_saved'));
339 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'));
347 $this->
ctrl->returnToParent($this);
356 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.crs_user_timings.html',
'components/ILIAS/Course');
357 $this->
tabs->clearSubTabs();
358 $this->
tabs->setTabActive(
'members');
361 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'no_checkbox'),
true);
362 $this->
ctrl->returnToParent($this);
366 $this->tpl->addBlockfile(
"BUTTONS",
"buttons",
"tpl.buttons.html");
367 $this->tpl->setCurrentBlock(
"btn_cell");
368 $this->tpl->setVariable(
"BTN_LINK", $this->
ctrl->getLinkTarget($this,
'returnToMembers'));
369 $this->tpl->setVariable(
"BTN_TXT", $this->
lng->txt(
"back"));
370 $this->tpl->parseCurrentBlock();
372 $usr_icon = $this->ui_factory->symbol()->icon()->standard(
374 $this->
lng->txt(
'obj_usr'),
377 $this->tpl->setVariable(
"HEADER_IMG", $this->ui_renderer->render($usr_icon));
378 $this->tpl->setVariable(
"TABLE_HEADER", $this->
lng->txt(
'timings_of'));
380 $this->tpl->setVariable(
"USER_NAME", $name[
'lastname'] .
', ' . $name[
'firstname']);
382 $this->tpl->setVariable(
"TXT_TITLE", $this->
lng->txt(
'title'));
383 $this->tpl->setVariable(
"TXT_START_END", $this->
lng->txt(
'crs_timings_short_start_end'));
384 $this->tpl->setVariable(
"TXT_INFO_START_END", $this->
lng->txt(
'crs_timings_start_end_info'));
385 $this->tpl->setVariable(
"TXT_CHANGED", $this->
lng->txt(
'crs_timings_changed'));
386 $this->tpl->setVariable(
"TXT_OWN_PRESETTING", $this->
lng->txt(
'crs_timings_planed_start'));
387 $this->tpl->setVariable(
"TXT_INFO_OWN_PRESETTING", $this->
lng->txt(
'crs_timings_from_until'));
390 foreach ($items as $item) {
404 $this->
lng->loadLanguageModule(
'meta');
408 for ($i = 0; $i < $level; $i++) {
409 $this->tpl->touchBlock(
'start_indent');
410 $this->tpl->touchBlock(
'end_indent');
412 if (strlen($item[
'description'])) {
413 $this->tpl->setCurrentBlock(
"item_description");
414 $this->tpl->setVariable(
"DESC", $item[
'description']);
415 $this->tpl->parseCurrentBlock();
418 $tlt_data = $this->lom_services->read(
422 $this->lom_services->paths()->firstTypicalLearningTime()
423 )->firstData($this->lom_services->paths()->firstTypicalLearningTime());
425 if ($tlt = $this->lom_services->dataHelper()->durationToSeconds($tlt_data->value())) {
426 $this->tpl->setCurrentBlock(
"tlt");
427 $this->tpl->setVariable(
"TXT_TLT", $this->
lng->txt(
'meta_typical_learning_time'));
429 $this->tpl->parseCurrentBlock();
432 if (!$item[
'title'] &&
433 $item[
'type'] ==
'sess') {
438 (
bool) $app_info[
'fullday']
442 $this->tpl->setCurrentBlock(
"title_plain");
443 $this->tpl->setVariable(
"TITLE", $item[
'title']);
444 $this->tpl->parseCurrentBlock();
446 $this->tpl->setCurrentBlock(
"container_standard_row");
448 $this->tpl->setVariable(
'TYPE_IMG',
ilObject::_getIcon($item[
'obj_id'],
'tiny', $item[
'type']));
449 $this->tpl->setVariable(
"TYPE_ALT_IMG", $this->
lng->txt(
'obj_' . $item[
'type']));
453 $this->tpl->setVariable(
'SUG_START', $usr_planed->getStart()->get(
IL_CAL_DATE));
456 $this->tpl->setVariable(
'SUG_END', $usr_planed->getEnd()->get(
IL_CAL_DATE));
459 $this->tpl->parseCurrentBlock();
470 if (!$this->
access->checkAccess(
'write',
'', $this->container_obj->getRefId())) {
471 $this->
error->raiseError($this->
lng->txt(
'msg_no_perm_write'), $this->error->WARNING);
474 $this->
tabs->clearSubTabs();
477 $post_item = (array) ($this->
http->request()->getParsedBody()[
'item']) ?? [];
484 $item_obj->toggleChangeable((
bool) (
$data[
'change'] ??
false));
490 if ($sug_start_dt instanceof
ilDate && $sug_end_dt instanceof
ilDate) {
492 $failed[
$ref_id] =
'crs_timing_err_start_end';
495 $item_obj->setSuggestionStart($sug_start_dt->get(
IL_CAL_UNIX));
496 $item_obj->setSuggestionEnd($sug_end_dt->get(
IL_CAL_UNIX));
498 $failed[
'ref_id'] =
'crs_timing_err_valid_dates';
503 (
int)
$data[
'sug_start_rel'] < 0 || (
int)
$data[
'duration_a'] < 0
505 $failed[
$ref_id] =
'crs_timing_err_start_dur_rel';
508 $item_obj->setSuggestionStartRelative(
$data[
'sug_start_rel']);
509 $item_obj->setSuggestionEndRelative(
$data[
'sug_start_rel'] +
$data[
'duration_a']);
514 $item_obj->setSuggestionStart($start->get(
IL_CAL_UNIX));
517 $item_obj->setSuggestionEnd($start->get(
IL_CAL_UNIX));
522 if ($failed === []) {
524 $this->course_obj->update();
525 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'));
529 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'));
537 if ($this->container_obj->getType() ==
'crs') {
538 $this->container_gui->setContentSubTabs();
547 $course_ref_id = $this->tree->checkForParentType($this->container_obj->getRefId(),
'crs');
550 $this->course_obj = $course;
Builds a Color from either hex- or rgb values.
static parseIncomingDate($value, bool $add_time=false)
Try to parse incoming value to date object.
static _checkAllConditionsOfTarget(int $a_target_ref_id, int $a_target_id, string $a_target_type="", int $a_usr_id=0)
checks wether all conditions of a target object are fulfilled
Class ilContainerGUI This is a base GUI class for all container objects in ILIAS: root folder,...
const IL_CRS_VIEW_TIMING_ABSOLUTE
Class ilCourseContentGUI.
ilFavouritesManager $fav_manager
ilObjectDataCache $objectDataCache
ilGlobalTemplateInterface $main_tpl
managePersonalTimings(array $failed=[])
Manage personal timings.
ilContainerGUI $container_gui
showStartObjects(ilCourseStart $start_obj)
updatePersonalTimings()
Update personal timings.
__renderUserItem(array $item, int $level)
ilContainer $container_obj
__construct(ilContainerGUI $container_gui_obj)
ilGlobalTemplateInterface $tpl
LOMServices $lom_services
manageTimings(array $failed_items=[])
Manage timings.
isFullfilled(int $user_id, int $item_id)
static secondsToString(int $seconds, bool $force_with_seconds=false, ?ilLanguage $a_lng=null)
converts seconds to string: Long: 7 days 4 hour(s) ...
static _after(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
compare two dates and check start is after end This method does not consider tz offsets.
Error Handling & global info handling.
Manages favourites, currently the interface for other components, needs discussion.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupName(int $a_user_id)
Class ilObjectActivation.
const TIMINGS_DEACTIVATED
static hasChangeableTimings(int $ref_id)
Check if there is any active changeable timing (in subtree)
static getTimingsAdministrationItems(int $parent_id)
Get (sub) item data for timings administration view (active/inactive)
static getItems(int $parent_id, bool $with_list_data=true)
Get sub item data.
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
static _lookupObjId(int $ref_id)
static _lookupAppointment(int $a_obj_id)
static _appointmentToString(int $start, int $end, bool $fulltime)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
TableGUI class for timings administration.
TableGUI class for timings administration.
TableGUI class for editing personal timings.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
Interface GlobalHttpState.
An entity that renders components to a string output.
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static http()
Fetches the global http state from ILIAS.