ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilTestLearningObjectivesStatusGUI Class Reference
+ Collaboration diagram for ilTestLearningObjectivesStatusGUI:

Public Member Functions

 __construct (ilLanguage $lng)
 
 getCrsObjId ()
 
 setCrsObjId ($crsObjId)
 
 getUsrId ()
 
 setUsrId ($usrId)
 
 getHTML ($objectiveId=null)
 

Protected Attributes

 $lng = null
 

Private Member Functions

 getHeaderLangVar ($objectiveId)
 
 renderStatus ($tpl, $objectiveId, $loStatusData)
 
 getUsersObjectivesStatus ($crsObjId, $usrId)
 
 getUsersObjectivesResults ($crsObjId, $usrId)
 

Private Attributes

 $crsObjId = null
 
 $usrId = null
 

Detailed Description

Definition at line 12 of file class.ilTestLearningObjectivesStatusGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilTestLearningObjectivesStatusGUI::__construct ( ilLanguage  $lng)

Member Function Documentation

◆ getCrsObjId()

ilTestLearningObjectivesStatusGUI::getCrsObjId ( )
Returns
integer

Definition at line 37 of file class.ilTestLearningObjectivesStatusGUI.php.

References $crsObjId.

Referenced by getHTML(), and renderStatus().

+ Here is the caller graph for this function:

◆ getHeaderLangVar()

ilTestLearningObjectivesStatusGUI::getHeaderLangVar (   $objectiveId)
private

Definition at line 83 of file class.ilTestLearningObjectivesStatusGUI.php.

84 {
85 if($objectiveId)
86 {
87 return 'tst_objective_progress_header';
88 }
89
90 return 'tst_objectives_progress_header';
91 }

◆ getHTML()

ilTestLearningObjectivesStatusGUI::getHTML (   $objectiveId = null)

Definition at line 66 of file class.ilTestLearningObjectivesStatusGUI.php.

67 {
68 $this->lng->loadLanguageModule('crs');
69
70 $tpl = new ilTemplate('tpl.tst_lo_status.html', true, true, 'Modules/Test');
71
72 $tpl->setCurrentBlock('objectives_progress_header');
73 $tpl->setVariable('OBJECTIVES_PROGRESS_HEADER', $this->lng->txt($this->getHeaderLangVar($objectiveId)));
74 $tpl->parseCurrentBlock();
75
76 $this->renderStatus($tpl, $objectiveId, $this->getUsersObjectivesStatus(
77 $this->getCrsObjId(), $this->getUsrId()
78 ));
79
80 return $tpl->get();
81 }
global $tpl
Definition: ilias.php:8
special template class to simplify handling of ITX/PEAR

References $tpl, getCrsObjId(), getUsersObjectivesStatus(), getUsrId(), and renderStatus().

+ Here is the call graph for this function:

◆ getUsersObjectivesResults()

ilTestLearningObjectivesStatusGUI::getUsersObjectivesResults (   $crsObjId,
  $usrId 
)
private

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

197 {
198 $res = array();
199
200 include_once "Modules/Course/classes/Objectives/class.ilLOUserResults.php";
201 $lur = new ilLOUserResults($crsObjId, $usrId);
202
203 foreach($lur->getCourseResultsForUserPresentation() as $objective_id => $types)
204 {
205 // show either initial or qualified for objective
206 if(isset($types[ilLOUserResults::TYPE_INITIAL]))
207 {
208 $initial_status = $types[ilLOUserResults::TYPE_INITIAL]["status"];
209 }
210
211 // qualified test has priority
212 if(isset($types[ilLOUserResults::TYPE_QUALIFIED]))
213 {
216 $result["initial"] = $types[ilLOUserResults::TYPE_INITIAL];
217 }
218 else
219 {
222 }
223
224 $result["initial_status"] = $initial_status;
225
226 $res[$objective_id] = $result;
227 }
228
229 return $res;
230 }
$result

References $crsObjId, $res, $result, $usrId, ilLOUserResults\TYPE_INITIAL, and ilLOUserResults\TYPE_QUALIFIED.

Referenced by getUsersObjectivesStatus().

+ Here is the caller graph for this function:

◆ getUsersObjectivesStatus()

ilTestLearningObjectivesStatusGUI::getUsersObjectivesStatus (   $crsObjId,
  $usrId 
)
private

Definition at line 138 of file class.ilTestLearningObjectivesStatusGUI.php.

139 {
140 $res = array();
141
142 // we need the collection for the correct order
143 include_once "Services/Tracking/classes/class.ilLPObjSettings.php";
144 include_once "Services/Tracking/classes/collection/class.ilLPCollectionOfObjectives.php";
146 $coll_objtv = $coll_objtv->getItems();
147 if($coll_objtv)
148 {
149 // #13373
150 $lo_results = $this->getUsersObjectivesResults($crsObjId, $usrId);
151
152 include_once "Modules/Course/classes/Objectives/class.ilLOTestAssignments.php";
154
155 $tmp = array();
156
157 include_once "Modules/Course/classes/class.ilCourseObjective.php";
158 foreach($coll_objtv as $objective_id)
159 {
160 // patch optes start
161
162 $title = ilCourseObjective::lookupObjectiveTitle($objective_id, true);
163
164 $tmp[$objective_id] = array(
165 "id" => $objective_id,
166 "title" => $title["title"],
167 "desc" => $title["description"],
168 "itest" => $lo_ass->getTestByObjective($objective_id, ilLOSettings::TYPE_TEST_INITIAL),
169 "qtest" => $lo_ass->getTestByObjective($objective_id, ilLOSettings::TYPE_TEST_QUALIFIED)
170 );
171
172 // patch optes end
173
174 if(array_key_exists($objective_id, $lo_results))
175 {
176 $lo_result = $lo_results[$objective_id];
177 $tmp[$objective_id]["user_id"] = $lo_result["user_id"];
178 $tmp[$objective_id]["result_perc"] = $lo_result["result_perc"];
179 $tmp[$objective_id]["limit_perc"] = $lo_result["limit_perc"];
180 $tmp[$objective_id]["status"] = $lo_result["status"];
181 $tmp[$objective_id]["type"] = $lo_result["type"];
182 $tmp[$objective_id]["initial"] = $lo_result["initial"];
183 }
184 }
185
186 // order
187 foreach($coll_objtv as $objtv_id)
188 {
189 $res[] = $tmp[$objtv_id];
190 }
191 }
192
193 return $res;
194 }
static lookupObjectiveTitle($a_objective_id, $a_add_description=false)
static getInstance($a_container_id)
Get instance by container id.

References $crsObjId, $res, $title, $usrId, ilLOTestAssignments\getInstance(), getUsersObjectivesResults(), ilCourseObjective\lookupObjectiveTitle(), ilLPObjSettings\LP_MODE_OBJECTIVES, ilLOSettings\TYPE_TEST_INITIAL, and ilLOSettings\TYPE_TEST_QUALIFIED.

Referenced by getHTML().

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

◆ getUsrId()

ilTestLearningObjectivesStatusGUI::getUsrId ( )
Returns
integer

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

54 {
55 return $this->usrId;
56 }

References $usrId.

Referenced by getHTML().

+ Here is the caller graph for this function:

◆ renderStatus()

ilTestLearningObjectivesStatusGUI::renderStatus (   $tpl,
  $objectiveId,
  $loStatusData 
)
private

Definition at line 93 of file class.ilTestLearningObjectivesStatusGUI.php.

94 {
95 include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
96 $loc_settings = ilLOSettings::getInstanceByObjId($this->getCrsObjId());
97 $has_initial_test = (bool)$loc_settings->getInitialTest();
98
99 foreach($loStatusData as $objtv)
100 {
101 if($objectiveId && $objtv['id'] != $objectiveId)
102 {
103 continue;
104 }
105
106 $tpl->setCurrentBlock("objective_nolink_bl");
107 $tpl->setVariable("OBJECTIVE_NOLINK_TITLE", $objtv["title"]);
108 $tpl->parseCurrentBlock();
109
110 $objtv_icon = ilUtil::getTypeIconPath("lobj", $objtv["id"]);
111
112 $tpl->setCurrentBlock("objective_bl");
113 $tpl->setVariable("OBJTV_ICON_URL", $objtv_icon);
114 $tpl->setVariable("OBJTV_ICON_ALT", $this->lng->txt("crs_objectives"));
115
116 if($objtv["type"])
117 {
118 $tpl->setVariable("LP_OBJTV_PROGRESS",
119 ilContainerObjectiveGUI::buildObjectiveProgressBar($has_initial_test, $objtv["id"], $objtv, true)
120 );
121
122 // since ilContainerObjectiveGUI::buildObjectiveProgressBar() "sets an empty ref_id" for ilObjTestGUI,
123 // after creating links for different test refs, the "saved ref_id param" for ilObjTestGUI gets overwritten.
124 // (!) we need to set an explicit ref_id param for ilObjTestGUI again to keep the things running (!)
125
126 global $DIC; /* @var \ILIAS\DI\Container $DIC */
127 $DIC->ctrl()->setParameterByClass('ilObjTestGUI', 'ref_id', (int)$_GET['ref_id']);
128 }
129
130 $tpl->parseCurrentBlock();
131 }
132
133 $tpl->setCurrentBlock("objectives_bl");
134 $tpl->setVariable("OBJTV_LIST_CRS_ID", $this->getCrsObjId());
135 $tpl->parseCurrentBlock();
136 }
$_GET["client_id"]
static buildObjectiveProgressBar($a_has_initial_test, $a_objective_id, array $a_lo_result, $a_list_mode=false, $a_sub=false, $a_tt_suffix=null)
Render progressbar(s) for given objective and result data.
static getInstanceByObjId($a_obj_id)
get singleton instance
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...
global $DIC

References $_GET, $DIC, $tpl, ilContainerObjectiveGUI\buildObjectiveProgressBar(), getCrsObjId(), ilLOSettings\getInstanceByObjId(), and ilUtil\getTypeIconPath().

Referenced by getHTML().

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

◆ setCrsObjId()

ilTestLearningObjectivesStatusGUI::setCrsObjId (   $crsObjId)
Parameters
integer$crsObjId

Definition at line 45 of file class.ilTestLearningObjectivesStatusGUI.php.

46 {
47 $this->crsObjId = $crsObjId;
48 }

References $crsObjId.

◆ setUsrId()

ilTestLearningObjectivesStatusGUI::setUsrId (   $usrId)
Parameters
integer$usrId

Definition at line 61 of file class.ilTestLearningObjectivesStatusGUI.php.

62 {
63 $this->usrId = $usrId;
64 }

References $usrId.

Field Documentation

◆ $crsObjId

ilTestLearningObjectivesStatusGUI::$crsObjId = null
private

◆ $lng

ilTestLearningObjectivesStatusGUI::$lng = null
protected

Definition at line 17 of file class.ilTestLearningObjectivesStatusGUI.php.

Referenced by __construct().

◆ $usrId

ilTestLearningObjectivesStatusGUI::$usrId = null
private

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