ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 195 of file class.ilLPListOfSettingsGUI.php.

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

196  {
197  if (!$_POST['item_ids']) {
198  ilUtil::sendFailure($this->lng->txt('select_one'), true);
199  $this->ctrl->redirect($this, 'show');
200  }
201  if (count($_POST['item_ids'])) {
202  $collection = $this->obj_lp->getCollectionInstance();
203  if ($collection && $collection->hasSelectableItems()) {
204  $collection->activateEntries($_POST['item_ids']);
205  }
206 
207  // #15045 - has to be done before LP refresh!
208  $this->obj_lp->resetCaches();
209 
210  // refresh learning progress
211  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
213  }
214  ilUtil::sendSuccess($this->lng->txt('trac_settings_saved'), true);
215  $this->ctrl->redirect($this, 'show');
216  }
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 222 of file class.ilLPListOfSettingsGUI.php.

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

223  {
224  if (!$_POST['item_ids']) {
225  ilUtil::sendFailure($this->lng->txt('select_one'), true);
226  $this->ctrl->redirect($this, 'show');
227  return false;
228  }
229  if (count($_POST['item_ids'])) {
230  $collection = $this->obj_lp->getCollectionInstance();
231  if ($collection && $collection->hasSelectableItems()) {
232  $collection->deactivateEntries($_POST['item_ids']);
233  }
234 
235  // #15045 - has to be done before LP refresh!
236  $this->obj_lp->resetCaches();
237 
238  // refresh learning progress
239  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
241  }
242  ilUtil::sendSuccess($this->lng->txt('trac_settings_saved'), true);
243  $this->ctrl->redirect($this, 'show');
244  }
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 ilLearningProgressBaseGUI\__getDefaultCommand().

39  {
40  switch ($this->ctrl->getNextClass()) {
41  default:
42  $cmd = $this->__getDefaultCommand();
43  $this->$cmd();
44 
45  }
46  return true;
47  }
+ 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 361 of file class.ilLPListOfSettingsGUI.php.

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

Referenced by handleLPUsageInfo().

362  {
363  global $tree;
364 
365  $has_lp_parents = false;
366 
367  $path = $tree->getNodePath($a_ref_id);
368  array_shift($path); // root
369  foreach ($path as $node) {
370  $supports_lp = ilObjectLP::isSupportedObjectType($node["type"]);
371 
372  if ($supports_lp || $has_lp_parents) {
373  $a_res[$node["child"]]["node"] = array(
374  "type" => $node["type"]
375  ,"title" => $node["title"]
376  ,"obj_id" => $node["obj_id"]
377  ,"lp" => false
378  ,"active" => false
379  );
380  }
381 
382  if ($supports_lp &&
383  $node["child"] != $a_ref_id) {
384  $a_res[$node["child"]]["node"]["lp"] = true;
385  $has_lp_parents = true;
386 
387  $parent_obj_id = $node["obj_id"];
388  $parent_obj_lp = ilObjectLP::getInstance($parent_obj_id);
389 
390  // parse LP collection
391  $parent_collection = $parent_obj_lp->getCollectionInstance();
392  if ($parent_collection &&
393  $parent_collection->hasSelectableItems() &&
394  $parent_collection->isAssignedEntry($a_ref_id)) {
395  $a_res[$node["child"]]["node"]["active"] = true;
396 
397  if ($parent_collection instanceof ilLPCollectionOfRepositoryObjects) {
398  $group = array();
399  foreach ($parent_collection->getTableGUIData($node["parent"]) as $item) {
400  $found = false;
401  $grp_tmp = array();
402  if ($item["grouped"]) {
403  // parse grouped items
404  foreach ($item["grouped"] as $group_item) {
405  if ($group_item["ref_id"] == $a_ref_id) {
406  $found = true;
407  } else {
408  $grp_tmp[$group_item["ref_id"]] = array(
409  "type" => $group_item["type"]
410  ,"title" => $group_item["title"]
411  ,"obj_id" => $group_item["obj_id"]
412  );
413  }
414  }
415  }
416  if (sizeof($grp_tmp) ||
417  $found) {
418  if ($item["ref_id"] == $a_ref_id) {
419  // group "parent" item is current object
420  $group = $grp_tmp;
421  } elseif ($found) {
422  // group "parent" item is not current object
423  // add group "parent" to grouped items
424  $group = $grp_tmp;
425  $group[$item["ref_id"]] = array(
426  "type" => $item["type"]
427  ,"title" => $item["title"]
428  ,"obj_id" => $item["obj_id"]
429  );
430  }
431  }
432  }
433  $a_res[$node["child"]]["group"] = $group;
434  }
435  }
436  }
437  }
438 
439  return $has_lp_parents;
440  }
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 180 of file class.ilLPListOfSettingsGUI.php.

References $table, and ilLearningProgressBaseGUI\getRefId().

Referenced by saveSettings(), and show().

181  {
182  $collection = $this->obj_lp->getCollectionInstance();
183  if ($collection && $collection->hasSelectableItems()) {
184  include_once "Services/Tracking/classes/repository_statistics/class.ilLPCollectionSettingsTableGUI.php";
185  $table = new ilLPCollectionSettingsTableGUI($this, 'show', $this->getRefId(), $this->obj_lp->getCurrentMode());
186  $table->parse($collection);
187  return $table->getHTML();
188  }
189  }
if(empty($password)) $table
Definition: pwgen.php:24
+ 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 249 of file class.ilLPListOfSettingsGUI.php.

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

250  {
251  if (!count((array) $_POST['item_ids'])) {
252  ilUtil::sendFailure($this->lng->txt('select_one'), true);
253  $this->ctrl->redirect($this, 'show');
254  }
255 
256  $collection = $this->obj_lp->getCollectionInstance();
257  if ($collection && $collection->hasSelectableItems()) {
258  // Assign new grouping id
259  $collection->createNewGrouping((array) $_POST['item_ids']);
260 
261  // refresh learning progress
262  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
264  }
265 
266  ilUtil::sendSuccess($this->lng->txt('trac_settings_saved'), true);
267  $this->ctrl->redirect($this, 'show');
268  }
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 442 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().

443  {
444  global $lng, $ilAccess;
445 
446  $ref_id = $_GET["ref_id"];
447  if (!$ref_id) {
448  $ref_id = $_REQUEST["ref_id"];
449  }
450 
451  $coll = array();
452  if ($ref_id &&
453  $this->getLPPathInfo($ref_id, $coll)) {
454  include_once "Services/Link/classes/class.ilLink.php";
455 
456  $tpl = new ilTemplate("tpl.lp_obj_settings_tree_info.html", true, true, "Services/Tracking");
457 
458  $margin = 0;
459  $has_active = false;
460  foreach ($coll as $parent_ref_id => $parts) {
461  /* currently not used
462  if($parts["group"])
463  {
464  foreach($parts["group"] as $group_item_ref_id => $group_item)
465  {
466  if($ilAccess->checkAccess("read", "", $group_item_ref_id))
467  {
468  $tpl->setCurrentBlock("group_item_link_bl");
469  $tpl->setVariable("GROUP_ITEM_LINK_TITLE", $group_item["title"]);
470  $tpl->setVariable("GROUP_ITEM_URL", ilLink::_getLink($group_item_ref_id, $group_item["type"], array("gotolp" => 1)));
471  $tpl->parseCurrentBlock();
472  }
473  else
474  {
475  $tpl->setCurrentBlock("group_item_nolink_bl");
476  $tpl->setVariable("GROUP_ITEM_NOLINK_TITLE", $group_item["title"]);
477  $tpl->parseCurrentBlock();
478  }
479 
480  $tpl->setCurrentBlock("group_item_bl");
481  $tpl->setVariable("GROUP_ITEM_TYPE_URL", ilUtil::getTypeIconPath($group_item["type"], $group_item["obj_id"]));
482  $tpl->setVariable("GROUP_ITEM_TYPE_ALT", $lng->txt("obj_".$group_item["type"]));
483  $tpl->parseCurrentBlock();
484  }
485 
486  $tpl->setCurrentBlock("group_bl");
487  $tpl->setVariable("GROUP_INFO", $lng->txt("trac_lp_settings_info_parent_group"));
488  $tpl->parseCurrentBlock();
489  }
490  */
491 
492  $node = $parts["node"];
493 
494  $params = array();
495  if ($node["lp"]) {
496  if ($node["active"]) {
497  $tpl->touchBlock("parent_active_bl");
498  $has_active = true;
499  }
500 
501  $params["gotolp"] = 1;
502  }
503 
504  if ($ilAccess->checkAccess("read", "", $parent_ref_id) &&
505  $parent_ref_id != $ref_id) { // #17170
506  $tpl->setCurrentBlock("parent_link_bl");
507  $tpl->setVariable("PARENT_LINK_TITLE", $node["title"]);
508  $tpl->setVariable("PARENT_URL", ilLink::_getLink($parent_ref_id, $node["type"], $params));
509  $tpl->parseCurrentBlock();
510  } else {
511  $tpl->setCurrentBlock("parent_nolink_bl");
512  $tpl->setVariable("PARENT_NOLINK_TITLE", $node["title"]);
513  $tpl->parseCurrentBlock();
514  }
515 
516  $tpl->setCurrentBlock("parent_usage_bl");
517  $tpl->setVariable("PARENT_TYPE_URL", ilUtil::getTypeIconPath($node["type"], $node["obj_id"]));
518  $tpl->setVariable("PARENT_TYPE_ALT", $lng->txt("obj_" . $node["type"]));
519 
520  $tpl->setVariable("PARENT_STYLE", $node["lp"]
521  ? ''
522  : ' class="ilLPParentInfoListLPUnsupported"');
523  $tpl->setVariable("MARGIN", $margin);
524  $tpl->parseCurrentBlock();
525 
526  $margin += 25;
527  }
528 
529  if ($has_active) {
530  $tpl->setVariable("LEGEND", sprintf(
531  $lng->txt("trac_lp_settings_info_parent_legend"),
533  ));
534  }
535 
536  include_once "Services/UIComponent/Panel/classes/class.ilPanelGUI.php";
537  $panel = ilPanelGUI::getInstance();
538  $panel->setPanelStyle(ilPanelGUI::PANEL_STYLE_SECONDARY);
539  $panel->setHeading($lng->txt("trac_lp_settings_info_parent_container"));
540  $panel->setBody($tpl->get());
541 
542  return $panel->getHTML();
543  }
544  }
$params
Definition: disable.php:11
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
+ 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 77 of file class.ilLPListOfSettingsGUI.php.

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

Referenced by saveSettings(), and show().

78  {
79  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
80  $form = new ilPropertyFormGUI();
81  $form->setTitle($this->lng->txt('tracking_settings'));
82  $form->setFormAction($this->ctrl->getFormAction($this));
83 
84  // Mode
85  $mod = new ilRadioGroupInputGUI($this->lng->txt('trac_mode'), 'modus');
86  $mod->setRequired(true);
87  $mod->setValue($this->obj_lp->getCurrentMode());
88  $form->addItem($mod);
89 
90  foreach ($this->obj_lp->getValidModes() as $mode_key) {
91  $opt = new ilRadioOption(
92  $this->obj_lp->getModeText($mode_key),
93  $mode_key,
94  $this->obj_lp->getModeInfoText($mode_key)
95  );
96  $opt->setValue($mode_key);
97  $mod->addOption($opt);
98 
99  // :TODO: Subitem for visits ?!
100  if ($mode_key == ilLPObjSettings::LP_MODE_VISITS) {
101  $vis = new ilNumberInputGUI($this->lng->txt('trac_visits'), 'visits');
102  $vis->setSize(3);
103  $vis->setMaxLength(4);
104  $vis->setInfo(sprintf(
105  $this->lng->txt('trac_visits_info'),
107  ));
108  $vis->setRequired(true);
109  $vis->setValue($this->obj_settings->getVisits());
110  $opt->addSubItem($vis);
111  }
112  }
113 
114  $form->addCommandButton('saveSettings', $this->lng->txt('save'));
115 
116  return $form;
117  }
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.
if(isset($_POST['submit'])) $form
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 273 of file class.ilLPListOfSettingsGUI.php.

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

274  {
275  if (!count((array) $_POST['item_ids'])) {
276  ilUtil::sendFailure($this->lng->txt('select_one'), true);
277  $this->ctrl->redirect($this, 'show');
278  }
279 
280  $collection = $this->obj_lp->getCollectionInstance();
281  if ($collection && $collection->hasSelectableItems()) {
282  $collection->releaseGrouping((array) $_POST['item_ids']);
283 
284  // refresh learning progress
285  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
287  }
288 
289  ilUtil::sendSuccess($this->lng->txt('trac_settings_saved'), true);
290  $this->ctrl->redirect($this, 'show');
291  }
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 296 of file class.ilLPListOfSettingsGUI.php.

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

297  {
298  if (!is_array((array) $_POST['grp'])) {
299  ilUtil::sendFailure($this->lng->txt('select_one'), true);
300  $this->ctrl->redirect($this, 'show');
301  }
302 
303  try {
304  $collection = $this->obj_lp->getCollectionInstance();
305  if ($collection && $collection->hasSelectableItems()) {
306  $collection->saveObligatoryMaterials((array) $_POST['grp']);
307 
308  // refresh learning progress
309  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
311  }
312 
313  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
314  $this->ctrl->redirect($this, 'show');
315  } catch (UnexpectedValueException $e) {
316  ilUtil::sendFailure($this->lng->txt('trac_grouped_material_obligatory_err'), true);
317  ilUtil::sendInfo($this->lng->txt('err_check_input'), true);
318  $this->ctrl->redirect($this, 'show');
319  }
320  }
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 123 of file class.ilLPListOfSettingsGUI.php.

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

124  {
125  $form = $this->initFormSettings();
126  if ($form->checkInput()) {
127  // anything changed?
128 
129  // mode
130  $new_mode = (int) $form->getInput('modus');
131  $old_mode = $this->obj_lp->getCurrentMode();
132  $mode_changed = ($old_mode != $new_mode);
133 
134  // visits
135  $new_visits = null;
136  $visits_changed = null;
137  if ($new_mode == ilLPObjSettings::LP_MODE_VISITS) {
138  $new_visits = (int) $form->getInput('visits');
139  $old_visits = $this->obj_settings->getVisits();
140  $visits_changed = ($old_visits != $new_visits);
141  }
142 
143  if ($mode_changed) {
144  // delete existing collection
145  $collection = $this->obj_lp->getCollectionInstance();
146  if ($collection) {
147  $collection->delete();
148  }
149  }
150 
151  $refresh_lp = ($mode_changed || $visits_changed);
152 
153  // has to be done before LP refresh!
154  $this->obj_lp->resetCaches();
155 
156  $this->obj_settings->setMode($new_mode);
157  $this->obj_settings->setVisits($new_visits);
158  $this->obj_settings->update($refresh_lp);
159 
160  if ($mode_changed &&
161  $this->obj_lp->getCollectionInstance() &&
162  $new_mode != ilLPObjSettings::LP_MODE_MANUAL_BY_TUTOR) { // #14819
163  ilUtil::sendInfo($this->lng->txt('trac_edit_collection'), true);
164  }
165  ilUtil::sendSuccess($this->lng->txt('trac_settings_saved'), true);
166  $this->ctrl->redirect($this, 'show');
167  }
168 
169  $form->setValuesByPost();
170  ilUtil::sendFailure($this->lng->txt('err_check_input'));
171 
172  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.lp_obj_settings.html', 'Services/Tracking');
173  $this->tpl->setVariable('PROP_FORM', $form->getHTML());
174  $this->tpl->setVariable('COLLECTION_TABLE', $this->getTableByMode());
175  }
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.
if(isset($_POST['submit'])) $form
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 52 of file class.ilLPListOfSettingsGUI.php.

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

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

◆ updateTLT()

ilLPListOfSettingsGUI::updateTLT ( )
protected

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

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

323  {
324  include_once "Services/MetaData/classes/class.ilMD.php";
325  foreach ($_POST['tlt'] as $item_id => $item) {
326  $md_obj = new ilMD($this->getObjId(), $item_id, 'st');
327  if (!is_object($md_section = $md_obj->getEducational())) {
328  $md_section = $md_obj->addEducational();
329  $md_section->save();
330  }
331  $md_section->setPhysicalTypicalLearningTime(
332  (int) $item['mo'],
333  (int) $item['d'],
334  (int) $item['h'],
335  (int) $item['m'],
336  0
337  );
338  $md_section->update();
339  }
340 
341  // refresh learning progress
342  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
344 
345  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
346  $this->ctrl->redirect($this, 'show');
347  }
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: