Exemple #1
0
     }
 }
 $arResult["Events"] = $arTmpEventsNew;
 if ($arParams["LOG_ID"] > 0 && count($arResult["Events"]) <= 0) {
     $arResult["FatalError"] = GetMessage("SONET_73_ENTRY_NOT_FOUND");
 }
 if ($arTmpEvent["DATE_FOLLOW"]) {
     $arResult["dateLastPageTS"] = MakeTimeStamp($arTmpEvent["DATE_FOLLOW"], CSite::GetDateFormat("FULL"));
     $dateLastPage = ConvertTimeStamp($arResult["dateLastPageTS"], "FULL");
 } elseif ($arParams["USE_FOLLOW"] == "N" && $arTmpEvent["LOG_UPDATE"]) {
     $arResult["dateLastPageTS"] = MakeTimeStamp($arTmpEvent["LOG_UPDATE"], CSite::GetDateFormat("FULL"));
     $dateLastPage = ConvertTimeStamp($arResult["dateLastPageTS"], "FULL");
 }
 $arResult["WORKGROUPS_PAGE"] = $folderWorkgroups;
 if ($GLOBALS["USER"]->IsAuthorized() && $arParams["SET_LOG_COUNTER"] == "Y") {
     $arCounters = CUserCounter::GetValues($user_id, SITE_ID);
     if (isset($arCounters[$arResult["COUNTER_TYPE"]])) {
         $arResult["LOG_COUNTER"] = intval($arCounters[$arResult["COUNTER_TYPE"]]);
     } else {
         $bEmptyCounter = true;
         $arResult["LOG_COUNTER"] = 0;
     }
 } else {
     $arParams["SHOW_UNREAD"] = "N";
 }
 if ($GLOBALS["USER"]->IsAuthorized() && $arParams["SET_LOG_COUNTER"] == "Y" && (intval($arResult["LOG_COUNTER"]) > 0 || $bEmptyCounter)) {
     CUserCounter::ClearByUser($user_id, array(SITE_ID, "**"), $arResult["COUNTER_TYPE"], true);
     CUserCounter::ClearByUser($user_id, SITE_ID, "BLOG_POST_IMPORTANT");
 }
 if ($GLOBALS["USER"]->IsAuthorized() && $arParams["SET_LOG_PAGE_CACHE"] == "Y" && $dateLastPage && (!$dateLastPageStart || $dateLastPageStart != $dateLastPage || $bNeedSetLogPage)) {
     $groupCode = strlen($arResult["COUNTER_TYPE"]) > 0 ? $arResult["COUNTER_TYPE"] : "**";
             $arUnread[$data['senderId']]['USER'] = $arMessage['users'][$data['senderId']];
         }
         foreach ($arUnread as $userId => $data) {
             $arData[$userId] = $data;
         }
         uasort($arData, create_function('$a, $b', 'if($a["MESSAGE"]["date"] < $b["MESSAGE"]["date"] ) return 1; elseif($a["MESSAGE"]["date"]  > $b["MESSAGE"]["date"] ) return -1; else return 0;'));
         $arResult['COUNTER_UNREAD_MESSAGES'] = $arData;
     }
     if (CModule::IncludeModule('pull')) {
         $arChannel = CPullChannel::Get($USER->GetId());
         if (is_array($arChannel)) {
             $arResult['PULL_CONFIG'] = array('CHANNEL_ID' => $arChannel['CHANNEL_ID'], 'LAST_ID' => $arChannel['LAST_ID'], 'PATH' => $arChannel['PATH'], 'PATH_WS' => $arChannel['PATH_WS'], 'METHOD' => $arChannel['METHOD'], 'ERROR' => '');
         }
     }
     // Counters
     $arResult["COUNTERS"] = CUserCounter::GetValues($USER->GetID(), $_POST['SITE_ID']);
     $arResult["ERROR"] = $errorMessage;
     echo CUtil::PhpToJsObject($arResult);
 } else {
     if ($_POST['IM_NOTIFY_LOAD'] == 'Y') {
         $CIMNotify = new CIMNotify();
         $arNotify = $CIMNotify->GetUnreadNotify(array('SPEED_CHECK' => 'N', 'USE_TIME_ZONE' => 'N'));
         if ($arNotify['result']) {
             $arSend['NOTIFY'] = $arNotify['notify'];
             $arSend['UNREAD_NOTIFY'] = $arNotify['unreadNotify'];
             $arSend['FLASH_NOTIFY'] = CIMNotify::GetFlashNotify($arNotify['unreadNotify']);
             $arSend['ERROR'] = '';
             if ($arNotify['maxNotify'] > 0) {
                 $CIMNotify->MarkNotifyRead($arNotify['maxNotify'], true);
             }
         }
Exemple #3
0
    }
    foreach ($arTmpEventsNew as $key => $arTmpEvent) {
        if (!is_array($arPrevPageLogID) || !in_array($arTmpEvent["ID"], $arPrevPageLogID)) {
            $arTmpEventsNew[$key]["EVENT_ID_FULLSET"] = CSocNetLogTools::FindFullSetEventIDByEventID($arTmpEvent["EVENT_ID"]);
        } else {
            unset($arTmpEventsNew[$key]);
        }
    }
    $arResult["Events"] = $arTmpEventsNew;
    if ($arTmpEvent["DATE_FOLLOW"]) {
        $dateLastPage = ConvertTimeStamp(MakeTimeStamp($arTmpEvent["DATE_FOLLOW"], CSite::GetDateFormat("FULL")), "FULL");
    } elseif ($arParams["USE_FOLLOW"] == "N" && $arTmpEvent["LOG_UPDATE"]) {
        $dateLastPage = ConvertTimeStamp(MakeTimeStamp($arTmpEvent["LOG_UPDATE"], CSite::GetDateFormat("FULL")), "FULL");
    }
    if ($arParams["LOG_ID"] <= 0 && intval($arParams["NEW_LOG_ID"]) <= 0 && $GLOBALS["USER"]->IsAuthorized()) {
        $arCounters = CUserCounter::GetValues($GLOBALS["USER"]->GetID(), SITE_ID);
        if (isset($arCounters[$arResult["COUNTER_TYPE"]])) {
            $arResult["LOG_COUNTER"] = intval($arCounters[$arResult["COUNTER_TYPE"]]);
        } else {
            $bEmptyCounter = true;
            $arResult["LOG_COUNTER"] = 0;
        }
    }
    if ($GLOBALS["USER"]->IsAuthorized() && $arParams["SET_LOG_COUNTER"] == "Y" && (intval($arResult["LOG_COUNTER"]) > 0 || $bEmptyCounter)) {
        CUserCounter::ClearByUser($GLOBALS["USER"]->GetID(), array(SITE_ID, "**"), $arResult["COUNTER_TYPE"]);
    }
    if ($GLOBALS["USER"]->IsAuthorized() && $arParams["SET_LOG_PAGE_CACHE"] == "Y" && $dateLastPage && (!$dateLastPageStart || $dateLastPageStart != $dateLastPage || $bNeedSetLogPage)) {
        CSocNetLogPages::Set($GLOBALS["USER"]->GetID(), $dateLastPage, $arParams["PAGE_SIZE"], $arResult["PAGE_NUMBER"], SITE_ID, strlen($arResult["COUNTER_TYPE"]) > 0 ? $arResult["COUNTER_TYPE"] : "**");
    }
} else {
    $rsCurrentUser = CUser::GetByID($GLOBALS["USER"]->GetID());
Exemple #4
0
	return;
else
	define("IM_COMPONENT_INIT", true);

if (intval($USER->GetID()) <= 0)
	return;

if (!CModule::IncludeModule('im'))
	return;

$arParams["DESKTOP"] = isset($arParams['DESKTOP']) && $arParams['DESKTOP'] == 'Y'? 'Y': 'N';

$arResult = Array();

// Counters
$arResult["COUNTERS"] = CUserCounter::GetValues($USER->GetID(), SITE_ID);

CIMContactList::SetOnline(null, true);

if ($arParams['DESKTOP'] == 'Y')
{
	$GLOBALS["APPLICATION"]->SetPageProperty("BodyClass", "im-desktop");
	CIMMessenger::SetDesktopStatusOnline();
}

$arParams["INIT"] = 'Y';
$arParams["DESKTOP_LINK_OPEN"] = 'N';

// Exchange
$arResult["PATH_TO_USER_MAIL"] = "";
$arResult["MAIL_COUNTER"] = 0;
Exemple #5
0
 public static function GetValues($site_id = SITE_ID, &$arLastDate = array())
 {
     return CUserCounter::GetValues(CUserCounter::SYSTEM_USER_ID, $site_id, $arLastDate);
 }
 private static function recountCounters_ORIGINATORS_WITHOUT_DEADLINES($userId)
 {
     global $DB;
     $DB->startTransaction();
     // Count tasks without DEADLINES
     // not in states: CTasks::STATE_SUPPOSEDLY_COMPLETED, CTasks::STATE_COMPLETED, CTasks::STATE_DECLINED
     // and where CREATED_BY != RESPONSIBLE_ID.
     // Count tasks for originators.
     $strSql = "SELECT COUNT(T.ID) AS T_WO_DEADLINES, \n\t\t\t\tT.CREATED_BY AS CREATED_BY\n\t\t\tFROM b_tasks T\n\t\t\tWHERE \n\t\t\t\tT.ZOMBIE = 'N'\n\t\t\t\tAND T.CREATED_BY != T.RESPONSIBLE_ID\n\t\t\t\tAND T.CREATED_BY != 0\n\t\t\t\tAND T.RESPONSIBLE_ID != 0\n\t\t\t\tAND T.DEADLINE IS NULL\n\t\t\t\tAND T.STATUS != " . CTasks::STATE_DECLINED . "\n\t\t\t\tAND T.STATUS != " . CTasks::STATE_SUPPOSEDLY_COMPLETED . "\n\t\t\t\tAND T.STATUS != " . CTasks::STATE_COMPLETED . "\n\t\t\t";
     if ($userId !== '*') {
         // All users or not?
         $strSql .= " AND T.CREATED_BY = " . (int) $userId;
     }
     $strSql .= " GROUP BY T.CREATED_BY";
     $rc = $DB->query($strSql);
     $i = 0;
     while ($ar = $rc->fetch()) {
         $arValues = CUserCounter::GetValues($ar['CREATED_BY'], $site_id = '**');
         $total = 0;
         if (isset($arValues[CTaskCountersProcessor::COUNTER_TASKS_TOTAL])) {
             $total = (int) $arValues[CTaskCountersProcessor::COUNTER_TASKS_TOTAL];
         }
         $subtotal = 0;
         if (isset($arValues[CTaskCountersProcessor::COUNTER_TASKS_ORIGINATOR])) {
             $subtotal = (int) $arValues[CTaskCountersProcessor::COUNTER_TASKS_ORIGINATOR];
         }
         CUserCounter::Set((int) $ar['CREATED_BY'], CTaskCountersProcessor::COUNTER_TASKS_ORIGINATOR_WO_DEADLINE, (int) $ar['T_WO_DEADLINES'], '**', $tag = '', false);
         CUserCounter::Set((int) $ar['CREATED_BY'], CTaskCountersProcessor::COUNTER_TASKS_ORIGINATOR, $subtotal + (int) $ar['T_WO_DEADLINES'], '**', $tag = '', false);
         CUserCounter::Set((int) $ar['CREATED_BY'], CTaskCountersProcessor::COUNTER_TASKS_TOTAL, $total + (int) $ar['T_WO_DEADLINES'], '**', $tag = '', false);
         // commit on after every 100 users have been processed
         if (!(++$i % 100)) {
             soundex('commit every 100 users');
             $DB->commit();
             $DB->startTransaction();
         }
     }
     $DB->commit();
 }
 private static function refreshTotalCounter($userId)
 {
     $arValues = CUserCounter::GetValues($userId, $site_id = '**');
     $total = 0;
     if (isset($arValues[CTaskCountersProcessor::COUNTER_TASKS_TOTAL])) {
         $total = (int) $arValues[CTaskCountersProcessor::COUNTER_TASKS_TOTAL];
     }
     $my = 0;
     if (isset($arValues[CTaskCountersProcessor::COUNTER_TASKS_MY])) {
         $my = (int) $arValues[CTaskCountersProcessor::COUNTER_TASKS_MY];
     }
     $accomplice = 0;
     if (isset($arValues[CTaskCountersProcessor::COUNTER_TASKS_ACCOMPLICE])) {
         $accomplice = (int) $arValues[CTaskCountersProcessor::COUNTER_TASKS_ACCOMPLICE];
     }
     $auditor = 0;
     if (isset($arValues[CTaskCountersProcessor::COUNTER_TASKS_AUDITOR])) {
         $auditor = (int) $arValues[CTaskCountersProcessor::COUNTER_TASKS_AUDITOR];
     }
     $originator = 0;
     if (isset($arValues[CTaskCountersProcessor::COUNTER_TASKS_ORIGINATOR])) {
         $originator = (int) $arValues[CTaskCountersProcessor::COUNTER_TASKS_ORIGINATOR];
     }
     // Responsible's real counters:
     $realMy = 0;
     if (isset($arValues[CTaskCountersProcessor::COUNTER_TASKS_MY_NEW])) {
         $realMy += (int) $arValues[CTaskCountersProcessor::COUNTER_TASKS_MY_NEW];
     }
     if (isset($arValues[CTaskCountersProcessor::COUNTER_TASKS_MY_EXPIRED])) {
         $realMy += (int) $arValues[CTaskCountersProcessor::COUNTER_TASKS_MY_EXPIRED];
     }
     if (isset($arValues[CTaskCountersProcessor::COUNTER_TASKS_MY_WO_DEADLINE])) {
         $realMy += (int) $arValues[CTaskCountersProcessor::COUNTER_TASKS_MY_WO_DEADLINE];
     }
     if (isset($arValues[CTaskCountersProcessor::COUNTER_TASKS_MY_EXPIRED_CANDIDATES])) {
         $realMy += (int) $arValues[CTaskCountersProcessor::COUNTER_TASKS_MY_EXPIRED_CANDIDATES];
     }
     // Accomplices' real counters:
     $realAccomplice = 0;
     if (isset($arValues[CTaskCountersProcessor::COUNTER_TASKS_ACCOMPLICE_NEW])) {
         $realAccomplice += (int) $arValues[CTaskCountersProcessor::COUNTER_TASKS_ACCOMPLICE_NEW];
     }
     if (isset($arValues[CTaskCountersProcessor::COUNTER_TASKS_ACCOMPLICE_EXPIRED])) {
         $realAccomplice += (int) $arValues[CTaskCountersProcessor::COUNTER_TASKS_ACCOMPLICE_EXPIRED];
     }
     if (isset($arValues[CTaskCountersProcessor::COUNTER_TASKS_ACCOMPLICE_EXPIRED_CANDIDATES])) {
         $realAccomplice += (int) $arValues[CTaskCountersProcessor::COUNTER_TASKS_ACCOMPLICE_EXPIRED_CANDIDATES];
     }
     // Originator's real counters:
     $realOriginator = 0;
     if (isset($arValues[CTaskCountersProcessor::COUNTER_TASKS_ORIGINATOR_WO_DEADLINE])) {
         $realOriginator += (int) $arValues[CTaskCountersProcessor::COUNTER_TASKS_ORIGINATOR_WO_DEADLINE];
     }
     if (isset($arValues[CTaskCountersProcessor::COUNTER_TASKS_ORIGINATOR_EXPIRED])) {
         $realOriginator += (int) $arValues[CTaskCountersProcessor::COUNTER_TASKS_ORIGINATOR_EXPIRED];
     }
     if (isset($arValues[CTaskCountersProcessor::COUNTER_TASKS_ORIGINATOR_WAIT_CTRL])) {
         $realOriginator += (int) $arValues[CTaskCountersProcessor::COUNTER_TASKS_ORIGINATOR_WAIT_CTRL];
     }
     // Auditors' real counters:
     $realAuditor = 0;
     if (isset($arValues[CTaskCountersProcessor::COUNTER_TASKS_AUDITOR_EXPIRED])) {
         $realAuditor += (int) $arValues[CTaskCountersProcessor::COUNTER_TASKS_AUDITOR_EXPIRED];
     }
     // Total:
     $realTotal = $realMy + $realAccomplice + $realOriginator + $realAuditor;
     if ($realTotal != $total) {
         //$s = '[USER_ID= ' . $userId . '] update master counter to: ' . $realTotal;
         //soundex($s);
         CUserCounter::Increment($userId, CTaskCountersProcessor::COUNTER_TASKS_TOTAL, $site_id = '**', $sendPull = true, $realTotal - $total);
     }
     if ($realMy != $my) {
         CUserCounter::Increment($userId, CTaskCountersProcessor::COUNTER_TASKS_MY, $site_id = '**', $sendPull = true, $realMy - $my);
     }
     if ($realOriginator != $originator) {
         CUserCounter::Increment($userId, CTaskCountersProcessor::COUNTER_TASKS_ORIGINATOR, $site_id = '**', $sendPull = true, $realOriginator - $originator);
     }
     if ($realAccomplice != $accomplice) {
         CUserCounter::Increment($userId, CTaskCountersProcessor::COUNTER_TASKS_ACCOMPLICE, $site_id = '**', $sendPull = true, $realAccomplice - $accomplice);
     }
     if ($realAuditor != $auditor) {
         CUserCounter::Increment($userId, CTaskCountersProcessor::COUNTER_TASKS_AUDITOR, $site_id = '**', $sendPull = true, $realAuditor - $auditor);
     }
 }