當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ilLPStatusWrapper::_removeStatusCache方法代碼示例

本文整理匯總了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;
 }
開發者ID:JKN-INC,項目名稱:SHELBY-ILIAS,代碼行數:63,代碼來源:class.ilLPStatus.php


注:本文中的ilLPStatusWrapper::_removeStatusCache方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。