本文整理汇总了PHP中ilLPStatusWrapper::_removeStatusCache方法的典型用法代码示例。如果您正苦于以下问题:PHP ilLPStatusWrapper::_removeStatusCache方法的具体用法?PHP ilLPStatusWrapper::_removeStatusCache怎么用?PHP ilLPStatusWrapper::_removeStatusCache使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilLPStatusWrapper
的用法示例。
在下文中一共展示了ilLPStatusWrapper::_removeStatusCache方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: writeStatus
/**
* Write status for user and object
*
* @param
* @return bool
*/
static function writeStatus($a_obj_id, $a_user_id, $a_status, $a_percentage = false, $a_force_per = false)
{
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;
}
} 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"));
}
}
} 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")), "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;
}