33 include_once
'./Services/Tracking/classes/class.ilLPStatus.php';
34 include_once
'./Services/Tracking/classes/class.ilLPStatusWrapper.php';
42 parent::__construct($a_obj_id);
50 $members = self::getMembers($a_obj_id);
63 include_once
'./Services/Tracking/classes/class.ilChangeEvent.php';
66 include_once
'./Services/Object/classes/class.ilObjectLP.php';
68 $collection = $olp->getCollectionInstance();
70 foreach ($collection->getItems() as $item_id) {
86 $users = array_intersect(self::getMembers($a_obj_id), (
array) $users);
101 global $ilObjDataCache;
103 include_once
'./Services/Object/classes/class.ilObjectLP.php';
105 $collection = $olp->getCollectionInstance();
107 $grouped_items = $collection->getGroupedItemsForLPStatus();
109 if (!
sizeof($grouped_items)) {
116 foreach ($grouped_items as $grouping_id => $grouping) {
117 $isGrouping = $grouping_id ? true :
false;
118 $grouping_completed =
array();
119 $grouping_completed_users_num =
array();
120 foreach ((
array) $grouping[
'items'] as $item) {
121 $item_id = $ilObjDataCache->lookupObjId($item);
125 foreach ($tmp_users as $tmp_user_id) {
126 ++$grouping_completed_users_num[$tmp_user_id];
139 foreach ($grouping_completed_users_num as $tmp_user_id => $grouping_num_completed) {
140 if ($grouping_num_completed >= $grouping[
'num_obligatory']) {
141 $grouping_completed[] = $tmp_user_id;
147 $users = $grouping_completed;
167 global $ilObjDataCache;
171 include_once
'./Services/Object/classes/class.ilObjectLP.php';
173 $collection = $olp->getCollectionInstance();
175 foreach ($collection->getGroupedItemsForLPStatus() as $grouping_id => $grouping) {
176 $isGrouping = $grouping_id ? true :
false;
178 $gr_failed =
array();
179 $gr_failed_users_num =
array();
181 foreach ((
array) $grouping[
'items'] as $item) {
182 $item_id = $ilObjDataCache->lookupObjId($item);
186 foreach ($tmp_users as $tmp_user_id) {
187 ++$gr_failed_users_num[$tmp_user_id];
191 $gr_failed = array_merge($gr_failed, $tmp_users);
196 $allowed_failed = count($grouping[
'items']) - $grouping[
'num_obligatory'];
198 foreach ($gr_failed_users_num as $tmp_user_id => $num_failed) {
199 if ($num_failed > $allowed_failed) {
200 $gr_failed[] = $tmp_user_id;
213 return array_unique(
$users);
218 $status_info =
array();
220 include_once
'./Services/Object/classes/class.ilObjectLP.php';
222 $collection = $olp->getCollectionInstance();
224 $status_info[
'collections'] = $collection->getItems();
225 $status_info[
'num_collections'] = count($status_info[
'collections']);
233 global $ilObjDataCache;
235 if ($ilObjDataCache->lookupType($a_obj_id) ==
'sahs') {
236 return parent::_getTypicalLearningTime($a_obj_id);
241 foreach ($status_info[
'collections'] as $item) {
257 global $ilObjDataCache;
259 $status[
'completed'] =
true;
260 $status[
'failed'] =
false;
261 $status[
'in_progress'] =
false;
263 switch ($ilObjDataCache->lookupType($a_obj_id)) {
267 include_once
"./Services/Tracking/classes/class.ilChangeEvent.php";
269 $status[
'in_progress'] =
true;
272 include_once
'./Services/Object/classes/class.ilObjectLP.php';
274 $collection = $olp->getCollectionInstance();
276 $grouped_items = $collection->getGroupedItemsForLPStatus();
278 if (!
sizeof($grouped_items)) {
280 $status[
'completed'] =
false;
282 foreach ($grouped_items as $grouping_id => $grouping) {
283 $isGrouping = $grouping_id ? true :
false;
284 $status = self::determineGroupingStatus($status, $grouping, $a_user_id, $isGrouping);
288 if ($status[
'completed']) {
289 return self::LP_STATUS_COMPLETED_NUM;
291 if ($status[
'failed']) {
292 return self::LP_STATUS_FAILED_NUM;
294 if ($status[
'in_progress']) {
295 return self::LP_STATUS_IN_PROGRESS_NUM;
299 return self::LP_STATUS_NOT_ATTEMPTED_NUM;
313 global $ilObjDataCache;
315 $items = $gr_info[
'items'];
317 $max_allowed_failed = count($items) - $gr_info[
'num_obligatory'];
318 $required_completed = $gr_info[
'num_obligatory'];
320 $max_allowed_failed = 0;
321 $required_completed = count($items);
328 foreach ($items as $item_id) {
329 $item_id = $ilObjDataCache->lookupObjId($item_id);
332 if ($gr_status == self::LP_STATUS_FAILED_NUM) {
333 if (++$num_failed > $max_allowed_failed) {
334 $status[
'failed'] =
true;
335 $status[
'completed'] =
false;
339 if ($gr_status == self::LP_STATUS_COMPLETED_NUM) {
340 if (++$num_completed >= $required_completed) {
346 $status[
'completed'] =
false;
357 global $ilObjDataCache, $tree;
359 switch ($ilObjDataCache->lookupType($a_obj_id)) {
361 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
363 return $member_obj->getMembers();
366 include_once
'Modules/Group/classes/class.ilGroupParticipants.php';
368 return $member_obj->getMembers();
372 $folder_ref_id = current($folder_ref_ids);
373 if ($crs_id = $tree->checkForParentType($folder_ref_id,
'crs')) {
374 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
376 return $member_obj->getMembers();
394 $a_user_ids = self::getMembers($a_obj_id);
399 return self::_lookupStatusForObject($a_obj_id, self::LP_STATUS_COMPLETED_NUM, $a_user_ids);
412 $a_user_ids = self::getMembers($a_obj_id);
417 return self::_lookupStatusForObject($a_obj_id, self::LP_STATUS_FAILED_NUM, $a_user_ids);
430 $a_user_ids = self::getMembers($a_obj_id);
435 return self::_lookupStatusForObject($a_obj_id, self::LP_STATUS_IN_PROGRESS_NUM, $a_user_ids);
static _lookupFailedForObject($a_obj_id, $a_user_ids=null)
Get failed users for object.
static hasAccessed($a_obj_id, $a_usr_id)
Has accessed.
static _getInProgress($a_obj_id)
Static function to read users who have the status 'in_progress'.
static _getCompleted($a_obj_id)
Static function to read the users who have the status 'completed'.
static determineGroupingStatus($status, $gr_info, $user_id, $is_grouping)
Determine grouping status $ilObjDataCache.
static getMembers($a_obj_id)
Get members for object.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static _getNotAttempted($a_obj_id)
determineStatus($a_obj_id, $a_user_id, $a_obj=null)
Determine status.
static _getAllReferences($a_id)
get all reference ids of object
static _getFailed($a_obj_id)
static _getFailed($a_obj_id)
Static function to read the users who have the status 'completed'.
static _getTypicalLearningTime($a_obj_id)
static _getStatusInfo($a_obj_id)
static _lookupObjId($a_id)
static _lookupInProgressForObject($a_obj_id, $a_user_ids=null)
Get in progress users for object.
static _getCompleted($a_obj_id)
Get completed users New handling for optional grouped assignments.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
Create styles array
The data for the language used.
static _getStatusInfo($a_obj_id)
Reads informations about the object e.g test results, tlt, number of visits.
Abstract class ilLPStatus for all learning progress modes E.g ilLPStatusManual, ilLPStatusObjectives ...
static _getInProgress($a_obj_id)
static _getTypicalLearningTime($a_obj_id)
Reads Typical learning time.
static getInstance($a_obj_id)
static _lookupCompletedForObject($a_obj_id, $a_user_ids=null)
Get completed users for object.
static _determineStatus($a_obj_id, $a_usr_id)
Determine status.
static lookupUsersInProgress($a_obj_id)
Lookup users in progress.