ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilLPListOfSettingsGUI Class Reference

Class ilLPListOfSettingsGUI. More...

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

Public Member Functions

 __construct ($a_mode, $a_ref_id)
 
 executeCommand ()
 execute command More...
 
- Public Member Functions inherited from ilLearningProgressBaseGUI
 __construct ($a_mode, $a_ref_id=0, $a_usr_id=0)
 
 isAnonymized ()
 
 getMode ()
 
 getRefId ()
 
 getObjId ()
 
 getUserId ()
 
 __getDefaultCommand ()
 
 __setSubTabs ($a_active)
 
 __buildFooter ()
 
 __buildHeader ()
 
 __insertPath (&$a_tpl, $a_ref_id)
 insert path More...
 
 __showImageByStatus (&$tpl, $a_status, $tpl_prefix="")
 
__initTableGUI ()
 
 __showObjectDetails (&$info, $item_id=0, $add_section=true)
 show details about current object. More...
 
 __appendUserInfo (&$info, $a_user)
 
 __appendLPDetails (&$info, $item_id, $user_id)
 
 __sort ($a_ids, $a_table, $a_field, $a_id_name)
 Function that sorts ids by a given table field using WHERE IN E.g: __sort(array(6,7),'usr_data','lastname','usr_id') => sorts by lastname. More...
 
 __getPercent ($max, $reached)
 
 __readItemStatusInfo ($a_items)
 
 __getLegendHTML ()
 
 __showEditUser ($a_user_id, $a_ref_id, $a_cancel, $a_sub_id=false)
 
 __updateUser ($user_id, $obj_id)
 

Protected Member Functions

 show ()
 Show settings tables. More...
 
 initFormSettings ()
 Init property form. More...
 
 saveSettings ()
 Save learning progress settings. More...
 
 getTableByMode ()
 Get tables by mode. More...
 
 assign ()
 Save material assignment. More...
 
 deassign ()
 save mterial assignment More...
 
 groupMaterials ()
 Group materials. More...
 
 releaseMaterials ()
 
 saveObligatoryMaterials ()
 Save obligatory state per grouped materials. More...
 
 updateTLT ()
 
 getLPPathInfo ($a_ref_id, array &$a_res)
 Gather LP data about parent objects. More...
 
 handleLPUsageInfo ()
 
- Protected Member Functions inherited from ilLearningProgressBaseGUI
 initEditUserForm ($a_user_id, $a_obj_id, $a_cancel=null)
 

Protected Attributes

 $obj_settings
 
 $obj_lp
 
- Protected Attributes inherited from ilLearningProgressBaseGUI
 $anonymized
 
 $logger
 

Additional Inherited Members

- Static Public Member Functions inherited from ilLearningProgressBaseGUI
static _showImageByStatus (&$tpl, $a_status, $tpl_prefix="")
 
static _getImagePathForStatus ($a_status)
 Get image path for status. More...
 
static _getStatusText ($a_status, $a_lng=null)
 Get status alt text. More...
 
static __readStatus ($a_obj_id, $user_id)
 
static isObjectOffline ($a_obj_id, $a_type=null)
 
- Data Fields inherited from ilLearningProgressBaseGUI
 $tpl = null
 
 $ctrl = null
 
 $lng = null
 
 $ref_id = 0
 
 $mode = 0
 
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
 
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
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilLPListOfSettingsGUI::__construct (   $a_mode,
  $a_ref_id 
)

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

References ilObjectLP\getInstance(), and ilLearningProgressBaseGUI\getObjId().

26  {
27  parent::__construct($a_mode,$a_ref_id);
28 
29  $this->obj_settings = new ilLPObjSettings($this->getObjId());
30 
31  include_once './Services/Object/classes/class.ilObjectLP.php';
32  $this->obj_lp = ilObjectLP::getInstance($this->getObjId());
33  }
static getInstance($a_obj_id)
+ Here is the call graph for this function:

Member Function Documentation

◆ assign()

ilLPListOfSettingsGUI::assign ( )
protected

Save material assignment.

Returns
void

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

References $_POST, ilLPStatusWrapper\_refreshStatus(), ilLearningProgressBaseGUI\getObjId(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

203  {
204  if(!$_POST['item_ids'])
205  {
206  ilUtil::sendFailure($this->lng->txt('select_one'),true);
207  $this->ctrl->redirect($this,'show');
208  }
209  if(count($_POST['item_ids']))
210  {
211  $collection = $this->obj_lp->getCollectionInstance();
212  if($collection && $collection->hasSelectableItems())
213  {
214  $collection->activateEntries($_POST['item_ids']);
215  }
216 
217  // #15045 - has to be done before LP refresh!
218  $this->obj_lp->resetCaches();
219 
220  // refresh learning progress
221  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
223  }
224  ilUtil::sendSuccess($this->lng->txt('trac_settings_saved'),true);
225  $this->ctrl->redirect($this,'show');
226  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ deassign()

ilLPListOfSettingsGUI::deassign ( )
protected

save mterial assignment

Returns
void

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

References $_POST, ilLPStatusWrapper\_refreshStatus(), ilLearningProgressBaseGUI\getObjId(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

233  {
234  if(!$_POST['item_ids'])
235  {
236  ilUtil::sendFailure($this->lng->txt('select_one'),true);
237  $this->ctrl->redirect($this,'show');
238  return false;
239  }
240  if(count($_POST['item_ids']))
241  {
242  $collection = $this->obj_lp->getCollectionInstance();
243  if($collection && $collection->hasSelectableItems())
244  {
245  $collection->deactivateEntries($_POST['item_ids']);
246  }
247 
248  // #15045 - has to be done before LP refresh!
249  $this->obj_lp->resetCaches();
250 
251  // refresh learning progress
252  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
254  }
255  ilUtil::sendSuccess($this->lng->txt('trac_settings_saved'),true);
256  $this->ctrl->redirect($this,'show');
257  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ executeCommand()

ilLPListOfSettingsGUI::executeCommand ( )

execute command

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

References $cmd, and ilLearningProgressBaseGUI\__getDefaultCommand().

39  {
40  switch($this->ctrl->getNextClass())
41  {
42  default:
43  $cmd = $this->__getDefaultCommand();
44  $this->$cmd();
45 
46  }
47  return true;
48  }
$cmd
Definition: sahs_server.php:35
+ Here is the call graph for this function:

◆ getLPPathInfo()

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

Gather LP data about parent objects.

Parameters
int$a_ref_id
array$a_res
Returns
bool

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

References $path, array, ilObjectLP\getInstance(), and ilObjectLP\isSupportedObjectType().

Referenced by handleLPUsageInfo().

380  {
381  global $tree;
382 
383  $has_lp_parents = false;
384 
385  $path = $tree->getNodePath($a_ref_id);
386  array_shift($path); // root
387  foreach($path as $node)
388  {
389  $supports_lp = ilObjectLP::isSupportedObjectType($node["type"]);
390 
391  if($supports_lp || $has_lp_parents)
392  {
393  $a_res[$node["child"]]["node"] = array(
394  "type" => $node["type"]
395  ,"title" => $node["title"]
396  ,"obj_id" => $node["obj_id"]
397  ,"lp" => false
398  ,"active" => false
399  );
400  }
401 
402  if($supports_lp &&
403  $node["child"] != $a_ref_id)
404  {
405  $a_res[$node["child"]]["node"]["lp"] = true;
406  $has_lp_parents = true;
407 
408  $parent_obj_id = $node["obj_id"];
409  $parent_obj_lp = ilObjectLP::getInstance($parent_obj_id);
410 
411  // parse LP collection
412  $parent_collection = $parent_obj_lp->getCollectionInstance();
413  if($parent_collection &&
414  $parent_collection->hasSelectableItems() &&
415  $parent_collection->isAssignedEntry($a_ref_id))
416  {
417  $a_res[$node["child"]]["node"]["active"] = true;
418 
419  if($parent_collection instanceof ilLPCollectionOfRepositoryObjects)
420  {
421  $group = array();
422  foreach($parent_collection->getTableGUIData($node["parent"]) as $item)
423  {
424  $found = false;
425  $grp_tmp = array();
426  if($item["grouped"])
427  {
428  // parse grouped items
429  foreach($item["grouped"] as $group_item)
430  {
431  if($group_item["ref_id"] == $a_ref_id)
432  {
433  $found = true;
434  }
435  else
436  {
437  $grp_tmp[$group_item["ref_id"]] = array(
438  "type" => $group_item["type"]
439  ,"title" => $group_item["title"]
440  ,"obj_id" => $group_item["obj_id"]
441  );
442  }
443  }
444  }
445  if(sizeof($grp_tmp) ||
446  $found)
447  {
448  if($item["ref_id"] == $a_ref_id)
449  {
450  // group "parent" item is current object
451  $group = $grp_tmp;
452  }
453  else if($found)
454  {
455  // group "parent" item is not current object
456  // add group "parent" to grouped items
457  $group = $grp_tmp;
458  $group[$item["ref_id"]] = array(
459  "type" => $item["type"]
460  ,"title" => $item["title"]
461  ,"obj_id" => $item["obj_id"]
462  );
463  }
464  }
465  }
466  $a_res[$node["child"]]["group"] = $group;
467  }
468  }
469  }
470  }
471 
472  return $has_lp_parents;
473  }
$path
Definition: aliased.php:25
static isSupportedObjectType($a_type)
Create styles array
The data for the language used.
static getInstance($a_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 186 of file class.ilLPListOfSettingsGUI.php.

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

Referenced by saveSettings(), and show().

187  {
188  $collection = $this->obj_lp->getCollectionInstance();
189  if($collection && $collection->hasSelectableItems())
190  {
191  include_once "Services/Tracking/classes/repository_statistics/class.ilLPCollectionSettingsTableGUI.php";
192  $table = new ilLPCollectionSettingsTableGUI($this, 'show', $this->getRefId(), $this->obj_lp->getCurrentMode());
193  $table->parse($collection);
194  return $table->getHTML();
195  }
196  }
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 262 of file class.ilLPListOfSettingsGUI.php.

References $_POST, ilLPStatusWrapper\_refreshStatus(), array, ilLearningProgressBaseGUI\getObjId(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

263  {
264  if(!count((array) $_POST['item_ids']))
265  {
266  ilUtil::sendFailure($this->lng->txt('select_one'),true);
267  $this->ctrl->redirect($this,'show');
268  }
269 
270  $collection = $this->obj_lp->getCollectionInstance();
271  if($collection && $collection->hasSelectableItems())
272  {
273  // Assign new grouping id
274  $collection->createNewGrouping((array)$_POST['item_ids']);
275 
276  // refresh learning progress
277  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
279  }
280 
281  ilUtil::sendSuccess($this->lng->txt('trac_settings_saved'),true);
282  $this->ctrl->redirect($this,'show');
283  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ handleLPUsageInfo()

ilLPListOfSettingsGUI::handleLPUsageInfo ( )
protected

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

References $_GET, ilLearningProgressBaseGUI\$lng, $params, ilLearningProgressBaseGUI\$ref_id, ilLearningProgressBaseGUI\$tpl, ilLink\_getLink(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), array, ilPanelGUI\getInstance(), getLPPathInfo(), ilUtil\getTypeIconPath(), and ilPanelGUI\PANEL_STYLE_SECONDARY.

Referenced by show().

476  {
477  global $lng, $ilAccess;
478 
479  $ref_id = $_GET["ref_id"];
480  if(!$ref_id)
481  {
482  $ref_id = $_REQUEST["ref_id"];
483  }
484 
485  $coll = array();
486  if($ref_id &&
487  $this->getLPPathInfo($ref_id, $coll))
488  {
489  include_once "Services/Link/classes/class.ilLink.php";
490 
491  $tpl = new ilTemplate("tpl.lp_obj_settings_tree_info.html", true, true, "Services/Tracking");
492 
493  $margin = 0;
494  $has_active = false;
495  foreach($coll as $parent_ref_id => $parts)
496  {
497  /* currently not used
498  if($parts["group"])
499  {
500  foreach($parts["group"] as $group_item_ref_id => $group_item)
501  {
502  if($ilAccess->checkAccess("read", "", $group_item_ref_id))
503  {
504  $tpl->setCurrentBlock("group_item_link_bl");
505  $tpl->setVariable("GROUP_ITEM_LINK_TITLE", $group_item["title"]);
506  $tpl->setVariable("GROUP_ITEM_URL", ilLink::_getLink($group_item_ref_id, $group_item["type"], array("gotolp" => 1)));
507  $tpl->parseCurrentBlock();
508  }
509  else
510  {
511  $tpl->setCurrentBlock("group_item_nolink_bl");
512  $tpl->setVariable("GROUP_ITEM_NOLINK_TITLE", $group_item["title"]);
513  $tpl->parseCurrentBlock();
514  }
515 
516  $tpl->setCurrentBlock("group_item_bl");
517  $tpl->setVariable("GROUP_ITEM_TYPE_URL", ilUtil::getTypeIconPath($group_item["type"], $group_item["obj_id"]));
518  $tpl->setVariable("GROUP_ITEM_TYPE_ALT", $lng->txt("obj_".$group_item["type"]));
519  $tpl->parseCurrentBlock();
520  }
521 
522  $tpl->setCurrentBlock("group_bl");
523  $tpl->setVariable("GROUP_INFO", $lng->txt("trac_lp_settings_info_parent_group"));
524  $tpl->parseCurrentBlock();
525  }
526  */
527 
528  $node = $parts["node"];
529 
530  $params = array();
531  if($node["lp"])
532  {
533  if($node["active"])
534  {
535  $tpl->touchBlock("parent_active_bl");
536  $has_active = true;
537  }
538 
539  $params["gotolp"] = 1;
540  }
541 
542  if($ilAccess->checkAccess("read", "", $parent_ref_id) &&
543  $parent_ref_id != $ref_id) // #17170
544  {
545  $tpl->setCurrentBlock("parent_link_bl");
546  $tpl->setVariable("PARENT_LINK_TITLE", $node["title"]);
547  $tpl->setVariable("PARENT_URL", ilLink::_getLink($parent_ref_id, $node["type"], $params));
548  $tpl->parseCurrentBlock();
549  }
550  else
551  {
552  $tpl->setCurrentBlock("parent_nolink_bl");
553  $tpl->setVariable("PARENT_NOLINK_TITLE", $node["title"]);
554  $tpl->parseCurrentBlock();
555  }
556 
557  $tpl->setCurrentBlock("parent_usage_bl");
558  $tpl->setVariable("PARENT_TYPE_URL", ilUtil::getTypeIconPath($node["type"], $node["obj_id"]));
559  $tpl->setVariable("PARENT_TYPE_ALT", $lng->txt("obj_".$node["type"]));
560 
561  $tpl->setVariable("PARENT_STYLE", $node["lp"]
562  ? ''
563  : ' class="ilLPParentInfoListLPUnsupported"');
564  $tpl->setVariable("MARGIN", $margin);
565  $tpl->parseCurrentBlock();
566 
567  $margin += 25;
568  }
569 
570  if($has_active)
571  {
572  $tpl->setVariable("LEGEND", sprintf(
573  $lng->txt("trac_lp_settings_info_parent_legend"),
575  ));
576  }
577 
578  include_once "Services/UIComponent/Panel/classes/class.ilPanelGUI.php";
579  $panel = ilPanelGUI::getInstance();
580  $panel->setPanelStyle(ilPanelGUI::PANEL_STYLE_SECONDARY);
581  $panel->setHeading($lng->txt("trac_lp_settings_info_parent_container"));
582  $panel->setBody($tpl->get());
583 
584  return $panel->getHTML();
585  }
586  }
getLPPathInfo($a_ref_id, array &$a_res)
Gather LP data about parent objects.
$_GET["client_id"]
static _lookupTitle($a_id)
lookup object title
static getTypeIconPath($a_type, $a_obj_id, $a_size='small')
Get type icon path path Return image path for icon_xxx.pngs Or (if enabled) path to custom icon Depre...
static _lookupObjId($a_id)
special template class to simplify handling of ITX/PEAR
Create styles array
The data for the language used.
static getInstance()
Get instance.
const PANEL_STYLE_SECONDARY
$params
Definition: example_049.php:96
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFormSettings()

ilLPListOfSettingsGUI::initFormSettings ( )
protected

Init property form.

Returns
ilPropertyFormGUI $form

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

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

Referenced by saveSettings(), and show().

79  {
80  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
81  $form = new ilPropertyFormGUI();
82  $form->setTitle($this->lng->txt('tracking_settings'));
83  $form->setFormAction($this->ctrl->getFormAction($this));
84 
85  // Mode
86  $mod = new ilRadioGroupInputGUI($this->lng->txt('trac_mode'), 'modus');
87  $mod->setRequired(true);
88  $mod->setValue($this->obj_lp->getCurrentMode());
89  $form->addItem($mod);
90 
91  foreach($this->obj_lp->getValidModes() as $mode_key)
92  {
93  $opt = new ilRadioOption(
94  $this->obj_lp->getModeText($mode_key),
95  $mode_key,
96  $this->obj_lp->getModeInfoText($mode_key)
97  );
98  $opt->setValue($mode_key);
99  $mod->addOption($opt);
100 
101  // :TODO: Subitem for visits ?!
102  if($mode_key == ilLPObjSettings::LP_MODE_VISITS)
103  {
104  $vis = new ilNumberInputGUI($this->lng->txt('trac_visits'), 'visits');
105  $vis->setSize(3);
106  $vis->setMaxLength(4);
107  $vis->setInfo(sprintf($this->lng->txt('trac_visits_info'),
109  $vis->setRequired(true);
110  $vis->setValue($this->obj_settings->getVisits());
111  $opt->addSubItem($vis);
112  }
113  }
114 
115  $form->addCommandButton('saveSettings', $this->lng->txt('save'));
116 
117  return $form;
118  }
This class represents an option in a radio group.
This class represents a property form user interface.
This class represents a property in a property form.
setValue($a_value)
Set Value.
This class represents a number property in a property form.
setSize($a_size)
Set Size.
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ releaseMaterials()

ilLPListOfSettingsGUI::releaseMaterials ( )
protected

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

References $_POST, ilLPStatusWrapper\_refreshStatus(), array, ilLearningProgressBaseGUI\getObjId(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

289  {
290  if(!count((array) $_POST['item_ids']))
291  {
292  ilUtil::sendFailure($this->lng->txt('select_one'),true);
293  $this->ctrl->redirect($this,'show');
294  }
295 
296  $collection = $this->obj_lp->getCollectionInstance();
297  if($collection && $collection->hasSelectableItems())
298  {
299  $collection->releaseGrouping((array)$_POST['item_ids']);
300 
301  // refresh learning progress
302  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
304  }
305 
306  ilUtil::sendSuccess($this->lng->txt('trac_settings_saved'),true);
307  $this->ctrl->redirect($this,'show');
308  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ saveObligatoryMaterials()

ilLPListOfSettingsGUI::saveObligatoryMaterials ( )
protected

Save obligatory state per grouped materials.

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

References $_POST, ilLPStatusWrapper\_refreshStatus(), array, ilLearningProgressBaseGUI\getObjId(), ilUtil\sendFailure(), ilUtil\sendInfo(), and ilUtil\sendSuccess().

314  {
315  if(!is_array((array) $_POST['grp']))
316  {
317  ilUtil::sendFailure($this->lng->txt('select_one'),true);
318  $this->ctrl->redirect($this,'show');
319  }
320 
321  try {
322 
323  $collection = $this->obj_lp->getCollectionInstance();
324  if($collection && $collection->hasSelectableItems())
325  {
326  $collection->saveObligatoryMaterials((array)$_POST['grp']);
327 
328  // refresh learning progress
329  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
331  }
332 
333  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
334  $this->ctrl->redirect($this,'show');
335  }
336  catch(UnexpectedValueException $e) {
337  ilUtil::sendFailure($this->lng->txt('trac_grouped_material_obligatory_err'), true);
338  ilUtil::sendInfo($this->lng->txt('err_check_input'),true);
339  $this->ctrl->redirect($this,'show');
340  }
341  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ saveSettings()

ilLPListOfSettingsGUI::saveSettings ( )
protected

Save learning progress settings.

Returns
void

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

References getTableByMode(), initFormSettings(), ilLPObjSettings\LP_MODE_MANUAL_BY_TUTOR, ilLPObjSettings\LP_MODE_VISITS, ilUtil\sendFailure(), ilUtil\sendInfo(), and ilUtil\sendSuccess().

125  {
126  $form = $this->initFormSettings();
127  if($form->checkInput())
128  {
129  // anything changed?
130 
131  // mode
132  $new_mode = (int)$form->getInput('modus');
133  $old_mode = $this->obj_lp->getCurrentMode();
134  $mode_changed = ($old_mode != $new_mode);
135 
136  // visits
137  $new_visits = null;
138  $visits_changed = null;
139  if($new_mode == ilLPObjSettings::LP_MODE_VISITS)
140  {
141  $new_visits = (int)$form->getInput('visits');
142  $old_visits = $this->obj_settings->getVisits();
143  $visits_changed = ($old_visits != $new_visits);
144  }
145 
146  if($mode_changed)
147  {
148  // delete existing collection
149  $collection = $this->obj_lp->getCollectionInstance();
150  if($collection)
151  {
152  $collection->delete();
153  }
154  }
155 
156  $refresh_lp = ($mode_changed || $visits_changed);
157 
158  // has to be done before LP refresh!
159  $this->obj_lp->resetCaches();
160 
161  $this->obj_settings->setMode($new_mode);
162  $this->obj_settings->setVisits($new_visits);
163  $this->obj_settings->update($refresh_lp);
164 
165  if($mode_changed &&
166  $this->obj_lp->getCollectionInstance() &&
167  $new_mode != ilLPObjSettings::LP_MODE_MANUAL_BY_TUTOR) // #14819
168  {
169  ilUtil::sendInfo($this->lng->txt('trac_edit_collection'), true);
170  }
171  ilUtil::sendSuccess($this->lng->txt('trac_settings_saved'), true);
172  $this->ctrl->redirect($this, 'show');
173  }
174 
175  $form->setValuesByPost();
176  ilUtil::sendFailure($this->lng->txt('err_check_input'));
177 
178  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.lp_obj_settings.html','Services/Tracking');
179  $this->tpl->setVariable('PROP_FORM',$form->getHTML());
180  $this->tpl->setVariable('COLLECTION_TABLE',$this->getTableByMode());
181  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
initFormSettings()
Init property form.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
getTableByMode()
Get tables by mode.
+ Here is the call graph for this function:

◆ show()

ilLPListOfSettingsGUI::show ( )
protected

Show settings tables.

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

References $info, getTableByMode(), handleLPUsageInfo(), initFormSettings(), and ilUtil\sendInfo().

54  {
55  global $ilHelp;
56 
57  $ilHelp->setSubScreenId("trac_settings");
58 
59  $info = $this->obj_lp->getSettingsInfo();
60  if($info)
61  {
63  }
64 
65  $form = $this->initFormSettings();
66  $this->tpl->setContent(
67  $this->handleLPUsageInfo().
68  $form->getHTML().
69  $this->getTableByMode());
70  }
initFormSettings()
Init property form.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$info
Definition: example_052.php:80
getTableByMode()
Get tables by mode.
+ Here is the call graph for this function:

◆ updateTLT()

ilLPListOfSettingsGUI::updateTLT ( )
protected

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

References $_POST, ilLPStatusWrapper\_refreshStatus(), ilLearningProgressBaseGUI\getObjId(), and ilUtil\sendSuccess().

344  {
345  include_once "Services/MetaData/classes/class.ilMD.php";
346  foreach($_POST['tlt'] as $item_id => $item)
347  {
348  $md_obj = new ilMD($this->getObjId(),$item_id,'st');
349  if(!is_object($md_section = $md_obj->getEducational()))
350  {
351  $md_section = $md_obj->addEducational();
352  $md_section->save();
353  }
354  $md_section->setPhysicalTypicalLearningTime((int)$item['mo'],
355  (int)$item['d'],(int)$item['h'],(int)$item['m'],0);
356  $md_section->update();
357  }
358 
359  // refresh learning progress
360  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
362 
363  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
364  $this->ctrl->redirect($this,'show');
365  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.
$_POST["username"]
+ Here is the call graph for this function:

Field Documentation

◆ $obj_lp

ilLPListOfSettingsGUI::$obj_lp
protected

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

◆ $obj_settings

ilLPListOfSettingsGUI::$obj_settings
protected

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


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