ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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\GlobalScreen\Provider\__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(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 229 of file class.ilLPListOfSettingsGUI.php.

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

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

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

259  : void
260  {
261  if (!$this->initItemIdsFromPost()) {
262  $this->tpl->setOnScreenMessage(
263  'failure',
264  $this->lng->txt('select_one'),
265  true
266  );
267  $this->ctrl->redirect($this, 'show');
268  return;
269  }
270  if (count($this->initItemIdsFromPost())) {
271  $collection = $this->obj_lp->getCollectionInstance();
272  if ($collection && $collection->hasSelectableItems()) {
273  $collection->deactivateEntries($this->initItemIdsFromPost());
274  }
275 
276  // #15045 - has to be done before LP refresh!
277  $this->obj_lp->resetCaches();
278 
279  // refresh learning progress
281  }
282  $this->tpl->setOnScreenMessage(
283  'success',
284  $this->lng->txt('trac_settings_saved'),
285  true
286  );
287  $this->ctrl->redirect($this, 'show');
288  }
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  }
52  }
+ Here is the call graph for this function:

◆ getLPPathInfo()

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

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

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

Referenced by handleLPUsageInfo().

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

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

Referenced by saveSettings(), and show().

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

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

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

References $panel, $params, $parts, ilLearningProgressBaseGUI\$ref_id, ilLearningProgressBaseGUI\$tpl, ilObject\_getIcon(), ilLink\_getLink(), 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().

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

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

Referenced by saveSettings(), and show().

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

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

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

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

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

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

354  : void
355  {
356  $groups = [];
357  if ($this->http->wrapper()->post()->has('grp')) {
358  $groups = $this->http->wrapper()->post()->retrieve(
359  'grp',
360  $this->refinery->kindlyTo()->dictOf(
361  $this->refinery->kindlyTo()->int()
362  )
363  );
364  }
365  if (!count($groups)) {
366  $this->tpl->setOnScreenMessage(
367  'failure',
368  $this->lng->txt('select_one'),
369  true
370  );
371  $this->ctrl->redirect($this, 'show');
372  }
373 
374  try {
375  $collection = $this->obj_lp->getCollectionInstance();
376  if ($collection && $collection->hasSelectableItems()) {
377  $collection->saveObligatoryMaterials($groups);
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 135 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.

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

◆ show()

ilLPListOfSettingsGUI::show ( )
protected

Show settings tables.

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

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

70  : void
71  {
72  $this->help->setSubScreenId("trac_settings");
73  $info = $this->obj_lp->getSettingsInfo();
74  if ($info) {
75  $this->tpl->setOnScreenMessage('info', $info);
76  }
77 
78  $form = $this->initFormSettings();
79  $this->tpl->setContent(
80  $this->handleLPUsageInfo() .
81  $form->getHTML() .
82  $this->getTableByMode()
83  );
84  }
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  $tlt = (array) ($this->http->request()->getParsedBody()['tlt'] ?? []);
412  foreach ($tlt as $item_id => $item) {
413  $md_obj = new ilMD($this->getObjId(), $item_id, 'st');
414  if (!is_object($md_section = $md_obj->getEducational())) {
415  $md_section = $md_obj->addEducational();
416  $md_section->save();
417  }
418  $md_section->setPhysicalTypicalLearningTime(
419  (int) $item['mo'],
420  (int) $item['d'],
421  (int) $item['h'],
422  (int) $item['m'],
423  0
424  );
425  $md_section->update();
426  }
427 
428  // refresh learning progress
430 
431  $this->tpl->setOnScreenMessage(
432  'success',
433  $this->lng->txt('settings_saved'),
434  true
435  );
436  $this->ctrl->redirect($this, 'show');
437  }
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: