ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilCourseLPBadgeGUI Class Reference

Course LP badge gui. More...

+ Inheritance diagram for ilCourseLPBadgeGUI:
+ Collaboration diagram for ilCourseLPBadgeGUI:

Public Member Functions

 initConfigForm (ilPropertyFormGUI $a_form, $a_parent_ref_id)
 Add custom fields to form. More...
 
 importConfigToForm (ilPropertyFormGUI $a_form, array $a_config)
 Set form values. More...
 
 getConfigFromForm (ilPropertyFormGUI $a_form)
 Export values to DB. More...
 
 validateForm (ilPropertyFormGUI $a_form)
 Custom form validation. More...
 
 initConfigForm (ilPropertyFormGUI $a_form, $a_parent_ref_id)
 Add custom fields to form. More...
 
 importConfigToForm (ilPropertyFormGUI $a_form, array $a_config)
 Set form values. More...
 
 getConfigFromForm (ilPropertyFormGUI $a_form)
 Export values to DB. More...
 
 validateForm (ilPropertyFormGUI $a_form)
 Custom form validation. More...
 

Static Public Member Functions

static getInvalidLPModes ()
 Get invalid lp modes. More...
 

Protected Member Functions

 getLPTypes ($a_parent_ref_id)
 

Protected Attributes

 $parent_ref_id
 

Detailed Description

Course LP badge gui.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id:$

Definition at line 14 of file class.ilCourseLPBadgeGUI.php.

Member Function Documentation

◆ getConfigFromForm()

ilCourseLPBadgeGUI::getConfigFromForm ( ilPropertyFormGUI  $a_form)

Export values to DB.

Parameters
ilPropertyFormGUI$a_form
Returns
array

Implements ilBadgeTypeGUI.

Definition at line 114 of file class.ilCourseLPBadgeGUI.php.

115 {
116 return array("subitems" => $a_form->getInput("subitems"));
117 }
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.

References ilPropertyFormGUI\getInput().

+ Here is the call graph for this function:

◆ getInvalidLPModes()

static ilCourseLPBadgeGUI::getInvalidLPModes ( )
static

Get invalid lp modes.

Parameters

return

Definition at line 125 of file class.ilCourseLPBadgeGUI.php.

126 {
127 include_once "Services/Object/classes/class.ilObjectLP.php";
128 include_once "Services/Tracking/classes/class.ilLPObjSettings.php";
129 include_once "Services/Tracking/classes/class.ilObjUserTracking.php";
130
131 /* supported modes
132 LP_MODE_TLT
133 LP_MODE_OBJECTIVES
134 LP_MODE_TEST_FINISHED
135 LP_MODE_TEST_PASSED
136 LP_MODE_EXERCISE_RETURNED
137 LP_MODE_EVENT
138 LP_MODE_SCORM_PACKAGE
139 LP_MODE_PLUGIN
140 LP_MODE_QUESTIONS
141 LP_MODE_SURVEY_FINISHED
142 LP_MODE_VISITED_PAGES
143 LP_MODE_DOWNLOADED
144 LP_MODE_STUDY_PROGRAMME ?!
145 */
146
147 $invalid_modes = array(ilLPObjSettings::LP_MODE_DEACTIVATED,
149
150 // without active LP the following modes cannot be supported
152 // status cannot be set without active LP
153 $invalid_modes[] = ilLPObjSettings::LP_MODE_MANUAL;
156
157 // mode cannot be configured without active LP
158 $invalid_modes[] = ilLPObjSettings::LP_MODE_COLLECTION;
161 $invalid_modes[] = ilLPObjSettings::LP_MODE_SCORM;
162 $invalid_modes[] = ilLPObjSettings::LP_MODE_VISITS; // ?
163 }
164 return $invalid_modes;
165 }
static _enabledLearningProgress()
check wether learing progress is enabled or not

References ilObjUserTracking\_enabledLearningProgress(), ilLPObjSettings\LP_MODE_COLLECTION, ilLPObjSettings\LP_MODE_COLLECTION_MANUAL, ilLPObjSettings\LP_MODE_COLLECTION_MOBS, ilLPObjSettings\LP_MODE_COLLECTION_TLT, ilLPObjSettings\LP_MODE_DEACTIVATED, ilLPObjSettings\LP_MODE_MANUAL, ilLPObjSettings\LP_MODE_MANUAL_BY_TUTOR, ilLPObjSettings\LP_MODE_SCORM, ilLPObjSettings\LP_MODE_UNDEFINED, and ilLPObjSettings\LP_MODE_VISITS.

Referenced by initConfigForm(), and validateForm().

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

◆ getLPTypes()

ilCourseLPBadgeGUI::getLPTypes (   $a_parent_ref_id)
protected

Definition at line 48 of file class.ilCourseLPBadgeGUI.php.

49 {
50 global $tree;
51
52 $res = array();
53
54 $root = $tree->getNodeData($a_parent_ref_id);
55 $sub_items = $tree->getSubTree($root);
56 array_shift($sub_items); // remove root
57
58 include_once "Services/Object/classes/class.ilObjectLP.php";
59 foreach ($sub_items as $node) {
60 if (ilObjectLP::isSupportedObjectType($node["type"])) {
61 $class = ilObjectLP::getTypeClass($node["type"]);
62 $modes = $class::getDefaultModes(ilObjUserTracking::_enabledLearningProgress());
63 if (sizeof($modes) > 1) {
64 $res[] = $node["type"];
65 }
66 }
67 }
68
69 return $res;
70 }
static isSupportedObjectType($a_type)
static getTypeClass($a_type)
foreach($_POST as $key=> $value) $res

References $res, ilObjUserTracking\_enabledLearningProgress(), ilObjectLP\getTypeClass(), and ilObjectLP\isSupportedObjectType().

Referenced by initConfigForm().

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

◆ importConfigToForm()

ilCourseLPBadgeGUI::importConfigToForm ( ilPropertyFormGUI  $a_form,
array  $a_config 
)

Set form values.

Parameters
ilPropertyFormGUI$a_form
array$a_config

Implements ilBadgeTypeGUI.

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

73 {
74 global $ilCtrl, $lng;
75
76 if (is_array($a_config["subitems"])) {
77 $items = $a_form->getItemByPostVar("subitems");
78 $items->setValue($a_config["subitems"]);
79
80 /*
81 include_once "Services/Tracking/classes/class.ilObjUserTracking.php";
82 if(!ilObjUserTracking::_enabledLearningProgress())
83 {
84 $lng->loadLanguageModule("trac");
85 $lp = new ilNonEditableValueGUI($lng->txt("tracking_settings"), "", true);
86 $a_form->addItem($lp);
87
88 include_once "Services/Object/classes/class.ilObjectLP.php";
89
90 $links = array();
91 foreach($a_config["subitems"] as $ref_id)
92 {
93 $obj_id = ilObject::_lookupObjId($ref_id);
94
95 $olp = ilObjectLP::getInstance($obj_id);
96 $mode = $olp->getCurrentMode();
97
98 $ilCtrl->setParameterByClass("ilLPListOfSettingsGUI", "lpid", $ref_id);
99 $url = $ilCtrl->getLinkTargetByClass("ilLPListOfSettingsGUI", "");
100 $ilCtrl->setParameterByClass("ilLPListOfSettingsGUI", "lpid", "");
101
102 $links[] = '<p><a href="'.$url.'">'.
103 '<img src="'.ilObject::_getIcon("", "tiny", ilObject::_lookupType($obj_id)).'" /> ' .
104 ilObject::_lookupTitle($obj_id).
105 '</a><div class="help-block">'.$olp->getModeText($mode).'</div>'.
106 '</p>';
107 }
108 $lp->setValue(implode("\n", $links));
109 }
110 */
111 }
112 }
getItemByPostVar($a_post_var)
Get Item by POST variable.
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:17

References $ilCtrl, $lng, and ilPropertyFormGUI\getItemByPostVar().

+ Here is the call graph for this function:

◆ initConfigForm()

ilCourseLPBadgeGUI::initConfigForm ( ilPropertyFormGUI  $a_form,
  $a_parent_ref_id 
)

Add custom fields to form.

Parameters
ilPropertyFormGUI$a_form
int$a_parent_ref_id

Implements ilBadgeTypeGUI.

Definition at line 18 of file class.ilCourseLPBadgeGUI.php.

19 {
20 global $lng;
21
22 $this->parent_ref_id = (int) $a_parent_ref_id;
23
24 $lng->loadLanguageModule("trac");
25
26 include_once "Services/Form/classes/class.ilRepositorySelector2InputGUI.php";
27 $subitems = new ilRepositorySelector2InputGUI($lng->txt("objects"), "subitems", true);
28
29 $exp = $subitems->getExplorerGUI();
30 $exp->setSkipRootNode(true);
31 $exp->setRootId($this->parent_ref_id);
32 $exp->setTypeWhiteList($this->getLPTypes($this->parent_ref_id));
33 $subitems->setTitleModifier(function ($a_id) {
34 $obj_id = ilObject::_lookupObjId($a_id);
35 $olp = ilObjectLP::getInstance($obj_id);
37 $mode = $olp->getModeText($olp->getCurrentMode());
38 if (in_array($olp->getCurrentMode(), $invalid_modes)) {
39 $mode = "<strong>$mode</strong>";
40 }
41 return ilObject::_lookupTitle(ilObject::_lookupObjId($a_id)) . " (" . $mode . ")";
42 });
43
44 $subitems->setRequired(true);
45 $a_form->addItem($subitems);
46 }
getLPTypes($a_parent_ref_id)
static getInvalidLPModes()
Get invalid lp modes.
static getInstance($a_obj_id)
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
addItem($a_item)
Add Item (Property, SectionHeader).

References $lng, ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilPropertyFormGUI\addItem(), ilObjectLP\getInstance(), getInvalidLPModes(), and getLPTypes().

+ Here is the call graph for this function:

◆ validateForm()

ilCourseLPBadgeGUI::validateForm ( ilPropertyFormGUI  $a_form)

Custom form validation.

Parameters
ilPropertyFormGUI$a_form
Returns
bool

Implements ilBadgeTypeGUI.

Definition at line 168 of file class.ilCourseLPBadgeGUI.php.

169 {
170 global $lng;
171 $invalid = array();
172
173 include_once "Services/Object/classes/class.ilObjectLP.php";
174 include_once "Services/Tracking/classes/class.ilLPObjSettings.php";
175 include_once "Services/Tracking/classes/class.ilObjUserTracking.php";
176
177 $invalid_modes = self::getInvalidLPModes();
178
179 foreach ($a_form->getInput("subitems") as $ref_id) {
180 $obj_id = ilObject::_lookupObjId($ref_id);
181 $olp = ilObjectLP::getInstance($obj_id);
182 if (in_array($olp->getCurrentMode(), $invalid_modes)) {
183 $invalid[] = ilObject::_lookupTitle($obj_id);
184 }
185 }
186
187 if (sizeof($invalid)) {
188 $mess = sprintf($lng->txt("badge_course_lp_invalid"), implode(", ", $invalid));
189 $a_form->getItemByPostVar("subitems")->setAlert($mess);
190 return false;
191 }
192
193 return true;
194 }
sprintf('%.4f', $callTime)

References $lng, ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilPropertyFormGUI\getInput(), ilObjectLP\getInstance(), getInvalidLPModes(), ilPropertyFormGUI\getItemByPostVar(), and sprintf.

+ Here is the call graph for this function:

Field Documentation

◆ $parent_ref_id

ilCourseLPBadgeGUI::$parent_ref_id
protected

Definition at line 16 of file class.ilCourseLPBadgeGUI.php.


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