ILIAS  Release_5_0_x_branch Revision 61816
 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, $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.
 determineStatus ($a_obj_id, $a_usr_id, $a_obj=null)
 Determine status.
 refreshStatus ($a_obj_id, $a_users=null)
 Refresh 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 _lookupStatus ($a_obj_id, $a_user_id, $a_create=true)
 Lookup status.
static _lookupPercentage ($a_obj_id, $a_user_id)
 Lookup percentage.
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

 $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

static $list_gui_cache

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:
class.ilLPStatus.php 58185 2015-02-25 09:41:22Z gitmgr

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

Member Function Documentation

ilLPStatus::_getCountCompleted (   $a_obj_id)

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

{
return 0;
}
ilLPStatus::_getCountFailed ( )

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

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

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

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

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

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

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

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

Referenced by refreshStatus().

{
return array();
}

+ Here is the caller graph for this function:

ilLPStatus::_getNotAttempted (   $a_obj_id)

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

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

Referenced by refreshStatus().

{
return array();
}

+ Here is the caller graph for this function:

ilLPStatus::_getTypicalLearningTime (   $a_obj_id)

Reimplemented in ilLPStatusCollection.

Definition at line 85 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::_hasUserCompleted (   $a_obj_id,
  $a_user_id 
)
static

Lookup user object completion.

Parameters
int$a_obj_id
int$a_user_id
Returns
bool

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

Referenced by ilConditionHandler\_checkCondition(), ilObjSAHSLearningModuleAccess\_lookupUserCertificate(), ilTimingCache\_showWarning(), ilObjSAHSLearningModuleAccess\checkCondition(), ilSCORMVerificationTableGUI\getItems(), ilContainerStartObjects\isFullfilled(), and ilCourseStart\isFullfilled().

{
return (self::_lookupStatus($a_obj_id, $a_user_id) == self::LP_STATUS_COMPLETED_NUM);
}

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

References _lookupStatusForObject().

{
return self::_lookupStatusForObject($a_obj_id, self::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 703 of file class.ilLPStatus.php.

References _lookupStatusForObject().

{
return self::_lookupStatusForObject($a_obj_id, self::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 715 of file class.ilLPStatus.php.

References _lookupStatusForObject().

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

+ Here is the call graph for this function:

static ilLPStatus::_lookupPercentage (   $a_obj_id,
  $a_user_id 
)
static

Lookup percentage.

Parameters
int$a_obj_idobject id
int$a_user_iduser id

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

References $ilDB.

Referenced by ilLearningProgressBaseGUI\__appendLPDetails().

{
global $ilDB;
$set = $ilDB->query("SELECT percentage 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["percentage"];
}
}

+ Here is the caller graph for this function:

static ilLPStatus::_lookupStatus (   $a_obj_id,
  $a_user_id,
  $a_create = true 
)
static

Lookup status.

Parameters
int$a_obj_idobject id
int$a_user_iduser id
bool$a_create

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

References $ilDB, and _updateStatus().

Referenced by ilLearningProgressBaseGUI\__readStatus(), ilObjSAHSLearningModuleAccess\checkCondition(), ilObjCourse\checkLPStatusSync(), ilLPStatusExerciseReturned\determineStatus(), ilSoapSCORMAdministration\getSCORMCompletionStatus(), ilObjSCORMInitData\getStatus(), ilLearningProgressBaseGUI\initEditUserForm(), and preloadListGUIData().

{
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 if((bool)$a_create)
{
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 617 of file class.ilLPStatus.php.

References $ilDB, and _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 654 of file class.ilLPStatus.php.

References $ilDB, and $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,
  $a_force_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->increase_attemptAndsave_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 – ilConditionHandlerGUI->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(), ilLPStatusCollectionManual\_setObjectStatus(), 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 = self::writeStatus($a_obj_id, $a_usr_id, $status, $percentage);
if(!$a_no_raise &&
($changed || $a_force_raise)) // #15529
{
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 241 of file class.ilLPStatus.php.

References $ilDB, and ilLPStatusFactory\_getInstance().

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
$trac_obj = ilLPStatusFactory::_getInstance($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, ilLPStatusSCORMPackage, ilLPStatusPlugin, ilLPStatusTypicalLearningTime, and ilLPStatusVisits.

Definition at line 217 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 
)
static ilLPStatus::getListGUIStatus (   $a_obj_id)
static

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

Referenced by ilObjectListGUI\insertProperties().

{
return self::$list_gui_cache[$a_obj_id];
}

+ Here is the caller graph for this function:

static ilLPStatus::preloadListGUIData (   $a_obj_ids)
static

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

References $ilDB, $ilUser, $lng, $obj_id, $path, $res, $row, $valid, ilObjUserTracking\_enabledLearningProgress(), ilLearningProgressBaseGUI\_getImagePathForStatus(), ilLearningProgressBaseGUI\_getStatusText(), ilObjUserTracking\_hasLearningProgressLearner(), ilObjUserTracking\_hasLearningProgressListGUI(), ilLPObjSettings\_lookupDBModeForObjects(), _lookupStatus(), ilObjectLP\getInstance(), ilUtil\img(), ilLPObjSettings\LP_MODE_DEACTIVATED, ilLPObjSettings\LP_MODE_UNDEFINED, and LP_STATUS_NOT_ATTEMPTED_NUM.

Referenced by ilObjectListGUIPreloader\preload().

{
global $ilDB, $ilUser, $lng;
$res = array();
include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
if($ilUser->getId() != ANONYMOUS_USER_ID &&
{
include_once "Services/Object/classes/class.ilObjectLP.php";
// validate objects
$valid = array();
foreach($existing as $obj_id => $obj_mode)
{
{
}
}
if(sizeof($existing) != sizeof($a_obj_ids))
{
// missing objects (default mode)
foreach(array_diff($a_obj_ids, $existing) as $obj_id)
{
$olp = ilObjectLP::getInstance($obj_id);
$mode = $olp->getCurrentMode();
{
// #11141
unset($valid[$obj_id]);
}
{
}
}
unset($existing);
}
$valid = array_values($valid);
// get user lp data
$sql = "SELECT status, status_dirty, obj_id FROM ut_lp_marks".
" WHERE ".$ilDB->in("obj_id", $valid, "", "integer").
" AND usr_id = ".$ilDB->quote($ilUser->getId(), "integer");
$set = $ilDB->query($sql);
while($row = $ilDB->fetchAssoc($set))
{
if(!$row["status_dirty"])
{
$res[$row["obj_id"]] = $row["status"];
}
else
{
$res[$row["obj_id"]] = self::_lookupStatus($row["obj_id"], $ilUser->getId());
}
}
// process missing user entries (same as dirty entries, see above)
foreach($valid as $obj_id)
{
if(!isset($res[$obj_id]))
{
$res[$obj_id] = self::_lookupStatus($obj_id, $ilUser->getId());
if($res[$obj_id] === null)
{
}
}
}
// value to icon
$lng->loadLanguageModule("trac");
include_once("./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
foreach($res as $obj_id => $status)
{
}
}
self::$list_gui_cache = $res;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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(), and raiseEvent().

{
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(self::writeStatus($a_obj_id, $user_id, self::LP_STATUS_NOT_ATTEMPTED_NUM, $percentage, true))
{
self::raiseEvent($a_obj_id, $user_id, self::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(self::writeStatus($a_obj_id, $user_id, self::LP_STATUS_IN_PROGRESS_NUM, $percentage, true))
{
self::raiseEvent($a_obj_id, $user_id, self::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(self::writeStatus($a_obj_id, $user_id, self::LP_STATUS_COMPLETED_NUM, $percentage, true))
{
self::raiseEvent($a_obj_id, $user_id, self::LP_STATUS_COMPLETED_NUM, $percentage);
}
}
foreach ($failed as $user_id)
{
$percentage = $this->determinePercentage($a_obj_id, $user_id);
if(self::writeStatus($a_obj_id, $user_id, self::LP_STATUS_FAILED_NUM, $percentage, true))
{
self::raiseEvent($a_obj_id, $user_id, self::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 516 of file class.ilLPStatus.php.

References $ilDB.

{
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 532 of file class.ilLPStatus.php.

References $ilDB.

{
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 477 of file class.ilLPStatus.php.

References $ilDB, and _updateStatus().

Referenced by ilLearningProgress\_tracProgress().

{
global $ilDB;
// #11513
$needs_update = false;
$set = $ilDB->query("SELECT usr_id, status FROM ut_lp_marks WHERE ".
" obj_id = ".$ilDB->quote($a_obj_id, "integer")." AND ".
" usr_id = ".$ilDB->quote($a_user_id, "integer")
);
if ($rec = $ilDB->fetchAssoc($set))
{
// current status is not attempted, so we need to update
if($rec["status"] == self::LP_STATUS_NOT_ATTEMPTED_NUM)
{
$needs_update = true;
}
}
else
{
// no ut_lp_marks yet, we should update
$needs_update = true;
}
if($needs_update)
{
require_once "Services/Tracking/classes/class.ilLPStatusWrapper.php";
ilLPStatusWrapper::_updateStatus($a_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 $ilDB, $ret, ilObject\_lookupType(), ilLPStatusWrapper\_removeStatusCache(), and _updateStatus().

Referenced by _updateStatus(), ilLPStatusSCORMPackage\refreshStatus(), ilLPStatusSCORM\refreshStatus(), ilObjSCORMTracking\syncGlobalStatus(), and ilSCORM2004StoreData\syncGlobalStatus().

{
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").
")");
*/
// #13783
$ilDB->replace("ut_lp_marks",
array(
"obj_id" => array("integer", $a_obj_id),
"usr_id" => array("integer", $a_user_id)
),
array(
"status" => array("integer", $a_status),
"status_changed" => array("timestamp", date("Y-m-d H:i:s")), // was $ilDB->now()
"status_dirty" => array("integer", 0)
)
);
$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 19 of file class.ilLPStatus.php.

ilLPStatus::$list_gui_cache
static

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

ilLPStatus::$obj_id = null

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

Referenced by preloadListGUIData().

const ilLPStatus::LP_STATUS_COMPLETED_NUM = 2

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

Referenced by ilLPObjectStatisticsLPTableGUI\__construct(), ilLearningProgressBaseGUI\__readStatus(), ilLearningProgressBaseGUI\_getImagePathForStatus(), ilLearningProgressBaseGUI\_getStatusText(), ilLMExplorerGUI\checkLPIcon(), ilObjCourse\checkLPStatusSync(), ilLPStatusQuestions\determineStatus(), ilLPStatusManual\determineStatus(), ilLPStatusVisits\determineStatus(), ilLPStatusTypicalLearningTime\determineStatus(), ilLPStatusSCORMPackage\determineStatus(), ilLPStatusExerciseReturned\determineStatus(), ilLPStatusCollectionManual\determineStatus(), ilLPStatusEvent\determineStatus(), ilLPStatusCollectionTLT\determineStatus(), ilLPStatusManualByTutor\determineStatus(), ilLPStatusTestFinished\determineStatus(), ilLPStatusTestPassed\determineStatus(), ilLPStatusSCORM\determineStatus(), ilLPStatusCollection\determineStatus(), ilTrSummaryTableGUI\fillHeaderCSV(), ilTrSummaryTableGUI\fillHeaderExcel(), ilLPProgressTableGUI\fillRow(), ilTrObjectUsersPropsTableGUI\fillRow(), ilTrMatrixTableGUI\fillRow(), ilLPObjectStatisticsLPTableGUI\getGraph(), ilTrMatrixTableGUI\getItems(), ilTrSummaryTableGUI\getItems(), ilLOUserResults\getObjectiveStatusForLP(), ilTrQuery\getObjectsDataForUser(), ilSoapSCORMAdministration\getSCORMCompletionStatus(), ilLOUserResults\getSummarizedObjectiveStatusForLP(), ilTrQuery\getUserObjectiveMatrix(), ilCourseAppEventListener\handleEvent(), ilObjSCORM2004LearningModule\importSuccess(), ilObjSCORMLearningModule\importSuccess(), ilLearningProgressGUI\initCollectionManualForm(), ilLearningProgressBaseGUI\initEditUserForm(), ilTrSummaryTableGUI\initFilter(), ilTrObjectUsersPropsTableGUI\initFilter(), and ilLearningProgressGUI\showtlt().

const ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM = 0

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

Referenced by ilLPObjectStatisticsLPTableGUI\__construct(), ilLearningProgressBaseGUI\__readStatus(), ilLearningProgressBaseGUI\_getStatusText(), ilTrQuery\buildFilters(), ilLMExplorerGUI\checkLPIcon(), ilLPStatusQuestions\determineStatus(), ilLPStatusManual\determineStatus(), ilLPStatusVisits\determineStatus(), ilLPStatusTypicalLearningTime\determineStatus(), ilLPStatusSCORMPackage\determineStatus(), ilLPStatusPlugin\determineStatus(), ilLPStatusExerciseReturned\determineStatus(), ilLPStatusCollectionManual\determineStatus(), ilLPStatusEvent\determineStatus(), ilLPStatusCollectionTLT\determineStatus(), ilLPStatusManualByTutor\determineStatus(), ilLPStatusObjectives\determineStatus(), ilLPStatusTestFinished\determineStatus(), ilLPStatusTestPassed\determineStatus(), ilLPStatusSCORM\determineStatus(), ilLPStatusCollection\determineStatus(), ilTrSummaryTableGUI\fillHeaderCSV(), ilTrSummaryTableGUI\fillHeaderExcel(), ilTrMatrixTableGUI\fillRow(), ilLPObjectStatisticsLPTableGUI\getGraph(), ilTrMatrixTableGUI\getItems(), ilTrSummaryTableGUI\getItems(), ilLPStatusPlugin\getLPDataForUser(), ilTrQuery\getObjectivesStatusForUser(), ilTrQuery\getObjectsDataForUser(), ilTrQuery\getUserObjectiveMatrix(), ilObjSCORM2004LearningModule\importSuccess(), ilObjSCORMLearningModule\importSuccess(), ilLearningProgressGUI\initCollectionManualForm(), ilTrSummaryTableGUI\initFilter(), ilTrObjectUsersPropsTableGUI\initFilter(), preloadListGUIData(), and ilLearningProgressGUI\showtlt().

const ilLPStatus::LP_STATUS_NOT_PARTICIPATED = 'trac_not_participated'
const ilLPStatus::LP_STATUS_NOT_REGISTERED = 'trac_not_registered'
const ilLPStatus::LP_STATUS_PARTICIPATED = 'trac_participated'
const ilLPStatus::LP_STATUS_REGISTERED = 'trac_registered'

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