ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilLPStatusCollectionManual Class Reference
+ Inheritance diagram for ilLPStatusCollectionManual:
+ Collaboration diagram for ilLPStatusCollectionManual:

Public Member Functions

 _getInProgress ($a_obj_id)
 _getCompleted ($a_obj_id)
 _getStatusInfo ($a_obj_id)
 determineStatus ($a_obj_id, $a_user_id, $a_obj=null)
 Determine status.
 _getObjectStatus ($a_obj_id, $a_user_id=null)
 _setObjectStatus ($a_obj_id, $a_user_id, array $a_completed=null)
- Public Member Functions inherited from ilLPStatus
 ilLPStatus ($a_obj_id)
 _getCountNotAttempted ($a_obj_id)
 _getNotAttempted ($a_obj_id)
 _getCountInProgress ($a_obj_id)
 _getCountCompleted ($a_obj_id)
 _getFailed ($a_obj_id)
 _getCountFailed ()
 _getTypicalLearningTime ($a_obj_id)
 _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.

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.
static _lookupStatus ($a_obj_id, $a_user_id)
 Lookup status.
static _hasUserCompleted ($a_obj_id, $a_user_id)
 Lookup user object completion.
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 preloadListGUIData ($a_obj_ids)
static getListGUIStatus ($a_obj_id)
- 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)
- 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.

Detailed Description

Definition at line 15 of file class.ilLPStatusCollectionManual.php.

Member Function Documentation

ilLPStatusCollectionManual::_getCompleted (   $a_obj_id)

Reimplemented from ilLPStatus.

Definition at line 38 of file class.ilLPStatusCollectionManual.php.

References _getStatusInfo().

{
$status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
$counter = 0;
$users = array();
foreach($status_info['items'] as $item_id)
{
$tmp_users = $status_info['completed'][$item_id];
if(!$counter++)
{
$users = $tmp_users;
}
else
{
$users = array_intersect($users,$tmp_users);
}
}
$users = array_unique($users);
return $users;
}

+ Here is the call graph for this function:

ilLPStatusCollectionManual::_getInProgress (   $a_obj_id)

Reimplemented from ilLPStatus.

Definition at line 17 of file class.ilLPStatusCollectionManual.php.

References ilLPStatusWrapper\_getCompleted(), and _getStatusInfo().

{
$status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
// find any completed item
$users = array();
if(is_array($status_info['completed']))
{
foreach($status_info['completed'] as $in_progress)
{
$users = array_merge($users,$in_progress);
}
$users = array_unique($users);
}
// remove all users which have completed ALL items
$users = array_diff($users,ilLPStatusWrapper::_getCompleted($a_obj_id));
return $users;
}

+ Here is the call graph for this function:

ilLPStatusCollectionManual::_getObjectStatus (   $a_obj_id,
  $a_user_id = null 
)

Definition at line 146 of file class.ilLPStatusCollectionManual.php.

References $res, and $row.

Referenced by _getStatusInfo(), and _setObjectStatus().

{
global $ilDB;
$res = array();
$sql = "SELECT subitem_id, completed, usr_id, last_change".
" FROM ut_lp_coll_manual".
" WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer");
if($a_user_id)
{
$sql .= " AND usr_id = ".$ilDB->quote($a_user_id, "integer");
}
$set = $ilDB->query($sql);
while($row = $ilDB->fetchAssoc($set))
{
if(!$a_user_id)
{
$res[$row["subitem_id"]][$row["usr_id"]] = $row["completed"];
}
else
{
$res[$row["subitem_id"]] = array($row["completed"], $row["last_change"]);
}
}
return $res;
}

+ Here is the caller graph for this function:

ilLPStatusCollectionManual::_getStatusInfo (   $a_obj_id)

Reimplemented from ilLPStatus.

Definition at line 62 of file class.ilLPStatusCollectionManual.php.

References $ref_id, ilObject\_getAllReferences(), _getObjectStatus(), and ilObjectLP\getInstance().

Referenced by _getCompleted(), _getInProgress(), and determineStatus().

{
$status_info = array();
include_once "Services/Object/classes/class.ilObjectLP.php";
$olp = ilObjectLP::getInstance($a_obj_id);
$collection = $olp->getCollectionInstance();
if($collection)
{
$status_info["items"] = $collection->getItems($a_obj_id);
foreach($status_info["items"] as $item_id)
{
$status_info["completed"][$item_id] = array();
}
$ref_ids = ilObject::_getAllReferences($a_obj_id);
$ref_id = end($ref_ids);
$possible_items = $collection->getPossibleItems($ref_id);
$chapter_ids = array_intersect(array_keys($possible_items),
$status_info["items"]);
// fix order (adapt from possible items)
$status_info["items"] = $chapter_ids;
if($chapter_ids)
{
$status = self::_getObjectStatus($a_obj_id);
foreach($chapter_ids as $item_id)
{
$status_info["item_titles"][$item_id] = $possible_items[$item_id]["title"];
if(isset($status[$item_id]))
{
foreach($status[$item_id] as $user_id => $user_status)
{
if($user_status)
{
$status_info["completed"][$item_id][] = $user_id;
}
}
}
}
}
}
return $status_info;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLPStatusCollectionManual::_setObjectStatus (   $a_obj_id,
  $a_user_id,
array  $a_completed = null 
)

Definition at line 175 of file class.ilLPStatusCollectionManual.php.

References _getObjectStatus(), ilLPStatus\_updateStatus(), and ilObjectLP\getInstance().

{
global $ilDB;
$now = time();
if(!$a_completed)
{
$a_completed = array();
}
include_once './Services/Object/classes/class.ilObjectLP.php';
$olp = ilObjectLP::getInstance($a_obj_id);
$collection = $olp->getCollectionInstance();
if($collection)
{
$existing = self::_getObjectStatus($a_obj_id, $a_user_id);
foreach($collection->getItems() as $item_id)
{
if(isset($existing[$item_id]))
{
// value changed
if((!$existing[$item_id][0] && in_array($item_id, $a_completed)) ||
($existing[$item_id][0] && !in_array($item_id, $a_completed)))
{
$ilDB->manipulate("UPDATE ut_lp_coll_manual SET ".
" completed = ".$ilDB->quote(in_array($item_id, $a_completed), "integer").
" , last_change = ".$ilDB->quote($now, "integer").
" WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer").
" AND usr_id = ".$ilDB->quote($a_user_id, "integer").
" AND subitem_id = ".$ilDB->quote($item_id, "integer"));
}
}
else if(in_array($item_id, $a_completed))
{
$ilDB->manipulate("INSERT INTO ut_lp_coll_manual".
"(obj_id,usr_id,subitem_id,completed,last_change)".
" VALUES (".$ilDB->quote($a_obj_id, "integer").
" , ".$ilDB->quote($a_user_id, "integer").
" , ".$ilDB->quote($item_id, "integer").
" , ".$ilDB->quote(1, "integer").
" , ".$ilDB->quote($now, "integer").")");
}
}
}
include_once "Services/Tracking/classes/class.ilLPStatusWrapper.php";
ilLPStatusWrapper::_updateStatus($a_obj_id, $a_user_id);
}

+ Here is the call graph for this function:

ilLPStatusCollectionManual::determineStatus (   $a_obj_id,
  $a_usr_id,
  $a_obj = null 
)

Determine status.

Parameters
@return

Reimplemented from ilLPStatus.

Definition at line 112 of file class.ilLPStatusCollectionManual.php.

References _getStatusInfo(), ilLPStatus\LP_STATUS_COMPLETED_NUM, ilLPStatus\LP_STATUS_IN_PROGRESS_NUM, and ilLPStatus\LP_STATUS_NOT_ATTEMPTED_NUM.

{
$info = self::_getStatusInfo($a_obj_id);
if(is_array($info["completed"]))
{
$completed = true;
$in_progress = false;
foreach($info["completed"] as $user_ids)
{
// has completed at least 1 item
if(in_array($a_user_id, $user_ids))
{
$in_progress = true;
}
// must have completed all items to complete collection
else
{
$completed = false;
}
}
if($completed)
{
}
if($in_progress)
{
}
}
}

+ Here is the call graph for this function:


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