Public Member Functions

ilLPStatusCollection Class Reference

Inheritance diagram for ilLPStatusCollection:
Collaboration diagram for ilLPStatusCollection:

Public Member Functions

 ilLPStatusCollection ($a_obj_id)
 _getNotAttempted ($a_obj_id)
 _getInProgress ($a_obj_id)
 _getCompleted ($a_obj_id)
 _getFailed ($a_obj_id)
 _getStatusInfo ($a_obj_id)
 _getTypicalLearningTime ($a_obj_id)

Detailed Description

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


Member Function Documentation

ilLPStatusCollection::_getCompleted ( a_obj_id  ) 

Reimplemented from ilLPStatus.

Definition at line 129 of file class.ilLPStatusCollection.php.

References $counter, $ilBench, $users, ilLPStatusWrapper::_getCompletedByType(), ilLPStatusWrapper::_getFailed(), ilLPEventCollections::_getItems(), ilLPCollectionCache::_getItems(), ilObjGroup::_getMembers(), and ilCourseMembers::_getMembers().

        {
                include_once './Services/Tracking/classes/class.ilLPCollectionCache.php';
                include_once './Services/Tracking/classes/class.ilLPEventCollections.php';

                global $ilBench,$ilObjDataCache;
                $ilBench->start('LearningProgress','9173_LPStatusCollection_completed');

                $counter = 0;
                $users = array();
                foreach(ilLPCollectionCache::_getItems($a_obj_id) as $item_id)
                {
                        $item_id = $ilObjDataCache->lookupObjId($item_id);

                        $tmp_users = ilLPStatusWrapper::_getCompleted($item_id);
                        if(!$counter++)
                        {
                                $users = $tmp_users;
                        }
                        else
                        {
                                $users = array_intersect($users,$tmp_users);
                        }

                }
                foreach(ilLPEventCollections::_getItems($a_obj_id) as $event_id)
                {
                        $tmp_users = ilLPStatusWrapper::_getCompletedByType($event_id,'event');
                        if(!$counter++)
                        {
                                $users = $tmp_users;
                        }
                        else
                        {
                                $users = array_intersect($users,$tmp_users);
                        }
                }

                switch($ilObjDataCache->lookupType($a_obj_id))
                {
                        case 'crs':
                                // Exclude all non members
                                include_once 'course/classes/class.ilCourseMembers.php';
                                $users = array_intersect(ilCourseMembers::_getMembers($a_obj_id),(array) $users);
                                break;

                        case 'grp':
                                include_once 'classes/class.ilObjGroup.php';
                                $members = ilObjGroup::_getMembers($a_obj_id);
                                $users = array_intersect($members,(array) $users);
                                break;
                }
                $users = array_diff($users,ilLPStatusWrapper::_getFailed($a_obj_id));
                $ilBench->stop('LearningProgress','9173_LPStatusCollection_completed');
                return (array) $users;
        }

Here is the call graph for this function:

ilLPStatusCollection::_getFailed ( a_obj_id  ) 

Reimplemented from ilLPStatus.

Definition at line 186 of file class.ilLPStatusCollection.php.

References $users, ilLPCollectionCache::_getItems(), ilObjGroup::_getMembers(), and ilCourseMembers::_getMembers().

        {
                global $ilObjDataCache;

                include_once './Services/Tracking/classes/class.ilLPCollectionCache.php';

                $users = array();
                foreach(ilLPCollectionCache::_getItems($a_obj_id) as $item_id)
                {
                        $item_id = $ilObjDataCache->lookupObjId($item_id);
                        $tmp_users = ilLPStatusWrapper::_getFailed($item_id);
                        $users = array_merge($users,$tmp_users);
                }
                
                switch($ilObjDataCache->lookupType($a_obj_id))
                {
                        case 'crs':
                                // Exclude all non members
                                include_once 'course/classes/class.ilCourseMembers.php';
                                $users = array_intersect(ilCourseMembers::_getMembers($a_obj_id),(array) $users);
                                break;
                                
                        case 'grp':
                                include_once 'classes/class.ilObjGroup.php';
                                $members = ilObjGroup::_getMembers($a_obj_id);
                                $users = array_intersect($members,(array) $users);
                                break;
                }
                
                return array_unique($users);
        }

Here is the call graph for this function:

ilLPStatusCollection::_getInProgress ( a_obj_id  ) 

Reimplemented from ilLPStatus.

Definition at line 78 of file class.ilLPStatusCollection.php.

References $ilBench, $users, ilLPStatusWrapper::_getCompleted(), ilLPStatusWrapper::_getCompletedByType(), ilLPStatusWrapper::_getFailed(), ilLPStatusWrapper::_getInProgress(), ilLPStatusWrapper::_getInProgressByType(), ilLPEventCollections::_getItems(), ilLPCollectionCache::_getItems(), ilObjGroup::_getMembers(), and ilCourseMembers::_getMembers().

        {
                include_once './Services/Tracking/classes/class.ilLPCollectionCache.php';
                include_once './Services/Tracking/classes/class.ilLPEventCollections.php';


                global $ilBench,$ilObjDataCache;
                $ilBench->start('LearningProgress','9172_LPStatusCollection_inProgress');

                $in_progress = 0;
                foreach(ilLPCollectionCache::_getItems($a_obj_id) as $item_id)
                {
                        $item_id = $ilObjDataCache->lookupObjId($item_id);

                        // merge arrays of users with status 'in progress'
                        $users = array_unique(array_merge((array) $users,ilLPStatusWrapper::_getInProgress($item_id)));
                        $users = array_unique(array_merge((array) $users,ilLPStatusWrapper::_getCompleted($item_id)));
                }

                // Handle status of events
                foreach(ilLPEventCollections::_getItems($a_obj_id) as $event_id)
                {
                        #var_dump("<pre>","EVENT_ID: ",$event_id,"<pre>");
                        $users = array_unique(array_merge((array) $users,ilLPStatusWrapper::_getInProgressByType($event_id,'event')));
                        $users = array_unique(array_merge((array) $users,ilLPStatusWrapper::_getCompletedByType($event_id,'event')));
                }

                // Exclude all users with status completed.
                $users = array_diff((array) $users,ilLPStatusWrapper::_getCompleted($a_obj_id));
                // Exclude all users with status failed.
                $users = array_diff((array) $users,ilLPStatusWrapper::_getFailed($a_obj_id));

                switch($ilObjDataCache->lookupType($a_obj_id))
                {
                        case 'crs':
                                // Exclude all non members
                                include_once 'course/classes/class.ilCourseMembers.php';
                                $users = array_intersect(ilCourseMembers::_getMembers($a_obj_id),(array) $users);
                                break;
                                
                        case 'grp':
                                include_once 'classes/class.ilObjGroup.php';
                                $members = ilObjGroup::_getMembers($a_obj_id);
                                $users = array_intersect($members,(array) $users);
                                break;
                }

                $ilBench->stop('LearningProgress','9172_LPStatusCollection_inProgress');
                return $users;
        }

Here is the call graph for this function:

ilLPStatusCollection::_getNotAttempted ( a_obj_id  ) 

Reimplemented from ilLPStatus.

Definition at line 47 of file class.ilLPStatusCollection.php.

References $users, ilLPStatusWrapper::_getCompleted(), ilLPStatusWrapper::_getFailed(), ilLPStatusWrapper::_getInProgress(), ilObjGroup::_getMembers(), and ilCourseMembers::_getMembers().

        {
                global $ilObjDataCache;

                switch($ilObjDataCache->lookupType($a_obj_id))
                {
                        case 'crs':
                                include_once 'course/classes/class.ilCourseMembers.php';
                                $members = ilCourseMembers::_getMembers($a_obj_id);
                                
                                // diff in progress and completed (use stored result in LPStatusWrapper)
                                $users = array_diff((array) $members,$inp = ilLPStatusWrapper::_getInProgress($a_obj_id));
                                $users = array_diff((array) $users,$com = ilLPStatusWrapper::_getCompleted($a_obj_id));
                                $users = array_diff((array) $users,$fai = ilLPStatusWrapper::_getFailed($a_obj_id));
                                return $users;

                        case 'grp':
                                include_once 'classes/class.ilObjGroup.php';
                                $members = ilObjGroup::_getMembers($a_obj_id);

                                // diff in progress and completed (use stored result in LPStatusWrapper)
                                $users = array_diff((array) $members,$inp = ilLPStatusWrapper::_getInProgress($a_obj_id));
                                $users = array_diff((array) $users,$com = ilLPStatusWrapper::_getCompleted($a_obj_id));
                                $users = array_diff((array) $users,$fai = ilLPStatusWrapper::_getFailed($a_obj_id));
                                return $users;

                        default:
                                return array();
                }
        }

Here is the call graph for this function:

ilLPStatusCollection::_getStatusInfo ( a_obj_id  ) 

Reimplemented from ilLPStatus.

Definition at line 219 of file class.ilLPStatusCollection.php.

References ilLPEventCollections::_getItems(), and ilLPCollectionCache::_getItems().

Referenced by _getTypicalLearningTime().

        {
                include_once './Services/Tracking/classes/class.ilLPCollectionCache.php';
                include_once './Services/Tracking/classes/class.ilLPEventCollections.php';

                $status_info['collections'] = ilLPCollectionCache::_getItems($a_obj_id);
                $status_info['event_collections'] = ilLPEventCollections::_getItems($a_obj_id);

                $status_info['num_collections'] = count($status_info['collections']) + count($status_info['event_collections']);
                return $status_info;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilLPStatusCollection::_getTypicalLearningTime ( a_obj_id  ) 

Reimplemented from ilLPStatus.

Definition at line 231 of file class.ilLPStatusCollection.php.

References _getStatusInfo().

        {
                global $ilObjDataCache;

                if($ilObjDataCache->lookupType($a_obj_id) == 'sahs')
                {
                        return parent::_getTypicalLearningTime($a_obj_id);
                }

                $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
                foreach($status_info['collections'] as $item)
                {
                        $tlt += ilLPStatusWrapper::_getTypicalLearningTime($ilObjDataCache->lookupObjId($item));
                }
                return $tlt;
        }

Here is the call graph for this function:

ilLPStatusCollection::ilLPStatusCollection ( a_obj_id  ) 

Definition at line 39 of file class.ilLPStatusCollection.php.

References ilLPStatus::ilLPStatus().

        {
                global $ilDB;

                parent::ilLPStatus($a_obj_id);
                $this->db =& $ilDB;
        }

Here is the call graph for this function:


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