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


PHP CUserCounter::GetValue方法代码示例

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


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

示例1: GetValue

 public function GetValue($forceSync = false)
 {
     if ($this->curValue !== null) {
         return $this->curValue;
     }
     if ($this->code === '') {
         return 0;
     }
     $this->curValue = CUserCounter::GetValue($this->userID, $this->code, SITE_ID);
     if (!$this->CheckLastCalculatedTime() || $forceSync) {
         $this->Synchronize();
     }
     return $this->curValue;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:14,代码来源:user_counter.php

示例2: onTaskGetList

 /**
  * Checks for broken counters.
  * Expirity counter is broken if it is < 0, or if it is more than tasks count in list of expired tasks
  * Other counters is broken if it is < 0, or if it is != tasks count in list of respective tasks
  *
  * Method is called inside CTask::GetList() to perform recounting of broken counters.
  * 
  * @param $arFilter Filter was used in GetList() call
  * @param $tasksCountInList Number of records returned by GetList() call
  */
 public static function onTaskGetList($arFilter, $tasksCountInList)
 {
     if (!CTaskCountersProcessorInstaller::isInstallComplete()) {
         return;
     }
     // Is there our marker?
     if (!(array_key_exists('::MARKERS', $arFilter) && array_key_exists(self::MARKER_ID, $arFilter['::MARKERS']) && $tasksCountInList !== null)) {
         return;
     }
     $tasksCountInList = (int) $tasksCountInList;
     $counterOwnerUserId = $arFilter['::MARKERS'][self::MARKER_ID]['userId'];
     $counterId = $arFilter['::MARKERS'][self::MARKER_ID]['counterId'];
     $counterValue = (int) CUserCounter::GetValue($counterOwnerUserId, $counterId, $site_id = '**');
     if (in_array($counterId, array(CTaskCountersProcessor::COUNTER_TASKS_MY_EXPIRED, CTaskCountersProcessor::COUNTER_TASKS_ACCOMPLICE_EXPIRED, CTaskCountersProcessor::COUNTER_TASKS_AUDITOR_EXPIRED, CTaskCountersProcessor::COUNTER_TASKS_ORIGINATOR_EXPIRED, CTaskCountersProcessor::COUNTER_TASKS_MY_EXPIRED_CANDIDATES, CTaskCountersProcessor::COUNTER_TASKS_ACCOMPLICE_EXPIRED_CANDIDATES), true)) {
         $isExpirityCounter = true;
     } else {
         $isExpirityCounter = false;
     }
     $isCounterBrokeDetected = false;
     $realTasksCount = null;
     // Is checksum correct?
     $filterCheksum = $arFilter['::MARKERS'][self::MARKER_ID]['filterCheksum'];
     $realCheksum = self::calcFilterChecksum($arFilter);
     // break detection part
     if ($filterCheksum === $realCheksum) {
         $realTasksCount = $tasksCountInList;
         if ($counterValue < 0 || $tasksCountInList != $counterValue) {
             $isCounterBrokeDetected = true;
         }
     } else {
         if (isset($arFilter['SAME_GROUP_PARENT'], $arFilter['ONLY_ROOT_TASKS']) && $arFilter['SAME_GROUP_PARENT'] === 'Y' && $arFilter['ONLY_ROOT_TASKS'] === 'Y') {
             // unset the corresponding fields and try to compare checksums again
             unset($arFilter['SAME_GROUP_PARENT']);
             unset($arFilter['ONLY_ROOT_TASKS']);
             $realCheksum = self::calcFilterChecksum($arFilter);
             if ($filterCheksum === $realCheksum) {
                 // tasks count in list shouldn't be more than registered in counter
                 // and counter shouldn't be less than zero
                 if ($counterValue < 0 || $tasksCountInList > $counterValue) {
                     $isCounterBrokeDetected = true;
                 } else {
                     if (static::getCountersRecheckForSubTasksNeed()) {
                         $rsTasksCount = CTasks::getCount($arFilter, array('bIgnoreDbErrors' => true, 'bSkipUserFields' => true, 'bSkipExtraTables' => true));
                         if ($rsTasksCount && ($arTasksCount = $rsTasksCount->fetch()) && isset($arTasksCount['CNT'])) {
                             $realTasksCount = (int) $arTasksCount['CNT'];
                             if ($realTasksCount != $counterValue) {
                                 // and finally check
                                 $isCounterBrokeDetected = true;
                             }
                         }
                     }
                 }
             }
         }
     }
     /*
     if ( ! $isCounterBrokeDetected )
     {
     	if ($counterValue < 0)
     	{
     		$isCounterBrokeDetected = true;
     	}
     	else if ($realTasksCount !== null)
     	{
     		if ($isExpirityCounter)
     		{
     			if ($realTasksCount < $counterValue)
     				$isCounterBrokeDetected = true;
     		}
     		else
     		{
     			if ($realTasksCount !== $counterValue)
     				$isCounterBrokeDetected = true;
     		}
     	}
     }
     */
     if ($isCounterBrokeDetected) {
         ob_start();
         // a special way for correction of 'deadline expired' counters
         if ($isExpirityCounter) {
             // pend counters reinstalling (agent is used)
             self::pendCountersRecalculation();
         } else {
             if ($realTasksCount !== null) {
                 $delta = $realTasksCount - $counterValue;
                 CTaskCountersQueue::push($counterId, CTaskCountersQueue::OP_INCREMENT, array($counterOwnerUserId), $delta);
                 CTaskCountersQueue::execute();
             } else {
                 CTaskAssert::logError('[0x97e63b37] counter "' . $counterId . '" was mistimed for user ' . $counterOwnerUserId . '. But no correct data available for recount.');
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:countersprocessorhomeostasis.php

示例3: GetBadge

	public static function GetBadge($userId)
	{
		return 0;
		$count = 0;
		$count += CUserCounter::GetValue($userId, 'im_notify_v2', '**');
		$count += CUserCounter::GetValue($userId, 'im_chat_v2', '**');
		$count += CUserCounter::GetValue($userId, 'im_message_v2', '**');

		return $count;
	}
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:10,代码来源:im_messenger.php

示例4: OnAdminInformerInsertItems

 public static function OnAdminInformerInsertItems()
 {
     global $USER;
     if (!defined("BX_AUTH_FORM")) {
         $tasksCount = CUserCounter::GetValue($USER->GetID(), 'bp_tasks');
         if ($tasksCount > 0) {
             $bpAIParams = array("TITLE" => GetMessage("BPTS_AI_BIZ_PROC"), "HTML" => '<span class="adm-informer-strong-text">' . GetMessage("BPTS_AI_EX_TASKS") . '</span><br>' . GetMessage("BPTS_AI_TASKS_NUM") . ' ' . $tasksCount, "FOOTER" => '<a href="/bitrix/admin/bizproc_task_list.php?lang=' . LANGUAGE_ID . '">' . GetMessage("BPTS_AI_TASKS_PERF") . '</a>', "COLOR" => "red", "ALERT" => true);
             CAdminInformer::AddItem($bpAIParams);
         }
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:11,代码来源:taskservice.php

示例5: GetMessage

    $arResult["H_NAV_STRING"] = $dbRecordsList->GetPageNavStringEx($navComponentObject, GetMessage("INTS_TASKS_NAV"), "", false);
    $arResult["H_NAV_CACHED_DATA"] = $navComponentObject->GetTemplateCachedData();
    $arResult["H_NAV_RESULT"] = $dbRecordsList;
}
if (strlen($arResult["FatalErrorMessage"]) <= 0) {
    if (!$arParams['COUNTERS_ONLY']) {
        if ($arParams["SET_TITLE"] == "Y") {
            $APPLICATION->SetTitle(GetMessage("BPABS_TITLE"));
        }
        if ($arParams["SET_NAV_CHAIN"] == "Y") {
            $APPLICATION->AddChainItem(GetMessage("BPABS_TITLE"));
        }
    }
    $arResult['COUNTERS'] = CBPTaskService::getCounters($targetUserId);
    if ($arParams['COUNTERS_ONLY']) {
        $arResult['COUNTERS_RUNNING'] = CBPStateService::getRunningCounters($targetUserId);
    }
    //counter autofixer
    $currentCounter = (int) CUserCounter::GetValue($targetUserId, 'bp_tasks', '**');
    if (isset($arResult['COUNTERS']['*']) && $currentCounter != $arResult['COUNTERS']['*']) {
        CUserCounter::Set($targetUserId, 'bp_tasks', $arResult['COUNTERS']['*'], '**');
    }
} elseif (!$arParams['COUNTERS_ONLY']) {
    if ($arParams["SET_TITLE"] == "Y") {
        $APPLICATION->SetTitle(GetMessage("BPWC_WLC_ERROR"));
    }
    if ($arParams["SET_NAV_CHAIN"] == "Y") {
        $APPLICATION->AddChainItem(GetMessage("BPWC_WLC_ERROR"));
    }
}
$this->IncludeComponentTemplate();
开发者ID:k-kalashnikov,项目名称:geekcon,代码行数:31,代码来源:component.php

示例6: getCounterForUser

 private static function getCounterForUser($userRoleId, $taskCategoryId, $userId)
 {
     $counterId = self::resolveCounterIdByRoleAndCategory($userRoleId, $taskCategoryId);
     if ($counterId !== null) {
         $rc = CUserCounter::GetValue($userId, $counterId, $site_id = '**');
     } else {
         CTaskAssert::logError('[0x0de6c535] unknown counter for $userRole: ' . $userRoleId . '; $taskCategoryId: ' . $taskCategoryId);
         $rc = false;
     }
     return $rc;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:11,代码来源:tasklistctrl.php

示例7: GetValue

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

示例8: GetTicker

 public static function GetTicker($user)
 {
     $userId = null;
     $numberOfUnreadMessages = null;
     if (!self::IsExchangeEnabled()) {
         return null;
     }
     if (is_object($user)) {
         if ($user->IsAuthorized()) {
             $userId = intval($user->GetID());
         }
     } elseif (is_array($user)) {
         if (array_key_exists("UF_UNREAD_MAIL_COUNT", $user)) {
             $numberOfUnreadMessages = $user["UF_UNREAD_MAIL_COUNT"];
         } elseif (array_key_exists("ID", $user)) {
             $userId = intval($user["ID"]);
         }
     } elseif (intval($user) . "!" == $user . "!" && intval($user) > 0) {
         $userId = intval($user);
     }
     if (is_null($numberOfUnreadMessages) && !is_null($userId)) {
         $numberOfUnreadMessages = CUserCounter::GetValue($userId, 'dav_unread_mail');
     }
     if (is_null($numberOfUnreadMessages) || empty($numberOfUnreadMessages)) {
         return null;
     }
     $exchangeMailboxPath = COption::GetOptionString("dav", "exchange_mailbox_path", "");
     return array("numberOfUnreadMessages" => $numberOfUnreadMessages, "exchangeMailboxPath" => $exchangeMailboxPath);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:29,代码来源:exchangemail.php


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