3 declare(strict_types=0);
46 switch ($this->
ctrl->getNextClass()) {
55 if ($this->
http->wrapper()->post()->has(
'item_ids')) {
56 return $this->
http->wrapper()->post()->retrieve(
69 protected function show(): void
71 $this->
help->setSubScreenId(
"trac_settings");
72 $info = $this->obj_lp->getSettingsInfo();
74 $this->tpl->setOnScreenMessage(
'info', $info);
78 $this->tpl->setContent(
88 $form->setTitle($this->
lng->txt(
'tracking_settings'));
89 $form->setFormAction($this->
ctrl->getFormAction($this));
94 $mod->setValue((
string) $this->obj_lp->getCurrentMode());
97 if ($this->obj_lp->hasIndividualModeOptions()) {
98 $this->obj_lp->initInvidualModeOptions($mod);
100 foreach ($this->obj_lp->getValidModes() as $mode_key) {
102 $this->obj_lp->getModeText($mode_key),
104 $this->obj_lp->getModeInfoText($mode_key)
107 $mod->addOption($opt);
112 $this->
lng->txt(
'trac_visits'),
116 $vis->setMaxLength(4);
119 $this->
lng->txt(
'trac_visits_info'),
123 $vis->setRequired(
true);
124 $vis->setValue((
string) $this->obj_settings->getVisits());
125 $opt->addSubItem($vis);
127 $this->obj_lp->appendModeConfiguration((
int) $mode_key, $opt);
130 $form->addCommandButton(
'saveSettings', $this->
lng->txt(
'save'));
137 if ($form->checkInput()) {
141 if ($this->obj_lp->shouldFetchIndividualModeFromFormSubmission()) {
142 $new_mode = $this->obj_lp->fetchIndividualModeFromFormSubmission(
146 $new_mode = (
int) $form->getInput(
'modus');
148 $old_mode = $this->obj_lp->getCurrentMode();
149 $mode_changed = ($old_mode != $new_mode);
153 $visits_changed = null;
155 $new_visits = (
int) $form->getInput(
'visits');
156 $old_visits = $this->obj_settings->getVisits();
157 $visits_changed = ($old_visits != $new_visits);
160 $this->obj_lp->saveModeConfiguration($form, $mode_changed);
164 $collection = $this->obj_lp->getCollectionInstance();
166 $collection->delete();
172 $this->obj_lp->resetCaches();
174 $this->obj_settings->setMode($new_mode);
175 $this->obj_settings->setVisits((
int) $new_visits);
176 $this->obj_settings->update(
true);
179 $this->obj_lp->getCollectionInstance() &&
181 $this->tpl->setOnScreenMessage(
184 'trac_edit_collection' 189 $this->tpl->setOnScreenMessage(
192 'trac_settings_saved' 196 $this->
ctrl->redirect($this,
'show');
199 $form->setValuesByPost();
201 $this->tpl->setContent(
213 $collection = $this->obj_lp->getCollectionInstance();
214 if ($collection && $collection->hasSelectableItems()) {
219 $this->obj_lp->getCurrentMode()
221 $table->
parse($collection);
222 return $table->getHTML();
230 $this->tpl->setOnScreenMessage(
232 $this->
lng->txt(
'select_one'),
235 $this->
ctrl->redirect($this,
'show');
238 $collection = $this->obj_lp->getCollectionInstance();
239 if ($collection && $collection->hasSelectableItems()) {
243 $this->obj_lp->resetCaches();
246 $this->tpl->setOnScreenMessage(
248 $this->
lng->txt(
'trac_settings_saved'),
251 $this->
ctrl->redirect($this,
'show');
257 $this->tpl->setOnScreenMessage(
259 $this->
lng->txt(
'select_one'),
262 $this->
ctrl->redirect($this,
'show');
266 $collection = $this->obj_lp->getCollectionInstance();
267 if ($collection && $collection->hasSelectableItems()) {
272 $this->obj_lp->resetCaches();
277 $this->tpl->setOnScreenMessage(
279 $this->
lng->txt(
'trac_settings_saved'),
282 $this->
ctrl->redirect($this,
'show');
291 $this->tpl->setOnScreenMessage(
293 $this->
lng->txt(
'select_one'),
296 $this->
ctrl->redirect($this,
'show');
299 $collection = $this->obj_lp->getCollectionInstance();
300 if ($collection && $collection->hasSelectableItems()) {
304 $this->obj_lp->resetCaches();
310 $this->tpl->setOnScreenMessage(
312 $this->
lng->txt(
'trac_settings_saved'),
315 $this->
ctrl->redirect($this,
'show');
324 $this->tpl->setOnScreenMessage(
326 $this->
lng->txt(
'select_one'),
329 $this->
ctrl->redirect($this,
'show');
332 $collection = $this->obj_lp->getCollectionInstance();
333 if ($collection && $collection->hasSelectableItems()) {
336 $this->obj_lp->resetCaches();
342 $this->tpl->setOnScreenMessage(
344 $this->
lng->txt(
'trac_settings_saved'),
347 $this->
ctrl->redirect($this,
'show');
356 if ($this->
http->wrapper()->post()->has(
'grp')) {
357 $groups = $this->
http->wrapper()->post()->retrieve(
359 $this->
refinery->kindlyTo()->dictOf(
364 if (!count($groups)) {
365 $this->tpl->setOnScreenMessage(
367 $this->
lng->txt(
'select_one'),
370 $this->
ctrl->redirect($this,
'show');
374 $collection = $this->obj_lp->getCollectionInstance();
375 if ($collection && $collection->hasSelectableItems()) {
376 $collection->saveObligatoryMaterials($groups);
378 $this->obj_lp->resetCaches();
384 $this->tpl->setOnScreenMessage(
386 $this->
lng->txt(
'settings_saved'),
389 $this->
ctrl->redirect($this,
'show');
391 $this->tpl->setOnScreenMessage(
394 'trac_grouped_material_obligatory_err' 398 $this->tpl->setOnScreenMessage(
400 $this->
lng->txt(
'err_check_input'),
403 $this->
ctrl->redirect($this,
'show');
412 $tlt = (array) ($this->
http->request()->getParsedBody()[
'tlt'] ?? []);
413 foreach ($tlt as $item_id => $item) {
415 if (!is_object($md_section = $md_obj->getEducational())) {
416 $md_section = $md_obj->addEducational();
419 $md_section->setPhysicalTypicalLearningTime(
426 $md_section->update();
430 $this->obj_lp->resetCaches();
433 $this->tpl->setOnScreenMessage(
435 $this->
lng->txt(
'settings_saved'),
438 $this->
ctrl->redirect($this,
'show');
443 $has_lp_parents =
false;
445 $path = $this->tree->getNodePath($a_ref_id);
447 foreach (
$path as $node) {
449 if ($supports_lp || $has_lp_parents) {
450 $a_res[(
int) $node[
"child"]][
"node"] = array(
451 "type" => (
string) $node[
"type"]
453 "title" => (string) $node[
"title"]
455 "obj_id" => (
int) $node[
"obj_id"]
465 $node[
"child"] != $a_ref_id) {
466 $a_res[(
int) $node[
"child"]][
"node"][
"lp"] =
true;
467 $has_lp_parents =
true;
469 $parent_obj_id = (
int) $node[
'obj_id'];
471 $parent_collection = $parent_obj_lp->getCollectionInstance();
473 $parent_collection &&
474 $parent_collection->hasSelectableItems() &&
475 $parent_collection->isAssignedEntry($a_ref_id)
477 $a_res[$node[
'child']][
'node'][
'active'] =
true;
481 return $has_lp_parents;
487 if ($this->
http->wrapper()->query()->has(
'ref_id')) {
488 $ref_id = $this->
http->wrapper()->query()->retrieve(
492 } elseif ($this->
http->wrapper()->post()->has(
'ref_id')) {
493 $ref_id = $this->
http->wrapper()->post()->retrieve(
502 "tpl.lp_obj_settings_tree_info.html",
510 foreach ($coll as $parent_ref_id =>
$parts) {
514 if ($node[
"active"]) {
522 if ($this->
access->checkAccess(
"read",
"", $parent_ref_id) &&
552 $this->
lng->txt(
"obj_" . $node[
"type"])
559 :
' class="ilLPParentInfoListLPUnsupported"' 571 $this->
lng->txt(
"trac_lp_settings_info_parent_legend"),
580 $this->
lng->txt(
"trac_lp_settings_info_parent_container")
584 return $panel->getHTML();
__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...
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
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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.
const PANEL_STYLE_SECONDARY
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
ilGlobalTemplateInterface $tpl
static getInstance(int $obj_id)
static _getValidTimeSpan()