19 declare(strict_types=0);
45 switch ($this->
ctrl->getNextClass()) {
54 if ($this->
http->wrapper()->post()->has(
'item_ids')) {
55 return $this->
http->wrapper()->post()->retrieve(
68 protected function show(): void
70 $this->
help->setSubScreenId(
"trac_settings");
71 $info = $this->obj_lp->getSettingsInfo();
73 $this->tpl->setOnScreenMessage(
'info', $info);
77 $this->tpl->setContent(
87 $form->setTitle($this->
lng->txt(
'tracking_settings'));
88 $form->setFormAction($this->
ctrl->getFormAction($this));
93 $mod->setValue((
string) $this->obj_lp->getCurrentMode());
96 if ($this->obj_lp->hasIndividualModeOptions()) {
97 $this->obj_lp->initInvidualModeOptions($mod);
99 foreach ($this->obj_lp->getValidModes() as $mode_key) {
101 $this->obj_lp->getModeText($mode_key),
103 $this->obj_lp->getModeInfoText($mode_key)
106 $mod->addOption($opt);
111 $this->
lng->txt(
'trac_visits'),
115 $vis->setMaxLength(4);
118 $this->
lng->txt(
'trac_visits_info'),
122 $vis->setRequired(
true);
123 $vis->setValue((
string) $this->obj_settings->getVisits());
124 $opt->addSubItem($vis);
126 $this->obj_lp->appendModeConfiguration((
int) $mode_key, $opt);
129 $form->addCommandButton(
'saveSettings', $this->
lng->txt(
'save'));
136 if ($form->checkInput()) {
140 if ($this->obj_lp->shouldFetchIndividualModeFromFormSubmission()) {
141 $new_mode = $this->obj_lp->fetchIndividualModeFromFormSubmission(
145 $new_mode = (
int) $form->getInput(
'modus');
147 $old_mode = $this->obj_lp->getCurrentMode();
148 $mode_changed = ($old_mode != $new_mode);
152 $visits_changed = null;
154 $new_visits = (
int) $form->getInput(
'visits');
155 $old_visits = $this->obj_settings->getVisits();
156 $visits_changed = ($old_visits != $new_visits);
159 $this->obj_lp->saveModeConfiguration($form, $mode_changed);
163 $collection = $this->obj_lp->getCollectionInstance();
165 $collection->delete();
171 $this->obj_lp->resetCaches();
173 $this->obj_settings->setMode($new_mode);
174 $this->obj_settings->setVisits((
int) $new_visits);
175 $this->obj_settings->update(
true);
178 $this->obj_lp->getCollectionInstance() &&
180 $this->tpl->setOnScreenMessage(
183 'trac_edit_collection' 188 $this->tpl->setOnScreenMessage(
191 'trac_settings_saved' 195 $this->
ctrl->redirect($this,
'show');
198 $form->setValuesByPost();
200 $this->tpl->setContent(
212 $collection = $this->obj_lp->getCollectionInstance();
213 if ($collection && $collection->hasSelectableItems()) {
218 $this->obj_lp->getCurrentMode()
220 $table->
parse($collection);
221 return $table->getHTML();
229 $this->tpl->setOnScreenMessage(
231 $this->
lng->txt(
'select_one'),
234 $this->
ctrl->redirect($this,
'show');
237 $collection = $this->obj_lp->getCollectionInstance();
238 if ($collection && $collection->hasSelectableItems()) {
242 $this->obj_lp->resetCaches();
245 $this->tpl->setOnScreenMessage(
247 $this->
lng->txt(
'trac_settings_saved'),
250 $this->
ctrl->redirect($this,
'show');
256 $this->tpl->setOnScreenMessage(
258 $this->
lng->txt(
'select_one'),
261 $this->
ctrl->redirect($this,
'show');
265 $collection = $this->obj_lp->getCollectionInstance();
266 if ($collection && $collection->hasSelectableItems()) {
271 $this->obj_lp->resetCaches();
276 $this->tpl->setOnScreenMessage(
278 $this->
lng->txt(
'trac_settings_saved'),
281 $this->
ctrl->redirect($this,
'show');
290 $this->tpl->setOnScreenMessage(
292 $this->
lng->txt(
'select_one'),
295 $this->
ctrl->redirect($this,
'show');
298 $collection = $this->obj_lp->getCollectionInstance();
299 if ($collection && $collection->hasSelectableItems()) {
303 $this->obj_lp->resetCaches();
309 $this->tpl->setOnScreenMessage(
311 $this->
lng->txt(
'trac_settings_saved'),
314 $this->
ctrl->redirect($this,
'show');
323 $this->tpl->setOnScreenMessage(
325 $this->
lng->txt(
'select_one'),
328 $this->
ctrl->redirect($this,
'show');
331 $collection = $this->obj_lp->getCollectionInstance();
332 if ($collection && $collection->hasSelectableItems()) {
335 $this->obj_lp->resetCaches();
341 $this->tpl->setOnScreenMessage(
343 $this->
lng->txt(
'trac_settings_saved'),
346 $this->
ctrl->redirect($this,
'show');
355 if ($this->
http->wrapper()->post()->has(
'grp')) {
356 $groups = $this->
http->wrapper()->post()->retrieve(
358 $this->
refinery->kindlyTo()->dictOf(
363 if (!count($groups)) {
364 $this->tpl->setOnScreenMessage(
366 $this->
lng->txt(
'select_one'),
369 $this->
ctrl->redirect($this,
'show');
373 $collection = $this->obj_lp->getCollectionInstance();
374 if ($collection && $collection->hasSelectableItems()) {
375 $collection->saveObligatoryMaterials($groups);
377 $this->obj_lp->resetCaches();
383 $this->tpl->setOnScreenMessage(
385 $this->
lng->txt(
'settings_saved'),
388 $this->
ctrl->redirect($this,
'show');
390 $this->tpl->setOnScreenMessage(
393 'trac_grouped_material_obligatory_err' 397 $this->tpl->setOnScreenMessage(
399 $this->
lng->txt(
'err_check_input'),
402 $this->
ctrl->redirect($this,
'show');
411 $paths = $this->lom_services->paths();
412 $data_helper = $this->lom_services->dataHelper();
414 $tlt = (array) ($this->
http->request()->getParsedBody()[
'tlt'] ?? []);
415 foreach ($tlt as $item_id => $item) {
416 $lom_duration = $data_helper->durationFromIntegers(
424 $this->lom_services->manipulate($this->
getObjId(), $item_id,
'st')
425 ->prepareCreateOrUpdate(
426 $paths->firstTypicalLearningTime(),
432 $this->obj_lp->resetCaches();
435 $this->tpl->setOnScreenMessage(
437 $this->
lng->txt(
'settings_saved'),
440 $this->
ctrl->redirect($this,
'show');
445 $has_lp_parents =
false;
447 $path = $this->tree->getNodePath($a_ref_id);
449 foreach (
$path as $node) {
451 if ($supports_lp || $has_lp_parents) {
452 $a_res[(
int) $node[
"child"]][
"node"] = array(
453 "type" => (
string) $node[
"type"]
455 "title" => (string) $node[
"title"]
457 "obj_id" => (
int) $node[
"obj_id"]
467 $node[
"child"] != $a_ref_id) {
468 $a_res[(
int) $node[
"child"]][
"node"][
"lp"] =
true;
469 $has_lp_parents =
true;
471 $parent_obj_id = (
int) $node[
'obj_id'];
473 $parent_collection = $parent_obj_lp->getCollectionInstance();
475 $parent_collection &&
476 $parent_collection->hasSelectableItems() &&
477 $parent_collection->isAssignedEntry($a_ref_id)
479 $a_res[$node[
'child']][
'node'][
'active'] =
true;
483 return $has_lp_parents;
489 if ($this->
http->wrapper()->query()->has(
'ref_id')) {
490 $ref_id = $this->
http->wrapper()->query()->retrieve(
494 } elseif ($this->
http->wrapper()->post()->has(
'ref_id')) {
495 $ref_id = $this->
http->wrapper()->post()->retrieve(
504 "tpl.lp_obj_settings_tree_info.html",
507 "components/ILIAS/Tracking" 512 foreach ($coll as $parent_ref_id =>
$parts) {
516 if ($node[
"active"]) {
524 if ($this->
access->checkAccess(
"read",
"", $parent_ref_id) &&
554 $this->
lng->txt(
"obj_" . $node[
"type"])
561 :
' class="ilLPParentInfoListLPUnsupported"' 573 $this->
lng->txt(
"trac_lp_settings_info_parent_legend"),
579 $panel = $this->ui_factory->panel()->secondary()->legacy(
580 $this->
lng->txt(
"trac_lp_settings_info_parent_container"),
581 $this->ui_factory->legacy(
$tpl->
get())
584 return $this->ui_renderer->render($panel);
__construct(int $a_mode, int $a_ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
const LP_MODE_MANUAL_BY_TUTOR
static isSupportedObjectType(string $type)
show()
Show settings tables.
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
touchBlock(string $block)
overwrites ITX::touchBlock.
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Class ilLPListOfSettingsGUI.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
setVariable(string $variable, $value='')
Sets the given variable to the given value.
parse(ilLPCollection $a_collection)
Read and parse items.
executeCommand()
execute command
static _lookupObjId(int $ref_id)
static http()
Fetches the global http state from ILIAS.
static _lookupTitle(int $obj_id)
setValue(string $a_value)
static _refreshStatus(int $a_obj_id, ?array $a_users=null)
getLPPathInfo(int $a_ref_id, array &$a_res)
groupMaterials()
Group materials.
saveObligatoryMaterials()
Save obligatory state per grouped materials.
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
ilLPObjSettings $obj_settings
getTableByMode()
Get tables by mode.
__construct(Container $dic, ilPlugin $plugin)
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
ilGlobalTemplateInterface $tpl
static getInstance(int $obj_id)
static _getValidTimeSpan()