ILIAS  Release_4_4_x_branch Revision 61816
 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)
 Get completed users New handling for optional grouped assignments.
 _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, $a_percentage=false, $a_no_raise=false, $a_force_raise=false)
 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.
 _lookupStatusChanged ($a_obj_id, $a_user_id)
 Lookup status changed.

Static Public Member Functions

static determineGroupingStatus ($status, $gr_info, $user_id, $is_grouping)
 Determine grouping status $ilObjDataCache.
static _lookupCompletedForObject ($a_obj_id, $a_user_ids=null)
 Get completed users for object.
static _lookupFailedForObject ($a_obj_id, $a_user_ids=null)
 Get failed users for object.
static _lookupInProgressForObject ($a_obj_id, $a_user_ids=null)
 Get in progress users for object.
- 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.
static _lookupStatus ($a_obj_id, $a_user_id)
 Lookup status.
static _hasUserCompleted ($a_obj_id, $a_user_id)
 Lookup user object completion.
static preloadListGUIData ($a_obj_ids)
static getListGUIStatus ($a_obj_id)

Static Protected Member Functions

static getMembers ($a_obj_id)
 Get members for object.
- Static Protected Member Functions inherited from ilLPStatus
static _lookupStatusForObject ($a_obj_id, $a_status, $a_user_ids=null)
 Get users with given status for object.

Additional Inherited Members

- Data Fields inherited from ilLPStatus
 $obj_id = null
 $db = null
const LP_STATUS_NOT_ATTEMPTED = 'trac_no_attempted'
const LP_STATUS_IN_PROGRESS = 'trac_in_progress'
const LP_STATUS_COMPLETED = 'trac_completed'
const LP_STATUS_FAILED = 'trac_failed'
const LP_STATUS_NOT_ATTEMPTED_NUM = 0
const LP_STATUS_IN_PROGRESS_NUM = 1
const LP_STATUS_COMPLETED_NUM = 2
const LP_STATUS_FAILED_NUM = 3
const LP_STATUS_REGISTERED = 'trac_registered'
const LP_STATUS_NOT_REGISTERED = 'trac_not_registered'
const LP_STATUS_PARTICIPATED = 'trac_participated'
const LP_STATUS_NOT_PARTICIPATED = 'trac_not_participated'
- Static Public Attributes inherited from ilLPStatus
static $list_gui_cache
- Protected Member Functions inherited from ilLPStatus
 raiseEvent ($a_obj_id, $a_usr_id, $a_status, $a_percentage)

Detailed Description

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

Member Function Documentation

ilLPStatusCollection::_getCompleted (   $a_obj_id)

Get completed users New handling for optional grouped assignments.

Parameters
int$a_obj_id
Returns
array users

Reimplemented from ilLPStatus.

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

References ilLPStatusWrapper\_getFailed(), and ilObjectLP\getInstance().

{
global $ilObjDataCache;
include_once './Services/Object/classes/class.ilObjectLP.php';
$olp = ilObjectLP::getInstance($a_obj_id);
$collection = $olp->getCollectionInstance();
if($collection)
{
$grouped_items = $collection->getGroupedItemsForLPStatus();
}
if(!sizeof($grouped_items))
{
// #11513 - empty collections cannot be completed
return array();
}
else
{
// New handling for optional assignments
$counter = 0;
$users = array();
foreach($grouped_items as $grouping_id => $grouping)
{
$isGrouping = $grouping_id ? true : false;
$grouping_completed = array();
$grouping_completed_users_num = array();
foreach((array) $grouping['items'] as $item)
{
$item_id = $ilObjDataCache->lookupObjId($item);
$tmp_users = ilLPStatusWrapper::_getCompleted($item_id);
if($isGrouping)
{
// Iterated through all grouped items and count the number of fullfiled items
foreach($tmp_users as $tmp_user_id)
{
++$grouping_completed_users_num[$tmp_user_id];
}
}
else
{
if(!$counter++)
{
$users = $tmp_users;
}
else
{
$users = array_intersect($users,$tmp_users);
}
}
}
if($isGrouping)
{
// Iterate through all "grouping_completed_users_num"
// All users with completed items greater equal than "num_obligatory" are completed
foreach($grouping_completed_users_num as $tmp_user_id => $grouping_num_completed)
{
if($grouping_num_completed >= $grouping['num_obligatory'])
{
$grouping_completed[] = $tmp_user_id;
}
}
// build intersection of users
if(!$counter++)
{
$users = $grouping_completed;
}
else
{
$users = array_intersect($users,$grouping_completed);
}
}
}
}
$users = array_diff($users,ilLPStatusWrapper::_getFailed($a_obj_id));
if($users)
{
// Exclude all non members
$users = array_intersect(self::getMembers($a_obj_id), (array)$users);
}
return (array) $users;
}

