ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilTestLearningObjectivesStatusGUI Class Reference
+ Collaboration diagram for ilTestLearningObjectivesStatusGUI:

Public Member Functions

 __construct (private ilLanguage $lng, private ilCtrlInterface $ctrl, private UIFactory $ui_factory, private UIRenderer $ui_renderer, private RequestDataCollector $testrequest)
 
 getCrsObjId ()
 
 setCrsObjId ($crs_obj_id)
 
 getUsrId ()
 
 setUsrId ($usr_id)
 
 getHTML (?int $objective_id=null)
 

Private Member Functions

 getHeaderLangVar (?int $objective_id)
 
 buildStatusItems (?int $objective_id, array $lo_status_data)
 
 getUsersObjectivesStatus ($crs_obj_id, $usr_id)
 
 getUsersObjectivesResults (int $crs_obj_id, int $usr_id)
 

Private Attributes

int $crs_obj_id = null
 
int $usr_id = null
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilTestLearningObjectivesStatusGUI::__construct ( private ilLanguage  $lng,
private ilCtrlInterface  $ctrl,
private UIFactory  $ui_factory,
private UIRenderer  $ui_renderer,
private RequestDataCollector  $testrequest 
)

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

42  {
43  }

Member Function Documentation

◆ buildStatusItems()

ilTestLearningObjectivesStatusGUI::buildStatusItems ( ?int  $objective_id,
array  $lo_status_data 
)
private
Parameters
type$lo_status_data
Returns
array

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

References ilObject\_getIcon(), ILIAS\Repository\ctrl(), getCrsObjId(), ilLOSettings\getInstanceByObjId(), ILIAS\Repository\lng(), null, and ilLOUserResults\TYPE_QUALIFIED.

Referenced by getHTML().

110  : array
111  {
112  $items = [];
113 
114  foreach ($lo_status_data as $objtv) {
115  if ($objective_id !== null && $objtv['id'] !== $objective_id) {
116  continue;
117  }
118 
119  $loc_settings = ilLOSettings::getInstanceByObjId($this->getCrsObjId());
120  $compare_value = null;
121  if ($objtv["type"] === ilLOUserResults::TYPE_QUALIFIED
122  && $loc_settings->getInitialTest() === 1
123  && isset($objtv['initial']['result_perc'])) {
124  $compare_value = $objtv['initial']['result_perc'];
125  }
126 
127  $items[] = $this->ui_factory->item()->standard($objtv["title"])
128  ->withLeadIcon(
129  $this->ui_factory->symbol()->icon()->custom(
130  ilObject::_getIcon($objtv["id"], "small", "lobj"),
131  $this->lng->txt("crs_objectives")
132  )
133  )->withProgress(
134  $this->ui_factory->chart()->progressMeter()->standard(
135  100,
136  $objtv['result_perc'],
137  $objtv['limit_perc'],
138  $compare_value
139  )
140  );
141 
142  // since ilContainerObjectiveGUI::buildObjectiveProgressBar() "sets an empty ref_id" for ilObjTestGUI,
143  // after creating links for different test refs, the "saved ref_id param" for ilObjTestGUI gets overwritten.
144  // (!) we need to set an explicit ref_id param for ilObjTestGUI again to keep the things running (!)
145  $this->ctrl->setParameterByClass('ilObjTestGUI', 'ref_id', $this->testrequest->getRefId());
146  }
147 
148  return $items;
149  }
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static getInstanceByObjId(int $a_obj_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCrsObjId()

ilTestLearningObjectivesStatusGUI::getCrsObjId ( )
Returns
integer

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

References $crs_obj_id.

Referenced by buildStatusItems(), and getHTML().

+ Here is the caller graph for this function:

◆ getHeaderLangVar()

ilTestLearningObjectivesStatusGUI::getHeaderLangVar ( ?int  $objective_id)
private

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

References null.

97  : string
98  {
99  if ($objective_id !== null) {
100  return 'tst_objective_progress_header';
101  }
102 
103  return 'tst_objectives_progress_header';
104  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ getHTML()

ilTestLearningObjectivesStatusGUI::getHTML ( ?int  $objective_id = null)

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

References buildStatusItems(), getCrsObjId(), getUsersObjectivesStatus(), getUsrId(), and ILIAS\Repository\lng().

77  : string
78  {
79  $this->lng->loadLanguageModule('crs');
80 
81  $items = $this->buildStatusItems(
82  $objective_id,
84  $this->getCrsObjId(),
85  $this->getUsrId()
86  )
87  );
88 
89  $panel = $this->ui_factory->panel()->standard(
90  $this->lng->txt($this->getHeaderLangVar($objective_id)),
91  $items
92  );
93 
94  return $this->ui_renderer->render($panel);
95  }
buildStatusItems(?int $objective_id, array $lo_status_data)
+ Here is the call graph for this function:

◆ getUsersObjectivesResults()

ilTestLearningObjectivesStatusGUI::getUsersObjectivesResults ( int  $crs_obj_id,
int  $usr_id 
)
private

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

References $res, null, ilLOUserResults\TYPE_INITIAL, and ilLOUserResults\TYPE_QUALIFIED.

Referenced by getUsersObjectivesStatus().

197  : array
198  {
199  $res = [];
200  $initial_status = null;
201  $lur = new ilLOUserResults($crs_obj_id, $usr_id);
202 
203  foreach ($lur->getCourseResultsForUserPresentation() as $objective_id => $types) {
204  // show either initial or qualified for objective
205  if (isset($types[ilLOUserResults::TYPE_INITIAL])) {
206  $initial_status = $types[ilLOUserResults::TYPE_INITIAL]["status"];
207  }
208 
209  // qualified test has priority
210  if (isset($types[ilLOUserResults::TYPE_QUALIFIED])) {
211  $result = $types[ilLOUserResults::TYPE_QUALIFIED];
212  $result["type"] = ilLOUserResults::TYPE_QUALIFIED;
213  $result["initial"] = $types[ilLOUserResults::TYPE_INITIAL] ?? null;
214  } else {
215  $result = $types[ilLOUserResults::TYPE_INITIAL];
216  $result["type"] = ilLOUserResults::TYPE_INITIAL;
217  }
218 
219  $result["initial_status"] = $initial_status;
220 
221  $res[$objective_id] = $result;
222  }
223 
224  return $res;
225  }
$res
Definition: ltiservices.php:66
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ getUsersObjectivesStatus()

ilTestLearningObjectivesStatusGUI::getUsersObjectivesStatus (   $crs_obj_id,
  $usr_id 
)
private

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

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

Referenced by getHTML().

151  : array
152  {
154  $objective_items = $collection_of_objectives->getItems();
155 
156  if ($objective_items === []) {
157  return [];
158  }
159 
160  $lo_results = $this->getUsersObjectivesResults($crs_obj_id, $usr_id);
162 
163  $res = [];
164  $tmp = [];
165  foreach ($objective_items as $objective_id) {
166  $title = ilCourseObjective::lookupObjectiveTitle($objective_id, true);
167 
168  $tmp[$objective_id] = [
169  "id" => $objective_id,
170  "title" => $title["title"],
171  "desc" => $title["description"],
172  "itest" => $lo_ass->getTestByObjective($objective_id, ilLOSettings::TYPE_TEST_INITIAL),
173  "qtest" => $lo_ass->getTestByObjective($objective_id, ilLOSettings::TYPE_TEST_QUALIFIED)
174  ];
175 
176  // patch optes end
177 
178  if (array_key_exists($objective_id, $lo_results)) {
179  $lo_result = $lo_results[$objective_id];
180  $tmp[$objective_id]["user_id"] = $lo_result["user_id"];
181  $tmp[$objective_id]["result_perc"] = $lo_result["result_perc"];
182  $tmp[$objective_id]["limit_perc"] = $lo_result["limit_perc"];
183  $tmp[$objective_id]["status"] = $lo_result["status"];
184  $tmp[$objective_id]["type"] = $lo_result["type"];
185  $tmp[$objective_id]["initial"] = $lo_result["initial"] ?? null;
186  }
187  }
188 
189  // order
190  foreach ($objective_items as $objtv_id) {
191  $res[] = $tmp[$objtv_id];
192  }
193 
194  return $res;
195  }
$res
Definition: ltiservices.php:66
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static lookupObjectiveTitle(int $a_objective_id, bool $a_add_description=false)
static getInstance(int $a_container_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUsrId()

ilTestLearningObjectivesStatusGUI::getUsrId ( )
Returns
integer

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

References $usr_id.

Referenced by getHTML().

+ Here is the caller graph for this function:

◆ setCrsObjId()

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

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

References $crs_obj_id.

57  {
58  $this->crs_obj_id = $crs_obj_id;
59  }

◆ setUsrId()

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

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

References $usr_id.

Field Documentation

◆ $crs_obj_id

int ilTestLearningObjectivesStatusGUI::$crs_obj_id = null
private

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

Referenced by getCrsObjId(), and setCrsObjId().

◆ $usr_id

int ilTestLearningObjectivesStatusGUI::$usr_id = null
private

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

Referenced by getUsrId(), and setUsrId().


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