ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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)

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

References $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 84 of file class.ilTestLearningObjectivesStatusGUI.php.

85  {
86  if ($objectiveId) {
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.

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

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(),
78  $this->getUsrId()
79  ));
80 
81  return $tpl->get();
82  }
$tpl
Definition: ilias.php:10
special template class to simplify handling of ITX/PEAR
+ Here is the call graph for this function:

◆ getUsersObjectivesResults()

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

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

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

Referenced by getUsersObjectivesStatus().

191  {
192  $res = array();
193 
194  include_once "Modules/Course/classes/Objectives/class.ilLOUserResults.php";
195  $lur = new ilLOUserResults($crsObjId, $usrId);
196 
197  foreach ($lur->getCourseResultsForUserPresentation() as $objective_id => $types) {
198  // show either initial or qualified for objective
199  if (isset($types[ilLOUserResults::TYPE_INITIAL])) {
200  $initial_status = $types[ilLOUserResults::TYPE_INITIAL]["status"];
201  }
202 
203  // qualified test has priority
204  if (isset($types[ilLOUserResults::TYPE_QUALIFIED])) {
207  $result["initial"] = $types[ilLOUserResults::TYPE_INITIAL];
208  } else {
211  }
212 
213  $result["initial_status"] = $initial_status;
214 
215  $res[$objective_id] = $result;
216  }
217 
218  return $res;
219  }
$result
foreach($_POST as $key=> $value) $res
+ Here is the caller graph for this function:

◆ getUsersObjectivesStatus()

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

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

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().

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

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.

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

Referenced by getHTML().

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  if ($objectiveId && $objtv['id'] != $objectiveId) {
101  continue;
102  }
103 
104  $tpl->setCurrentBlock("objective_nolink_bl");
105  $tpl->setVariable("OBJECTIVE_NOLINK_TITLE", $objtv["title"]);
106  $tpl->parseCurrentBlock();
107 
108  $objtv_icon = ilUtil::getTypeIconPath("lobj", $objtv["id"]);
109 
110  $tpl->setCurrentBlock("objective_bl");
111  $tpl->setVariable("OBJTV_ICON_URL", $objtv_icon);
112  $tpl->setVariable("OBJTV_ICON_ALT", $this->lng->txt("crs_objectives"));
113 
114  if ($objtv["type"]) {
115  $tpl->setVariable(
116  "LP_OBJTV_PROGRESS",
117  ilContainerObjectiveGUI::buildObjectiveProgressBar($has_initial_test, $objtv["id"], $objtv, true)
118  );
119 
120  // since ilContainerObjectiveGUI::buildObjectiveProgressBar() "sets an empty ref_id" for ilObjTestGUI,
121  // after creating links for different test refs, the "saved ref_id param" for ilObjTestGUI gets overwritten.
122  // (!) we need to set an explicit ref_id param for ilObjTestGUI again to keep the things running (!)
123 
124  global $DIC; /* @var \ILIAS\DI\Container $DIC */
125  $DIC->ctrl()->setParameterByClass('ilObjTestGUI', 'ref_id', (int) $_GET['ref_id']);
126  }
127 
128  $tpl->parseCurrentBlock();
129  }
130 
131  $tpl->setCurrentBlock("objectives_bl");
132  $tpl->setVariable("OBJTV_LIST_CRS_ID", $this->getCrsObjId());
133  $tpl->parseCurrentBlock();
134  }
static getInstanceByObjId($a_obj_id)
get singleton instance
global $DIC
Definition: saml.php:7
$_GET["client_id"]
$tpl
Definition: ilias.php:10
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...
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.
+ 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.

References $crsObjId.

◆ setUsrId()

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

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

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: