ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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
 
ProgressBlockSettings $progress_block_settings
 
- 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 37 of file class.ilLPListOfSettingsGUI.php.

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

38  {
39  parent::__construct($a_mode, $a_ref_id);
40 
41  $this->obj_settings = new ilLPObjSettings($this->getObjId());
42  $this->obj_lp = ilObjectLP::getInstance($this->getObjId());
43  $this->progress_block_settings = (new ViewFactory())->progressBlock()->settings()->repository();
44  }
__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 260 of file class.ilLPListOfSettingsGUI.php.

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

260  : void
261  {
262  if (!$this->initItemIdsFromPost()) {
263  $this->tpl->setOnScreenMessage(
264  'failure',
265  $this->lng->txt('select_one'),
266  true
267  );
268  $this->ctrl->redirect($this, 'show');
269  }
270  if (count($this->initItemIdsFromPost())) {
271  $collection = $this->obj_lp->getCollectionInstance();
272  if ($collection && $collection->hasSelectableItems()) {
273  $collection->activateEntries($this->initItemIdsFromPost());
274  }
275  // refresh learning progress
276  $this->obj_lp->resetCaches();
278  }
279  $this->tpl->setOnScreenMessage(
280  'success',
281  $this->lng->txt('trac_settings_saved'),
282  true
283  );
284  $this->ctrl->redirect($this, 'show');
285  }
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 287 of file class.ilLPListOfSettingsGUI.php.

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

287  : void
288  {
289  if (!$this->initItemIdsFromPost()) {
290  $this->tpl->setOnScreenMessage(
291  'failure',
292  $this->lng->txt('select_one'),
293  true
294  );
295  $this->ctrl->redirect($this, 'show');
296  return;
297  }
298  if (count($this->initItemIdsFromPost())) {
299  $collection = $this->obj_lp->getCollectionInstance();
300  if ($collection && $collection->hasSelectableItems()) {
301  $collection->deactivateEntries($this->initItemIdsFromPost());
302  }
303 
304  // #15045 - has to be done before LP refresh!
305  $this->obj_lp->resetCaches();
306 
307  // refresh learning progress
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:

◆ executeCommand()

ilLPListOfSettingsGUI::executeCommand ( )

execute command

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

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

49  : void
50  {
51  switch ($this->ctrl->getNextClass()) {
52  default:
53  $cmd = $this->__getDefaultCommand();
54  $this->$cmd();
55  }
56  }
+ Here is the call graph for this function:

◆ getLPPathInfo()

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

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

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

Referenced by handleLPUsageInfo().

477  : bool
478  {
479  $has_lp_parents = false;
480 
481  $path = $this->tree->getNodePath($a_ref_id);
482  array_shift($path); // root
483  foreach ($path as $node) {
484  $supports_lp = ilObjectLP::isSupportedObjectType($node["type"]);
485  if ($supports_lp || $has_lp_parents) {
486  $a_res[(int) $node["child"]]["node"] = array(
487  "type" => (string) $node["type"]
488  ,
489  "title" => (string) $node["title"]
490  ,
491  "obj_id" => (int) $node["obj_id"]
492  ,
493  "lp" => false
494  ,
495  "active" => false
496  );
497  }
498 
499  if (
500  $supports_lp &&
501  $node["child"] != $a_ref_id) {
502  $a_res[(int) $node["child"]]["node"]["lp"] = true;
503  $has_lp_parents = true;
504 
505  $parent_obj_id = (int) $node['obj_id'];
506  $parent_obj_lp = \ilObjectLP::getInstance($parent_obj_id);
507  $parent_collection = $parent_obj_lp->getCollectionInstance();
508  if (
509  $parent_collection &&
510  $parent_collection->hasSelectableItems() &&
511  $parent_collection->isAssignedEntry($a_ref_id)
512  ) {
513  $a_res[$node['child']]['node']['active'] = true;
514  }
515  }
516  }
517  return $has_lp_parents;
518  }
static isSupportedObjectType(string $type)
$path
Definition: ltiservices.php:29
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 244 of file class.ilLPListOfSettingsGUI.php.

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

Referenced by saveSettings(), and show().

244  : string
245  {
246  $collection = $this->obj_lp->getCollectionInstance();
247  if ($collection && $collection->hasSelectableItems()) {
248  $table = new ilLPCollectionSettingsTableGUI(
249  $this,
250  'show',
251  $this->getRefId(),
252  $this->obj_lp->getCurrentMode()
253  );
254  $table->parse($collection);
255  return $table->getHTML();
256  }
257  return '';
258  }
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 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  // Assign new grouping id
335  $collection->createNewGrouping($this->initItemIdsFromPost());
336 
337  $this->obj_lp->resetCaches();
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:

◆ handleLPUsageInfo()

ilLPListOfSettingsGUI::handleLPUsageInfo ( )
protected

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

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

Referenced by saveSettings(), and show().

520  : string
521  {
522  $ref_id = 0;
523  if ($this->http->wrapper()->query()->has('ref_id')) {
524  $ref_id = $this->http->wrapper()->query()->retrieve(
525  'ref_id',
526  $this->refinery->kindlyTo()->int()
527  );
528  } elseif ($this->http->wrapper()->post()->has('ref_id')) {
529  $ref_id = $this->http->wrapper()->post()->retrieve(
530  'ref_id',
531  $this->refinery->kindlyTo()->int()
532  );
533  }
534  $coll = array();
535  if ($ref_id &&
536  $this->getLPPathInfo((int) $ref_id, $coll)) {
537  $tpl = new ilTemplate(
538  "tpl.lp_obj_settings_tree_info.html",
539  true,
540  true,
541  "components/ILIAS/Tracking"
542  );
543 
544  $margin = 0;
545  $has_active = false;
546  foreach ($coll as $parent_ref_id => $parts) {
547  $node = $parts["node"];
548  $params = array();
549  if ($node["lp"]) {
550  if ($node["active"]) {
551  $tpl->touchBlock("parent_active_bl");
552  $has_active = true;
553  }
554 
555  $params["gotolp"] = 1;
556  }
557 
558  if ($this->access->checkAccess("read", "", $parent_ref_id) &&
559  $parent_ref_id != $ref_id) { // #17170
560  $tpl->setCurrentBlock("parent_link_bl");
561  $tpl->setVariable("PARENT_LINK_TITLE", $node["title"]);
562  $tpl->setVariable(
563  "PARENT_URL",
564  ilLink::_getLink(
565  $parent_ref_id,
566  $node["type"],
567  $params
568  )
569  );
571  } else {
572  $tpl->setCurrentBlock("parent_nolink_bl");
573  $tpl->setVariable("PARENT_NOLINK_TITLE", $node["title"]);
575  }
576 
577  $tpl->setCurrentBlock("parent_usage_bl");
578  $tpl->setVariable(
579  "PARENT_TYPE_URL",
581  $node["obj_id"],
582  "small",
583  $node["type"]
584  )
585  );
586  $tpl->setVariable(
587  "PARENT_TYPE_ALT",
588  $this->lng->txt("obj_" . $node["type"])
589  );
590 
591  $tpl->setVariable(
592  "PARENT_STYLE",
593  $node["lp"]
594  ? ''
595  : ' class="ilLPParentInfoListLPUnsupported"'
596  );
597  $tpl->setVariable("MARGIN", $margin);
599 
600  $margin += 25;
601  }
602 
603  if ($has_active) {
604  $tpl->setVariable(
605  "LEGEND",
606  sprintf(
607  $this->lng->txt("trac_lp_settings_info_parent_legend"),
609  )
610  );
611  }
612 
613  $panel = $this->ui_factory->panel()->secondary()->legacy(
614  $this->lng->txt("trac_lp_settings_info_parent_container"),
615  $this->ui_factory->legacy()->content($tpl->get())
616  );
617 
618  return $this->ui_renderer->render($panel);
619  }
620  return '';
621  }
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
touchBlock(string $block)
overwrites ITX::touchBlock.
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
Definition: ltitoken.php:61
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:31
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)
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFormSettings()

ilLPListOfSettingsGUI::initFormSettings ( )
protected

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

References ilLearningProgressBaseGUI\$mode, ilObjUserTracking\_getValidTimeSpan(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ilLPObjSettings\LP_MODE_COLLECTION, ilLPObjSettings\LP_MODE_VISITS, ILIAS\Repository\refinery(), and ILIAS\UI\Implementation\Component\Input\withValue().

Referenced by saveSettings(), and show().

90  : StandardForm
91  {
92  $mode_groups = [];
93  if ($this->obj_lp->hasIndividualModeOptions()) {
94  $mode_groups = $this->obj_lp->initInvidualModeOptions();
95  } else {
96  foreach ($this->obj_lp->getValidModes() as $mode_key) {
97  $mode_config_inputs = [];
98 
99  if ($mode_key == ilLPObjSettings::LP_MODE_VISITS) {
100  $mode_config_inputs['visits'] = $this->ui_factory->input()->field()->numeric(
101  $this->lng->txt('trac_visits'),
102  sprintf(
103  $this->lng->txt('trac_visits_info'),
105  )
106  )->withRequired(true)
107  ->withAdditionalTransformation(
108  $this->refinery->in()->series([
109  $this->refinery->int()->isGreaterThanOrEqual(1),
110  $this->refinery->int()->isLessThanOrEqual(99999)
111  ])
112  )->withValue($this->obj_settings->getVisits());
113  }
114 
115  if ($mode_key == ilLPObjSettings::LP_MODE_COLLECTION) {
116  $mode_config_inputs['show_block'] = $this->ui_factory->input()->field()->checkbox(
117  $this->lng->txt('trac_show_progress_block'),
118  )->withValue(
119  $this->progress_block_settings->isBlockShownForObject($this->getObjId())
120  );
121  }
122 
123  $mode_config_inputs = array_merge(
124  $mode_config_inputs,
125  $this->obj_lp->appendModeConfiguration($mode_key)
126  );
127 
128  $mode_groups[$mode_key] = $this->ui_factory->input()->field()->group(
129  $mode_config_inputs,
130  $this->obj_lp->getModeText($mode_key),
131  $this->obj_lp->getModeInfoText($mode_key)
132  );
133  }
134  }
135 
136  $mode = $this->ui_factory->input()->field()->switchableGroup(
137  $mode_groups,
138  $this->lng->txt('trac_mode')
139  )->withRequired(true)
140  ->withValue((string) $this->obj_lp->getCurrentMode());
141 
142  $section = $this->ui_factory->input()->field()->section(
143  ['modus' => $mode],
144  $this->lng->txt('tracking_settings')
145  );
146 
147  return $this->ui_factory->input()->container()->form()->standard(
148  $this->ctrl->getLinkTarget($this, 'saveSettings'),
149  ['main' => $section]
150  );
151  }
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:61
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initItemIdsFromPost()

ilLPListOfSettingsGUI::initItemIdsFromPost ( )
protected

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

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

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

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

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

354  : void
355  {
356  if (!count((array) $this->initItemIdsFromPost())) {
357  $this->tpl->setOnScreenMessage(
358  'failure',
359  $this->lng->txt('select_one'),
360  true
361  );
362  $this->ctrl->redirect($this, 'show');
363  }
364 
365  $collection = $this->obj_lp->getCollectionInstance();
366  if ($collection && $collection->hasSelectableItems()) {
367  $collection->releaseGrouping($this->initItemIdsFromPost());
368 
369  $this->obj_lp->resetCaches();
370 
371  // refresh learning progress
373  }
374 
375  $this->tpl->setOnScreenMessage(
376  'success',
377  $this->lng->txt('trac_settings_saved'),
378  true
379  );
380  $this->ctrl->redirect($this, 'show');
381  }
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 386 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().

386  : void
387  {
388  $groups = [];
389  if ($this->http->wrapper()->post()->has('grp')) {
390  $groups = $this->http->wrapper()->post()->retrieve(
391  'grp',
392  $this->refinery->kindlyTo()->dictOf(
393  $this->refinery->kindlyTo()->int()
394  )
395  );
396  }
397  if (!count($groups)) {
398  $this->tpl->setOnScreenMessage(
399  'failure',
400  $this->lng->txt('select_one'),
401  true
402  );
403  $this->ctrl->redirect($this, 'show');
404  }
405 
406  try {
407  $collection = $this->obj_lp->getCollectionInstance();
408  if ($collection && $collection->hasSelectableItems()) {
409  $collection->saveObligatoryMaterials($groups);
410 
411  $this->obj_lp->resetCaches();
412 
413  // refresh learning progress
415  }
416 
417  $this->tpl->setOnScreenMessage(
418  'success',
419  $this->lng->txt('settings_saved'),
420  true
421  );
422  $this->ctrl->redirect($this, 'show');
423  } catch (UnexpectedValueException $e) {
424  $this->tpl->setOnScreenMessage(
425  'failure',
426  $this->lng->txt(
427  'trac_grouped_material_obligatory_err'
428  ),
429  true
430  );
431  $this->tpl->setOnScreenMessage(
432  'info',
433  $this->lng->txt('err_check_input'),
434  true
435  );
436  $this->ctrl->redirect($this, 'show');
437  }
438  }
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 153 of file class.ilLPListOfSettingsGUI.php.

References $data, ILIAS\Repository\ctrl(), ilLearningProgressBaseGUI\getObjId(), getTableByMode(), handleLPUsageInfo(), ILIAS\FileDelivery\http(), initFormSettings(), ILIAS\Repository\int(), ILIAS\Repository\lng(), ilLPObjSettings\LP_MODE_COLLECTION, ilLPObjSettings\LP_MODE_MANUAL_BY_TUTOR, ilLPObjSettings\LP_MODE_VISITS, and null.

153  : void
154  {
155  $form = $this->initFormSettings()
156  ->withRequest($this->http->request());
157  if ($data = $form->getData()) {
158  $selected_mode = (string) $data['main']['modus'][0];
159  $mode_data = $data['main']['modus'][1];
160 
161  // mode
162  if ($this->obj_lp->shouldFetchIndividualModeFromFormSubmission()) {
163  $new_mode = $this->obj_lp->fetchIndividualModeFromFormSubmission(
164  $selected_mode,
165  $mode_data
166  );
167  } else {
168  $new_mode = (int) $selected_mode;
169  }
170  $old_mode = $this->obj_lp->getCurrentMode();
171  // anything changed?
172  $mode_changed = ($old_mode != $new_mode);
173 
174  // visits
175  $new_visits = null;
176  $visits_changed = null;
177  if ($new_mode == ilLPObjSettings::LP_MODE_VISITS) {
178  $new_visits = (int) $mode_data['visits'];
179  $old_visits = $this->obj_settings->getVisits();
180  $visits_changed = ($old_visits != $new_visits);
181  }
182 
183  // progress block
184  if ($new_mode == ilLPObjSettings::LP_MODE_COLLECTION) {
185  $this->progress_block_settings->setShowBlockForObject(
186  $this->getObjId(),
187  (bool) $mode_data['show_block']
188  );
189  }
190 
191  $this->obj_lp->saveModeConfiguration(
192  $selected_mode,
193  $mode_data,
194  $mode_changed
195  );
196 
197  if ($mode_changed) {
198  // delete existing collection
199  $collection = $this->obj_lp->getCollectionInstance();
200  if ($collection) {
201  $collection->delete();
202  }
203  }
204 
205 
206  // has to be done before LP refresh!
207  $this->obj_lp->resetCaches();
208 
209  $this->obj_settings->setMode($new_mode);
210  $this->obj_settings->setVisits((int) $new_visits);
211  $this->obj_settings->update(true);
212 
213  if ($mode_changed &&
214  $this->obj_lp->getCollectionInstance() &&
215  $new_mode != ilLPObjSettings::LP_MODE_MANUAL_BY_TUTOR) { // #14819
216  $this->tpl->setOnScreenMessage(
217  'info',
218  $this->lng->txt(
219  'trac_edit_collection'
220  ),
221  true
222  );
223  }
224  $this->tpl->setOnScreenMessage(
225  'success',
226  $this->lng->txt(
227  'trac_settings_saved'
228  ),
229  true
230  );
231  $this->ctrl->redirect($this, 'show');
232  }
233 
234  $this->tpl->setContent(
235  $this->handleLPUsageInfo() .
236  $this->ui_renderer->render($form) .
237  $this->getTableByMode()
238  );
239  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static http()
Fetches the global http state from ILIAS.
getTableByMode()
Get tables by mode.
+ Here is the call graph for this function:

◆ show()

ilLPListOfSettingsGUI::show ( )
protected

Show settings tables.

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

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

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

◆ updateTLT()

ilLPListOfSettingsGUI::updateTLT ( )
protected
Exceptions
ilCtrlException

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

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

443  : void
444  {
445  $paths = $this->lom_services->paths();
446  $data_helper = $this->lom_services->dataHelper();
447 
448  $tlt = (array) ($this->http->request()->getParsedBody()['tlt'] ?? []);
449  foreach ($tlt as $item_id => $item) {
450  $lom_duration = $data_helper->durationFromIntegers(
451  null,
452  (int) $item['mo'],
453  (int) $item['d'],
454  (int) $item['h'],
455  (int) $item['m'],
456  null
457  );
458  $this->lom_services->manipulate($this->getObjId(), $item_id, 'st')
459  ->prepareCreateOrUpdate(
460  $paths->firstTypicalLearningTime(),
461  $lom_duration
462  )->execute();
463  }
464 
465  // refresh learning progress
466  $this->obj_lp->resetCaches();
468 
469  $this->tpl->setOnScreenMessage(
470  'success',
471  $this->lng->txt('settings_saved'),
472  true
473  );
474  $this->ctrl->redirect($this, 'show');
475  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 34 of file class.ilLPListOfSettingsGUI.php.

◆ $obj_settings

ilLPObjSettings ilLPListOfSettingsGUI::$obj_settings
protected

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

◆ $progress_block_settings

ProgressBlockSettings ilLPListOfSettingsGUI::$progress_block_settings
protected

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


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