+ Here is the call graph for this function:

ilLPStatusCollection::_getFailed (   $a_obj_id)

Reimplemented from ilLPStatus.

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

References ilObjectLP\getInstance().

{
global $ilObjDataCache;
$users = array();
include_once './Services/Object/classes/class.ilObjectLP.php';
$olp = ilObjectLP::getInstance($a_obj_id);
$collection = $olp->getCollectionInstance();
if($collection)
{
foreach($collection->getGroupedItemsForLPStatus() as $grouping_id => $grouping)
{
$isGrouping = $grouping_id ? true : false;
$gr_failed = array();
$gr_failed_users_num = array();
$counter = 0;
foreach((array) $grouping['items'] as $item)
{
$item_id = $ilObjDataCache->lookupObjId($item);
$tmp_users = ilLPStatusWrapper::_getFailed($item_id);
if($isGrouping)
{
foreach($tmp_users as $tmp_user_id)
{
++$gr_failed_users_num[$tmp_user_id];
}
}
else
{
// One item failed is sufficient for status failed.
$gr_failed = array_merge($gr_failed,$tmp_users);
}
$counter++;
}
if($isGrouping)
{
$allowed_failed = count($grouping['items']) - $grouping['num_obligatory'];
// Itereate over all failed users and check whether the allowd_failed value exceeded
foreach($gr_failed_users_num as $tmp_user_id => $num_failed)
{
if($num_failed > $allowed_failed)
{
$gr_failed[] = $tmp_user_id;
}
}
}
$users = array_unique(array_merge($users, $gr_failed));
}
}
if($users)
{
// Exclude all non members
$users = array_intersect(self::getMembers($a_obj_id), (array)$users);
}
return array_unique($users);
}

+ Here is the call graph for this function:

ilLPStatusCollection::_getInProgress (   $a_obj_id)

Reimplemented from ilLPStatus.

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

References ilLPStatusWrapper\_getCompleted(), ilLPStatusWrapper\_getFailed(), ilLPStatusWrapper\_getInProgress(), ilObject\_lookupObjId(), ilObjectLP\getInstance(), and ilChangeEvent\lookupUsersInProgress().

{
include_once './Services/Tracking/classes/class.ilChangeEvent.php';
include_once './Services/Object/classes/class.ilObjectLP.php';
$olp = ilObjectLP::getInstance($a_obj_id);
$collection = $olp->getCollectionInstance();
if($collection)
{
foreach($collection->getItems() as $item_id)
{
$item_id = ilObject::_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));
if($users)
{
// Exclude all non members
$users = array_intersect(self::getMembers($a_obj_id), (array)$users);
}
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 ilLPStatusWrapper\_getCompleted(), ilLPStatusWrapper\_getFailed(), ilLPStatusWrapper\_getInProgress(), and getMembers().

{
$users = array();
$members = self::getMembers($a_obj_id);
if($members)
{
// 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;
}

+ Here is the call graph for this function:

ilLPStatusCollection::_getStatusInfo (   $a_obj_id)

Reimplemented from ilLPStatus.

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

References ilObjectLP\getInstance().

Referenced by _getTypicalLearningTime().

{
$status_info = array();
include_once './Services/Object/classes/class.ilObjectLP.php';
$olp = ilObjectLP::getInstance($a_obj_id);
$collection = $olp->getCollectionInstance();
if($collection)
{
$status_info['collections'] = $collection->getItems();
$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 269 of file class.ilLPStatusCollection.php.

References _getStatusInfo().

{
global $ilObjDataCache;
if($ilObjDataCache->lookupType($a_obj_id) == 'sahs')
{
}
$tlt = 0;
$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:

static ilLPStatusCollection::_lookupCompletedForObject (   $a_obj_id,
  $a_user_ids = null 
)
static

Get completed users for object.

Parameters
int$a_obj_id
array$a_user_ids
Returns
array

Reimplemented from ilLPStatus.

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

References ilLPStatus\_lookupStatusForObject(), and getMembers().

{
if(!$a_user_ids)
{
$a_user_ids = self::getMembers($a_obj_id);
if(!$a_user_ids)
{
return array();
}
}
return self::_lookupStatusForObject($a_obj_id, self::LP_STATUS_COMPLETED_NUM, $a_user_ids);
}

+ Here is the call graph for this function:

static ilLPStatusCollection::_lookupFailedForObject (   $a_obj_id,
  $a_user_ids = null 
)
static

Get failed users for object.

Parameters
int$a_obj_id
array$a_user_ids
Returns
array

Reimplemented from ilLPStatus.

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

References ilLPStatus\_lookupStatusForObject(), and getMembers().

{
if(!$a_user_ids)
{
$a_user_ids = self::getMembers($a_obj_id);
if(!$a_user_ids)
{
return array();
}
}
return self::_lookupStatusForObject($a_obj_id, self::LP_STATUS_FAILED_NUM, $a_user_ids);
}

+ Here is the call graph for this function:

static ilLPStatusCollection::_lookupInProgressForObject (   $a_obj_id,
  $a_user_ids = null 
)
static

Get in progress users for object.

Parameters
int$a_obj_id
array$a_user_ids
Returns
array

Reimplemented from ilLPStatus.

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

References ilLPStatus\_lookupStatusForObject(), and getMembers().

{
if(!$a_user_ids)
{
$a_user_ids = self::getMembers($a_obj_id);
if(!$a_user_ids)
{
return array();
}
}
return self::_lookupStatusForObject($a_obj_id, self::LP_STATUS_IN_PROGRESS_NUM, $a_user_ids);
}

+ Here is the call graph for this function:

static ilLPStatusCollection::determineGroupingStatus (   $status,
  $gr_info,
  $user_id,
  $is_grouping 
)
static

Determine grouping status $ilObjDataCache.

Parameters
array$status
array$items
int$user_id
boolean$is_grouping
Returns
boolean

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

References ilLPStatusWrapper\_determineStatus().

Referenced by determineStatus().

{
global $ilObjDataCache;
$items = $gr_info['items'];
if($is_grouping)
{
$max_allowed_failed = count($items) - $gr_info['num_obligatory'];
$required_completed = $gr_info['num_obligatory'];
}
else
{
$max_allowed_failed = 0;
$required_completed = count($items);
}
// Required for grouping with a number of obligatory items
$num_failed = 0;
$num_completed = 0;
foreach($items as $item_id)
{
$item_id = $ilObjDataCache->lookupObjId($item_id);
$gr_status = ilLPStatusWrapper::_determineStatus($item_id, $user_id);
if($gr_status == self::LP_STATUS_FAILED_NUM)
{
if(++$num_failed > $max_allowed_failed)
{
$status['failed'] = true;
$status['completed'] = false;
return $status;
}
}
if($gr_status == self::LP_STATUS_COMPLETED_NUM)
{
if(++$num_completed >= $required_completed)
{
return $status;
}
}
}
// Not completed since returned above
$status['completed'] = false;
return $status;
}

+ Here is the call graph for this function:

+ Here is the caller 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 295 of file class.ilLPStatusCollection.php.

References determineGroupingStatus(), ilObjectLP\getInstance(), ilChangeEvent\hasAccessed(), ilLPStatus\LP_STATUS_COMPLETED_NUM, ilLPStatus\LP_STATUS_FAILED_NUM, ilLPStatus\LP_STATUS_IN_PROGRESS_NUM, and ilLPStatus\LP_STATUS_NOT_ATTEMPTED_NUM.

{
global $ilObjDataCache;
$status['completed'] = true;
$status['failed'] = false;
$status['in_progress'] = false;
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))
{
$status['in_progress'] = true;
}
include_once './Services/Object/classes/class.ilObjectLP.php';
$olp = ilObjectLP::getInstance($a_obj_id);
$collection = $olp->getCollectionInstance();
if($collection)
{
$grouped_items = $collection->getGroupedItemsForLPStatus();
}
if(!sizeof($grouped_items))
{
// #11513 - empty collections cannot be completed
$status['completed'] = false;
}
else
{
foreach($grouped_items as $grouping_id => $grouping)
{
$isGrouping = $grouping_id ? true : false;
$status = self::determineGroupingStatus($status,$grouping,$a_user_id,$isGrouping);
}
}
if($status['completed'])
{
}
if($status['failed'])
{
}
if($status['in_progress'])
{
}
break;
}
}

+ Here is the call graph for this function:

static ilLPStatusCollection::getMembers (   $a_obj_id)
staticprotected

Get members for object.

Parameters
int$a_obj_id
Returns
array

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

References ilObject\_getAllReferences(), ilGroupParticipants\_getInstanceByObjId(), ilCourseParticipants\_getInstanceByObjId(), and ilObject\_lookupObjId().

Referenced by _getNotAttempted(), _lookupCompletedForObject(), _lookupFailedForObject(), and _lookupInProgressForObject().

{
global $ilObjDataCache, $tree;
switch($ilObjDataCache->lookupType($a_obj_id))
{
case 'crs':
include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
return $member_obj->getMembers();
case 'grp':
include_once 'Modules/Group/classes/class.ilGroupParticipants.php';
$member_obj = ilGroupParticipants::_getInstanceByObjId($a_obj_id);
return $member_obj->getMembers();
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';
return $member_obj->getMembers();
}
break;
}
return array();
}

+ Here is the call graph for this function:

+ Here is the caller 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: