ILIAS  eassessment Revision 61809
 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)
 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)
 Refresh status.

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.

Data Fields

 $obj_id = null
 $db = null

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 29497 2011-06-13 19:14:41Z mwarkus

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, ilLPStatusSCORM, ilLPStatusTestPassed, ilLPStatusExerciseReturned, 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 ilLPStatusManualByTutor, ilLPStatusExerciseReturned, ilLPStatusCollection, ilLPStatusEvent, ilLPStatusObjectives, and ilLPStatusManual.

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:

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

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()
  • 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 191 of file class.ilLPStatus.php.

References determinePercentage(), determineStatus(), and writeStatus().

Referenced by setInProgressIfNotAttempted(), and writeStatus().

{
$status = $this->determineStatus($a_obj_id, $a_usr_id, $a_obj);
$percentage = $this->determinePercentage($a_obj_id, $a_usr_id, $a_obj);
ilLPStatus::writeStatus($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 228 of file class.ilLPStatus.php.

References $ilDB, and ilLPStatusFactory\_getClassById().

Referenced by ilTrQuery\getObjectIds(), ilTrQuery\getUserDataForObject(), and ilTrQuery\getUserObjectMatrix().

{
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.
$set = $ilDB->query("SELECT usr_id FROM ut_lp_marks WHERE ".
" obj_id = ".$ilDB->quote($a_obj_id, "integer")." AND ".
" status_dirty = ".$ilDB->quote(1, "integer")
);
$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)
{
$class = ilLPStatusFactory::_getClassById($a_obj_id);
$trac_obj = new $class($a_obj_id);
$trac_obj->refreshStatus($a_obj_id);
}
}

+ 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, ilLPStatusTypicalLearningTime, and ilLPStatusVisits.

Definition at line 204 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 
)

Determine status.

Parameters
@return

Reimplemented in ilLPStatusCollection, ilLPStatusManualByTutor, ilLPStatusSCORM, ilLPStatusManual, ilLPStatusObjectives, ilLPStatusTestPassed, ilLPStatusEvent, ilLPStatusExerciseReturned, ilLPStatusTestFinished, ilLPStatusSCORMPackage, ilLPStatusTypicalLearningTime, and ilLPStatusVisits.

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

Referenced by _updateStatus().

{
return false;
}

+ Here is the caller graph for this function:

ilLPStatus::refreshStatus (   $a_obj_id)

Refresh status.

Parameters
@return

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

References _getCompleted(), _getFailed(), _getInProgress(), _getNotAttempted(), determinePercentage(), LP_STATUS_COMPLETED_NUM, LP_STATUS_FAILED_NUM, LP_STATUS_IN_PROGRESS_NUM, LP_STATUS_NOT_ATTEMPTED_NUM, 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);
ilLPStatus::writeStatus($a_obj_id, $user_id, LP_STATUS_NOT_ATTEMPTED_NUM, $percentage, true);
}
$in_progress = ilLPStatusWrapper::_getInProgress($a_obj_id);
foreach ($in_progress as $user_id)
{
$percentage = $this->determinePercentage($a_obj_id, $user_id);
ilLPStatus::writeStatus($a_obj_id, $user_id, LP_STATUS_IN_PROGRESS_NUM, $percentage, true);
}
$completed = ilLPStatusWrapper::_getCompleted($a_obj_id);
foreach ($completed as $user_id)
{
$percentage = $this->determinePercentage($a_obj_id, $user_id);
ilLPStatus::writeStatus($a_obj_id, $user_id, LP_STATUS_COMPLETED_NUM, $percentage, true);
}
$failed = ilLPStatusWrapper::_getFailed($a_obj_id);
foreach ($failed as $user_id)
{
$percentage = $this->determinePercentage($a_obj_id, $user_id);
ilLPStatus::writeStatus($a_obj_id, $user_id, LP_STATUS_FAILED_NUM, $percentage, true);
}
}

+ 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 453 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 469 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 391 of file class.ilLPStatus.php.

References $ilDB, $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
@return

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

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

Referenced by _updateStatus(), and refreshStatus().

{
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($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").
" AND status <> ".$ilDB->quote($a_status, "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($a_status, "integer").",".
$ilDB->now().",".
$ilDB->quote($a_user_id, "integer").",".
$ilDB->quote($a_obj_id, "integer").",".
$ilDB->quote(0, "integer").
")");
$update_collections = true;
}
// always reset dirty flag
$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")
);
// 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)
{
$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:

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: