本文整理汇总了PHP中CUserCounter类的典型用法代码示例。如果您正苦于以下问题:PHP CUserCounter类的具体用法?PHP CUserCounter怎么用?PHP CUserCounter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CUserCounter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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")) {
$DB->Query("DELETE FROM b_bp_task_user WHERE TASK_ID = " . intval($id) . " ");
CUserCounter::ClearByTag($id, 'bp_tasks', '**');
$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;
}
}
$events = GetModuleEvents("bizproc", "OnTaskUpdate");
while ($arEvent = $events->Fetch()) {
ExecuteModuleEventEx($arEvent, array($id, $arFields));
}
return $id;
}
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源: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__);
$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
示例3: array
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
$arResult["urlToOwnBlog"] = "";
$arResult["urlToOwnProfile"] = "";
if (CModule::IncludeModule("blog") && $GLOBALS["USER"]->IsAuthorized()) {
$arResult["urlToCreateMessageInBlog"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BLOG_NEW_POST"], array("user_id" => $GLOBALS["USER"]->GetID(), "post_id" => "new"));
}
if ($GLOBALS["USER"]->IsAuthorized()) {
$arResult["urlToOwnProfile"] = CComponentEngine::MakePathFromTemplate($arParams["PROFILE_URL"], array("user_id" => $GLOBALS["USER"]->GetID()));
$arCounters = CUserCounter::GetValues($GLOBALS["USER"]->GetID(), SITE_ID);
$arResult["LOG_COUNTER"] = isset($arCounters["**"]) ? intval($arCounters["**"]) : 0;
}
开发者ID:Satariall,项目名称:izurit,代码行数:15,代码来源:result_modifier.php
示例4: GetMessage
} else {
$arResult['ID'] = CMailbox::Add($arFields);
$res = $arResult['ID'] > 0;
}
if (!$res) {
$arResult['ERRORS'][] = GetMessage('INTR_MAIL_SAVE_ERROR');
} else {
CUserCounter::Set($USER->GetID(), 'mail_unseen', $unseen, SITE_ID);
CUserOptions::SetOption('global', 'last_mail_check_' . SITE_ID, time());
CUserOptions::SetOption('global', 'last_mail_check_success_' . SITE_ID, $unseen >= 0);
LocalRedirect($APPLICATION->GetCurPage() . '?STEP=confirm&ACT=setup');
}
}
}
break;
case 'remove':
if (check_bitrix_sessid()) {
CMailbox::Delete($arResult['ID']);
CUserCounter::Clear($USER->GetID(), 'mail_unseen', SITE_ID);
CUserOptions::DeleteOption('global', 'last_mail_check_' . SITE_ID);
CUserOptions::DeleteOption('global', 'last_mail_check_success_' . SITE_ID);
LocalRedirect($APPLICATION->GetCurPage() . '?STEP=confirm&ACT=remove');
} else {
LocalRedirect($APPLICATION->GetCurPage() . '?STEP=setup');
}
break;
case 'confirm':
$arResult['ACT'] = isset($_REQUEST['ACT']) ? $_REQUEST['ACT'] : '';
break;
}
$this->IncludeComponentTemplate();
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php
示例5: list
case 'crdomain':
list($acc['login'], $acc['domain']) = explode('@', $acc['LOGIN'], 2);
$crCheckMailbox = CControllerClient::ExecuteEvent('OnMailControllerCheckMemberMailbox', array('DOMAIN' => $acc['domain'], 'NAME' => $acc['login']));
if (isset($crCheckMailbox['result'])) {
$unseen = intval($crCheckMailbox['result']);
} else {
$unseen = -1;
$error = empty($crCheckMailbox['error']) ? GetMessage('INTR_MAIL_CONTROLLER_INVALID') : CMail::getErrorMessage($crCheckMailbox['error']);
}
break;
case 'domain':
$service = \Bitrix\Mail\MailServicesTable::getRowById($acc['SERVICE_ID']);
list($acc['login'], $acc['domain']) = explode('@', $acc['LOGIN'], 2);
$result = CMailDomain2::getUnreadMessagesCount($service['TOKEN'], $acc['domain'], $acc['login'], $error);
if (is_null($result)) {
$unseen = -1;
$error = CMail::getErrorMessage($error);
} else {
$unseen = intval($result);
}
break;
}
CUserCounter::Set($userId, 'mail_unseen', $unseen, $siteId);
CUserOptions::SetOption('global', 'last_mail_check_' . $siteId, time(), false, $userId);
CUserOptions::SetOption('global', 'last_mail_check_success_' . $siteId, $unseen >= 0, false, $userId);
} else {
$unseen = 0;
CUserOptions::SetOption('global', 'last_mail_check_' . $siteId, -1, false, $userId);
}
header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
echo json_encode(array('result' => $error === false ? 'ok' : 'error', 'unseen' => $unseen, 'last_check' => CUserOptions::GetOption('global', 'last_mail_check_' . $siteId, false, $userId), 'error' => $error));
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:check_mail.php
示例6: 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
示例7: MessageUpdate
public static function MessageUpdate($REPORT_ID, $arReport = array(), $arFields = array())
{
global $DB, $USER;
$curUser = $USER->GetID();
if (CModule::IncludeModule("socialnetwork")) {
$dbLog = CSocNetLog::GetList(array(), array("SOURCE_ID" => $REPORT_ID, "EVENT_ID" => "report"));
if (!($arLog = $dbLog->Fetch())) {
$LOG_ID = CReportNotifications::SendMessage($REPORT_ID, false);
} else {
$LOG_ID = $arLog["ID"];
CSocNetLog::Update($LOG_ID, array("USER_ID" => $curUser, "=LOG_DATE" => $DB->CurrentTimeFunction(), "=LOG_UPDATE" => $DB->CurrentTimeFunction()));
CUserCounter::IncrementWithSelect(CSocNetLogCounter::GetSubSelect($LOG_ID, $arLog["ENTITY_TYPE"], $arLog["ENTITY_ID"], $arLog["EVENT_ID"], $arLog["USER_ID"]));
}
if (CModule::IncludeModule("im") && is_array($arFields) && is_array($arReport) && intval($arReport["USER_ID"]) > 0 && $arReport["USER_ID"] != $curUser) {
$date_text = "";
$date_from = FormatDate("j F", MakeTimeStamp($arReport["DATE_FROM"], CSite::GetDateFormat("FULL", SITE_ID)));
$date_to = FormatDate("j F", MakeTimeStamp($arReport["DATE_TO"], CSite::GetDateFormat("FULL", SITE_ID)));
if ($date_from == $date_to) {
$date_text = $date_to;
} else {
$date_text = $date_from . " - " . $date_to;
}
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => $arReport["USER_ID"], "FROM_USER_ID" => $curUser, "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "timeman", "NOTIFY_EVENT" => "report_approve", "NOTIFY_TAG" => "TIMEMAN|REPORT|" . $arReport["ID"] . "_" . $arFields["MARK"]);
$gender_suffix = "";
$dbUser = CUser::GetByID($curUser);
if ($arUser = $dbUser->Fetch()) {
switch ($arUser["PERSONAL_GENDER"]) {
case "M":
$gender_suffix = "_M";
break;
case "F":
$gender_suffix = "_F";
break;
default:
$gender_suffix = "";
}
}
$reports_page = COption::GetOptionString("timeman", "WORK_REPORT_PATH", "/company/work_report.php");
$arTmp = CSocNetLogTools::ProcessPath(array("REPORTS_PAGE" => $reports_page), $arReport["USER_ID"]);
switch ($arFields["MARK"]) {
case "G":
$mark = "G";
break;
case "B":
$mark = "B";
break;
case "X":
$mark = "X";
break;
default:
$mark = "N";
}
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("REPORT_FULL_IM_APPROVE" . $gender_suffix . "_" . $mark, array("#period#" => "<a href=\"" . $arTmp["URLS"]["REPORTS_PAGE"] . "#user_id=" . $arReport["USER_ID"] . "&report=" . $REPORT_ID . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($date_text) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("REPORT_FULL_IM_APPROVE" . $gender_suffix . "_" . $mark, array("#period#" => htmlspecialcharsbx($date_text))) . " ( " . $arTmp["SERVER_NAME"] . $arTmp["URLS"]["REPORTS_PAGE"] . "#user_id=" . $arReport["USER_ID"] . "&report=" . $REPORT_ID . " )";
CIMNotify::Add($arMessageFields);
}
$dbLogRights = CSocNetLogRights::GetList(array(), array("LOG_ID" => $LOG_ID));
while ($arRight = $dbLogRights->Fetch()) {
$arRights[] = $arRight["GROUP_CODE"];
}
if (!in_array("U" . $curUser, $arRights)) {
CSocNetLogRights::Add($LOG_ID, "U" . $curUser);
}
return $LOG_ID;
} else {
return false;
}
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:68,代码来源:timeman_report_full.php
示例8: Delete
function Delete($ID)
{
global $DB;
$ID = IntVal($ID);
$db_msg = CMailMessage::GetList(Array(), Array("MAILBOX_ID"=>$ID));
while($msg = $db_msg->Fetch())
{
if(!CMailMessage::Delete($msg["ID"]))
return false;
}
$db_flt = CMailFilter::GetList(Array(), Array("MAILBOX_ID"=>$ID));
while($flt = $db_flt->Fetch())
{
if(!CMailFilter::Delete($flt["ID"]))
return false;
}
$db_log = CMailLog::GetList(Array(), Array("MAILBOX_ID"=>$ID));
while($log = $db_log->Fetch())
{
if(!CMailLog::Delete($log["ID"]))
return false;
}
$db_mbox = CMailbox::GetList(array('ID' => $ID, 'ACTIVE' => 'Y', '!USER_ID' => 0));
if ($mbox = $db_mbox->fetch())
{
CUserCounter::Clear($mbox['USER_ID'], 'mail_unseen', $mbox['LID']);
CUserOptions::DeleteOption('global', 'last_mail_check_'.$mbox['LID'], false, $mbox['USER_ID']);
CUserOptions::DeleteOption('global', 'last_mail_check_success_'.$mbox['LID'], false, $mbox['USER_ID']);
}
CAgent::RemoveAgent("CMailbox::CheckMailAgent(".$ID.");", "mail");
$strSql = "DELETE FROM b_mail_message_uid WHERE MAILBOX_ID=".$ID;
if(!$DB->Query($strSql, true))
return false;
CMailbox::SMTPReload();
$strSql = "DELETE FROM b_mail_mailbox WHERE ID=".$ID;
return $DB->Query($strSql, true);
}
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:44,代码来源:mail.php
示例9: CounterDecrement
public static function CounterDecrement($log_id, $event_id = false, $type = "L", $bForAllAccess = false)
{
if (intval($log_id) <= 0) {
return false;
}
CUserCounter::IncrementWithSelect(CSocNetLogCounter::GetSubSelect2($log_id, array("TYPE" => $type, "DECREMENT" => true, "FOR_ALL_ACCESS" => $bForAllAccess)));
if ($event_id == "blog_post_important") {
CUserCounter::IncrementWithSelect(CSocNetLogCounter::GetSubSelect2($log_id, array("TYPE" => "L", "CODE" => "'BLOG_POST_IMPORTANT'", "DECREMENT" => true, "FOR_ALL_ACCESS" => $bForAllAccess)));
}
}
开发者ID:rasuldev,项目名称:torino,代码行数:10,代码来源:log.php
示例10: DeleteByCode
public static function DeleteByCode($code)
{
global $DB, $APPLICATION, $CACHE_MANAGER;
if (strlen($code) <= 0) {
return false;
}
$pullMessage = array();
$bPullEnabled = false;
if (self::CheckLiveMode()) {
$db_lock = $DB->Query("SELECT GET_LOCK('" . $APPLICATION->GetServerUniqID() . "_pull', 0) as L");
$ar_lock = $db_lock->Fetch();
if ($ar_lock["L"] > 0) {
$bPullEnabled = true;
$arSites = array();
$res = CSite::GetList($b = "", $o = "", array("ACTIVE" => "Y"));
while ($row = $res->Fetch()) {
$arSites[] = $row['ID'];
}
$strSQL = "\n\t\t\t\t\tSELECT distinct pc.CHANNEL_ID, uc.USER_ID, uc.SITE_ID, uc.CODE, uc.CNT\n\t\t\t\t\tFROM b_user_counter uc\n\t\t\t\t\tINNER JOIN b_pull_channel pc ON pc.USER_ID = uc.USER_ID\n\t\t\t\t\tWHERE uc.CODE LIKE '**%'\n\t\t\t\t";
$res = $DB->Query($strSQL, false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
while ($row = $res->Fetch()) {
if ($row["CODE"] == $code) {
continue;
}
CUserCounter::addValueToPullMessage($row, $arSites, $pullMessage);
}
}
}
$DB->Query("DELETE FROM b_user_counter WHERE CODE = '" . $code . "'", false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
self::$counters = false;
$CACHE_MANAGER->CleanDir("user_counter");
if ($bPullEnabled) {
$DB->Query("SELECT RELEASE_LOCK('" . $APPLICATION->GetServerUniqID() . "_pull')");
}
foreach ($pullMessage as $channelId => $arMessage) {
CPullStack::AddByChannel($channelId, array('module_id' => 'main', 'command' => 'user_counter', 'params' => $arMessage));
}
}
开发者ID:Satariall,项目名称:izurit,代码行数:38,代码来源:user_counter.php
示例11: ConvertTimeStamp
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());
if ($arCurrentUser = $rsCurrentUser->Fetch()) {
$arResult["EmptyComment"] = array("AVATAR_SRC" => CSocNetLogTools::FormatEvent_CreateAvatar($arCurrentUser, $arParams, ""), "AUTHOR_NAME" => CUser::FormatName($arParams["NAME_TEMPLATE"], $arCurrentUser, $bUseLogin));
}
}
if ($GLOBALS["USER"]->IsAuthorized() && $arParams["USE_FOLLOW"] == "Y") {
$rsFollow = CSocNetLogFollow::GetList(array("USER_ID" => $GLOBALS["USER"]->GetID(), "CODE" => "**"), array("TYPE"));
if ($arFollow = $rsFollow->Fetch()) {
$arResult["FOLLOW_DEFAULT"] = $arFollow["TYPE"];
} else {
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php
示例12: define
define("NOT_CHECK_PERMISSIONS", true);
define("PUBLIC_AJAX_MODE", true);
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/bx_root.php";
$cuid = IntVal($_REQUEST["cuid"]);
$site_id = isset($_REQUEST["site"]) && is_string($_REQUEST["site"]) ? trim($_REQUEST["site"]) : "";
if (isset($_REQUEST["is"])) {
$ImageSize = intval($_REQUEST["is"]);
} else {
$ImageSize = 0;
}
if ($ImageSize <= 0) {
$ImageSize = 42;
}
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
if ($GLOBALS["USER"]->IsAuthorized()) {
$log_cnt = CUserCounter::GetValueByUserID($GLOBALS["USER"]->GetID(), $site);
}
if ($CACHE_MANAGER->Read(86400 * 30, "socnet_cm_" . $cuid) && $CACHE_MANAGER->Read(86400 * 30, "socnet_cf_" . $cuid) && $CACHE_MANAGER->Read(86400 * 30, "socnet_cg_" . $cuid)) {
if (intval($log_cnt) > 0) {
$arData = array(array("LOG_CNT" => $log_cnt));
echo CUtil::PhpToJSObject($arData);
define('PUBLIC_AJAX_MODE', true);
}
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_after.php";
die;
}
$rsSites = CSite::GetByID($site);
if ($arSite = $rsSites->Fetch()) {
$DateTimeFormat = $arSite["FORMAT_DATETIME"];
__IncludeLang(dirname(__FILE__) . "/lang/" . $arSite["LANGUAGE_ID"] . "/get_message_2.php");
} else {
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:get_message_2.php
示例13: isset
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;
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:31,代码来源:component.php
示例14: foreach
}
}
}
}
}
foreach ($arTmpEventsNew as $arTmpEvent) {
if (!is_array($_SESSION["SONET_LOG_ID"]) || !in_array($arTmpEvent["EVENT"]["ID"], $_SESSION["SONET_LOG_ID"])) {
$_SESSION["SONET_LOG_ID"][] = $arTmpEvent["EVENT"]["ID"];
}
$arResult["EventsNew"][] = $arTmpEvent;
}
if ($arTmpEvent["EVENT"]["DATE_FOLLOW"]) {
$dateLastPage = ConvertTimeStamp(MakeTimeStamp($arTmpEvent["EVENT"]["DATE_FOLLOW"], CSite::GetDateFormat("FULL")), "FULL");
}
$arResult["WORKGROUPS_PAGE"] = COption::GetOptionString("socialnetwork", "workgroups_page", "/workgroups/", SITE_ID);
if ($GLOBALS["USER"]->IsAuthorized() && $arParams["SET_LOG_COUNTER"] == "Y") {
CUserCounter::ClearByUser($GLOBALS["USER"]->GetID(), SITE_ID, $arResult["COUNTER_TYPE"]);
CUserCounter::ClearByUser($GLOBALS["USER"]->GetID(), "**", $arResult["COUNTER_TYPE"]);
}
if ($GLOBALS["USER"]->IsAuthorized() && $arParams["SET_LOG_PAGE_CACHE"] == "Y" && $dateLastPage) {
CSocNetLogPages::Set($GLOBALS["USER"]->GetID(), $dateLastPage, $arParams["PAGE_SIZE"], $arResult["PAGE_NUMBER"], SITE_ID);
}
if ($GLOBALS["USER"]->IsAuthorized() && $arParams["USE_FOLLOW"] == "Y") {
$rsFollow = CSocNetLogFollow::GetList(array("USER_ID" => $GLOBALS["USER"]->GetID(), "CODE" => "**"), array("TYPE"));
if ($arFollow = $rsFollow->Fetch()) {
$arResult["FOLLOW_DEFAULT"] = $arFollow["TYPE"];
} else {
$arResult["FOLLOW_DEFAULT"] = COption::GetOptionString("socialnetwork", "follow_default_type", "Y");
}
}
$this->IncludeComponentTemplate();
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php
示例15: intval
}
$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"] : "**";
$bNeedSetTraffic = CSocNetLogComponent::isSetTrafficNeeded(array("PAGE_NUMBER" => $arResult["PAGE_NUMBER"], "GROUP_CODE" => $groupCode, "TRAFFIC_LAST_DATE_TS" => $arLastPageStart['TRAFFIC_LAST_DATE_TS']));
CSocNetLogPages::Set($user_id, $dateLastPage, $arParams["PAGE_SIZE"], $arResult["PAGE_NUMBER"], SITE_ID, $groupCode, $bNeedSetTraffic ? ($arLastPageStart['TRAFFIC_AVG'] + $dateFirstPageTS - $arResult["dateLastPageTS"]) / ($arLastPageStart['TRAFFIC_CNT'] + 1) : false, $bNeedSetTraffic ? $arLastPageStart['TRAFFIC_CNT'] + 1 : false);
}
} else {
$arResult["NEED_AUTH"] = "Y";
}
if (!isset($arResult["FatalError"]) && $GLOBALS["USER"]->IsAuthorized() && !$arResult["AJAX_CALL"]) {
$cache = new CPHPCache();
$cache_id = "log_form_comments" . serialize($arParams["COMMENT_PROPERTY"]);
$cache_path = "/sonet/log_form/comments";
if (defined("BX_COMP_MANAGED_CACHE")) {
$ttl = 2592000;
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php
示例16: foreach
$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);
}
}
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:im.ajax.php
示例17: 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
示例18: SetUnreadCounter
public static function SetUnreadCounter($userId)
{
return false;
global $DB;
$userId = intval($userId);
if ($userId <= 0)
return false;
$sqlCounter = "SELECT COUNT(M.ID) as CNT
FROM b_im_message M
INNER JOIN b_im_relation R1 ON M.ID > R1.LAST_ID AND M.CHAT_ID = R1.CHAT_ID AND R1.USER_ID != M.AUTHOR_ID
WHERE R1.USER_ID = ".$userId." AND R1.MESSAGE_TYPE = '".IM_MESSAGE_PRIVATE."' AND R1.STATUS < ".IM_STATUS_READ;
$dbRes = $DB->Query($sqlCounter, false, "File: ".__FILE__."<br>Line: ".__LINE__);
if ($row = $dbRes->Fetch())
CUserCounter::Set($userId, 'im_message_v2', $row['CNT'], '**', false);
else
CUserCounter::Set($userId, 'im_message_v2', 0, '**', false);
return true;
}
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:22,代码来源:im_message.php
示例19: Synchronize
public function Synchronize()
{
$currentDay = time() + CTimeZone::GetOffset();
$currentDayEnd = ConvertTimeStamp(mktime(23, 59, 59, date('n', $currentDay), date('j', $currentDay), date('Y', $currentDay)), 'FULL', SITE_ID);
$count = 0;
if ($this->typeID === self::CurrentActivies) {
//Count of open user activities (start time: before tomorrow)
$filter = array('RESPONSIBLE_ID' => $this->userID, 'COMPLETED' => 'N', '<=START_TIME' => $currentDayEnd);
$count = CCrmActivity::GetCount($filter);
} elseif ($this->typeID === self::CurrentCompanyActivies) {
$count = CCrmActivity::GetCurrentQuantity($this->userID, CCrmOwnerType::Company);
} elseif ($this->typeID === self::CurrentContactActivies) {
$count = CCrmActivity::GetCurrentQuantity($this->userID, CCrmOwnerType::Contact);
} elseif ($this->typeID === self::CurrentLeadActivies) {
$count = CCrmActivity::GetCurrentQuantity($this->userID, CCrmOwnerType::Lead);
if (CCrmUserCounterSettings::GetValue(CCrmUserCounterSettings::ReckonActivitylessItems, true)) {
$leadTable = CCrmLead::TABLE_NAME;
$activityTable = CCrmActivity::USER_ACTIVITY_TABLE_NAME;
$statusStr = "'CONVERTED'";
$statusCount = 1;
$statuses = self::GetStatusList('STATUS');
$isFound = false;
foreach ($statuses as &$status) {
if (!$isFound) {
$isFound = $status['STATUS_ID'] === 'CONVERTED';
} else {
$statusStr .= ",'{$status['STATUS_ID']}'";
$statusCount++;
// Foolproof
if ($statusCount === 10) {
break;
}
}
}
unset($status);
global $DBType;
$sqlData = array('FROM' => '', 'WHERE' => "l.ASSIGNED_BY_ID = {$this->userID} AND l.STATUS_ID NOT IN({$statusStr}) AND l.ID NOT IN(SELECT a.OWNER_ID FROM {$activityTable} a WHERE a.USER_ID = 0 AND a.OWNER_TYPE_ID = 1)", 'GROUPBY' => '');
$count += CSqlUtil::GetRowCount($sqlData, $leadTable, 'l', $DBType);
}
} elseif ($this->typeID === self::CurrentDealActivies) {
$count = CCrmActivity::GetCurrentQuantity($this->userID, CCrmOwnerType::Deal);
if (CCrmUserCounterSettings::GetValue(CCrmUserCounterSettings::ReckonActivitylessItems, true)) {
$dealTable = CCrmDeal::TABLE_NAME;
$activityTable = CCrmActivity::USER_ACTIVITY_TABLE_NAME;
$stageStr = "'WON'";
$stageCount = 1;
$stages = self::GetStatusList('DEAL_STAGE');
$isFound = false;
foreach ($stages as &$stage) {
if (!$isFound) {
$isFound = $stage['STATUS_ID'] === 'WON';
} else {
$stageStr .= ",'{$stage['STATUS_ID']}'";
$stageCount++;
// Foolproof
if ($stageCount === 10) {
break;
}
}
}
unset($stage);
global $DB;
$dbResult = $DB->Query("SELECT COUNT(d.ID) AS CNT FROM {$dealTable} d WHERE d.ASSIGNED_BY_ID = {$this->userID} AND d.STAGE_ID NOT IN({$stageStr}) AND d.ID NOT IN(SELECT a.OWNER_ID FROM {$activityTable} a WHERE a.USER_ID = 0 AND a.OWNER_TYPE_ID = 2)", false, 'File: ' . __FILE__ . '<br/>Line: ' . __LINE__);
$result = $dbResult->Fetch();
$count += is_array($result) ? intval($result['CNT']) : 0;
}
} elseif ($this->typeID === self::CurrentQuoteActivies) {
$count = 0;
if (CCrmUserCounterSettings::GetValue(CCrmUserCounterSettings::ReckonActivitylessItems, true)) {
$quoteTable = CCrmQuote::TABLE_NAME;
$statusStr = "'APPROVED'";
$statusCount = 1;
$statuses = self::GetStatusList('QUOTE_STATUS');
$isFound = false;
foreach ($statuses as &$status) {
if (!$isFound) {
$isFound = $status['STATUS_ID'] === 'APPROVED';
} else {
$statusStr .= ",'{$status['STATUS_ID']}'";
$statusCount++;
// Foolproof
if ($statusCount === 10) {
break;
}
}
}
unset($status);
global $DB;
$currentDay = time() + CTimeZone::GetOffset();
$currentDayEnd = ConvertTimeStamp(mktime(23, 59, 59, date('n', $currentDay), date('j', $currentDay), date('Y', $currentDay)), 'FULL', SITE_ID);
$currentDayEnd = $DB->CharToDateFunction($DB->ForSql($currentDayEnd), 'FULL');
$dbResult = $DB->Query("SELECT COUNT(q.ID) AS CNT FROM {$quoteTable} q WHERE q.ASSIGNED_BY_ID = {$this->userID} AND q.CLOSEDATE IS NOT NULL AND q.CLOSEDATE <= {$currentDayEnd} AND q.STATUS_ID NOT IN ({$statusStr})", false, 'File: ' . __FILE__ . '<br/>Line: ' . __LINE__);
$result = $dbResult->Fetch();
$count += is_array($resul
|
请发表评论