当前位置: 首页>>代码示例>>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;未经允许,请勿转载。