ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilLPListOfSettingsGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. 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, 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 ()
 
 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
 
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

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilLPListOfSettingsGUI

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om ilLPListOfSettingsGUI:

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

Constructor & Destructor Documentation

◆ __construct()

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

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

References ILIAS\MetaData\Repository\Validation\Data\__construct(), ilObjectLP\getInstance(), and ilLearningProgressBaseGUI\getObjId().

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

Member Function Documentation

◆ assign()

ilLPListOfSettingsGUI::assign ( )
protected

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

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

227  : void
228  {
229  if (!$this->initItemIdsFromPost()) {
230  $this->tpl->setOnScreenMessage(
231  'failure',
232  $this->lng->txt('select_one'),
233  true
234  );
235  $this->ctrl->redirect($this, 'show');
236  }
237  if (count($this->initItemIdsFromPost())) {
238  $collection = $this->obj_lp->getCollectionInstance();
239  if ($collection && $collection->hasSelectableItems()) {
240  $collection->activateEntries($this->initItemIdsFromPost());
241  }
242  // refresh learning progress
243  $this->obj_lp->resetCaches();
245  }
246  $this->tpl->setOnScreenMessage(
247  'success',
248  $this->lng->txt('trac_settings_saved'),
249  true
250  );
251  $this->ctrl->redirect($this, 'show');
252  }
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 254 of file class.ilLPListOfSettingsGUI.php.

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

254  : void
255  {
256  if (!$this->initItemIdsFromPost()) {
257  $this->tpl->setOnScreenMessage(
258  'failure',
259  $this->lng->txt('select_one'),
260  true
261  );
262  $this->ctrl->redirect($this, 'show');
263  return;
264  }
265  if (count($this->initItemIdsFromPost())) {
266  $collection = $this->obj_lp->getCollectionInstance();
267  if ($collection && $collection->hasSelectableItems()) {
268  $collection->deactivateEntries($this->initItemIdsFromPost());
269  }
270 
271  // #15045 - has to be done before LP refresh!
272  $this->obj_lp->resetCaches();
273 
274  // refresh learning progress
276  }
277  $this->tpl->setOnScreenMessage(
278  'success',
279  $this->lng->txt('trac_settings_saved'),
280  true
281  );
282  $this->ctrl->redirect($this, 'show');
283  }
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 44 of file class.ilLPListOfSettingsGUI.php.

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

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

◆ getLPPathInfo()

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

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

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

Referenced by handleLPUsageInfo().

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

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

Referenced by saveSettings(), and show().

211  : string
212  {
213  $collection = $this->obj_lp->getCollectionInstance();
214  if ($collection && $collection->hasSelectableItems()) {
215  $table = new ilLPCollectionSettingsTableGUI(
216  $this,
217  'show',
218  $this->getRefId(),
219  $this->obj_lp->getCurrentMode()
220  );
221  $table->parse($collection);
222  return $table->getHTML();
223  }
224  return '';
225  }
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 288 of file class.ilLPListOfSettingsGUI.php.

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

288  : void
289  {
290  if (!count((array) $this->initItemIdsFromPost())) {
291  $this->tpl->setOnScreenMessage(
292  'failure',
293  $this->lng->txt('select_one'),
294  true
295  );
296  $this->ctrl->redirect($this, 'show');
297  }
298 
299  $collection = $this->obj_lp->getCollectionInstance();
300  if ($collection && $collection->hasSelectableItems()) {
301  // Assign new grouping id
302  $collection->createNewGrouping($this->initItemIdsFromPost());
303 
304  $this->obj_lp->resetCaches();
305 
306  // refresh learning progress
308  }
309 
310  $this->tpl->setOnScreenMessage(
311  'success',
312  $this->lng->txt('trac_settings_saved'),
313  true
314  );
315  $this->ctrl->redirect($this, 'show');
316  }
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 484 of file class.ilLPListOfSettingsGUI.php.

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

Referenced by saveSettings(), and show().

484  : string
485  {
486  $ref_id = 0;
487  if ($this->http->wrapper()->query()->has('ref_id')) {
488  $ref_id = $this->http->wrapper()->query()->retrieve(
489  'ref_id',
490  $this->refinery->kindlyTo()->int()
491  );
492  } elseif ($this->http->wrapper()->post()->has('ref_id')) {
493  $ref_id = $this->http->wrapper()->post()->retrieve(
494  'ref_id',
495  $this->refinery->kindlyTo()->int()
496  );
497  }
498  $coll = array();
499  if ($ref_id &&
500  $this->getLPPathInfo((int) $ref_id, $coll)) {
501  $tpl = new ilTemplate(
502  "tpl.lp_obj_settings_tree_info.html",
503  true,
504  true,
505  "Services/Tracking"
506  );
507 
508  $margin = 0;
509  $has_active = false;
510  foreach ($coll as $parent_ref_id => $parts) {
511  $node = $parts["node"];
512  $params = array();
513  if ($node["lp"]) {
514  if ($node["active"]) {
515  $tpl->touchBlock("parent_active_bl");
516  $has_active = true;
517  }
518 
519  $params["gotolp"] = 1;
520  }
521 
522  if ($this->access->checkAccess("read", "", $parent_ref_id) &&
523  $parent_ref_id != $ref_id) { // #17170
524  $tpl->setCurrentBlock("parent_link_bl");
525  $tpl->setVariable("PARENT_LINK_TITLE", $node["title"]);
526  $tpl->setVariable(
527  "PARENT_URL",
528  ilLink::_getLink(
529  $parent_ref_id,
530  $node["type"],
531  $params
532  )
533  );
535  } else {
536  $tpl->setCurrentBlock("parent_nolink_bl");
537  $tpl->setVariable("PARENT_NOLINK_TITLE", $node["title"]);
539  }
540 
541  $tpl->setCurrentBlock("parent_usage_bl");
542  $tpl->setVariable(
543  "PARENT_TYPE_URL",
545  $node["obj_id"],
546  "small",
547  $node["type"]
548  )
549  );
550  $tpl->setVariable(
551  "PARENT_TYPE_ALT",
552  $this->lng->txt("obj_" . $node["type"])
553  );
554 
555  $tpl->setVariable(
556  "PARENT_STYLE",
557  $node["lp"]
558  ? ''
559  : ' class="ilLPParentInfoListLPUnsupported"'
560  );
561  $tpl->setVariable("MARGIN", $margin);
563 
564  $margin += 25;
565  }
566 
567  if ($has_active) {
568  $tpl->setVariable(
569  "LEGEND",
570  sprintf(
571  $this->lng->txt("trac_lp_settings_info_parent_legend"),
573  )
574  );
575  }
576 
577  $panel = ilPanelGUI::getInstance();
578  $panel->setPanelStyle(ilPanelGUI::PANEL_STYLE_SECONDARY);
579  $panel->setHeading(
580  $this->lng->txt("trac_lp_settings_info_parent_container")
581  );
582  $panel->setBody($tpl->get());
583 
584  return $panel->getHTML();
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:64
touchBlock(string $block)
overwrites ITX::touchBlock.
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:33
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.
static getInstance()
const PANEL_STYLE_SECONDARY
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 85 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().

86  {
87  $form = new ilPropertyFormGUI();
88  $form->setTitle($this->lng->txt('tracking_settings'));
89  $form->setFormAction($this->ctrl->getFormAction($this));
90 
91  // Mode
92  $mod = new ilRadioGroupInputGUI($this->lng->txt('trac_mode'), 'modus');
93  $mod->setRequired(true);
94  $mod->setValue((string) $this->obj_lp->getCurrentMode());
95  $form->addItem($mod);
96 
97  if ($this->obj_lp->hasIndividualModeOptions()) {
98  $this->obj_lp->initInvidualModeOptions($mod);
99  } else {
100  foreach ($this->obj_lp->getValidModes() as $mode_key) {
101  $opt = new ilRadioOption(
102  $this->obj_lp->getModeText($mode_key),
103  (string) $mode_key,
104  $this->obj_lp->getModeInfoText($mode_key)
105  );
106  $opt->setValue((string) $mode_key);
107  $mod->addOption($opt);
108 
109  // :TODO: Subitem for visits ?!
110  if ($mode_key == ilLPObjSettings::LP_MODE_VISITS) {
111  $vis = new ilNumberInputGUI(
112  $this->lng->txt('trac_visits'),
113  'visits'
114  );
115  $vis->setSize(3);
116  $vis->setMaxLength(4);
117  $vis->setInfo(
118  sprintf(
119  $this->lng->txt('trac_visits_info'),
121  )
122  );
123  $vis->setRequired(true);
124  $vis->setValue((string) $this->obj_settings->getVisits());
125  $opt->addSubItem($vis);
126  }
127  $this->obj_lp->appendModeConfiguration((int) $mode_key, $opt);
128  }
129  }
130  $form->addCommandButton('saveSettings', $this->lng->txt('save'));
131  return $form;
132  }
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 53 of file class.ilLPListOfSettingsGUI.php.

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

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

53  : array
54  {
55  if ($this->http->wrapper()->post()->has('item_ids')) {
56  return $this->http->wrapper()->post()->retrieve(
57  'item_ids',
58  $this->refinery->kindlyTo()->listOf(
59  $this->refinery->kindlyTo()->int()
60  )
61  );
62  }
63  return [];
64  }
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 321 of file class.ilLPListOfSettingsGUI.php.

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

321  : void
322  {
323  if (!count((array) $this->initItemIdsFromPost())) {
324  $this->tpl->setOnScreenMessage(
325  'failure',
326  $this->lng->txt('select_one'),
327  true
328  );
329  $this->ctrl->redirect($this, 'show');
330  }
331 
332  $collection = $this->obj_lp->getCollectionInstance();
333  if ($collection && $collection->hasSelectableItems()) {
334  $collection->releaseGrouping($this->initItemIdsFromPost());
335 
336  $this->obj_lp->resetCaches();
337 
338  // refresh learning progress
340  }
341 
342  $this->tpl->setOnScreenMessage(
343  'success',
344  $this->lng->txt('trac_settings_saved'),
345  true
346  );
347  $this->ctrl->redirect($this, 'show');
348  }
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 353 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().

353  : void
354  {
355  $groups = [];
356  if ($this->http->wrapper()->post()->has('grp')) {
357  $groups = $this->http->wrapper()->post()->retrieve(
358  'grp',
359  $this->refinery->kindlyTo()->dictOf(
360  $this->refinery->kindlyTo()->int()
361  )
362  );
363  }
364  if (!count($groups)) {
365  $this->tpl->setOnScreenMessage(
366  'failure',
367  $this->lng->txt('select_one'),
368  true
369  );
370  $this->ctrl->redirect($this, 'show');
371  }
372 
373  try {
374  $collection = $this->obj_lp->getCollectionInstance();
375  if ($collection && $collection->hasSelectableItems()) {
376  $collection->saveObligatoryMaterials($groups);
377 
378  $this->obj_lp->resetCaches();
379 
380  // refresh learning progress
382  }
383 
384  $this->tpl->setOnScreenMessage(
385  'success',
386  $this->lng->txt('settings_saved'),
387  true
388  );
389  $this->ctrl->redirect($this, 'show');
390  } catch (UnexpectedValueException $e) {
391  $this->tpl->setOnScreenMessage(
392  'failure',
393  $this->lng->txt(
394  'trac_grouped_material_obligatory_err'
395  ),
396  true
397  );
398  $this->tpl->setOnScreenMessage(
399  'info',
400  $this->lng->txt('err_check_input'),
401  true
402  );
403  $this->ctrl->redirect($this, 'show');
404  }
405  }
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 134 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.

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

◆ show()

ilLPListOfSettingsGUI::show ( )
protected

Show settings tables.

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

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

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

◆ updateTLT()

ilLPListOfSettingsGUI::updateTLT ( )
protected
Exceptions
ilCtrlException

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

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

410  : void
411  {
412  $tlt = (array) ($this->http->request()->getParsedBody()['tlt'] ?? []);
413  foreach ($tlt as $item_id => $item) {
414  $md_obj = new ilMD($this->getObjId(), $item_id, 'st');
415  if (!is_object($md_section = $md_obj->getEducational())) {
416  $md_section = $md_obj->addEducational();
417  $md_section->save();
418  }
419  $md_section->setPhysicalTypicalLearningTime(
420  (int) $item['mo'],
421  (int) $item['d'],
422  (int) $item['h'],
423  (int) $item['m'],
424  0
425  );
426  $md_section->update();
427  }
428 
429  // refresh learning progress
430  $this->obj_lp->resetCaches();
432 
433  $this->tpl->setOnScreenMessage(
434  'success',
435  $this->lng->txt('settings_saved'),
436  true
437  );
438  $this->ctrl->redirect($this, 'show');
439  }
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 31 of file class.ilLPListOfSettingsGUI.php.

◆ $obj_settings

ilLPObjSettings ilLPListOfSettingsGUI::$obj_settings
protected

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


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