当前位置: 首页>>代码示例>>PHP>>正文


PHP CUserCounter::Decrement方法代码示例

本文整理汇总了PHP中CUserCounter::Decrement方法的典型用法代码示例。如果您正苦于以下问题:PHP CUserCounter::Decrement方法的具体用法?PHP CUserCounter::Decrement怎么用?PHP CUserCounter::Decrement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CUserCounter的用法示例。


在下文中一共展示了CUserCounter::Decrement方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: DeleteByWorkflow

	public static function DeleteByWorkflow($workflowId)
	{
		global $DB;

		$workflowId = trim($workflowId);
		if (strlen($workflowId) <= 0)
			throw new Exception("workflowId");

		$dbRes = $DB->Query(
			"SELECT ID ".
			"FROM b_bp_task ".
			"WHERE WORKFLOW_ID = '".$DB->ForSql($workflowId)."' "
		);
		while ($arRes = $dbRes->Fetch())
		{
			$taskId = intval($arRes["ID"]);
			$dbResUser = $DB->Query("SELECT USER_ID FROM b_bp_task_user WHERE TASK_ID = ".$taskId." ");
			while ($arResUser = $dbResUser->Fetch())
				CUserCounter::Decrement($arResUser["USER_ID"], 'bp_tasks', '**');

			$DB->Query("DELETE FROM b_bp_task_user WHERE TASK_ID = ".$taskId." ", true);

			foreach (GetModuleEvents("bizproc", "OnTaskDelete", true) as $arEvent)
				ExecuteModuleEventEx($arEvent, array($taskId));
		}

		$DB->Query(
			"DELETE FROM b_bp_task ".
			"WHERE WORKFLOW_ID = '".$DB->ForSql($workflowId)."' ",
			true
		);
	}
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:32,代码来源:taskservice.php

示例2: Update

 public static function Update($id, $arFields)
 {
     global $DB;
     $id = intval($id);
     if ($id <= 0) {
         throw new Exception("id");
     }
     self::ParseFields($arFields, $id);
     $strUpdate = $DB->PrepareUpdate("b_bp_task", $arFields);
     $strSql = "UPDATE b_bp_task SET " . "\t" . $strUpdate . ", " . "\tMODIFIED = " . $DB->CurrentTimeFunction() . " " . "WHERE ID = " . intval($id) . " ";
     $DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     if (is_set($arFields, "USERS")) {
         $dbResUser = $DB->Query("SELECT USER_ID FROM b_bp_task_user WHERE TASK_ID = " . intval($id) . " ");
         while ($arResUser = $dbResUser->Fetch()) {
             CUserCounter::Decrement($arResUser["USER_ID"], 'bp_tasks', '**');
         }
         $DB->Query("DELETE FROM b_bp_task_user WHERE TASK_ID = " . intval($id) . " ");
         $ar = array();
         foreach ($arFields["USERS"] as $userId) {
             $userId = intval($userId);
             if (in_array($userId, $ar)) {
                 continue;
             }
             $DB->Query("INSERT INTO b_bp_task_user (USER_ID, TASK_ID) " . "VALUES (" . intval($userId) . ", " . intval($id) . ") ");
             CUserCounter::Increment($userId, 'bp_tasks', '**');
             $ar[] = $userId;
         }
     }
     foreach (GetModuleEvents("bizproc", "OnTaskUpdate", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array($id, $arFields));
     }
     return $id;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:33,代码来源:taskservice.php

示例3: Update

 public static function Update($id, $arFields)
 {
     global $DB;
     $id = intval($id);
     if ($id <= 0) {
         throw new Exception("id");
     }
     self::ParseFields($arFields, $id);
     $strUpdate = $DB->PrepareUpdate("b_bp_task", $arFields);
     $strSql = "UPDATE b_bp_task SET " . "\t" . $strUpdate . ", " . "\tMODIFIED = " . $DB->CurrentTimeFunction() . " " . "WHERE ID = " . intval($id) . " ";
     $DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     $removedUsers = array();
     if (is_set($arFields, "USERS")) {
         $dbResUser = $DB->Query("SELECT USER_ID FROM b_bp_task_user WHERE TASK_ID = " . intval($id) . " ");
         while ($arResUser = $dbResUser->Fetch()) {
             CUserCounter::Decrement($arResUser["USER_ID"], 'bp_tasks', '**');
             $removedUsers[] = $arResUser["USER_ID"];
         }
         $DB->Query("DELETE FROM b_bp_task_user WHERE TASK_ID = " . intval($id) . " ");
         $ar = array();
         foreach ($arFields["USERS"] as $userId) {
             $userId = intval($userId);
             if (in_array($userId, $ar)) {
                 continue;
             }
             $DB->Query("INSERT INTO b_bp_task_user (USER_ID, TASK_ID, ORIGINAL_USER_ID) " . "VALUES (" . intval($userId) . ", " . intval($id) . ", " . intval($userId) . ") ");
             CUserCounter::Increment($userId, 'bp_tasks', '**');
             $ar[] = $userId;
         }
     }
     $userStatuses = array();
     if (isset($arFields['STATUS']) && $arFields['STATUS'] > CBPTaskStatus::Running) {
         $dbResUser = $DB->Query("SELECT USER_ID FROM b_bp_task_user WHERE TASK_ID = " . $id . " AND STATUS = " . CBPTaskUserStatus::Waiting);
         while ($arResUser = $dbResUser->Fetch()) {
             CUserCounter::Decrement($arResUser["USER_ID"], 'bp_tasks', '**');
             if ($arFields['STATUS'] == CBPTaskStatus::Timeout) {
                 $userStatuses[$arResUser["USER_ID"]] = CBPTaskUserStatus::No;
             } else {
                 $removedUsers[] = $arResUser["USER_ID"];
             }
         }
         if ($arFields['STATUS'] == CBPTaskStatus::Timeout) {
             $DB->Query("UPDATE b_bp_task_user SET STATUS = " . CBPTaskUserStatus::No . ", DATE_UPDATE = " . $DB->CurrentTimeFunction() . " WHERE TASK_ID = " . $id . " AND STATUS = " . CBPTaskUserStatus::Waiting);
         } else {
             $DB->Query("DELETE FROM b_bp_task_user WHERE TASK_ID = " . $id . " AND STATUS = " . CBPTaskUserStatus::Waiting);
         }
     }
     foreach (GetModuleEvents("bizproc", "OnTaskUpdate", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array($id, $arFields));
     }
     if ($removedUsers) {
         $arFields['USERS_REMOVED'] = $removedUsers;
     }
     if ($userStatuses) {
         $arFields['USERS_STATUSES'] = $userStatuses;
     }
     self::onTaskChange($id, $arFields, CBPTaskChangedStatus::Update);
     return $id;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:59,代码来源:taskservice.php

示例4: MarkCompleted

 public function MarkCompleted($id, $userId)
 {
     global $DB;
     $id = intval($id);
     if ($id <= 0) {
         throw new Exception("id");
     }
     $userId = intval($userId);
     if ($userId <= 0) {
         throw new Exception("userId");
     }
     $DB->Query("DELETE FROM b_bp_task_user WHERE TASK_ID = " . intval($id) . " AND USER_ID = " . intval($userId) . " ", true);
     $dbRes = $DB->Query("SELECT COUNT(ID) as CNT FROM b_bp_task_user WHERE TASK_ID = " . intval($id) . " ");
     $arRes = $dbRes->Fetch();
     if (intval($arRes["CNT"]) <= 0) {
         $DB->Query("DELETE FROM b_bp_task WHERE ID = " . intval($id) . " ", true);
     }
     CUserCounter::Decrement($userId, 'bp_tasks', '**');
     $events = GetModuleEvents("bizproc", "OnTaskMarkCompleted");
     while ($arEvent = $events->Fetch()) {
         ExecuteModuleEventEx($arEvent, array($id, $userId));
     }
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:23,代码来源:taskservice.php

示例5: DeleteByWorkflow

 public static function DeleteByWorkflow($workflowId)
 {
     global $DB;
     $workflowId = trim($workflowId);
     if (strlen($workflowId) <= 0) {
         throw new Exception("workflowId");
     }
     $dbRes = $DB->Query("SELECT ID " . "FROM b_bp_task " . "WHERE WORKFLOW_ID = '" . $DB->ForSql($workflowId) . "' ");
     while ($arRes = $dbRes->Fetch()) {
         $taskId = intval($arRes["ID"]);
         $removedUsers = array();
         $dbResUser = $DB->Query("SELECT USER_ID, STATUS FROM b_bp_task_user WHERE TASK_ID = " . $taskId . " ");
         while ($arResUser = $dbResUser->Fetch()) {
             if ($arResUser['STATUS'] == CBPTaskUserStatus::Waiting) {
                 CUserCounter::Decrement($arResUser["USER_ID"], 'bp_tasks', '**');
             }
             $removedUsers[] = $arResUser['USER_ID'];
         }
         $DB->Query("DELETE FROM b_bp_task_user WHERE TASK_ID = " . $taskId . " ", true);
         self::onTaskChange($taskId, array('USERS_REMOVED' => $removedUsers), CBPTaskChangedStatus::Delete);
         foreach (GetModuleEvents("bizproc", "OnTaskDelete", true) as $arEvent) {
             ExecuteModuleEventEx($arEvent, array($taskId));
         }
     }
     $DB->Query("DELETE FROM b_bp_task " . "WHERE WORKFLOW_ID = '" . $DB->ForSql($workflowId) . "' ", true);
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:26,代码来源:taskservice.php

示例6: Decrement

 public static function Decrement($code, $site_id = SITE_ID, $sendPull = true, $decrement = 1)
 {
     return CUserCounter::Decrement(CUserCounter::SYSTEM_USER_ID, $code, $site_id, $sendPull, $decrement);
 }
开发者ID:Satariall,项目名称:izurit,代码行数:4,代码来源:global_counter.php

示例7: processUsersCounters

 private static function processUsersCounters($counterId, $operation, $arUsers, $delta)
 {
     if (!is_array($arUsers)) {
         CTaskAssert::logError('[0x9418f293] ');
         return;
     }
     $arUsers = array_unique($arUsers);
     if ($operation === self::OP_DECREMENT) {
         foreach ($arUsers as $userId) {
             $userId = (int) $userId;
             if ($userId < 1) {
                 CTaskAssert::logError('[0x8886cc18] ');
                 continue;
             }
             //$x = '[USER_ID= ' . $userId . '] ' . $counterId . '--';
             //soundex($x);
             CUserCounter::Decrement($userId, $counterId, '**', false, $delta);
         }
     } elseif ($operation === self::OP_INCREMENT) {
         foreach ($arUsers as $userId) {
             $userId = (int) $userId;
             if ($userId < 1) {
                 CTaskAssert::logError('[0x01f722e7] ');
                 continue;
             }
             //$x = '[USER_ID= ' . $userId . '] ' . $counterId . '+=' . $delta;
             //soundex($x);
             CUserCounter::Increment((int) $userId, $counterId, '**', false, $delta);
         }
     } else {
         CTaskAssert::logError('[0x0a5999d4] Invalid operation: ' . $operation);
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:33,代码来源:countersprocessor.php


注:本文中的CUserCounter::Decrement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。