33 include_once
'./Services/Tracking/classes/class.ilLPStatus.php';
34 include_once
'./Services/Tracking/classes/class.ilLPStatusWrapper.php';
50 $this->tree = $DIC->repositoryTree();
51 $this->ilObjDataCache = $DIC[
'ilObjDataCache'];
59 $members = self::getMembers($a_obj_id);
72 include_once
'./Services/Tracking/classes/class.ilChangeEvent.php';
75 include_once
'./Services/Object/classes/class.ilObjectLP.php';
77 $collection = $olp->getCollectionInstance();
79 foreach ($collection->getItems() as $item_id) {
95 $users = array_intersect(self::getMembers($a_obj_id), (array) $users);
114 include_once
'./Services/Object/classes/class.ilObjectLP.php';
116 $collection = $olp->getCollectionInstance();
118 $grouped_items = $collection->getGroupedItemsForLPStatus();
120 if (!
sizeof($grouped_items)) {
127 foreach ($grouped_items as $grouping_id => $grouping) {
128 $isGrouping = $grouping_id ? true :
false;
129 $grouping_completed = array();
130 $grouping_completed_users_num = array();
131 foreach ((array) $grouping[
'items'] as $item) {
136 foreach ($tmp_users as $tmp_user_id) {
137 ++$grouping_completed_users_num[$tmp_user_id];
143 $users = array_intersect($users, $tmp_users);
150 foreach ($grouping_completed_users_num as $tmp_user_id => $grouping_num_completed) {
151 if ($grouping_num_completed >= $grouping[
'num_obligatory']) {
152 $grouping_completed[] = $tmp_user_id;
158 $users = $grouping_completed;
160 $users = array_intersect($users, $grouping_completed);
170 $users = array_intersect(self::getMembers($a_obj_id), (array) $users);
173 return (array) $users;
184 include_once
'./Services/Object/classes/class.ilObjectLP.php';
186 $collection = $olp->getCollectionInstance();
188 foreach ($collection->getGroupedItemsForLPStatus() as $grouping_id => $grouping) {
189 $isGrouping = $grouping_id ? true :
false;
191 $gr_failed = array();
192 $gr_failed_users_num = array();
194 foreach ((array) $grouping[
'items'] as $item) {
199 foreach ($tmp_users as $tmp_user_id) {
200 ++$gr_failed_users_num[$tmp_user_id];
204 $gr_failed = array_merge($gr_failed, $tmp_users);
209 $allowed_failed = count($grouping[
'items']) - $grouping[
'num_obligatory'];
211 foreach ($gr_failed_users_num as $tmp_user_id => $num_failed) {
212 if ($num_failed > $allowed_failed) {
213 $gr_failed[] = $tmp_user_id;
217 $users = array_unique(array_merge($users, $gr_failed));
223 $users = array_intersect(self::getMembers($a_obj_id), (array) $users);
226 return array_unique($users);
231 $status_info = array();
233 include_once
'./Services/Object/classes/class.ilObjectLP.php';
235 $collection = $olp->getCollectionInstance();
237 $status_info[
'collections'] = $collection->getItems();
238 $status_info[
'num_collections'] = count($status_info[
'collections']);
251 return parent::_getTypicalLearningTime($a_obj_id);
256 foreach ($status_info[
'collections'] as $item) {
276 $status[
'completed'] =
true;
277 $status[
'failed'] =
false;
278 $status[
'in_progress'] =
false;
285 include_once
"./Services/Tracking/classes/class.ilChangeEvent.php";
287 $status[
'in_progress'] =
true;
290 include_once
'./Services/Object/classes/class.ilObjectLP.php';
292 $collection = $olp->getCollectionInstance();
294 $grouped_items = $collection->getGroupedItemsForLPStatus();
296 if (!
sizeof($grouped_items)) {
298 $status[
'completed'] =
false;
300 foreach ($grouped_items as $grouping_id => $grouping) {
301 $isGrouping = $grouping_id ? true :
false;
302 $status = self::determineGroupingStatus($status, $grouping, $a_user_id, $isGrouping);
306 if ($status[
'completed']) {
307 if (!$this->
isMember((
int) $a_obj_id, (
int) $a_user_id)) {
308 return self::LP_STATUS_IN_PROGRESS_NUM;
311 return self::LP_STATUS_COMPLETED_NUM;
314 if ($status[
'failed']) {
315 return self::LP_STATUS_FAILED_NUM;
318 if ($status[
'in_progress']) {
319 return self::LP_STATUS_IN_PROGRESS_NUM;
323 return self::LP_STATUS_NOT_ATTEMPTED_NUM;
341 $items = $gr_info[
'items'];
343 $max_allowed_failed = count($items) - $gr_info[
'num_obligatory'];
344 $required_completed = $gr_info[
'num_obligatory'];
346 $max_allowed_failed = 0;
347 $required_completed = count($items);
354 foreach ($items as $item_id) {
358 if ($gr_status == self::LP_STATUS_FAILED_NUM) {
359 if (++$num_failed > $max_allowed_failed) {
360 $status[
'failed'] =
true;
361 $status[
'completed'] =
false;
365 if ($gr_status == self::LP_STATUS_COMPLETED_NUM) {
366 if (++$num_completed >= $required_completed) {
372 $status[
'completed'] =
false;
383 switch ($this->ilObjDataCache->lookupType($objId)) {
386 return $participants->isMember();
390 return $participants->isMember($usrId);
394 $folderRefId = current($folderRefIds);
395 if ($crsRefId = $this->tree->checkForParentType($folderRefId,
'crs')) {
397 return $participants->isMember();
400 if ($grpRefId = $this->tree->checkForParentType($folderRefId,
'grp')) {
402 return $participants->isMember($usrId);
408 return $participants->isMember($usrId);
424 $tree = $DIC[
'tree'];
428 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
430 return $member_obj->getMembers();
433 include_once
'Modules/Group/classes/class.ilGroupParticipants.php';
435 return $member_obj->getMembers();
439 $folder_ref_id = current($folder_ref_ids);
440 if ($crs_id =
$tree->checkForParentType($folder_ref_id,
'crs')) {
441 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
443 return $member_obj->getMembers();
449 return $member_obj->getMembers();
466 $a_user_ids = self::getMembers($a_obj_id);
471 return self::_lookupStatusForObject($a_obj_id, self::LP_STATUS_COMPLETED_NUM, $a_user_ids);
484 $a_user_ids = self::getMembers($a_obj_id);
489 return self::_lookupStatusForObject($a_obj_id, self::LP_STATUS_FAILED_NUM, $a_user_ids);
502 $a_user_ids = self::getMembers($a_obj_id);
507 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.
isMember(int $objId, int $usrId)
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 _getInstanceByObjId($a_obj_id, $a_usr_id)
Get singleton instance.
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.
__construct(Container $dic, ilPlugin $plugin)
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.