ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ilLPListOfSettingsGUI Class Reference

Class ilLPListOfSettingsGUI. More...

+ Inheritance diagram for ilLPListOfSettingsGUI:
+ Collaboration diagram for ilLPListOfSettingsGUI:

Public Member Functions

 __construct (int $a_mode, int $a_ref_id)
 
 executeCommand ()
 execute command More...
 
- Public Member Functions inherited from ilLearningProgressBaseGUI
 __construct (int $a_mode, int $a_ref_id=0, int $a_usr_id=0)
 
 isAnonymized ()
 
 getMode ()
 
 getRefId ()
 
 getObjId ()
 
 getUserId ()
 
 __getDefaultCommand ()
 
 __setSubTabs (int $a_active)
 
 __buildFooter ()
 
 __buildHeader ()
 
 __showObjectDetails (ilInfoScreenGUI $info, int $item_id=0, string $item_type='', bool $add_section=true)
 show details about current object. More...
 
 __appendLPDetails (ilInfoScreenGUI $info, int $item_id, int $user_id)
 
 __getLegendHTML (int $variant=ilLPStatusIcons::ICON_VARIANT_LONG)
 
 __showEditUser (int $a_user_id, int $a_ref_id, ?string $a_cancel=null, int $a_sub_id=0)
 
 __updateUser (int $user_id, int $obj_id)
 

Protected Member Functions

 initItemIdsFromPost ()
 
 show ()
 Show settings tables. More...
 
 initFormSettings ()
 
 saveSettings ()
 
 getTableByMode ()
 Get tables by mode. More...
 
 assign ()
 
 deassign ()
 
 groupMaterials ()
 Group materials. More...
 
 releaseMaterials ()
 
 saveObligatoryMaterials ()
 Save obligatory state per grouped materials. More...
 
 updateTLT ()
 
 getLPPathInfo (int $a_ref_id, array &$a_res)
 
 handleLPUsageInfo ()
 
- Protected Member Functions inherited from ilLearningProgressBaseGUI
 initUserIdFromQuery ()
 
 readTypicalLearningTimeInSeconds (int $obj_id, int $sub_id, string $type)
 
 initEditUserForm (int $a_user_id, int $a_obj_id, ?string $a_cancel=null)
 

Protected Attributes

ilLPObjSettings $obj_settings
 
ilObjectLP $obj_lp
 
- Protected Attributes inherited from ilLearningProgressBaseGUI
RefineryFactory $refinery
 
HttpServices $http
 
ilGlobalTemplateInterface $tpl
 
ilHelpGUI $help
 
ilCtrlInterface $ctrl
 
ilLanguage $lng
 
ilLogger $logger
 
ilTabsGUI $tabs_gui
 
ilToolbarGUI $toolbar
 
ilObjectDataCache $ilObjectDataCache
 
ilObjUser $user
 
ilAccessHandler $access
 
ilRbacSystem $rbacsystem
 
ilRbacReview $rbacreview
 
ilTree $tree
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 
LOMServices $lom_services
 
bool $anonymized
 
int $usr_id = 0
 
int $ref_id = 0
 
int $obj_id = 0
 
string $obj_type = ''
 
int $mode = 0
 
const LP_ACTIVE_SETTINGS = 1
 
const LP_ACTIVE_OBJECTS = 2
 
const LP_ACTIVE_PROGRESS = 3
 
const LP_ACTIVE_USERS = 5
 
const LP_ACTIVE_SUMMARY = 6
 
const LP_ACTIVE_OBJSTATACCESS = 7
 
const LP_ACTIVE_OBJSTATTYPES = 8
 
const LP_ACTIVE_OBJSTATDAILY = 9
 
const LP_ACTIVE_OBJSTATADMIN = 10
 
const LP_ACTIVE_MATRIX = 11
 

Additional Inherited Members

- Static Public Member Functions inherited from ilLearningProgressBaseGUI
static _getStatusText (int $a_status, ?ilLanguage $a_lng=null)
 Get status alt text. More...
 
static __readStatus (int $a_obj_id, int $user_id)
 PhpInconsistentReturnPointsInspection More...
 
static isObjectOffline (int $a_obj_id, string $a_type='')
 
- Data Fields inherited from ilLearningProgressBaseGUI
const LP_CONTEXT_PERSONAL_DESKTOP = 1
 
const LP_CONTEXT_ADMINISTRATION = 2
 
const LP_CONTEXT_REPOSITORY = 3
 
const LP_CONTEXT_USER_FOLDER = 4
 
const LP_CONTEXT_ORG_UNIT = 5
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilLPListOfSettingsGUI::__construct ( int  $a_mode,
int  $a_ref_id 
)

Definition at line 32 of file class.ilLPListOfSettingsGUI.php.

References ILIAS\GlobalScreen\Provider\__construct(), ilObjectLP\getInstance(), and ilLearningProgressBaseGUI\getObjId().

33  {
34  parent::__construct($a_mode, $a_ref_id);
35 
36  $this->obj_settings = new ilLPObjSettings($this->getObjId());
37  $this->obj_lp = ilObjectLP::getInstance($this->getObjId());
38  }
__construct(Container $dic, ilPlugin $plugin)
static getInstance(int $obj_id)
+ Here is the call graph for this function:

Member Function Documentation

◆ assign()

ilLPListOfSettingsGUI::assign ( )
protected

Definition at line 226 of file class.ilLPListOfSettingsGUI.php.

References ilLPStatusWrapper\_refreshStatus(), ILIAS\Repository\ctrl(), ilLearningProgressBaseGUI\getObjId(), initItemIdsFromPost(), and ILIAS\Repository\lng().

226  : void
227  {
228  if (!$this->initItemIdsFromPost()) {
229  $this->tpl->setOnScreenMessage(
230  'failure',
231  $this->lng->txt('select_one'),
232  true
233  );
234  $this->ctrl->redirect($this, 'show');
235  }
236  if (count($this->initItemIdsFromPost())) {
237  $collection = $this->obj_lp->getCollectionInstance();
238  if ($collection && $collection->hasSelectableItems()) {
239  $collection->activateEntries($this->initItemIdsFromPost());
240  }
241  // refresh learning progress
242  $this->obj_lp->resetCaches();
244  }
245  $this->tpl->setOnScreenMessage(
246  'success',
247  $this->lng->txt('trac_settings_saved'),
248  true
249  );
250  $this->ctrl->redirect($this, 'show');
251  }
static _refreshStatus(int $a_obj_id, ?array $a_users=null)
+ Here is the call graph for this function:

◆ deassign()

ilLPListOfSettingsGUI::deassign ( )
protected

Definition at line 253 of file class.ilLPListOfSettingsGUI.php.

References ilLPStatusWrapper\_refreshStatus(), ILIAS\Repository\ctrl(), ilLearningProgressBaseGUI\getObjId(), initItemIdsFromPost(), and ILIAS\Repository\lng().

253  : void
254  {
255  if (!$this->initItemIdsFromPost()) {
256  $this->tpl->setOnScreenMessage(
257  'failure',
258  $this->lng->txt('select_one'),
259  true
260  );
261  $this->ctrl->redirect($this, 'show');
262  return;
263  }
264  if (count($this->initItemIdsFromPost())) {
265  $collection = $this->obj_lp->getCollectionInstance();
266  if ($collection && $collection->hasSelectableItems()) {
267  $collection->deactivateEntries($this->initItemIdsFromPost());
268  }
269 
270  // #15045 - has to be done before LP refresh!
271  $this->obj_lp->resetCaches();
272 
273  // refresh learning progress
275  }
276  $this->tpl->setOnScreenMessage(
277  'success',
278  $this->lng->txt('trac_settings_saved'),
279  true
280  );
281  $this->ctrl->redirect($this, 'show');
282  }
static _refreshStatus(int $a_obj_id, ?array $a_users=null)
+ Here is the call graph for this function:

◆ executeCommand()

ilLPListOfSettingsGUI::executeCommand ( )

execute command

Definition at line 43 of file class.ilLPListOfSettingsGUI.php.

References ilLearningProgressBaseGUI\__getDefaultCommand(), and ILIAS\Repository\ctrl().

43  : void
44  {
45  switch ($this->ctrl->getNextClass()) {
46  default:
47  $cmd = $this->__getDefaultCommand();
48  $this->$cmd();
49  }
50  }
+ Here is the call graph for this function:

◆ getLPPathInfo()

ilLPListOfSettingsGUI::getLPPathInfo ( int  $a_ref_id,
array &  $a_res 
)
protected

Definition at line 443 of file class.ilLPListOfSettingsGUI.php.

References $path, ilObjectLP\getInstance(), ILIAS\Repository\int(), and ilObjectLP\isSupportedObjectType().

Referenced by handleLPUsageInfo().

443  : bool
444  {
445  $has_lp_parents = false;
446 
447  $path = $this->tree->getNodePath($a_ref_id);
448  array_shift($path); // root
449  foreach ($path as $node) {
450  $supports_lp = ilObjectLP::isSupportedObjectType($node["type"]);
451  if ($supports_lp || $has_lp_parents) {
452  $a_res[(int) $node["child"]]["node"] = array(
453  "type" => (string) $node["type"]
454  ,
455  "title" => (string) $node["title"]
456  ,
457  "obj_id" => (int) $node["obj_id"]
458  ,
459  "lp" => false
460  ,
461  "active" => false
462  );
463  }
464 
465  if (
466  $supports_lp &&
467  $node["child"] != $a_ref_id) {
468  $a_res[(int) $node["child"]]["node"]["lp"] = true;
469  $has_lp_parents = true;
470 
471  $parent_obj_id = (int) $node['obj_id'];
472  $parent_obj_lp = \ilObjectLP::getInstance($parent_obj_id);
473  $parent_collection = $parent_obj_lp->getCollectionInstance();
474  if (
475  $parent_collection &&
476  $parent_collection->hasSelectableItems() &&
477  $parent_collection->isAssignedEntry($a_ref_id)
478  ) {
479  $a_res[$node['child']]['node']['active'] = true;
480  }
481  }
482  }
483  return $has_lp_parents;
484  }
static isSupportedObjectType(string $type)
$path
Definition: ltiservices.php:30
static getInstance(int $obj_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTableByMode()

ilLPListOfSettingsGUI::getTableByMode ( )
protected

Get tables by mode.

Definition at line 210 of file class.ilLPListOfSettingsGUI.php.

References ilLearningProgressBaseGUI\getRefId(), and ilLPCollectionSettingsTableGUI\parse().

Referenced by saveSettings(), and show().

210  : string
211  {
212  $collection = $this->obj_lp->getCollectionInstance();
213  if ($collection && $collection->hasSelectableItems()) {
214  $table = new ilLPCollectionSettingsTableGUI(
215  $this,
216  'show',
217  $this->getRefId(),
218  $this->obj_lp->getCurrentMode()
219  );
220  $table->parse($collection);
221  return $table->getHTML();
222  }
223  return '';
224  }
parse(ilLPCollection $a_collection)
Read and parse items.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ groupMaterials()

ilLPListOfSettingsGUI::groupMaterials ( )
protected

Group materials.

Definition at line 287 of file class.ilLPListOfSettingsGUI.php.

References ilLPStatusWrapper\_refreshStatus(), ILIAS\Repository\ctrl(), ilLearningProgressBaseGUI\getObjId(), initItemIdsFromPost(), and ILIAS\Repository\lng().

287  : void
288  {
289  if (!count((array) $this->initItemIdsFromPost())) {
290  $this->tpl->setOnScreenMessage(
291  'failure',
292  $this->lng->txt('select_one'),
293  true
294  );
295  $this->ctrl->redirect($this, 'show');
296  }
297 
298  $collection = $this->obj_lp->getCollectionInstance();
299  if ($collection && $collection->hasSelectableItems()) {
300  // Assign new grouping id
301  $collection->createNewGrouping($this->initItemIdsFromPost());
302 
303  $this->obj_lp->resetCaches();
304 
305  // refresh learning progress
307  }
308 
309  $this->tpl->setOnScreenMessage(
310  'success',
311  $this->lng->txt('trac_settings_saved'),
312  true
313  );
314  $this->ctrl->redirect($this, 'show');
315  }
static _refreshStatus(int $a_obj_id, ?array $a_users=null)
+ Here is the call graph for this function:

◆ handleLPUsageInfo()

ilLPListOfSettingsGUI::handleLPUsageInfo ( )
protected

Definition at line 486 of file class.ilLPListOfSettingsGUI.php.

References $params, $parts, ilLearningProgressBaseGUI\$ref_id, ilLearningProgressBaseGUI\$tpl, ilObject\_getIcon(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ILIAS\Repository\access(), ilGlobalTemplateInterface\get(), getLPPathInfo(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ilGlobalTemplateInterface\parseCurrentBlock(), ILIAS\Repository\refinery(), ilGlobalTemplateInterface\setCurrentBlock(), ilGlobalTemplateInterface\setVariable(), and ilGlobalTemplateInterface\touchBlock().

Referenced by saveSettings(), and show().

486  : string
487  {
488  $ref_id = 0;
489  if ($this->http->wrapper()->query()->has('ref_id')) {
490  $ref_id = $this->http->wrapper()->query()->retrieve(
491  'ref_id',
492  $this->refinery->kindlyTo()->int()
493  );
494  } elseif ($this->http->wrapper()->post()->has('ref_id')) {
495  $ref_id = $this->http->wrapper()->post()->retrieve(
496  'ref_id',
497  $this->refinery->kindlyTo()->int()
498  );
499  }
500  $coll = array();
501  if ($ref_id &&
502  $this->getLPPathInfo((int) $ref_id, $coll)) {
503  $tpl = new ilTemplate(
504  "tpl.lp_obj_settings_tree_info.html",
505  true,
506  true,
507  "components/ILIAS/Tracking"
508  );
509 
510  $margin = 0;
511  $has_active = false;
512  foreach ($coll as $parent_ref_id => $parts) {
513  $node = $parts["node"];
514  $params = array();
515  if ($node["lp"]) {
516  if ($node["active"]) {
517  $tpl->touchBlock("parent_active_bl");
518  $has_active = true;
519  }
520 
521  $params["gotolp"] = 1;
522  }
523 
524  if ($this->access->checkAccess("read", "", $parent_ref_id) &&
525  $parent_ref_id != $ref_id) { // #17170
526  $tpl->setCurrentBlock("parent_link_bl");
527  $tpl->setVariable("PARENT_LINK_TITLE", $node["title"]);
528  $tpl->setVariable(
529  "PARENT_URL",
530  ilLink::_getLink(
531  $parent_ref_id,
532  $node["type"],
533  $params
534  )
535  );
537  } else {
538  $tpl->setCurrentBlock("parent_nolink_bl");
539  $tpl->setVariable("PARENT_NOLINK_TITLE", $node["title"]);
541  }
542 
543  $tpl->setCurrentBlock("parent_usage_bl");
544  $tpl->setVariable(
545  "PARENT_TYPE_URL",
547  $node["obj_id"],
548  "small",
549  $node["type"]
550  )
551  );
552  $tpl->setVariable(
553  "PARENT_TYPE_ALT",
554  $this->lng->txt("obj_" . $node["type"])
555  );
556 
557  $tpl->setVariable(
558  "PARENT_STYLE",
559  $node["lp"]
560  ? ''
561  : ' class="ilLPParentInfoListLPUnsupported"'
562  );
563  $tpl->setVariable("MARGIN", $margin);
565 
566  $margin += 25;
567  }
568 
569  if ($has_active) {
570  $tpl->setVariable(
571  "LEGEND",
572  sprintf(
573  $this->lng->txt("trac_lp_settings_info_parent_legend"),
575  )
576  );
577  }
578 
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())
582  );
583 
584  return $this->ui_renderer->render($panel);
585  }
586  return '';
587  }
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
Definition: ltitoken.php:61
touchBlock(string $block)
overwrites ITX::touchBlock.
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:31
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.
static _lookupObjId(int $ref_id)
static http()
Fetches the global http state from ILIAS.
static _lookupTitle(int $obj_id)
getLPPathInfo(int $a_ref_id, array &$a_res)
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFormSettings()

ilLPListOfSettingsGUI::initFormSettings ( )
protected

Definition at line 84 of file class.ilLPListOfSettingsGUI.php.

References ilObjUserTracking\_getValidTimeSpan(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ilLPObjSettings\LP_MODE_VISITS, ilFormPropertyGUI\setRequired(), and ilRadioOption\setValue().

Referenced by saveSettings(), and show().

85  {
86  $form = new ilPropertyFormGUI();
87  $form->setTitle($this->lng->txt('tracking_settings'));
88  $form->setFormAction($this->ctrl->getFormAction($this));
89 
90  // Mode
91  $mod = new ilRadioGroupInputGUI($this->lng->txt('trac_mode'), 'modus');
92  $mod->setRequired(true);
93  $mod->setValue((string) $this->obj_lp->getCurrentMode());
94  $form->addItem($mod);
95 
96  if ($this->obj_lp->hasIndividualModeOptions()) {
97  $this->obj_lp->initInvidualModeOptions($mod);
98  } else {
99  foreach ($this->obj_lp->getValidModes() as $mode_key) {
100  $opt = new ilRadioOption(
101  $this->obj_lp->getModeText($mode_key),
102  (string) $mode_key,
103  $this->obj_lp->getModeInfoText($mode_key)
104  );
105  $opt->setValue((string) $mode_key);
106  $mod->addOption($opt);
107 
108  // :TODO: Subitem for visits ?!
109  if ($mode_key == ilLPObjSettings::LP_MODE_VISITS) {
110  $vis = new ilNumberInputGUI(
111  $this->lng->txt('trac_visits'),
112  'visits'
113  );
114  $vis->setSize(3);
115  $vis->setMaxLength(4);
116  $vis->setInfo(
117  sprintf(
118  $this->lng->txt('trac_visits_info'),
120  )
121  );
122  $vis->setRequired(true);
123  $vis->setValue((string) $this->obj_settings->getVisits());
124  $opt->addSubItem($vis);
125  }
126  $this->obj_lp->appendModeConfiguration((int) $mode_key, $opt);
127  }
128  }
129  $form->addCommandButton('saveSettings', $this->lng->txt('save'));
130  return $form;
131  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a property in a property form.
setValue(string $a_value)
setRequired(bool $a_required)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initItemIdsFromPost()

ilLPListOfSettingsGUI::initItemIdsFromPost ( )
protected

Definition at line 52 of file class.ilLPListOfSettingsGUI.php.

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by assign(), deassign(), groupMaterials(), and releaseMaterials().

52  : array
53  {
54  if ($this->http->wrapper()->post()->has('item_ids')) {
55  return $this->http->wrapper()->post()->retrieve(
56  'item_ids',
57  $this->refinery->kindlyTo()->listOf(
58  $this->refinery->kindlyTo()->int()
59  )
60  );
61  }
62  return [];
63  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ releaseMaterials()

ilLPListOfSettingsGUI::releaseMaterials ( )
protected

Definition at line 320 of file class.ilLPListOfSettingsGUI.php.

References ilLPStatusWrapper\_refreshStatus(), ILIAS\Repository\ctrl(), ilLearningProgressBaseGUI\getObjId(), initItemIdsFromPost(), and ILIAS\Repository\lng().

320  : void
321  {
322  if (!count((array) $this->initItemIdsFromPost())) {
323  $this->tpl->setOnScreenMessage(
324  'failure',
325  $this->lng->txt('select_one'),
326  true
327  );
328  $this->ctrl->redirect($this, 'show');
329  }
330 
331  $collection = $this->obj_lp->getCollectionInstance();
332  if ($collection && $collection->hasSelectableItems()) {
333  $collection->releaseGrouping($this->initItemIdsFromPost());
334 
335  $this->obj_lp->resetCaches();
336 
337  // refresh learning progress
339  }
340 
341  $this->tpl->setOnScreenMessage(
342  'success',
343  $this->lng->txt('trac_settings_saved'),
344  true
345  );
346  $this->ctrl->redirect($this, 'show');
347  }
static _refreshStatus(int $a_obj_id, ?array $a_users=null)
+ Here is the call graph for this function:

◆ saveObligatoryMaterials()

ilLPListOfSettingsGUI::saveObligatoryMaterials ( )
protected

Save obligatory state per grouped materials.

Definition at line 352 of file class.ilLPListOfSettingsGUI.php.

References Vendor\Package\$e, ilLPStatusWrapper\_refreshStatus(), ILIAS\Repository\ctrl(), ilLearningProgressBaseGUI\getObjId(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

352  : void
353  {
354  $groups = [];
355  if ($this->http->wrapper()->post()->has('grp')) {
356  $groups = $this->http->wrapper()->post()->retrieve(
357  'grp',
358  $this->refinery->kindlyTo()->dictOf(
359  $this->refinery->kindlyTo()->int()
360  )
361  );
362  }
363  if (!count($groups)) {
364  $this->tpl->setOnScreenMessage(
365  'failure',
366  $this->lng->txt('select_one'),
367  true
368  );
369  $this->ctrl->redirect($this, 'show');
370  }
371 
372  try {
373  $collection = $this->obj_lp->getCollectionInstance();
374  if ($collection && $collection->hasSelectableItems()) {
375  $collection->saveObligatoryMaterials($groups);
376 
377  $this->obj_lp->resetCaches();
378 
379  // refresh learning progress
381  }
382 
383  $this->tpl->setOnScreenMessage(
384  'success',
385  $this->lng->txt('settings_saved'),
386  true
387  );
388  $this->ctrl->redirect($this, 'show');
389  } catch (UnexpectedValueException $e) {
390  $this->tpl->setOnScreenMessage(
391  'failure',
392  $this->lng->txt(
393  'trac_grouped_material_obligatory_err'
394  ),
395  true
396  );
397  $this->tpl->setOnScreenMessage(
398  'info',
399  $this->lng->txt('err_check_input'),
400  true
401  );
402  $this->ctrl->redirect($this, 'show');
403  }
404  }
static http()
Fetches the global http state from ILIAS.
static _refreshStatus(int $a_obj_id, ?array $a_users=null)
+ Here is the call graph for this function:

◆ saveSettings()

ilLPListOfSettingsGUI::saveSettings ( )
protected

Definition at line 133 of file class.ilLPListOfSettingsGUI.php.

References ILIAS\Repository\ctrl(), getTableByMode(), handleLPUsageInfo(), initFormSettings(), ILIAS\Repository\int(), ILIAS\Repository\lng(), ilLPObjSettings\LP_MODE_MANUAL_BY_TUTOR, and ilLPObjSettings\LP_MODE_VISITS.

133  : void
134  {
135  $form = $this->initFormSettings();
136  if ($form->checkInput()) {
137  // anything changed?
138 
139  // mode
140  if ($this->obj_lp->shouldFetchIndividualModeFromFormSubmission()) {
141  $new_mode = $this->obj_lp->fetchIndividualModeFromFormSubmission(
142  $form
143  );
144  } else {
145  $new_mode = (int) $form->getInput('modus');
146  }
147  $old_mode = $this->obj_lp->getCurrentMode();
148  $mode_changed = ($old_mode != $new_mode);
149 
150  // visits
151  $new_visits = null;
152  $visits_changed = null;
153  if ($new_mode == ilLPObjSettings::LP_MODE_VISITS) {
154  $new_visits = (int) $form->getInput('visits');
155  $old_visits = $this->obj_settings->getVisits();
156  $visits_changed = ($old_visits != $new_visits);
157  }
158 
159  $this->obj_lp->saveModeConfiguration($form, $mode_changed);
160 
161  if ($mode_changed) {
162  // delete existing collection
163  $collection = $this->obj_lp->getCollectionInstance();
164  if ($collection) {
165  $collection->delete();
166  }
167  }
168 
169 
170  // has to be done before LP refresh!
171  $this->obj_lp->resetCaches();
172 
173  $this->obj_settings->setMode($new_mode);
174  $this->obj_settings->setVisits((int) $new_visits);
175  $this->obj_settings->update(true);
176 
177  if ($mode_changed &&
178  $this->obj_lp->getCollectionInstance() &&
179  $new_mode != ilLPObjSettings::LP_MODE_MANUAL_BY_TUTOR) { // #14819
180  $this->tpl->setOnScreenMessage(
181  'info',
182  $this->lng->txt(
183  'trac_edit_collection'
184  ),
185  true
186  );
187  }
188  $this->tpl->setOnScreenMessage(
189  'success',
190  $this->lng->txt(
191  'trac_settings_saved'
192  ),
193  true
194  );
195  $this->ctrl->redirect($this, 'show');
196  }
197 
198  $form->setValuesByPost();
199 
200  $this->tpl->setContent(
201  $this->handleLPUsageInfo() .
202  $form->getHTML() .
203  $this->getTableByMode()
204  );
205  }
getTableByMode()
Get tables by mode.
+ Here is the call graph for this function:

◆ show()

ilLPListOfSettingsGUI::show ( )
protected

Show settings tables.

Definition at line 68 of file class.ilLPListOfSettingsGUI.php.

References getTableByMode(), handleLPUsageInfo(), ILIAS\Repository\help(), and initFormSettings().

68  : void
69  {
70  $this->help->setSubScreenId("trac_settings");
71  $info = $this->obj_lp->getSettingsInfo();
72  if ($info) {
73  $this->tpl->setOnScreenMessage('info', $info);
74  }
75 
76  $form = $this->initFormSettings();
77  $this->tpl->setContent(
78  $this->handleLPUsageInfo() .
79  $form->getHTML() .
80  $this->getTableByMode()
81  );
82  }
getTableByMode()
Get tables by mode.
+ Here is the call graph for this function:

◆ updateTLT()

ilLPListOfSettingsGUI::updateTLT ( )
protected
Exceptions
ilCtrlException

Definition at line 409 of file class.ilLPListOfSettingsGUI.php.

References ilLPStatusWrapper\_refreshStatus(), ILIAS\Repository\ctrl(), ilLearningProgressBaseGUI\getObjId(), ILIAS\FileDelivery\http(), and ILIAS\Repository\lng().

409  : void
410  {
411  $paths = $this->lom_services->paths();
412  $data_helper = $this->lom_services->dataHelper();
413 
414  $tlt = (array) ($this->http->request()->getParsedBody()['tlt'] ?? []);
415  foreach ($tlt as $item_id => $item) {
416  $lom_duration = $data_helper->durationFromIntegers(
417  null,
418  (int) $item['mo'],
419  (int) $item['d'],
420  (int) $item['h'],
421  (int) $item['m'],
422  null
423  );
424  $this->lom_services->manipulate($this->getObjId(), $item_id, 'st')
425  ->prepareCreateOrUpdate(
426  $paths->firstTypicalLearningTime(),
427  $lom_duration
428  )->execute();
429  }
430 
431  // refresh learning progress
432  $this->obj_lp->resetCaches();
434 
435  $this->tpl->setOnScreenMessage(
436  'success',
437  $this->lng->txt('settings_saved'),
438  true
439  );
440  $this->ctrl->redirect($this, 'show');
441  }
static http()
Fetches the global http state from ILIAS.
static _refreshStatus(int $a_obj_id, ?array $a_users=null)
+ Here is the call graph for this function:

Field Documentation

◆ $obj_lp

ilObjectLP ilLPListOfSettingsGUI::$obj_lp
protected

Definition at line 30 of file class.ilLPListOfSettingsGUI.php.

◆ $obj_settings

ilLPObjSettings ilLPListOfSettingsGUI::$obj_settings
protected

Definition at line 29 of file class.ilLPListOfSettingsGUI.php.


The documentation for this class was generated from the following file: