ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilSCORM2004Tracking Class Reference

Class ilSCORM2004Tracking. More...

+ Collaboration diagram for ilSCORM2004Tracking:

Public Member Functions

 ilObjSCORM2004Tracking ()
 Constructor public.
 _getInProgress ($scorm_item_id, $a_obj_id)
 _getCompleted ($scorm_item_id, $a_obj_id)
 _getFailed ($scorm_item_id, $a_obj_id)
 _getCountCompletedPerUser ($a_scorm_item_ids, $a_obj_id, $a_omit_failed=false)
 Get progress of selected scos.
 _getProgressInfo ($a_obj_id)
 Get overall scorm status.
 _getProgressInfoOfUser ($a_obj_id, $a_user_id)
 Get overall scorm status.
 _getTrackedUsers ($a_obj_id)
 Get all tracked users.
 _getItemProgressInfo ($a_scorm_item_ids, $a_obj_id, $a_omit_failed=false)
 _syncReadEvent ($a_obj_id, $a_user_id, $a_type, $a_ref_id)
 Synch read event table.

Static Public Member Functions

static _getCollectionStatus ($a_scos, $a_obj_id, $a_user_id)
static _countCompleted ($a_scos, $a_obj_id, $a_user_id, $a_omit_failed=false)
static _isCompleted ($a_status, $a_satisfied)
static _isInProgress ($a_status, $a_satisfied)
static _isFailed ($a_status, $a_satisfied)

Detailed Description

Member Function Documentation

static ilSCORM2004Tracking::_countCompleted (   $a_scos,
  $a_obj_id,
  $a_user_id,
  $a_omit_failed = false 
)
static

Definition at line 342 of file class.ilSCORM2004Tracking.php.

References $ilDB, $in, and $res.

Referenced by ilLPStatusSCORM\determinePercentage().

{
global $ilDB;
if (is_array($a_scos))
{
$in = $ilDB->in('cp_node.cp_node_id', $a_scos, false, 'integer');
$res = $ilDB->queryF(
'SELECT cp_node.cp_node_id id,
cmi_node.completion_status completion,
cmi_node.success_status success
FROM cp_node, cmi_node
WHERE '.$in.'
AND cp_node.cp_node_id = cmi_node.cp_node_id
AND cp_node.slm_id = %s
AND cmi_node.user_id = %s',
array('integer', 'integer'),
array($a_obj_id, $a_user_id)
);
$cnt = 0;
while ($rec = $ilDB->fetchAssoc($res))
{
// #8171: alex, added (!$a_omit_failed || $rec["success"] != "failed")
// since completed/failed combination should not be included in
// percentage calculation at ilLPStatusSCOM::determinePercentage
if (($rec["completion"] == "completed" || $rec["success"] == "passed")
&& (!$a_omit_failed || $rec["success"] != "failed"))
{
$cnt++;
}
}
}
return $cnt;
}

+ Here is the caller graph for this function:

static ilSCORM2004Tracking::_getCollectionStatus (   $a_scos,
  $a_obj_id,
  $a_user_id 
)
static

Definition at line 300 of file class.ilSCORM2004Tracking.php.

References $ilDB, $in, and $res.

Referenced by ilLPStatusSCORM\determineStatus().

{
global $ilDB;
$status = "not_attempted";
if (is_array($a_scos))
{
$in = $ilDB->in('cp_node.cp_node_id', $a_scos, false, 'integer');
$res = $ilDB->queryF(
'SELECT cp_node.cp_node_id id,
cmi_node.completion_status completion,
cmi_node.success_status success
FROM cp_node, cmi_node
WHERE '.$in.'
AND cp_node.cp_node_id = cmi_node.cp_node_id
AND cp_node.slm_id = %s
AND cmi_node.user_id = %s',
array('integer', 'integer'),
array($a_obj_id, $a_user_id)
);
$started = false;
$cntcompleted = 0;
$failed = false;
while ($rec = $ilDB->fetchAssoc($res))
{
if ($rec["completion"] == "completed" || $rec["success"] == "passed")
{
$cntcompleted++;
}
if ($rec["success"] == "failed") $failed = true;
$started = true;
}
if ($started == true) $status = "in_progress";
if ($failed == true) $status = "failed";
else if ($cntcompleted == count($a_scos)) $status = "completed";
}
return $status;
}

+ Here is the caller graph for this function:

ilSCORM2004Tracking::_getCompleted (   $scorm_item_id,
  $a_obj_id 
)

Definition at line 58 of file class.ilSCORM2004Tracking.php.

References $ilDB.

{
global $ilDB;
die("Not Implemented: ilSCORM2004Tracking_getCompleted");
/*
if(is_array($scorm_item_id))
{
$where = "WHERE sco_id IN(".implode(",",ilUtil::quoteArray($scorm_item_id)).") ";
}
else
{
$where = "sco_id = ".$ilDB->quote($scorm_item_id)." ";
}
$query = "SELECT DISTINCT(user_id) FROM scorm_tracking ".
$where.
"AND obj_id = ".$ilDB->quote($a_obj_id)." ".
"AND lvalue = 'cmi.core.lesson_status' ".
"AND ( rvalue = 'completed' ".
"OR rvalue = 'passed')";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$user_ids[] = $row->user_id;
}
return $user_ids ? $user_ids : array();
*/
}
ilSCORM2004Tracking::_getCountCompletedPerUser (   $a_scorm_item_ids,
  $a_obj_id,
  $a_omit_failed = false 
)

Get progress of selected scos.

Parameters
object$a_scorm_item_ids
object$a_obj_id
bool$a_omit_faileddo not include success==failed
Returns

Definition at line 124 of file class.ilSCORM2004Tracking.php.

References $ilDB, $in, $res, and $row.

Referenced by ilLPStatusSCORM\_getStatusInfo().

{
global $ilDB;
$in = $ilDB->in('cp_node.cp_node_id', $a_scorm_item_ids, false, 'integer');
// #8171: success_status vs. completion status
$omit_failed = '';
if($a_omit_failed)
{
$omit_failed = ' AND success_status <> '.$ilDB->quote('failed', 'text');
}
$res = $ilDB->queryF('
SELECT cmi_node.user_id user_id, COUNT(user_id) completed FROM cp_node, cmi_node
WHERE '.$in.$omit_failed.'
AND cp_node.cp_node_id = cmi_node.cp_node_id
AND cp_node.slm_id = %s
AND completion_status = %s
GROUP BY cmi_node.user_id',
array('integer', 'text'),
array($a_obj_id, 'completed')
);
while($row = $ilDB->fetchObject($res))
{
$users[$row->user_id] = $row->completed;
}
return $users ? $users : array();
}

+ Here is the caller graph for this function:

ilSCORM2004Tracking::_getFailed (   $scorm_item_id,
  $a_obj_id 
)

Definition at line 88 of file class.ilSCORM2004Tracking.php.

References $ilDB.

{
global $ilDB;
die("Not Implemented: ilSCORM2004Tracking_getFailed");
/*
if(is_array($scorm_item_id))
{
$where = "WHERE sco_id IN('".implode("','",$scorm_item_id)."') ";
}
else
{
$where = "sco_id = '".$scorm_item_id."' ";
}
$query = "SELECT DISTINCT(user_id) FROM scorm_tracking ".
$where.
"AND obj_id = '".$a_obj_id."' ".
"AND lvalue = 'cmi.core.lesson_status' ".
"AND rvalue = 'failed'";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$user_ids[] = $row->user_id;
}
return $user_ids ? $user_ids : array();
*/
}
ilSCORM2004Tracking::_getInProgress (   $scorm_item_id,
  $a_obj_id 
)

Definition at line 22 of file class.ilSCORM2004Tracking.php.

{
die("Not Implemented: ilSCORM2004Tracking_getInProgress");
/*
global $ilDB;
if(is_array($scorm_item_id))
{
$where = "WHERE sco_id IN(";
$where .= implode(",",ilUtil::quoteArray($scorm_item_id));
$where .= ") ";
$where .= ("AND obj_id = ".$ilDB->quote($a_obj_id)." ");
}
else
{
$where = "WHERE sco_id = ".$ilDB->quote($scorm_item_id)." ";
$where .= ("AND obj_id = ".$ilDB->quote($a_obj_id)." ");
}
$query = "SELECT user_id,sco_id FROM scorm_tracking ".
$where.
"GROUP BY user_id, sco_id";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$in_progress[$row->sco_id][] = $row->user_id;
}
return is_array($in_progress) ? $in_progress : array();
*/
}
ilSCORM2004Tracking::_getItemProgressInfo (   $a_scorm_item_ids,
  $a_obj_id,
  $a_omit_failed = false 
)

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

References $ilDB, $in, $res, and $row.

Referenced by ilLPStatusSCORM\_getStatusInfo().

{
global $ilDB;
$in = $ilDB->in('cp_node.cp_node_id', $a_scorm_item_ids, false, 'integer');
$res = $ilDB->queryF(
'SELECT cp_node.cp_node_id id,
cmi_node.user_id user_id,
cmi_node.completion_status completion,
cmi_node.success_status success
FROM cp_node, cmi_node
WHERE '.$in.'
AND cp_node.cp_node_id = cmi_node.cp_node_id
AND cp_node.slm_id = %s',
array('integer'),
array($a_obj_id)
);
$info['completed'] = array();
$info['failed'] = array();
$info['in_progress'] = array();
while($row = $ilDB->fetchAssoc($res))
{
// if any data available, set in progress.
$info['in_progress'][$row["id"]][] = $row["user_id"];
if ($row["completion"] == "completed" || $row["success"] == "passed")
{
// #8171: success_status vs. completion status
if(!$a_omit_failed || $row["success"] != "failed")
{
$info['completed'][$row["id"]][] = $row["user_id"];
}
}
if ($row["success"] == "failed")
{
$info['failed'][$row["id"]][] = $row["user_id"];
}
}
return $info;
}

+ Here is the caller graph for this function:

ilSCORM2004Tracking::_getProgressInfo (   $a_obj_id)

Get overall scorm status.

Parameters
object$a_obj_id
Returns

Definition at line 161 of file class.ilSCORM2004Tracking.php.

References $ilDB, $res, and $row.

Referenced by ilLPStatusSCORMPackage\_getStatusInfo().

{
global $ilDB;
$res = $ilDB->queryF('
SELECT * FROM cmi_gobjective
WHERE objective_id = %s
AND scope_id = %s',
array('text', 'integer'),
array('-course_overall_status-', $a_obj_id)
);
$info['completed'] = array();
$info['failed'] = array();
$info['in_progress'] = array();
while($row = $ilDB->fetchAssoc($res))
{
if (self::_isCompleted($row["status"], $row["status"]))
{
$info['completed'][] = $row["user_id"];
}
if (self::_isInProgress($row["status"], $row["status"]))
{
$info['in_progress'][] = $row["user_id"];
}
if (self::_isFailed($row["status"], $row["status"]))
{
$info['failed'][] = $row["user_id"];
}
}
return $info;
}

+ Here is the caller graph for this function:

ilSCORM2004Tracking::_getProgressInfoOfUser (   $a_obj_id,
  $a_user_id 
)

Get overall scorm status.

Parameters
object$a_obj_id
Returns

Definition at line 201 of file class.ilSCORM2004Tracking.php.

References $ilDB, $ilLog, $res, and $row.

Referenced by ilLPStatusSCORMPackage\determineStatus().

{
global $ilDB, $ilLog;
$res = $ilDB->queryF('
SELECT * FROM cmi_gobjective
WHERE objective_id = %s
AND scope_id = %s AND user_id = %s',
array('text', 'integer', 'integer'),
array('-course_overall_status-', $a_obj_id, $a_user_id)
);
$status = "not_attempted";
if ($row = $ilDB->fetchAssoc($res))
{
if (self::_isInProgress($row["status"], $row["status"]))
{
$status = "in_progress";
}
if (self::_isCompleted($row["status"], $row["status"]))
{
$status = "completed";
}
if (self::_isFailed($row["status"], $row["status"]))
{
$status = "failed";
}
}
return $status;
}

+ Here is the caller graph for this function:

ilSCORM2004Tracking::_getTrackedUsers (   $a_obj_id)

Get all tracked users.

Parameters
object$a_obj_id
Returns

Definition at line 237 of file class.ilSCORM2004Tracking.php.

References $ilDB, $ilLog, $res, and $row.

{
global $ilDB, $ilLog;
$res = $ilDB->queryF('
SELECT DISTINCT user_id FROM cmi_gobjective
WHERE objective_id = %s
AND scope_id = %s',
array('text', 'integer'),
array('-course_overall_status-', $a_obj_id)
);
$users = array();
while ($row = $ilDB->fetchAssoc($res))
{
$users[] = $row["user_id"];
}
return $users;
}
static ilSCORM2004Tracking::_isCompleted (   $a_status,
  $a_satisfied 
)
static

Definition at line 457 of file class.ilSCORM2004Tracking.php.

{
if ($a_status == "completed")
{
return true;
}
return false;
}
static ilSCORM2004Tracking::_isFailed (   $a_status,
  $a_satisfied 
)
static

Definition at line 483 of file class.ilSCORM2004Tracking.php.

{
if ($a_status == "completed" && $a_satisfied == "notSatisfied")
{
return true;
}
return false;
}
static ilSCORM2004Tracking::_isInProgress (   $a_status,
  $a_satisfied 
)
static

Definition at line 470 of file class.ilSCORM2004Tracking.php.

{
if ($a_status != "completed")
{
return true;
}
return false;
}
ilSCORM2004Tracking::_syncReadEvent (   $a_obj_id,
  $a_user_id,
  $a_type,
  $a_ref_id 
)

Synch read event table.

Parameters
@return

Definition at line 387 of file class.ilSCORM2004Tracking.php.

References $ilDB, $ilLog, ilObjSCORM2004LearningModule\_ISODurationToCentisec(), and ilChangeEvent\_recordReadEvent().

Referenced by ilSCORM13Player\setCMIData().

{
global $ilDB, $ilLog;
// get attempts
$val_set = $ilDB->queryF('
SELECT * FROM cmi_custom
WHERE user_id = %s
AND sco_id = %s
AND lvalue = %s
AND obj_id = %s',
array('integer','integer', 'text','integer'),
array($a_user_id, 0,'package_attempts',$a_obj_id));
$val_rec = $ilDB->fetchAssoc($val_set);
$val_rec["rvalue"] = str_replace("\r\n", "\n", $val_rec["rvalue"]);
if ($val_rec["rvalue"] == null) {
$val_rec["rvalue"]="";
}
$attempts = $val_rec["rvalue"];
// time
$scos = array();
$val_set = $ilDB->queryF(
'SELECT cp_node_id FROM cp_node
WHERE nodename = %s
AND cp_node.slm_id = %s',
array('text', 'integer'),
array('item', $a_obj_id)
);
while($val_rec = $ilDB->fetchAssoc($val_set))
{
array_push($scos,$val_rec['cp_node_id']);
}
$time = 0;
foreach ($scos as $sco)
{
include_once("./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php");
$data_set = $ilDB->queryF('
SELECT c_timestamp last_access, session_time, success_status, completion_status,
c_raw, cp_node_id, total_time
FROM cmi_node
WHERE cp_node_id = %s
AND user_id = %s',
array('integer','integer'),
array($sco, $a_user_id)
);
while($data_rec = $ilDB->fetchAssoc($data_set))
{
// see bug report 7246
// $sec = ilObjSCORM2004LearningModule::_ISODurationToCentisec($data_rec["session_time"]) / 100;
$sec = ilObjSCORM2004LearningModule::_ISODurationToCentisec($data_rec["total_time"]) / 100;
}
$time += (int) $sec;
$sec = 0;
//$ilLog->write("++".$time);
}
include_once("./Services/Tracking/classes/class.ilChangeEvent.php");
ilChangeEvent::_recordReadEvent($a_type, $a_ref_id,
$a_obj_id, $a_user_id, false, $attempts, $time);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSCORM2004Tracking::ilObjSCORM2004Tracking ( )

Constructor public.

Definition at line 18 of file class.ilSCORM2004Tracking.php.

{
}

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