ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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 ()
 
 __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, $add_section=true)
 show details about current object. More...
 
 __appendUserInfo (&$info, $a_user)
 
 __appendLPDetails (&$info, $item_id, $user_id)
 
 __readStatus ($a_obj_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 ()
 
- 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
 

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
 
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

Class ilLPListOfSettingsGUI.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

@ilCtrl_Calls ilLPListOfSettingsGUI:

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

Constructor & Destructor Documentation

◆ __construct()

ilLPListOfSettingsGUI::__construct (   $a_mode,
  $a_ref_id 
)

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

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)

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

+ Here is the call graph for this function:

Member Function Documentation

◆ assign()

ilLPListOfSettingsGUI::assign ( )
protected

Save material assignment.

Returns
void

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

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

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

+ Here is the call graph for this function:

◆ deassign()

ilLPListOfSettingsGUI::deassign ( )
protected

save mterial assignment

Returns
void

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

227 {
228 if(!$_POST['item_ids'])
229 {
230 ilUtil::sendFailure($this->lng->txt('select_one'),true);
231 $this->ctrl->redirect($this,'show');
232 return false;
233 }
234 if(count($_POST['item_ids']))
235 {
236 $collection = $this->obj_lp->getCollectionInstance();
237 if($collection && $collection->hasSelectableItems())
238 {
239 $collection->deactivateEntries($_POST['item_ids']);
240 }
241
242 // #15045 - has to be done before LP refresh!
243 $this->obj_lp->resetCaches();
244
245 // refresh learning progress
246 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
248 }
249 ilUtil::sendSuccess($this->lng->txt('trac_settings_saved'),true);
250 $this->ctrl->redirect($this,'show');
251 }

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

+ Here is the call graph for this function:

◆ executeCommand()

& ilLPListOfSettingsGUI::executeCommand ( )

execute command

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

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

References $cmd, and ilLearningProgressBaseGUI\__getDefaultCommand().

+ Here is the call graph for this function:

◆ getTableByMode()

ilLPListOfSettingsGUI::getTableByMode ( )
protected

Get tables by mode.

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

181 {
182 $collection = $this->obj_lp->getCollectionInstance();
183 if($collection && $collection->hasSelectableItems())
184 {
185 include_once "Services/Tracking/classes/repository_statistics/class.ilLPCollectionSettingsTableGUI.php";
186 $table = new ilLPCollectionSettingsTableGUI($this, 'show', $this->getRefId(), $this->obj_lp->getCurrentMode());
187 $table->parse($collection);
188 return $table->getHTML();
189 }
190 }

References ilLearningProgressBaseGUI\getRefId().

Referenced by saveSettings(), and show().

+ 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 256 of file class.ilLPListOfSettingsGUI.php.

257 {
258 if(!count((array) $_POST['item_ids']))
259 {
260 ilUtil::sendFailure($this->lng->txt('select_one'),true);
261 $this->ctrl->redirect($this,'show');
262 }
263
264 $collection = $this->obj_lp->getCollectionInstance();
265 if($collection && $collection->hasSelectableItems())
266 {
267 // Assign new grouping id
268 $collection->createNewGrouping((array)$_POST['item_ids']);
269
270 // refresh learning progress
271 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
273 }
274
275 ilUtil::sendSuccess($this->lng->txt('trac_settings_saved'),true);
276 $this->ctrl->redirect($this,'show');
277 }

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

+ 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.

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 a number property in a property form.
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.

References ilObjUserTracking\_getValidTimeSpan(), and ilLPObjSettings\LP_MODE_VISITS.

Referenced by saveSettings(), and show().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ releaseMaterials()

ilLPListOfSettingsGUI::releaseMaterials ( )
protected

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

283 {
284 if(!count((array) $_POST['item_ids']))
285 {
286 ilUtil::sendFailure($this->lng->txt('select_one'),true);
287 $this->ctrl->redirect($this,'show');
288 }
289
290 $collection = $this->obj_lp->getCollectionInstance();
291 if($collection && $collection->hasSelectableItems())
292 {
293 $collection->releaseGrouping((array)$_POST['item_ids']);
294
295 // refresh learning progress
296 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
298 }
299
300 ilUtil::sendSuccess($this->lng->txt('trac_settings_saved'),true);
301 $this->ctrl->redirect($this,'show');
302 }

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

+ Here is the call graph for this function:

◆ saveObligatoryMaterials()

ilLPListOfSettingsGUI::saveObligatoryMaterials ( )
protected

Save obligatory state per grouped materials.

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

308 {
309 if(!is_array((array) $_POST['grp']))
310 {
311 ilUtil::sendFailure($this->lng->txt('select_one'),true);
312 $this->ctrl->redirect($this,'show');
313 }
314
315 try {
316
317 $collection = $this->obj_lp->getCollectionInstance();
318 if($collection && $collection->hasSelectableItems())
319 {
320 $collection->saveObligatoryMaterials((array)$_POST['grp']);
321
322 // refresh learning progress
323 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
325 }
326
327 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
328 $this->ctrl->redirect($this,'show');
329 }
330 catch(UnexpectedValueException $e) {
331 ilUtil::sendFailure($this->lng->txt('trac_grouped_material_obligatory_err'), true);
332 ilUtil::sendInfo($this->lng->txt('err_check_input'),true);
333 $this->ctrl->redirect($this,'show');
334 }
335 }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

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

+ 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.

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 &&
160 $this->obj_lp->getCollectionInstance() &&
161 $new_mode != ilLPObjSettings::LP_MODE_MANUAL_BY_TUTOR) // #14819
162 {
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 }
initFormSettings()
Init property form.

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

+ Here is the call graph for this function:

◆ show()

ilLPListOfSettingsGUI::show ( )
protected

Show settings tables.

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

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 }

References getTableByMode(), and initFormSettings().

+ Here is the call graph for this function:

◆ updateTLT()

ilLPListOfSettingsGUI::updateTLT ( )
protected

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

338 {
339 include_once "Services/MetaData/classes/class.ilMD.php";
340 foreach($_POST['tlt'] as $item_id => $item)
341 {
342 $md_obj = new ilMD($this->getObjId(),$item_id,'st');
343 if(!is_object($md_section = $md_obj->getEducational()))
344 {
345 $md_section = $md_obj->addEducational();
346 $md_section->save();
347 }
348 $md_section->setPhysicalTypicalLearningTime((int)$item['mo'],
349 (int)$item['d'],(int)$item['h'],(int)$item['m'],0);
350 $md_section->update();
351 }
352
353 // refresh learning progress
354 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
356
357 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
358 $this->ctrl->redirect($this,'show');
359 }

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

+ 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: