5include_once
'./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php';
6include_once
'./Services/Tracking/classes/class.ilLPObjSettings.php';
31 include_once
'./Services/Object/classes/class.ilObjectLP.php';
40 switch ($this->ctrl->getNextClass()) {
56 $ilHelp =
$DIC[
'ilHelp'];
58 $ilHelp->setSubScreenId(
"trac_settings");
60 $info = $this->obj_lp->getSettingsInfo();
66 $this->tpl->setContent(
69 $this->getTableByMode()
81 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
83 $form->setTitle($this->lng->txt(
'tracking_settings'));
84 $form->setFormAction($this->ctrl->getFormAction($this));
88 $mod->setRequired(
true);
89 $mod->setValue($this->obj_lp->getCurrentMode());
92 if (method_exists($this->obj_lp,
'initModeOptions')) {
97 $this->obj_lp->initModeOptions($mod);
99 foreach ($this->obj_lp->getValidModes() as $mode_key) {
101 $this->obj_lp->getModeText($mode_key),
103 $this->obj_lp->getModeInfoText($mode_key)
105 $opt->setValue($mode_key);
106 $mod->addOption($opt);
112 $vis->setMaxLength(4);
113 $vis->setInfo(sprintf(
114 $this->lng->txt(
'trac_visits_info'),
117 $vis->setRequired(
true);
118 $vis->setValue($this->obj_settings->getVisits());
119 $opt->addSubItem($vis);
124 $form->addCommandButton(
'saveSettings', $this->lng->txt(
'save'));
136 if ($form->checkInput()) {
140 if (method_exists($this->obj_lp,
'fetchModeOption')) {
145 $new_mode = (int) $this->obj_lp->fetchModeOption($form);
147 $new_mode = (int) $form->getInput(
'modus');
149 $old_mode = $this->obj_lp->getCurrentMode();
150 $mode_changed = ($old_mode != $new_mode);
154 $visits_changed =
null;
156 $new_visits = (int) $form->getInput(
'visits');
157 $old_visits = $this->obj_settings->getVisits();
158 $visits_changed = ($old_visits != $new_visits);
163 $collection = $this->obj_lp->getCollectionInstance();
165 $collection->delete();
169 $refresh_lp = ($mode_changed || $visits_changed);
172 $this->obj_lp->resetCaches();
174 $this->obj_settings->setMode($new_mode);
175 $this->obj_settings->setVisits($new_visits);
176 $this->obj_settings->update($refresh_lp);
179 $this->obj_lp->getCollectionInstance() &&
183 ilUtil::sendSuccess($this->lng->txt(
'trac_settings_saved'),
true);
184 $this->ctrl->redirect($this,
'show');
187 $form->setValuesByPost();
190 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.lp_obj_settings.html',
'Services/Tracking');
191 $this->tpl->setVariable(
'PROP_FORM', $form->getHTML());
192 $this->tpl->setVariable(
'COLLECTION_TABLE', $this->
getTableByMode());
200 $collection = $this->obj_lp->getCollectionInstance();
201 if ($collection && $collection->hasSelectableItems()) {
202 include_once
"Services/Tracking/classes/repository_statistics/class.ilLPCollectionSettingsTableGUI.php";
204 $table->parse($collection);
205 return $table->getHTML();
215 if (!
$_POST[
'item_ids']) {
217 $this->ctrl->redirect($this,
'show');
219 if (count(
$_POST[
'item_ids'])) {
220 $collection = $this->obj_lp->getCollectionInstance();
221 if ($collection && $collection->hasSelectableItems()) {
222 $collection->activateEntries(
$_POST[
'item_ids']);
226 $this->obj_lp->resetCaches();
229 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
232 ilUtil::sendSuccess($this->lng->txt(
'trac_settings_saved'),
true);
233 $this->ctrl->redirect($this,
'show');
242 if (!
$_POST[
'item_ids']) {
244 $this->ctrl->redirect($this,
'show');
247 if (count(
$_POST[
'item_ids'])) {
248 $collection = $this->obj_lp->getCollectionInstance();
249 if ($collection && $collection->hasSelectableItems()) {
250 $collection->deactivateEntries(
$_POST[
'item_ids']);
254 $this->obj_lp->resetCaches();
257 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
260 ilUtil::sendSuccess($this->lng->txt(
'trac_settings_saved'),
true);
261 $this->ctrl->redirect($this,
'show');
269 if (!count((array)
$_POST[
'item_ids'])) {
271 $this->ctrl->redirect($this,
'show');
274 $collection = $this->obj_lp->getCollectionInstance();
275 if ($collection && $collection->hasSelectableItems()) {
277 $collection->createNewGrouping((array)
$_POST[
'item_ids']);
280 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
284 ilUtil::sendSuccess($this->lng->txt(
'trac_settings_saved'),
true);
285 $this->ctrl->redirect($this,
'show');
293 if (!count((array)
$_POST[
'item_ids'])) {
295 $this->ctrl->redirect($this,
'show');
298 $collection = $this->obj_lp->getCollectionInstance();
299 if ($collection && $collection->hasSelectableItems()) {
300 $collection->releaseGrouping((array)
$_POST[
'item_ids']);
303 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
307 ilUtil::sendSuccess($this->lng->txt(
'trac_settings_saved'),
true);
308 $this->ctrl->redirect($this,
'show');
316 if (!is_array((array)
$_POST[
'grp'])) {
318 $this->ctrl->redirect($this,
'show');
322 $collection = $this->obj_lp->getCollectionInstance();
323 if ($collection && $collection->hasSelectableItems()) {
324 $collection->saveObligatoryMaterials((array)
$_POST[
'grp']);
327 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
331 ilUtil::sendSuccess($this->lng->txt(
'settings_saved'),
true);
332 $this->ctrl->redirect($this,
'show');
336 $this->ctrl->redirect($this,
'show');
342 include_once
"Services/MetaData/classes/class.ilMD.php";
343 foreach (
$_POST[
'tlt'] as $item_id => $item) {
345 if (!is_object($md_section = $md_obj->getEducational())) {
346 $md_section = $md_obj->addEducational();
349 $md_section->setPhysicalTypicalLearningTime(
356 $md_section->update();
360 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
363 ilUtil::sendSuccess($this->lng->txt(
'settings_saved'),
true);
364 $this->ctrl->redirect($this,
'show');
383 $tree =
$DIC[
'tree'];
385 $has_lp_parents =
false;
387 $path = $tree->getNodePath($a_ref_id);
389 foreach ($path as $node) {
392 if ($supports_lp || $has_lp_parents) {
393 $a_res[$node[
"child"]][
"node"] = array(
394 "type" => $node[
"type"]
395 ,
"title" => $node[
"title"]
396 ,
"obj_id" => $node[
"obj_id"]
404 $node[
"child"] != $a_ref_id) {
405 $a_res[$node[
"child"]][
"node"][
"lp"] =
true;
406 $has_lp_parents =
true;
408 $parent_obj_id = $node[
'obj_id'];
410 $parent_collection = $parent_obj_lp->getCollectionInstance();
412 $parent_collection &&
413 $parent_collection->hasSelectableItems() &&
414 $parent_collection->isAssignedEntry($a_ref_id)
416 $a_res[$node[
'child']][
'node'][
'active'] =
true;
420 return $has_lp_parents;
428 $ilAccess =
$DIC[
'ilAccess'];
438 include_once
"Services/Link/classes/class.ilLink.php";
440 $tpl =
new ilTemplate(
"tpl.lp_obj_settings_tree_info.html",
true,
true,
"Services/Tracking");
444 foreach ($coll as $parent_ref_id => $parts) {
445 $node = $parts[
"node"];
448 if ($node[
"active"]) {
449 $tpl->touchBlock(
"parent_active_bl");
453 $params[
"gotolp"] = 1;
456 if ($ilAccess->checkAccess(
"read",
"", $parent_ref_id) &&
458 $tpl->setCurrentBlock(
"parent_link_bl");
459 $tpl->setVariable(
"PARENT_LINK_TITLE", $node[
"title"]);
461 $tpl->parseCurrentBlock();
463 $tpl->setCurrentBlock(
"parent_nolink_bl");
464 $tpl->setVariable(
"PARENT_NOLINK_TITLE", $node[
"title"]);
465 $tpl->parseCurrentBlock();
468 $tpl->setCurrentBlock(
"parent_usage_bl");
470 $tpl->setVariable(
"PARENT_TYPE_ALT",
$lng->txt(
"obj_" . $node[
"type"]));
472 $tpl->setVariable(
"PARENT_STYLE", $node[
"lp"]
474 :
' class="ilLPParentInfoListLPUnsupported"');
475 $tpl->setVariable(
"MARGIN", $margin);
476 $tpl->parseCurrentBlock();
482 $tpl->setVariable(
"LEGEND", sprintf(
483 $lng->txt(
"trac_lp_settings_info_parent_legend"),
488 include_once
"Services/UIComponent/Panel/classes/class.ilPanelGUI.php";
491 $panel->setHeading(
$lng->txt(
"trac_lp_settings_info_parent_container"));
492 $panel->setBody(
$tpl->get());
494 return $panel->getHTML();
An exception for terminatinating execution or to throw for unit testing.
Class ilLPListOfSettingsGUI.
__construct($a_mode, $a_ref_id)
getLPPathInfo($a_ref_id, array &$a_res)
Gather LP data about parent objects.
initFormSettings()
Init property form.
assign()
Save material assignment.
show()
Show settings tables.
saveObligatoryMaterials()
Save obligatory state per grouped materials.
executeCommand()
execute command
groupMaterials()
Group materials.
getTableByMode()
Get tables by mode.
saveSettings()
Save learning progress settings.
deassign()
save mterial assignment
const LP_MODE_MANUAL_BY_TUTOR
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")
static _getValidTimeSpan()
static isSupportedObjectType($a_type)
static getInstance($a_obj_id)
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
const PANEL_STYLE_SECONDARY
static getInstance()
Get instance.
This class represents an option in a radio group.
special template class to simplify handling of ITX/PEAR
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
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...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc