ILIAS  release_4-4 Revision
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
 ilLearningProgressBaseGUI ($a_mode, $a_ref_id=0, $a_usr_id=0)
 
 isAnonymized ()
 
 getMode ()
 
 getRefId ()
 
 getObjId ()
 
 getUserId ()
 
 activateStatistics ($a_act=true)
 
 __getDefaultCommand ()
 
 __setSubTabs ($a_active)
 
 __buildFooter ()
 
 __buildHeader ()
 
 __insertPath (&$a_tpl, $a_ref_id)
 insert path More...
 
 __showImageByStatus (&$tpl, $a_status, $tpl_prefix="")
 
 _getImagePathForStatus ($a_status)
 Get image path for status. More...
 
 _getStatusText ($a_status)
 Get status alt text. More...
 
__initTableGUI ()
 
 __showObjectDetails (&$info, $item_id=0)
 show details about current object. More...
 
 __appendUserInfo (&$info, $a_user)
 
 __appendLPDetails (&$info, $item_id, $user_id)
 
 __readStatus ($a_obj_id, $user_id)
 
 __showButton ($a_link, $a_text, $a_target='')
 
 __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 ()
 

Protected Attributes

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

Additional Inherited Members

- Static Public Member Functions inherited from ilLearningProgressBaseGUI
static _showImageByStatus (&$tpl, $a_status, $tpl_prefix="")
 
static isObjectOffline ($a_obj_id, $a_type=null)
 
- Data Fields inherited from ilLearningProgressBaseGUI
 $tpl = null
 
 $ctrl = null
 
 $lng = null
 
 $ref_id = 0
 
 $mode = 0
 
 $statistics_activated = false
 
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_LM_STATISTICS = 4
 
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 194 of file class.ilLPListOfSettingsGUI.php.

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

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

◆ deassign()

ilLPListOfSettingsGUI::deassign ( )
protected

save mterial assignment

Returns
void

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

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

225  {
226  if(!$_POST['item_ids'])
227  {
228  ilUtil::sendFailure($this->lng->txt('select_one'),true);
229  $this->ctrl->redirect($this,'show');
230  return false;
231  }
232  if(count($_POST['item_ids']))
233  {
234  $collection = $this->obj_lp->getCollectionInstance();
235  if($collection && $collection->hasSelectableItems())
236  {
237  $collection->deactivateEntries($_POST['item_ids']);
238  }
239 
240  // #15045 - has to be done before LP refresh!
241  $this->obj_lp->resetCaches();
242 
243  // refresh learning progress
244  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
246  }
247  ilUtil::sendSuccess($this->lng->txt('trac_settings_saved'),true);
248  $this->ctrl->redirect($this,'show');
249  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
_refreshStatus($a_obj_id, $a_users=null)
Set dirty.
+ 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:

◆ getTableByMode()

ilLPListOfSettingsGUI::getTableByMode ( )
protected

Get tables by mode.

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

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

Referenced by saveSettings(), and show().

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

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

255  {
256  if(!count((array) $_POST['item_ids']))
257  {
258  ilUtil::sendFailure($this->lng->txt('select_one'),true);
259  $this->ctrl->redirect($this,'show');
260  }
261 
262  $collection = $this->obj_lp->getCollectionInstance();
263  if($collection && $collection->hasSelectableItems())
264  {
265  // Assign new grouping id
266  $collection->createNewGrouping((array)$_POST['item_ids']);
267 
268  // refresh learning progress
269  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
271  }
272 
273  ilUtil::sendSuccess($this->lng->txt('trac_settings_saved'),true);
274  $this->ctrl->redirect($this,'show');
275  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
_refreshStatus($a_obj_id, $a_users=null)
Set dirty.
+ Here is the call graph for this function:

◆ initFormSettings()

ilLPListOfSettingsGUI::initFormSettings ( )
protected

Init property form.

Returns
ilPropertyFormGUI $form

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

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

Referenced by saveSettings(), and show().

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

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

281  {
282  if(!count((array) $_POST['item_ids']))
283  {
284  ilUtil::sendFailure($this->lng->txt('select_one'),true);
285  $this->ctrl->redirect($this,'show');
286  }
287 
288  $collection = $this->obj_lp->getCollectionInstance();
289  if($collection && $collection->hasSelectableItems())
290  {
291  $collection->releaseGrouping((array)$_POST['item_ids']);
292 
293  // refresh learning progress
294  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
296  }
297 
298  ilUtil::sendSuccess($this->lng->txt('trac_settings_saved'),true);
299  $this->ctrl->redirect($this,'show');
300  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
_refreshStatus($a_obj_id, $a_users=null)
Set dirty.
+ Here is the call graph for this function:

◆ saveObligatoryMaterials()

ilLPListOfSettingsGUI::saveObligatoryMaterials ( )
protected

Save obligatory state per grouped materials.

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

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

306  {
307  if(!is_array((array) $_POST['grp']))
308  {
309  ilUtil::sendFailure($this->lng->txt('select_one'),true);
310  $this->ctrl->redirect($this,'show');
311  }
312 
313  try {
314 
315  $collection = $this->obj_lp->getCollectionInstance();
316  if($collection && $collection->hasSelectableItems())
317  {
318  $collection->saveObligatoryMaterials((array)$_POST['grp']);
319 
320  // refresh learning progress
321  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
323  }
324 
325  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
326  $this->ctrl->redirect($this,'show');
327  }
328  catch(UnexpectedValueException $e) {
329  ilUtil::sendFailure($this->lng->txt('trac_grouped_material_obligatory_err'), true);
330  ilUtil::sendInfo($this->lng->txt('err_check_input'),true);
331  $this->ctrl->redirect($this,'show');
332  }
333  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
_refreshStatus($a_obj_id, $a_users=null)
Set dirty.
+ Here is the call graph for this function:

◆ saveSettings()

ilLPListOfSettingsGUI::saveSettings ( )
protected

Save learning progress settings.

Returns
void

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

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

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

54  {
55  global $ilHelp;
56 
57  $ilHelp->setSubScreenId("trac_settings");
58 
59  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.lp_obj_settings.html','Services/Tracking');
60 
61  $form = $this->initFormSettings();
62  $this->tpl->setVariable('PROP_FORM',$form->getHTML());
63  $this->tpl->setVariable('COLLECTION_TABLE',$this->getTableByMode());
64  }
initFormSettings()
Init property form.
getTableByMode()
Get tables by mode.
+ Here is the call graph for this function:

◆ updateTLT()

ilLPListOfSettingsGUI::updateTLT ( )
protected

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

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

336  {
337  include_once "Services/MetaData/classes/class.ilMD.php";
338  foreach($_POST['tlt'] as $item_id => $item)
339  {
340  $md_obj = new ilMD($this->getObjId(),$item_id,'st');
341  if(!is_object($md_section = $md_obj->getEducational()))
342  {
343  $md_section = $md_obj->addEducational();
344  $md_section->save();
345  }
346  $md_section->setPhysicalTypicalLearningTime((int)$item['mo'],
347  (int)$item['d'],(int)$item['h'],(int)$item['m'],0);
348  $md_section->update();
349  }
350 
351  // refresh learning progress
352  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
354 
355  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
356  $this->ctrl->redirect($this,'show');
357  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
_refreshStatus($a_obj_id, $a_users=null)
Set dirty.
+ 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: