ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
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)
 determineStatus ($a_obj_id, $a_user_id, $a_obj=null)
 Determine status.
- Public Member Functions inherited from ilLPStatus
 ilLPStatus ($a_obj_id)
 _getCountNotAttempted ($a_obj_id)
 _getCountInProgress ($a_obj_id)
 _getCountCompleted ($a_obj_id)
 _getCountFailed ()
 _updateStatus ($a_obj_id, $a_usr_id, $a_obj=null)
 New status handling (st: status, nr: accesses, p: percentage, t: time spent, m: mark)
 determinePercentage ($a_obj_id, $a_usr_id, $a_obj=null)
 Determine percentage.
 refreshStatus ($a_obj_id, $a_users=null)
 Refresh status.

Additional Inherited Members

- Static Public Member Functions inherited from ilLPStatus
static checkStatusForObject ($a_obj_id, $a_users=false)
 This function checks whether the status for a given number of users is dirty and must be recalculated.
static writeStatus ($a_obj_id, $a_user_id, $a_status, $a_percentage=false, $a_force_per=false)
 Write status for user and object.
static setInProgressIfNotAttempted ($a_obj_id, $a_user_id)
 This function shoudl be clalled for normal "read events".
static setAllDirty ()
 Sets all status to dirty.
static setDirty ($a_obj_id)
 Sets status of an object to dirty.
- Data Fields inherited from ilLPStatus
 $obj_id = null
 $db = null

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 153 of file class.ilLPStatusCollection.php.

References $ilBench, ilObject\_getAllReferences(), ilLPStatusWrapper\_getFailed(), ilCourseParticipants\_getInstanceByObjId(), ilLPCollectionCache\_getItems(), ilObjGroup\_getMembers(), and ilObject\_lookupObjId().

{
include_once './Services/Tracking/classes/class.ilLPCollectionCache.php';
global $ilBench,$ilObjDataCache,$tree;
$ilBench->start('LearningProgress','9173_LPStatusCollection_completed');
$counter = 0;
$users = array();
foreach(ilLPCollectionCache::_getItems($a_obj_id, true) 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);
}
}
switch($ilObjDataCache->lookupType($a_obj_id))
{
case 'crs':
// Exclude all non members
include_once './Modules/Course/classes/class.ilCourseParticipants.php';
$users = array_intersect($member_obj->getMembers(),(array) $users);
break;
case 'grp':
include_once './Modules/Group/classes/class.ilObjGroup.php';
$members = ilObjGroup::_getMembers($a_obj_id);
$users = array_intersect($members,(array) $users);
break;
case 'fold':
$folder_ref_ids = ilObject::_getAllReferences($a_obj_id);
$folder_ref_id = current($folder_ref_ids);
if($crs_id = $tree->checkForParentType($folder_ref_id,'crs'))
{
include_once './Modules/Course/classes/class.ilCourseParticipants.php';
$users = array_intersect($members_obj->getMembers(),(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 210 of file class.ilLPStatusCollection.php.

References ilObject\_getAllReferences(), ilCourseParticipants\_getInstanceByObjId(), ilLPCollectionCache\_getItems(), ilObjGroup\_getMembers(), and ilObject\_lookupObjId().

{
global $ilObjDataCache,$tree;
include_once './Services/Tracking/classes/class.ilLPCollectionCache.php';
$users = array();
foreach(ilLPCollectionCache::_getItems($a_obj_id, true) 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 './Modules/Course/classes/class.ilCourseParticipants.php';
$members_obj = ilCourseParticipants::_getInstanceByObjId($a_obj_id);
$members = $members_obj->getMembers();
$users = array_intersect($members,(array) $users);
break;
case 'grp':
include_once './Modules/Group/classes/class.ilObjGroup.php';
$members = ilObjGroup::_getMembers($a_obj_id);
$users = array_intersect($members,(array) $users);
break;
case 'fold':
$folder_ref_ids = ilObject::_getAllReferences($a_obj_id);
$folder_ref_id = current($folder_ref_ids);
if($crs_id = $tree->checkForParentType($folder_ref_id,'crs'))
{
$members = $members_obj->getMembers();
$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 96 of file class.ilLPStatusCollection.php.

References $ilBench, ilObject\_getAllReferences(), ilLPStatusWrapper\_getCompleted(), ilLPStatusWrapper\_getFailed(), ilLPStatusWrapper\_getInProgress(), ilCourseParticipants\_getInstanceByObjId(), ilLPCollectionCache\_getItems(), ilObjGroup\_getMembers(), and ilObject\_lookupObjId().

{
global $tree;
include_once './Services/Tracking/classes/class.ilLPCollectionCache.php';
global $ilBench,$ilObjDataCache;
$ilBench->start('LearningProgress','9172_LPStatusCollection_inProgress');
$in_progress = 0;
foreach(ilLPCollectionCache::_getItems($a_obj_id, true) 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)));
}
// 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 './Modules/Course/classes/class.ilCourseParticipants.php';
$members_obj = ilCourseParticipants::_getInstanceByObjId($a_obj_id);
$members = $members_obj->getMembers();
$users = array_intersect($members,(array) $users);
break;
case 'grp':
include_once './Modules/Group/classes/class.ilObjGroup.php';
$members = ilObjGroup::_getMembers($a_obj_id);
$users = array_intersect($members,(array) $users);
break;
case 'fold':
$folder_ref_ids = ilObject::_getAllReferences($a_obj_id);
$folder_ref_id = current($folder_ref_ids);
if($crs_id = $tree->checkForParentType($folder_ref_id,'crs'))
{
include_once './Modules/Course/classes/class.ilCourseParticipants.php';
$members = $members_obj->getMembers();
$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 ilObject\_getAllReferences(), ilLPStatusWrapper\_getCompleted(), ilLPStatusWrapper\_getFailed(), ilLPStatusWrapper\_getInProgress(), ilCourseParticipants\_getInstanceByObjId(), ilObjGroup\_getMembers(), and ilObject\_lookupObjId().

{
global $ilObjDataCache,$tree;
switch($ilObjDataCache->lookupType($a_obj_id))
{
case 'crs':
include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
$members = $member_obj->getMembers();
// diff in progress and completed (use stored result in LPStatusWrapper)
$users = array_diff((array) $members, ilLPStatusWrapper::_getInProgress($a_obj_id));
$users = array_diff((array) $users, ilLPStatusWrapper::_getCompleted($a_obj_id));
$users = array_diff((array) $users, ilLPStatusWrapper::_getFailed($a_obj_id));
return $users;
case 'grp':
include_once './Modules/Group/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, ilLPStatusWrapper::_getInProgress($a_obj_id));
$users = array_diff((array) $users, ilLPStatusWrapper::_getCompleted($a_obj_id));
$users = array_diff((array) $users, ilLPStatusWrapper::_getFailed($a_obj_id));
return $users;
case 'fold':
$folder_ref_ids = ilObject::_getAllReferences($a_obj_id);
$folder_ref_id = current($folder_ref_ids);
if($crs_id = $tree->checkForParentType($folder_ref_id,'crs'))
{
include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
$members = $member_obj->getMembers();
// diff in progress and completed (use stored result in LPStatusWrapper)
$users = array_diff((array) $members,ilLPStatusWrapper::_getInProgress($a_obj_id));
$users = array_diff((array) $users, ilLPStatusWrapper::_getCompleted($a_obj_id));
$users = array_diff((array) $users, ilLPStatusWrapper::_getFailed($a_obj_id));
return $users;
}
// fallthrough
default:
return array();
}
}

+ Here is the call graph for this function:

ilLPStatusCollection::_getStatusInfo (   $a_obj_id)

Reimplemented from ilLPStatus.

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

References ilLPCollectionCache\_getItems().

Referenced by _getTypicalLearningTime().

{
include_once './Services/Tracking/classes/class.ilLPCollectionCache.php';
$status_info['collections'] = ilLPCollectionCache::_getItems($a_obj_id);
$status_info['num_collections'] = count($status_info['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 266 of file class.ilLPStatusCollection.php.

References _getStatusInfo().

{
global $ilObjDataCache;
if($ilObjDataCache->lookupType($a_obj_id) == 'sahs')
{
}
$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::determineStatus (   $a_obj_id,
  $a_user_id,
  $a_obj = null 
)

Determine status.

Parameters
integerobject id
integeruser id
objectobject (optional depends on object type)
Returns
integer status

Reimplemented from ilLPStatus.

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

References $failed, $ilDB, ilLPStatusWrapper\_determineStatus(), ilLPCollectionCache\_getItems(), ilChangeEvent\hasAccessed(), LP_STATUS_COMPLETED_NUM, LP_STATUS_FAILED_NUM, LP_STATUS_IN_PROGRESS_NUM, and LP_STATUS_NOT_ATTEMPTED_NUM.

{
global $ilObjDataCache, $ilDB;
switch ($ilObjDataCache->lookupType($a_obj_id))
{
case "crs":
case "fold":
case "grp":
include_once "./Services/Tracking/classes/class.ilChangeEvent.php";
if (ilChangeEvent::hasAccessed($a_obj_id, $a_user_id))
{
}
$completed = true;
$failed = false;
include_once("./Services/Tracking/classes/class.ilLPCollectionCache.php");
foreach(ilLPCollectionCache::_getItems($a_obj_id, true) as $item_id)
{
$item_id = $ilObjDataCache->lookupObjId($item_id);
$st2 = ilLPStatusWrapper::_determineStatus($item_id, $a_user_id);
if ($st2
{
$completed = false;
}
if ($st2
{
}
if ($st2
{
$failed = true;
}
}
if ($failed)
{
}
else if ($completed)
{
}
break;
}
return $status;
}

+ Here is the call graph for this function:

ilLPStatusCollection::ilLPStatusCollection (   $a_obj_id)

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

References $ilDB, and 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: