ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 119 of file class.ilCourseLPBadgeGUI.php.

120 {
121 return array("subitems" => $a_form->getInput("subitems"));
122 }
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 130 of file class.ilCourseLPBadgeGUI.php.

131 {
132 include_once "Services/Object/classes/class.ilObjectLP.php";
133 include_once "Services/Tracking/classes/class.ilLPObjSettings.php";
134 include_once "Services/Tracking/classes/class.ilObjUserTracking.php";
135
136 /* supported modes
137 LP_MODE_TLT
138 LP_MODE_OBJECTIVES
139 LP_MODE_TEST_FINISHED
140 LP_MODE_TEST_PASSED
141 LP_MODE_EXERCISE_RETURNED
142 LP_MODE_EVENT
143 LP_MODE_SCORM_PACKAGE
144 LP_MODE_PLUGIN
145 LP_MODE_QUESTIONS
146 LP_MODE_SURVEY_FINISHED
147 LP_MODE_VISITED_PAGES
148 LP_MODE_DOWNLOADED
149 LP_MODE_STUDY_PROGRAMME ?!
150 */
151
152 $invalid_modes = array(ilLPObjSettings::LP_MODE_DEACTIVATED,
154
155 // without active LP the following modes cannot be supported
157 {
158 // status cannot be set without active LP
159 $invalid_modes[] = ilLPObjSettings::LP_MODE_MANUAL;
162
163 // mode cannot be configured without active LP
164 $invalid_modes[] = ilLPObjSettings::LP_MODE_COLLECTION;
167 $invalid_modes[] = ilLPObjSettings::LP_MODE_SCORM;
168 $invalid_modes[] = ilLPObjSettings::LP_MODE_VISITS; // ?
169 }
170 return $invalid_modes;
171 }
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 49 of file class.ilCourseLPBadgeGUI.php.

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

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 76 of file class.ilCourseLPBadgeGUI.php.

77 {
78 global $ilCtrl, $lng;
79
80 if(is_array($a_config["subitems"]))
81 {
82 $items = $a_form->getItemByPostVar("subitems");
83 $items->setValue($a_config["subitems"]);
84
85 /*
86 include_once "Services/Tracking/classes/class.ilObjUserTracking.php";
87 if(!ilObjUserTracking::_enabledLearningProgress())
88 {
89 $lng->loadLanguageModule("trac");
90 $lp = new ilNonEditableValueGUI($lng->txt("tracking_settings"), "", true);
91 $a_form->addItem($lp);
92
93 include_once "Services/Object/classes/class.ilObjectLP.php";
94
95 $links = array();
96 foreach($a_config["subitems"] as $ref_id)
97 {
98 $obj_id = ilObject::_lookupObjId($ref_id);
99
100 $olp = ilObjectLP::getInstance($obj_id);
101 $mode = $olp->getCurrentMode();
102
103 $ilCtrl->setParameterByClass("ilLPListOfSettingsGUI", "lpid", $ref_id);
104 $url = $ilCtrl->getLinkTargetByClass("ilLPListOfSettingsGUI", "");
105 $ilCtrl->setParameterByClass("ilLPListOfSettingsGUI", "lpid", "");
106
107 $links[] = '<p><a href="'.$url.'">'.
108 '<img src="'.ilObject::_getIcon("", "tiny", ilObject::_lookupType($obj_id)).'" /> ' .
109 ilObject::_lookupTitle($obj_id).
110 '</a><div class="help-block">'.$olp->getModeText($mode).'</div>'.
111 '</p>';
112 }
113 $lp->setValue(implode("\n", $links));
114 }
115 */
116 }
117 }
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 {
40 $mode = "<strong>$mode</strong>";
41 }
42 return ilObject::_lookupTitle(ilObject::_lookupObjId($a_id))." (".$mode.")";
43 });
44
45 $subitems->setRequired(true);
46 $a_form->addItem($subitems);
47 }
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 174 of file class.ilCourseLPBadgeGUI.php.

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

References $lng, $ref_id, 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: