33 include_once
'./Services/Tracking/classes/class.ilLPStatus.php';
34 include_once
'./Services/Tracking/classes/class.ilLPStatusWrapper.php';
44 parent::__construct($a_obj_id);
52 $members = self::getMembers($a_obj_id);
65 include_once
'./Services/Tracking/classes/class.ilChangeEvent.php';
68 include_once
'./Services/Object/classes/class.ilObjectLP.php';
70 $collection = $olp->getCollectionInstance();
72 foreach ($collection->getItems() as $item_id) {
88 $users = array_intersect(self::getMembers($a_obj_id), (array) $users);
105 $ilObjDataCache = $DIC[
'ilObjDataCache'];
107 include_once
'./Services/Object/classes/class.ilObjectLP.php';
109 $collection = $olp->getCollectionInstance();
111 $grouped_items = $collection->getGroupedItemsForLPStatus();
113 if (!
sizeof($grouped_items)) {
120 foreach ($grouped_items as $grouping_id => $grouping) {
121 $isGrouping = $grouping_id ? true :
false;
122 $grouping_completed = array();
123 $grouping_completed_users_num = array();
124 foreach ((array) $grouping[
'items'] as $item) {
125 $item_id = $ilObjDataCache->lookupObjId($item);
129 foreach ($tmp_users as $tmp_user_id) {
130 ++$grouping_completed_users_num[$tmp_user_id];
143 foreach ($grouping_completed_users_num as $tmp_user_id => $grouping_num_completed) {
144 if ($grouping_num_completed >= $grouping[
'num_obligatory']) {
145 $grouping_completed[] = $tmp_user_id;
151 $users = $grouping_completed;
163 $users = array_intersect(self::getMembers($a_obj_id), (array)
$users);
173 $ilObjDataCache = $DIC[
'ilObjDataCache'];
177 include_once
'./Services/Object/classes/class.ilObjectLP.php';
179 $collection = $olp->getCollectionInstance();
181 foreach ($collection->getGroupedItemsForLPStatus() as $grouping_id => $grouping) {
182 $isGrouping = $grouping_id ? true :
false;
184 $gr_failed = array();
185 $gr_failed_users_num = array();
187 foreach ((array) $grouping[
'items'] as $item) {
188 $item_id = $ilObjDataCache->lookupObjId($item);
192 foreach ($tmp_users as $tmp_user_id) {
193 ++$gr_failed_users_num[$tmp_user_id];
197 $gr_failed = array_merge($gr_failed, $tmp_users);
202 $allowed_failed = count($grouping[
'items']) - $grouping[
'num_obligatory'];
204 foreach ($gr_failed_users_num as $tmp_user_id => $num_failed) {
205 if ($num_failed > $allowed_failed) {
206 $gr_failed[] = $tmp_user_id;
216 $users = array_intersect(self::getMembers($a_obj_id), (array)
$users);
219 return array_unique(
$users);
224 $status_info = array();
226 include_once
'./Services/Object/classes/class.ilObjectLP.php';
228 $collection = $olp->getCollectionInstance();
230 $status_info[
'collections'] = $collection->getItems();
231 $status_info[
'num_collections'] = count($status_info[
'collections']);
241 $ilObjDataCache = $DIC[
'ilObjDataCache'];
243 if ($ilObjDataCache->lookupType($a_obj_id) ==
'sahs') {
244 return parent::_getTypicalLearningTime($a_obj_id);
249 foreach ($status_info[
'collections'] as $item) {
267 $ilObjDataCache = $DIC[
'ilObjDataCache'];
269 $status[
'completed'] =
true;
270 $status[
'failed'] =
false;
271 $status[
'in_progress'] =
false;
273 switch ($ilObjDataCache->lookupType($a_obj_id)) {
278 include_once
"./Services/Tracking/classes/class.ilChangeEvent.php";
280 $status[
'in_progress'] =
true;
283 include_once
'./Services/Object/classes/class.ilObjectLP.php';
285 $collection = $olp->getCollectionInstance();
287 $grouped_items = $collection->getGroupedItemsForLPStatus();
289 if (!
sizeof($grouped_items)) {
291 $status[
'completed'] =
false;
293 foreach ($grouped_items as $grouping_id => $grouping) {
294 $isGrouping = $grouping_id ? true :
false;
295 $status = self::determineGroupingStatus($status, $grouping, $a_user_id, $isGrouping);
299 if ($status[
'completed']) {
300 return self::LP_STATUS_COMPLETED_NUM;
302 if ($status[
'failed']) {
303 return self::LP_STATUS_FAILED_NUM;
305 if ($status[
'in_progress']) {
306 return self::LP_STATUS_IN_PROGRESS_NUM;
310 return self::LP_STATUS_NOT_ATTEMPTED_NUM;
326 $ilObjDataCache = $DIC[
'ilObjDataCache'];
328 $items = $gr_info[
'items'];
330 $max_allowed_failed = count($items) - $gr_info[
'num_obligatory'];
331 $required_completed = $gr_info[
'num_obligatory'];
333 $max_allowed_failed = 0;
334 $required_completed = count($items);
341 foreach ($items as $item_id) {
342 $item_id = $ilObjDataCache->lookupObjId($item_id);
345 if ($gr_status == self::LP_STATUS_FAILED_NUM) {
346 if (++$num_failed > $max_allowed_failed) {
347 $status[
'failed'] =
true;
348 $status[
'completed'] =
false;
352 if ($gr_status == self::LP_STATUS_COMPLETED_NUM) {
353 if (++$num_completed >= $required_completed) {
359 $status[
'completed'] =
false;
372 $ilObjDataCache = $DIC[
'ilObjDataCache'];
373 $tree = $DIC[
'tree'];
375 switch ($ilObjDataCache->lookupType($a_obj_id)) {
377 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
379 return $member_obj->getMembers();
382 include_once
'Modules/Group/classes/class.ilGroupParticipants.php';
384 return $member_obj->getMembers();
388 $folder_ref_id = current($folder_ref_ids);
389 if ($crs_id =
$tree->checkForParentType($folder_ref_id,
'crs')) {
390 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
392 return $member_obj->getMembers();
398 return $member_obj->getMembers();
415 $a_user_ids = self::getMembers($a_obj_id);
420 return self::_lookupStatusForObject($a_obj_id, self::LP_STATUS_COMPLETED_NUM, $a_user_ids);
433 $a_user_ids = self::getMembers($a_obj_id);
438 return self::_lookupStatusForObject($a_obj_id, self::LP_STATUS_FAILED_NUM, $a_user_ids);
451 $a_user_ids = self::getMembers($a_obj_id);
456 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 _getInstanceByObjId(int $obj_id)
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.
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.