ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilLPStatus Class Reference

Abstract class ilLPStatus for all learning progress modes E.g ilLPStatusManual, ilLPStatusObjectives ... More...

+ Inheritance diagram for ilLPStatus:
+ Collaboration diagram for ilLPStatus:

Public Member Functions

 ilLPStatus ($a_obj_id)
 _getCountNotAttempted ($a_obj_id)
 _getNotAttempted ($a_obj_id)
 _getCountInProgress ($a_obj_id)
 _getInProgress ($a_obj_id)
 _getCountCompleted ($a_obj_id)
 _getCompleted ($a_obj_id)
 _getFailed ($a_obj_id)
 _getCountFailed ()
 _getStatusInfo ($a_obj_id)
 _getTypicalLearningTime ($a_obj_id)
 _updateStatus ($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_no_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.
 determineStatus ($a_obj_id, $a_usr_id, $a_obj=null)
 Determine status.
 refreshStatus ($a_obj_id, $a_users=null)
 Refresh status.
 _lookupStatus ($a_obj_id, $a_user_id)
 Lookup status.
 _lookupStatusChanged ($a_obj_id, $a_user_id)
 Lookup status changed.

Static Public Member Functions

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 _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.

Data Fields

 $obj_id = null
 $db = null

Protected Member Functions

 raiseEvent ($a_obj_id, $a_usr_id, $a_status, $a_percentage)

Static Protected Member Functions

static _lookupStatusForObject ($a_obj_id, $a_status, $a_user_ids=null)
 Get users with given status for object.

Detailed Description

Abstract class ilLPStatus for all learning progress modes E.g ilLPStatusManual, ilLPStatusObjectives ...

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 31 of file class.ilLPStatus.php.

Member Function Documentation

ilLPStatus::_getCompleted (   $a_obj_id)
ilLPStatus::_getCountCompleted (   $a_obj_id)

Definition at line 64 of file class.ilLPStatus.php.

{
return 0;
}
ilLPStatus::_getCountFailed ( )

Definition at line 76 of file class.ilLPStatus.php.

{
return 0;
}
ilLPStatus::_getCountInProgress (   $a_obj_id)

Definition at line 55 of file class.ilLPStatus.php.

{
return 0;
}
ilLPStatus::_getCountNotAttempted (   $a_obj_id)

Definition at line 45 of file class.ilLPStatus.php.

{
return 0;
}
ilLPStatus::_getFailed (   $a_obj_id)

Reimplemented in ilLPStatusCollection, ilLPStatusTestPassed, ilLPStatusPlugin, ilLPStatusExerciseReturned, ilLPStatusSCORM, and ilLPStatusSCORMPackage.

Definition at line 72 of file class.ilLPStatus.php.

Referenced by refreshStatus().

{
return array();
}

+ Here is the caller graph for this function:

ilLPStatus::_getInProgress (   $a_obj_id)
ilLPStatus::_getNotAttempted (   $a_obj_id)

Reimplemented in ilLPStatusTestPassed, ilLPStatusTestFinished, ilLPStatusManualByTutor, ilLPStatusPlugin, ilLPStatusExerciseReturned, ilLPStatusCollection, ilLPStatusEvent, and ilLPStatusObjectives.

Definition at line 50 of file class.ilLPStatus.php.

Referenced by refreshStatus().

{
return array();
}

+ Here is the caller graph for this function:

ilLPStatus::_getStatusInfo (   $a_obj_id)
ilLPStatus::_getTypicalLearningTime (   $a_obj_id)

Reimplemented in ilLPStatusCollection.

Definition at line 84 of file class.ilLPStatus.php.

References ilMDEducational\_getTypicalLearningTimeSeconds().

{
include_once 'Services/MetaData/classes/class.ilMDEducational.php';
}

+ Here is the call graph for this function:

static ilLPStatus::_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 in ilLPStatusCollection, ilLPStatusEvent, ilLPStatusManualByTutor, ilLPStatusObjectives, and ilLPStatusExerciseReturned.

Definition at line 664 of file class.ilLPStatus.php.

References _lookupStatusForObject(), and LP_STATUS_COMPLETED_NUM.

{
return self::_lookupStatusForObject($a_obj_id, LP_STATUS_COMPLETED_NUM, $a_user_ids);
}

+ Here is the call graph for this function:

static ilLPStatus::_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 in ilLPStatusCollection, ilLPStatusEvent, ilLPStatusManualByTutor, ilLPStatusObjectives, ilLPStatusExerciseReturned, and ilLPStatusManual.

Definition at line 676 of file class.ilLPStatus.php.

References _lookupStatusForObject(), and LP_STATUS_FAILED_NUM.

{
return self::_lookupStatusForObject($a_obj_id, LP_STATUS_FAILED_NUM, $a_user_ids);
}

+ Here is the call graph for this function:

static ilLPStatus::_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 in ilLPStatusCollection, ilLPStatusEvent, ilLPStatusManualByTutor, ilLPStatusObjectives, and ilLPStatusExerciseReturned.

Definition at line 688 of file class.ilLPStatus.php.

References _lookupStatusForObject(), and LP_STATUS_IN_PROGRESS_NUM.

{
}

+ Here is the call graph for this function:

ilLPStatus::_lookupStatus (   $a_obj_id,
  $a_user_id 
)

Lookup status.

Parameters
int$a_obj_idobject id
int$a_user_iduser id

Definition at line 555 of file class.ilLPStatus.php.

References _updateStatus().

Referenced by ilLearningProgressBaseGUI\__readStatus(), ilLearningProgressBaseGUI\__showEditUser(), ilConditionHandler\_checkCondition(), ilObjSAHSLearningModuleAccess\_lookupUserCertificate(), ilTimingCache\_showWarning(), ilObjCourse\checkLPStatusSync(), ilLPStatusExerciseReturned\determineStatus(), ilSoapSCORMAdministration\getSCORMCompletionStatus(), and ilCourseStart\isFullfilled().

{
global $ilDB;
$set = $ilDB->query("SELECT status FROM ut_lp_marks WHERE ".
" status_dirty = ".$ilDB->quote(0, "integer").
" AND usr_id = ".$ilDB->quote($a_user_id, "integer").
" AND obj_id = ".$ilDB->quote($a_obj_id, "integer")
);
if ($rec = $ilDB->fetchAssoc($set))
{
return $rec["status"];
}
else
{
include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
ilLPStatusWrapper::_updateStatus($a_obj_id, $a_user_id);
$set = $ilDB->query("SELECT status FROM ut_lp_marks WHERE ".
" status_dirty = ".$ilDB->quote(0, "integer").
" AND usr_id = ".$ilDB->quote($a_user_id, "integer").
" AND obj_id = ".$ilDB->quote($a_obj_id, "integer")
);
if ($rec = $ilDB->fetchAssoc($set))
{
return $rec["status"];
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLPStatus::_lookupStatusChanged (   $a_obj_id,
  $a_user_id 
)

Lookup status changed.

Parameters
int$a_obj_idobject id
int$a_user_iduser id

Definition at line 590 of file class.ilLPStatus.php.

References _updateStatus().

Referenced by ilCertificateAdapter\getUserCompletionDate().

{
global $ilDB;
$set = $ilDB->query("SELECT status_changed FROM ut_lp_marks WHERE ".
" status_dirty = ".$ilDB->quote(0, "integer").
" AND usr_id = ".$ilDB->quote($a_user_id, "integer").
" AND obj_id = ".$ilDB->quote($a_obj_id, "integer")
);
if ($rec = $ilDB->fetchAssoc($set))
{
return $rec["status_changed"];
}
else
{
include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
ilLPStatusWrapper::_updateStatus($a_obj_id, $a_user_id);
$set = $ilDB->query("SELECT status_changed FROM ut_lp_marks WHERE ".
" status_dirty = ".$ilDB->quote(0, "integer").
" AND usr_id = ".$ilDB->quote($a_user_id, "integer").
" AND obj_id = ".$ilDB->quote($a_obj_id, "integer")
);
if ($rec = $ilDB->fetchAssoc($set))
{
return $rec["status_changed"];
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilLPStatus::_lookupStatusForObject (   $a_obj_id,
  $a_status,
  $a_user_ids = null 
)
staticprotected

Get users with given status for object.

Parameters
int$a_obj_id
int$a_status
array$a_user_ids
Returns
array

Definition at line 627 of file class.ilLPStatus.php.

References $res.

Referenced by ilLPStatusExerciseReturned\_lookupCompletedForObject(), ilLPStatusObjectives\_lookupCompletedForObject(), ilLPStatusManualByTutor\_lookupCompletedForObject(), ilLPStatusEvent\_lookupCompletedForObject(), ilLPStatusCollection\_lookupCompletedForObject(), _lookupCompletedForObject(), ilLPStatusExerciseReturned\_lookupFailedForObject(), ilLPStatusCollection\_lookupFailedForObject(), _lookupFailedForObject(), ilLPStatusExerciseReturned\_lookupInProgressForObject(), ilLPStatusObjectives\_lookupInProgressForObject(), ilLPStatusManualByTutor\_lookupInProgressForObject(), ilLPStatusEvent\_lookupInProgressForObject(), ilLPStatusCollection\_lookupInProgressForObject(), and _lookupInProgressForObject().

{
global $ilDB;
$sql = "SELECT usr_id, status, status_dirty FROM ut_lp_marks".
" WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer").
" AND status = ".$ilDB->quote($a_status, "integer");
if($a_user_ids)
{
$sql .= " AND ".$ilDB->in("usr_id", $a_user_ids, "", "integer");
}
$set = $ilDB->query($sql);
$res = array();
while($rec = $ilDB->fetchAssoc($set))
{
if($res["status_dirty"])
{
// update status and check again
if(self::_lookupStatus($a_obj_id, $rec["usr_id"]) != $a_status)
{
continue;
}
}
$res[] = $rec["usr_id"];
}
return $res;
}

+ Here is the caller graph for this function:

ilLPStatus::_updateStatus (   $a_obj_id,
  $a_usr_id,
  $a_obj = null,
  $a_percentage = false,
  $a_no_raise = false 
)

New status handling (st: status, nr: accesses, p: percentage, t: time spent, m: mark)

Learning progress:

Added determine Status to:

Updating the status:

- ilLearningProgress->_tracProgress() added to:

  • ilLPStatusWrapper::_updateStatus($a_obj_id, $a_user_id); added to: – ilInfoScreenGUI->saveProgress() – ilLMPresentation->ilPage() – ilLPListOfObjectsGUI->updateUser() – ilCourseObjectiveResult->reset() – ilCourseObjectiveResult->__updatePassed() – ilEventParticipants->updateUser() – ilEventParticipants->_updateParticipation() – ilEventParticipants->_register() – ilEventParticipants->_unregister() – ilExerciseMembers->assignMember() – ilExerciseMembers->deassignMember() – ilExerciseMembers->ilClone() – ilExerciseMembers->writeStatus() – ilExerciseMembers->writeReturned() – ilSCORM13Player->writeGObjective() – ilObjSCORM2004LearningModule->deleteTrackingDataOfUsers() – ilObjSCORM2004LearningModule->importSuccess() – ilObjSCORM2004LearningModuleGUI->confirmedDeleteTracking() – ilSCORM13Player->removeCMIData() – ilSCORM13Player->setCMIData() – ilObjSCORMLearningModule->importSuccess() – ilObjSCORMLearningModule->importRaw() – ilObjSCORMLearningModuleGUI->confirmedDelete() – ilObjSCORMLearningModuleGUI->decreaseAttempt() – ilObjSCORMTracking->store() – ilObjSCORMTracking-> _insertTrackData() – ilSCORMPresentationGUI->increaseAttempt() – ilSCORMPresentationGUI->save_module_version() – ilTestScoringGUI->setPointsManual() – ilTestSession->increaseTestPass() – ilTestSession->saveToDb()
  • ilLPStatusWrapper::_refreshStatus($a_ojb_id); aufgenommen in: – ilCourseObjective->add() – ilCourseObjective->delete() – ilCourseObjective->deleteAll() – ilExerciseMembers->delete() – ilSCORM13Package->removeCMIData() – ilAICCCourse->delete() – ilAICCUnit->delete() – ilObjAICCLearningModule->delete() – ilSCORMItem->delete() – ilLPStatusWrapper->update() – ilLPListOfSettingsGUI->assign() – ilLPListOfSettingsGUI->deassign() – ilLPListOfSettingsGUI->groupMaterials() – ilLPListOfSettingsGUI->releaseMaterials() – ilObjTestGUI->confirmDeleteAllUserResultsObject move to ilObjTest but this can ba called for each single question – ilConditionHandlerInterface->updateCondition()
  • external time/access values for read events ilChangeEvent::_recordReadEvent($a_obj_id, $a_user_id, false, $attempts, $time); – ilObjSCORMTracking->_syncReadEvent in ilObjSCORMTracking->store() (add to refresh) – ilSCORM2004Tracking->_syncReadEvent in ilSCORM13Player->setCMIData() Write status
Parameters
@return

Definition at line 195 of file class.ilLPStatus.php.

References $changed, determinePercentage(), determineStatus(), raiseEvent(), and writeStatus().

Referenced by _lookupStatus(), _lookupStatusChanged(), refreshStatus(), setInProgressIfNotAttempted(), and writeStatus().

{
//global $ilLog;
//$ilLog->write("ilLPStatus-_updateStatus-");
$status = $this->determineStatus($a_obj_id, $a_usr_id, $a_obj);
$percentage = $this->determinePercentage($a_obj_id, $a_usr_id, $a_obj);
$changed = ilLPStatus::writeStatus($a_obj_id, $a_usr_id, $status, $percentage);
if(!$a_no_raise && $changed)
{
self::raiseEvent($a_obj_id, $a_usr_id, $status, $percentage);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilLPStatus::checkStatusForObject (   $a_obj_id,
  $a_users = false 
)
static

This function checks whether the status for a given number of users is dirty and must be recalculated.

"Missing" records are not inserted!

Parameters
@return

Definition at line 240 of file class.ilLPStatus.php.

References ilLPStatusFactory\_getClassById().

Referenced by ilTrQuery\refreshObjectsStatus().

{
global $ilDB;
//@todo: there maybe the need to add extra handling for sessions here, since the
// "in progress" status is time dependent here. On the other hand, if they registered
// to the session, they already accessed the course and should have a "in progress"
// anyway. But the status on the session itself may not be correct.
$sql = "SELECT usr_id FROM ut_lp_marks WHERE ".
" obj_id = ".$ilDB->quote($a_obj_id, "integer")." AND ".
" status_dirty = ".$ilDB->quote(1, "integer");
if(is_array($a_users) && count($a_users) > 0)
{
$sql .= " AND ".$ilDB->in("usr_id", $a_users, false, "integer");
}
$set = $ilDB->query($sql);
$dirty = false;
if ($rec = $ilDB->fetchAssoc($set))
{
$dirty = true;
}
// check if any records are missing
$missing = false;
if (!$dirty && is_array($a_users) && count($a_users) > 0)
{
$set = $ilDB->query("SELECT count(usr_id) cnt FROM ut_lp_marks WHERE ".
" obj_id = ".$ilDB->quote($a_obj_id, "integer")." AND ".
$ilDB->in("usr_id", $a_users, false, "integer"));
$r = $ilDB->fetchAssoc($set);
if ($r["cnt"] < count($a_users))
{
$missing = true;
}
}
// refresh status, if records are dirty or missing
if ($dirty || $missing)
{
require_once "Services/Tracking/classes/class.ilLPStatusFactory.php"; // #13330
$class = ilLPStatusFactory::_getClassById($a_obj_id);
$trac_obj = new $class($a_obj_id);
$trac_obj->refreshStatus($a_obj_id, $a_users);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLPStatus::determinePercentage (   $a_obj_id,
  $a_usr_id,
  $a_obj = null 
)

Determine percentage.

Parameters
@return

Reimplemented in ilLPStatusSCORM, ilLPStatusTestPassed, ilLPStatusPlugin, ilLPStatusTypicalLearningTime, and ilLPStatusVisits.

Definition at line 216 of file class.ilLPStatus.php.

Referenced by _updateStatus(), and refreshStatus().

{
return false;
}

+ Here is the caller graph for this function:

ilLPStatus::determineStatus (   $a_obj_id,
  $a_usr_id,
  $a_obj = null 
)
ilLPStatus::raiseEvent (   $a_obj_id,
  $a_usr_id,
  $a_status,
  $a_percentage 
)
protected

Definition at line 287 of file class.ilLPStatus.php.

Referenced by _updateStatus(), and refreshStatus().

{
global $ilAppEventHandler;
$ilAppEventHandler->raise("Services/Tracking", "updateStatus", array(
"obj_id" => $a_obj_id,
"usr_id" => $a_usr_id,
"status" => $a_status,
"percentage" => $a_percentage
));
}

+ Here is the caller graph for this function:

ilLPStatus::refreshStatus (   $a_obj_id,
  $a_users = null 
)

Refresh status.

Parameters
@return

Definition at line 305 of file class.ilLPStatus.php.

References $failed, _getCompleted(), _getFailed(), _getInProgress(), _getNotAttempted(), _updateStatus(), determinePercentage(), LP_STATUS_COMPLETED_NUM, LP_STATUS_FAILED_NUM, LP_STATUS_IN_PROGRESS_NUM, LP_STATUS_NOT_ATTEMPTED_NUM, raiseEvent(), and writeStatus().

{
include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
$not_attempted = ilLPStatusWrapper::_getNotAttempted($a_obj_id);
foreach ($not_attempted as $user_id)
{
$percentage = $this->determinePercentage($a_obj_id, $user_id);
if(ilLPStatus::writeStatus($a_obj_id, $user_id, LP_STATUS_NOT_ATTEMPTED_NUM, $percentage, true))
{
self::raiseEvent($a_obj_id, $user_id, LP_STATUS_NOT_ATTEMPTED_NUM, $percentage);
}
}
$in_progress = ilLPStatusWrapper::_getInProgress($a_obj_id);
foreach ($in_progress as $user_id)
{
$percentage = $this->determinePercentage($a_obj_id, $user_id);
if(ilLPStatus::writeStatus($a_obj_id, $user_id, LP_STATUS_IN_PROGRESS_NUM, $percentage, true))
{
self::raiseEvent($a_obj_id, $user_id, LP_STATUS_IN_PROGRESS_NUM, $percentage);
}
}
$completed = ilLPStatusWrapper::_getCompleted($a_obj_id);
foreach ($completed as $user_id)
{
$percentage = $this->determinePercentage($a_obj_id, $user_id);
if(ilLPStatus::writeStatus($a_obj_id, $user_id, LP_STATUS_COMPLETED_NUM, $percentage, true))
{
self::raiseEvent($a_obj_id, $user_id, LP_STATUS_COMPLETED_NUM, $percentage);
}
}
foreach ($failed as $user_id)
{
$percentage = $this->determinePercentage($a_obj_id, $user_id);
if(ilLPStatus::writeStatus($a_obj_id, $user_id, LP_STATUS_FAILED_NUM, $percentage, true))
{
self::raiseEvent($a_obj_id, $user_id, LP_STATUS_FAILED_NUM, $percentage);
}
}
if($a_users)
{
$missing_users = array_diff($a_users, $not_attempted+$in_progress+$completed+$failed);
if($missing_users)
{
foreach ($missing_users as $user_id)
{
ilLPStatusWrapper::_updateStatus($a_obj_id, $user_id);
}
}
}
}

+ Here is the call graph for this function:

static ilLPStatus::setAllDirty ( )
static

Sets all status to dirty.

For testing puproses.

Parameters
@return

Definition at line 523 of file class.ilLPStatus.php.

{
global $ilDB;
$ilDB->manipulate("UPDATE ut_lp_marks SET ".
" status_dirty = ".$ilDB->quote(1, "integer")
);
}
static ilLPStatus::setDirty (   $a_obj_id)
static

Sets status of an object to dirty.

Parameters
integerobject id
Returns

Definition at line 539 of file class.ilLPStatus.php.

{
global $ilDB;
$ilDB->manipulate("UPDATE ut_lp_marks SET ".
" status_dirty = ".$ilDB->quote(1, "integer").
" WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer")
);
}
static ilLPStatus::setInProgressIfNotAttempted (   $a_obj_id,
  $a_user_id 
)
static

This function shoudl be clalled for normal "read events".

The "in progress" status is only written, if current status is "NOT ATTEMPTED"

Definition at line 461 of file class.ilLPStatus.php.

References $ret, ilObject\_lookupType(), _updateStatus(), LP_STATUS_IN_PROGRESS_NUM, and LP_STATUS_NOT_ATTEMPTED_NUM.

Referenced by ilLearningProgress\_tracProgress().

{
global $ilDB;
$set = $ilDB->query("SELECT usr_id FROM ut_lp_marks WHERE ".
" obj_id = ".$ilDB->quote($a_obj_id, "integer")." AND ".
" usr_id = ".$ilDB->quote($a_user_id, "integer")
);
$update_collections = false;
if ($rec = $ilDB->fetchAssoc($set))
{
$ret = $ilDB->manipulate("UPDATE ut_lp_marks SET ".
" status = ".$ilDB->quote(LP_STATUS_IN_PROGRESS_NUM, "integer").",".
" status_changed = ".$ilDB->now().",".
" status_dirty = ".$ilDB->quote(0, "integer").
" WHERE usr_id = ".$ilDB->quote($a_user_id, "integer").
" AND obj_id = ".$ilDB->quote($a_obj_id, "integer").
" AND status = ".$ilDB->quote(LP_STATUS_NOT_ATTEMPTED_NUM, "integer")
);
if ($ret != 0)
{
$update_collections = true;
}
}
else
{
$ilDB->manipulate("INSERT INTO ut_lp_marks ".
"(status, status_changed, usr_id, obj_id, status_dirty) VALUES (".
$ilDB->quote(LP_STATUS_IN_PROGRESS_NUM, "integer").",".
$ilDB->now().",".
$ilDB->quote($a_user_id, "integer").",".
$ilDB->quote($a_obj_id, "integer").",".
$ilDB->quote(0, "integer").
")");
$update_collections = true;
}
// update collections
if ($update_collections)
{
$set = $ilDB->query("SELECT ut_lp_collections.obj_id obj_id FROM ".
"object_reference JOIN ut_lp_collections ON ".
"(object_reference.obj_id = ".$ilDB->quote($a_obj_id, "integer").
" AND object_reference.ref_id = ut_lp_collections.item_id)");
while ($rec = $ilDB->fetchAssoc($set))
{
if (in_array(ilObject::_lookupType($rec["obj_id"]), array("crs", "grp", "fold")))
{
include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
ilLPStatusWrapper::_updateStatus($rec["obj_id"], $a_user_id);
}
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilLPStatus::writeStatus (   $a_obj_id,
  $a_user_id,
  $a_status,
  $a_percentage = false,
  $a_force_per = false 
)
static

Write status for user and object.

Parameters
@returnbool

Definition at line 363 of file class.ilLPStatus.php.

References $ret, ilObject\_lookupType(), ilLPStatusWrapper\_removeStatusCache(), and _updateStatus().

Referenced by _updateStatus(), ilLPStatusSCORM\refreshStatus(), and refreshStatus().

{
global $ilDB;
$update_collections = false;
// get status in DB
$set = $ilDB->query("SELECT usr_id,status,status_dirty FROM ut_lp_marks WHERE ".
" obj_id = ".$ilDB->quote($a_obj_id, "integer")." AND ".
" usr_id = ".$ilDB->quote($a_user_id, "integer")
);
$rec = $ilDB->fetchAssoc($set);
// update
if ($rec)
{
// status has changed: update
if ($rec["status"] != $a_status)
{
$ret = $ilDB->manipulate("UPDATE ut_lp_marks SET ".
" status = ".$ilDB->quote($a_status, "integer").",".
" status_changed = ".$ilDB->now().",".
" status_dirty = ".$ilDB->quote(0, "integer").
" WHERE usr_id = ".$ilDB->quote($a_user_id, "integer").
" AND obj_id = ".$ilDB->quote($a_obj_id, "integer")
);
if ($ret != 0)
{
$update_collections = true;
}
}
// status has not changed: reset dirty flag
else if ($rec["status_dirty"])
{
$ilDB->manipulate("UPDATE ut_lp_marks SET ".
" status_dirty = ".$ilDB->quote(0, "integer").
" WHERE usr_id = ".$ilDB->quote($a_user_id, "integer").
" AND obj_id = ".$ilDB->quote($a_obj_id, "integer")
);
}
}
// insert
else
{
$ilDB->manipulate("INSERT INTO ut_lp_marks ".
"(status, status_changed, usr_id, obj_id, status_dirty) VALUES (".
$ilDB->quote($a_status, "integer").",".
$ilDB->now().",".
$ilDB->quote($a_user_id, "integer").",".
$ilDB->quote($a_obj_id, "integer").",".
$ilDB->quote(0, "integer").
")");
$update_collections = true;
}
// update percentage
if ($a_percentage !== false || $a_force_per)
{
$a_percentage = max(0, (int) $a_percentage);
$a_percentage = min(100, $a_percentage);
$ret = $ilDB->manipulate("UPDATE ut_lp_marks SET ".
" percentage = ".$ilDB->quote($a_percentage, "integer").
" WHERE usr_id = ".$ilDB->quote($a_user_id, "integer").
" AND obj_id = ".$ilDB->quote($a_obj_id, "integer")
);
}
// update collections
if ($update_collections)
{
// a change occured - remove existing cache entry
include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
ilLPStatusWrapper::_removeStatusCache($a_obj_id, $a_user_id);
$set = $ilDB->query("SELECT ut_lp_collections.obj_id obj_id FROM ".
"object_reference JOIN ut_lp_collections ON ".
"(object_reference.obj_id = ".$ilDB->quote($a_obj_id, "integer").
" AND object_reference.ref_id = ut_lp_collections.item_id)");
while ($rec = $ilDB->fetchAssoc($set))
{
if (in_array(ilObject::_lookupType($rec["obj_id"]), array("crs", "grp", "fold")))
{
// just to make sure - remove existing cache entry
ilLPStatusWrapper::_removeStatusCache($rec["obj_id"], $a_user_id);
ilLPStatusWrapper::_updateStatus($rec["obj_id"], $a_user_id);
}
}
}
return $update_collections;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilLPStatus::$db = null

Definition at line 35 of file class.ilLPStatus.php.

ilLPStatus::$obj_id = null

Definition at line 33 of file class.ilLPStatus.php.


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