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


PHP CSocNetLog::GetByID方法代码示例

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


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

示例1: SetForSonet

 function SetForSonet($logID, $entity_type, $entity_id, $feature, $operation, $bNew = false)
 {
     $bFlag = true;
     if (!$bNew) {
         $rsRights = CSocNetLogRights::GetList(array(), array("LOG_ID" => $logID));
         if ($arRights = $rsRights->Fetch()) {
             $bFlag = false;
         }
     }
     if ($bFlag) {
         $bExtranet = false;
         $perm = CSocNetFeaturesPerms::GetOperationPerm($entity_type, $entity_id, $feature, $operation);
         if ($perm) {
             if (CModule::IncludeModule("extranet") && ($extranet_site_id = CExtranet::GetExtranetSiteID())) {
                 $arLogSites = array();
                 $rsLogSite = CSocNetLog::GetSite($logID);
                 while ($arLogSite = $rsLogSite->Fetch()) {
                     $arLogSites[] = $arLogSite["LID"];
                 }
                 if (in_array($extranet_site_id, $arLogSites)) {
                     $bExtranet = true;
                 }
             }
             if ($bExtranet) {
                 if ($entity_type == SONET_ENTITY_GROUP && $perm == SONET_ROLES_OWNER) {
                     CSocNetLogRights::Add($logID, array("SA", "S" . SONET_ENTITY_GROUP . $entity_id, "S" . SONET_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_OWNER));
                 } elseif ($entity_type == SONET_ENTITY_GROUP && $perm == SONET_ROLES_MODERATOR) {
                     CSocNetLogRights::Add($logID, array("SA", "S" . SONET_ENTITY_GROUP . $entity_id, "S" . SONET_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_OWNER, "S" . SONET_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_MODERATOR));
                 } elseif ($entity_type == SONET_ENTITY_GROUP && in_array($perm, array(SONET_ROLES_USER, SONET_ROLES_AUTHORIZED, SONET_ROLES_ALL))) {
                     CSocNetLogRights::Add($logID, array("SA", "S" . SONET_ENTITY_GROUP . $entity_id, "S" . SONET_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_OWNER, "S" . SONET_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_MODERATOR, "S" . SONET_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_USER));
                 } elseif ($entity_type == SONET_ENTITY_USER && $perm == SONET_RELATIONS_TYPE_NONE) {
                     CSocNetLogRights::Add($logID, array("SA", "U" . $entity_id));
                 } elseif ($entity_type == SONET_ENTITY_USER && in_array($perm, array(SONET_RELATIONS_TYPE_FRIENDS, SONET_RELATIONS_TYPE_FRIENDS2, SONET_RELATIONS_TYPE_AUTHORIZED, SONET_RELATIONS_TYPE_ALL))) {
                     $arCode = array("SA");
                     $arLog = CSocNetLog::GetByID($logID);
                     if ($arLog) {
                         $dbUsersInGroup = CSocNetUserToGroup::GetList(array(), array("USER_ID" => $arLog["USER_ID"], "<=ROLE" => SONET_ROLES_USER, "GROUP_SITE_ID" => $extranet_site_id, "GROUP_ACTIVE" => "Y"), false, false, array("ID", "GROUP_ID"));
                         while ($arUsersInGroup = $dbUsersInGroup->Fetch()) {
                             if (!in_array("S" . SONET_ENTITY_GROUP . $arUsersInGroup["GROUP_ID"] . "_" . SONET_ROLES_USER, $arCode)) {
                                 $arCode = array_merge($arCode, array("S" . SONET_ENTITY_GROUP . $arUsersInGroup["GROUP_ID"] . "_" . SONET_ROLES_OWNER, "S" . SONET_ENTITY_GROUP . $arUsersInGroup["GROUP_ID"] . "_" . SONET_ROLES_MODERATOR, "S" . SONET_ENTITY_GROUP . $arUsersInGroup["GROUP_ID"] . "_" . SONET_ROLES_USER));
                             }
                         }
                         CSocNetLogRights::Add($logID, $arCode);
                     }
                 }
             } else {
                 if ($entity_type == SONET_ENTITY_GROUP && $perm == SONET_ROLES_OWNER) {
                     CSocNetLogRights::Add($logID, array("SA", "S" . SONET_ENTITY_GROUP . $entity_id, "S" . SONET_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_OWNER));
                 } elseif ($entity_type == SONET_ENTITY_GROUP && $perm == SONET_ROLES_MODERATOR) {
                     CSocNetLogRights::Add($logID, array("SA", "S" . SONET_ENTITY_GROUP . $entity_id, "S" . SONET_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_OWNER, "S" . SONET_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_MODERATOR));
                 } elseif ($entity_type == SONET_ENTITY_GROUP && $perm == SONET_ROLES_USER) {
                     CSocNetLogRights::Add($logID, array("SA", "S" . SONET_ENTITY_GROUP . $entity_id, "S" . SONET_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_OWNER, "S" . SONET_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_MODERATOR, "S" . SONET_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_USER));
                 } elseif ($entity_type == SONET_ENTITY_USER && in_array($perm, array(SONET_RELATIONS_TYPE_FRIENDS, SONET_RELATIONS_TYPE_FRIENDS2))) {
                     $arCodes = array("SA", "U" . $entity_id, "S" . $entity_type . $entity_id . "_" . SONET_RELATIONS_TYPE_FRIENDS);
                     if ($perm == SONET_RELATIONS_TYPE_FRIENDS2) {
                         $arCodes[] = "S" . $entity_type . $entity_id . "_" . SONET_RELATIONS_TYPE_FRIENDS2;
                     }
                     CSocNetLogRights::Add($logID, $arCodes);
                 } elseif ($entity_type == SONET_ENTITY_USER && $perm == SONET_RELATIONS_TYPE_NONE) {
                     CSocNetLogRights::Add($logID, array("SA", "U" . $entity_id));
                 } elseif ($entity_type == SONET_ENTITY_GROUP && $perm == SONET_ROLES_AUTHORIZED) {
                     CSocNetLogRights::Add($logID, array("SA", "S" . $entity_type . $entity_id, "AU"));
                 } elseif ($entity_type == SONET_ENTITY_USER && $perm == SONET_RELATIONS_TYPE_AUTHORIZED) {
                     CSocNetLogRights::Add($logID, array("SA", "AU"));
                 } elseif ($entity_type == SONET_ENTITY_GROUP && $perm == SONET_ROLES_ALL) {
                     CSocNetLogRights::Add($logID, array("SA", "S" . $entity_type . $entity_id, "G2"));
                 } elseif ($entity_type == SONET_ENTITY_USER && $perm == SONET_RELATIONS_TYPE_ALL) {
                     CSocNetLogRights::Add($logID, array("SA", "G2"));
                 }
             }
         }
     }
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:73,代码来源:log_rights.php

示例2: intval

				}
				
				if (strlen($rating_entity_type) > 0)
					$arResult["arComments"][$key]["EVENT_FORMATTED"]["ALLOW_VOTE"] = CRatings::CheckAllowVote(
						array(
							"ENTITY_TYPE_ID" => $rating_entity_type,
							"OWNER_ID" => $arResult["arComments"][$key]["EVENT"]["USER_ID"]
						)
					);
			}
		}
	}
	elseif ($action == "change_favorites" && $GLOBALS["USER"]->IsAuthorized())
	{
		$log_id = intval($_REQUEST["log_id"]);
		if ($arLog = CSocNetLog::GetByID($log_id))
		{
			if ($strRes = CSocNetLogFavorites::Change($GLOBALS["USER"]->GetID(), $log_id))
			{
				if ($strRes == "Y")
					CSocNetLogFollow::Set($GLOBALS["USER"]->GetID(), "L".$log_id, "Y");
				$arResult["bResult"] = $strRes;
			}
			else
			{
				if($e = $GLOBALS["APPLICATION"]->GetException())
					$arResult["strMessage"] = $e->GetString();
				else
					$arResult["strMessage"] = GetMessage("SONET_LOG_FAVORITES_CANNOT_CHANGE");
				$arResult["bResult"] = "E";
			}
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:31,代码来源:ajax.php

示例3: OnAddRatingVote

 public static function OnAddRatingVote($rating_vote_id, $arRatingFields)
 {
     if (CModule::IncludeModule("socialnetwork") && CModule::IncludeModule("im")) {
         $arData = CSocNetLogTools::GetDataFromRatingEntity($arRatingFields["ENTITY_TYPE_ID"], $arRatingFields["ENTITY_ID"], false);
         if (is_array($arData) && isset($arData["LOG_ID"]) && intval($arData["LOG_ID"]) > 0) {
             if ($arRatingFields["ENTITY_TYPE_ID"] != "LOG_COMMENT" && ($arLog = CSocNetLog::GetByID($arData["LOG_ID"])) && intval($arLog['USER_ID']) != intval($arRatingFields['USER_ID']) && isset($arLog["ENTITY_TYPE"]) && in_array($arLog["ENTITY_TYPE"], CCrmLiveFeedEntity::GetAll())) {
                 $title = self::GetNotifyEntryTitle($arLog, "LIKE");
                 if (strlen($title) > 0) {
                     if (!isset($arRatingFields["PATH_TO_LOG_ENTRY"]) || strlen($arRatingFields["PATH_TO_LOG_ENTRY"]) <= 0) {
                         $arRatingFields["PATH_TO_LOG_ENTRY"] = '/crm/stream/?log_id=#log_id#';
                     }
                     $url = str_replace(array("#log_id#"), array($arLog["ID"]), $arRatingFields["PATH_TO_LOG_ENTRY"]);
                     $serverName = (CMain::IsHTTPS() ? "https" : "http") . "://" . (defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0 ? SITE_SERVER_NAME : COption::GetOptionString("main", "server_name", ""));
                     $arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => intval($arLog['USER_ID']), "FROM_USER_ID" => intval($arRatingFields['USER_ID']), "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "main", "NOTIFY_EVENT" => "rating_vote", "NOTIFY_TAG" => "RATING|" . ($arRatingFields['VALUE'] >= 0 ? "" : "DL|") . $arRatingFields['ENTITY_TYPE_ID'] . "|" . $arRatingFields['ENTITY_ID'], "NOTIFY_MESSAGE" => GetMessage("CRM_LF_LIKE_IM_NOTIFY", array("#title#" => "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($title) . "</a>")), "NOTIFY_MESSAGE_OUT" => GetMessage("CRM_LF_LIKE_IM_NOTIFY", array("#title#" => htmlspecialcharsbx($title))) . " (" . $serverName . $url . ")");
                     CIMNotify::Add($arMessageFields);
                 }
             }
         }
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:20,代码来源:livefeed.php

示例4: GetSubSelect

 function GetSubSelect($entityId, $entity_type = false, $entity_id = false, $event_id = false, $created_by_id = false, $arOfEntities = false, $arAdmin = false, $transport = false, $visible = "Y", $type = "L", $params = array(), $bDecrement = false, $bForAllAccess = false)
 {
     global $DB;
     if (is_array($entityId) && isset($entityId["LOG_ID"])) {
         $arFields = $entityId;
         $entityId = intval($arFields["LOG_ID"]);
         $entity_type = isset($arFields["ENTITY_TYPE"]) ? $arFields["ENTITY_TYPE"] : false;
         $entity_id = isset($arFields["ENTITY_ID"]) ? $arFields["ENTITY_ID"] : false;
         $event_id = isset($arFields["EVENT_ID"]) ? $arFields["EVENT_ID"] : false;
         $created_by_id = isset($arFields["CREATED_BY_ID"]) ? $arFields["CREATED_BY_ID"] : false;
         $arOfEntities = isset($arFields["ENTITIES"]) ? $arFields["ENTITIES"] : false;
         $transport = isset($arFields["TRANSPORT"]) ? $arFields["TRANSPORT"] : false;
         $visible = isset($arFields["VISIBLE"]) ? $arFields["VISIBLE"] : "Y";
         $type = isset($arFields["TYPE"]) ? $arFields["TYPE"] : "L";
         $code = isset($arFields["CODE"]) ? $arFields["CODE"] : false;
         $params = isset($arFields["PARAMS"]) ? $arFields["PARAMS"] : array();
         $bDecrement = isset($arFields["DECREMENT"]) ? $arFields["DECREMENT"] : false;
         $bMultiple = isset($arFields["MULTIPLE"]) && $arFields["MULTIPLE"] == "Y";
         $IsForAllAccessOnly = false;
         if (isset($arFields["FOR_ALL_ACCESS_ONLY"])) {
             $IsForAllAccessOnly = $arFields["FOR_ALL_ACCESS_ONLY"] ? "Y" : "N";
         }
         $bForAllAccess = $IsForAllAccessOnly == "Y" ? true : (isset($arFields["FOR_ALL_ACCESS"]) ? $arFields["FOR_ALL_ACCESS"] : false);
         $tagSet = isset($arFields["TAG_SET"]) ? $arFields["TAG_SET"] : false;
     }
     if (intval($entityId) <= 0) {
         return false;
     }
     $arSocNetAllowedSubscribeEntityTypesDesc = CSocNetAllowed::GetAllowedEntityTypesDesc();
     $bGroupCounters = $type === "group";
     $params = is_array($params) ? $params : array();
     $params['CODE'] = !empty($params['CODE']) ? $params['CODE'] : ($code ? $code : ($bGroupCounters ? "SLR0.GROUP_CODE" : "'**" . ($bMultiple ? $type . $entityId : "") . "'"));
     if ($type == "L" && ($arLog = CSocNetLog::GetByID($entityId))) {
         $logId = $entityId;
         $entity_type = $arLog["ENTITY_TYPE"];
         $entity_id = $arLog["ENTITY_ID"];
         $event_id = $arLog["EVENT_ID"];
         $created_by_id = $arLog["USER_ID"];
         $log_user_id = $arLog["USER_ID"];
     } elseif ($type == "LC" && ($arLogComment = CSocNetLogComments::GetByID($entityId))) {
         $entity_type = $arLogComment["ENTITY_TYPE"];
         $entity_id = $arLogComment["ENTITY_ID"];
         $event_id = $arLogComment["EVENT_ID"];
         $created_by_id = $arLogComment["USER_ID"];
         $logId = $arLogComment["LOG_ID"];
         // recalculate log_id
         $log_user_id = $arLogComment["LOG_USER_ID"];
     } else {
         $logId = $entityId;
     }
     if (!in_array($entity_type, CSocNetAllowed::GetAllowedEntityTypes()) || intval($entity_id) <= 0 || strlen($event_id) <= 0) {
         return false;
     }
     if (!$arOfEntities) {
         if (array_key_exists($entity_type, $arSocNetAllowedSubscribeEntityTypesDesc) && array_key_exists("HAS_MY", $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]) && $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]["HAS_MY"] == "Y" && array_key_exists("CLASS_OF", $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]) && array_key_exists("METHOD_OF", $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]) && strlen($arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]["CLASS_OF"]) > 0 && strlen($arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]["METHOD_OF"]) > 0 && method_exists($arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]["CLASS_OF"], $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]["METHOD_OF"])) {
             $arOfEntities = call_user_func(array($arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]["CLASS_OF"], $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]["METHOD_OF"]), $entity_id);
         } else {
             $arOfEntities = array();
         }
     }
     if ((!defined("DisableSonetLogVisibleSubscr") || DisableSonetLogVisibleSubscr !== true) && $visible && strlen($visible) > 0) {
         $key_res = CSocNetGroup::GetFilterOperation($visible);
         $strField = $key_res["FIELD"];
         $strNegative = $key_res["NEGATIVE"];
         $strOperation = $key_res["OPERATION"];
         $visibleFilter = "AND (" . ($strNegative == "Y" ? " SLE.VISIBLE IS NULL OR NOT " : "") . "(SLE.VISIBLE " . $strOperation . " '" . $DB->ForSql($strField) . "'))";
         $transportFilter = "";
     } else {
         $visibleFilter = "";
         if ($transport && strlen($transport) > 0) {
             $key_res = CSocNetGroup::GetFilterOperation($transport);
             $strField = $key_res["FIELD"];
             $strNegative = $key_res["NEGATIVE"];
             $strOperation = $key_res["OPERATION"];
             $transportFilter = "AND (" . ($strNegative == "Y" ? " SLE.TRANSPORT IS NULL OR NOT " : "") . "(SLE.TRANSPORT " . $strOperation . " '" . $DB->ForSql($strField) . "'))";
         } else {
             $transportFilter = "";
         }
     }
     if ($type == "LC" && (!defined("DisableSonetLogFollow") || DisableSonetLogFollow !== true)) {
         $default_follow = COption::GetOptionString("socialnetwork", "follow_default_type", "Y");
         if ($default_follow == "Y") {
             $followJoin = " LEFT JOIN b_sonet_log_follow LFW ON LFW.USER_ID = U.ID AND (LFW.CODE = 'L" . $logId . "' OR LFW.CODE = '**') ";
             $followWhere = "AND (LFW.USER_ID IS NULL OR LFW.TYPE = 'Y')";
         } else {
             $followJoin = " \n\t\t\t\t\tINNER JOIN b_sonet_log_follow LFW ON LFW.USER_ID = U.ID AND (LFW.CODE = 'L" . $logId . "' OR LFW.CODE = '**')\n\t\t\t\t\tLEFT JOIN b_sonet_log_follow LFW2 ON LFW2.USER_ID = U.ID AND (LFW2.CODE = 'L" . $logId . "' AND LFW2.TYPE = 'N')\n\t\t\t\t";
             $followWhere = "\n\t\t\t\t\tAND (LFW.USER_ID IS NOT NULL AND LFW.TYPE = 'Y')\n\t\t\t\t\tAND LFW2.USER_ID IS NULL\n\t\t\t\t";
         }
     }
     $strOfEntities = is_array($arOfEntities) && count($arOfEntities) > 0 ? "U.ID IN (" . implode(",", $arOfEntities) . ")" : "";
     $strSQL = "\n\t\tSELECT DISTINCT\n\t\t\tU.ID as ID\n\t\t\t," . ($bDecrement ? "-1" : "1") . " as CNT\n\t\t\t," . $DB->IsNull("SLS.SITE_ID", "'**'") . " as SITE_ID\n\t\t\t," . $params['CODE'] . " as CODE,\n\t\t\t0 as SENT\n\t\t\t" . ($tagSet ? ", '" . $DB->ForSQL($tagSet) . "' as TAG" : "") . "\n\t\tFROM\n\t\t\tb_user U \n\t\t\tINNER JOIN b_sonet_log_right SLR ON SLR.LOG_ID = " . $logId . "\n\t\t\t" . ($bGroupCounters ? "INNER JOIN b_sonet_log_right SLR0 ON SLR0.LOG_ID = SLR.LOG_ID " : "") . "\n\t\t\t" . (!$bForAllAccess ? "INNER JOIN b_user_access UA ON UA.USER_ID = U.ID" : "") . "\n\t\t\tLEFT JOIN b_sonet_log_site SLS ON SLS.LOG_ID = SLR.LOG_ID\n\t\t\t" . (strlen($followJoin) > 0 ? $followJoin : "") . "\n\t\t\t" . (!$bGroupCounters && !IsModuleInstalled("intranet") ? "LEFT JOIN b_sonet_log_smartfilter SLSF ON SLSF.USER_ID = U.ID " : "") . "\n\t\t\t\n\t\tWHERE\n\t\t\tU.ACTIVE = 'Y'\n\t\t\tAND U.LAST_ACTIVITY_DATE IS NOT NULL\n\t\t\tAND\tU.LAST_ACTIVITY_DATE > " . CSocNetLogCounter::dbWeeksAgo(2) . "\n\t\t\t" . (($type == "LC" || array_key_exists("USE_CB_FILTER", $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]) && $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]["USE_CB_FILTER"] == "Y") && intval($created_by_id) > 0 ? "AND U.ID <> " . $created_by_id : "") . "\n\t\t\t" . ($bGroupCounters ? "AND (SLR0.GROUP_CODE like 'SG%' AND SLR0.GROUP_CODE NOT LIKE 'SG%\\_%')" : "") . (!$bGroupCounters && !IsModuleInstalled("intranet") ? COption::GetOptionString("socialnetwork", "sonet_log_smart_filter", "N") == "Y" ? "\n\t\t\t\t\t\t\t\tAND (\n\t\t\t\t\t\t\t\t\t0=1 \n\t\t\t\t\t\t\t\t\tOR (\n\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\tSLSF.USER_ID IS NULL \n\t\t\t\t\t\t\t\t\t\t\tOR SLSF.TYPE = 'Y'\n\t\t\t\t\t\t\t\t\t\t) \n\t\t\t\t\t\t\t\t\t\t" . (!$bForAllAccess ? "AND (UA.ACCESS_CODE = SLR.GROUP_CODE)" : "") . "\n\t\t\t\t\t\t\t\t\t\tAND (\n\t\t\t\t\t\t\t\t\t\t\tSLR.GROUP_CODE LIKE 'SG%'\n\t\t\t\t\t\t\t\t\t\t\tOR SLR.GROUP_CODE = 'U" . $log_user_id . "' \n\t\t\t\t\t\t\t\t\t\t\tOR SLR.GROUP_CODE = " . $DB->Concat("'U'", $DB->type == "MSSQL" ? "CAST(U.ID as varchar(17))" : "U.ID") . " \n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\tOR (\n\t\t\t\t\t\t\t\t\t\tSLSF.TYPE <> 'Y'\n\t\t\t\t\t\t\t\t\t\tAND (\n\t\t\t\t\t\t\t\t\t\t\tSLR.GROUP_CODE IN ('AU', 'G2')\n\t\t\t\t\t\t\t\t\t\t\t" . (!$bForAllAccess ? "OR (UA.ACCESS_CODE = SLR.GROUP_CODE)" : "") . "\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t" : "\n\t\t\t\t\t\t\t\tAND (\n\t\t\t\t\t\t\t\t\t0=1 \n\t\t\t\t\t\t\t\t\tOR (\n\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\tSLSF.USER_ID IS NULL \n\t\t\t\t\t\t\t\t\t\t\tOR SLSF.TYPE <> 'Y'\n\t\t\t\t\t\t\t\t\t\t) \n\t\t\t\t\t\t\t\t\t\tAND (\n\t\t\t\t\t\t\t\t\t\t\tSLR.GROUP_CODE IN ('AU', 'G2')\n\t\t\t\t\t\t\t\t\t\t\t" . ($bForAllAccess ? "" : " OR (UA.ACCESS_CODE = SLR.GROUP_CODE)") . "\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\tOR (\n\t\t\t\t\t\t\t\t\t\tSLSF.TYPE = 'Y' \n\t\t\t\t\t\t\t\t\t\t" . ($bForAllAccess ? "" : "AND (UA.ACCESS_CODE = SLR.GROUP_CODE)") . "\n\t\t\t\t\t\t\t\t\t\tAND (\n\t\t\t\t\t\t\t\t\t\t\tSLR.GROUP_CODE LIKE 'SG%'\n\t\t\t\t\t\t\t\t\t\t\tOR SLR.GROUP_CODE = 'U" . $log_user_id . "'\n\t\t\t\t\t\t\t\t\t\t\tOR SLR.GROUP_CODE = " . $DB->Concat("'U'", $DB->type == "MSSQL" ? "CAST(U.ID as varchar(17))" : "U.ID") . " \n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t" : "\n\t\t\t\t\t\tAND (\n\t\t\t\t\t\t\t0=1\n\t\t\t\t\t\t\t" . ($IsForAllAccessOnly != "N" || $bForAllAccess ? "OR (SLR.GROUP_CODE IN ('AU', 'G2'))" : "") . "\n\t\t\t\t\t\t\t" . (!$bForAllAccess && $IsForAllAccessOnly != "Y" ? " OR (UA.ACCESS_CODE = SLR.GROUP_CODE) " : "") . "\n\t\t\t\t\t\t)\n\t\t\t\t\t") . " " . (strlen($followWhere) > 0 ? $followWhere : "") . "\n\t\t";
     if ($bGroupCounters) {
         return $strSQL;
     }
     if (strlen($visibleFilter) > 0 || strlen($transportFilter) > 0) {
         $strSQL .= "\n\t\t\t\tAND\t\n\t\t\t\t(\n\t\t\t\t\tEXISTS(\n\t\t\t\t\t\tSELECT ID\n\t\t\t\t\t\tFROM b_sonet_log_events SLE\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tSLE.USER_ID = U.ID\n\t\t\t\t\t\t\tAND SLE.ENTITY_TYPE = '" . $entity_type . "'\n\t\t\t\t\t\t\tAND SLE.ENTITY_CB = 'N'\n\t\t\t\t\t\t\tAND SLE.ENTITY_ID = " . $entity_id . "\n\t\t\t\t\t\t\tAND SLE.EVENT_ID = '" . $event_id . "'\n\t\t\t\t\t\t\t" . $transportFilter . "\n\t\t\t\t\t\t\t" . $visibleFilter . "\n\t\t\t\t\t)";
         if (array_key_exists("USE_CB_FILTER", $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]) && $arSocNetAllowedSubscribeEntityTypesDesc[$entity_type]["USE_CB_FILTER"] == "Y" && intval($created_by_id) > 0) {
             $strSQL .= "\n\t\t\t\tOR\n\t\t\t\t(\n\t\t\t\t\tEXISTS(\n\t\t\t\t\t\tSELECT ID\n\t\t\t\t\t\tFROM b_sonet_log_events SLE\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tSLE.USER_ID = U.ID\n\t\t\t\t\t\t\tAND SLE.ENTITY_CB = 'Y'\n\t\t\t\t\t\t\tAND SLE.ENTITY_ID = " . $created_by_id . "\n\t\t\t\t\t\t\tAND SLE.EVENT_ID = '" . $event_id . "'\n\t\t\t\t\t\t\t" . $transportFilter . "\n\t\t\t\t\t\t\t" . $visibleFilter . "\n\t\t\t\t\t)\n\t\t\t\t)";
         }
         $strSQL .= "\n\t\t\tOR\n\t\t\t(\n\t\t\t\t(\n\t\t\t\t\tNOT EXISTS(\n\t\t\t\t\t\tSELECT ID\n\t\t\t\t\t\tFROM b_sonet_log_events SLE\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tSLE.USER_ID = U.ID\n\t\t\t\t\t\t\tAND SLE.ENTITY_TYPE = '" . $entity_type . "'\n\t\t\t\t\t\t\tAND SLE.ENTITY_CB = 'N'\n\t\t\t\t\t\t\tAND SLE.ENTITY_ID = " . $entity_id . "\n\t\t\t\t\t\t\tAND SLE.EVENT_ID = '" . $event_id . "'\n\t\t\t\t\t)\n\t\t\t\t\tOR\n\t\t\t\t\tEXISTS(\n\t\t\t\t\t\tSELECT ID\n\t\t\t\t\t\tFROM b_sonet_log_events SLE\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tSLE.USER_ID = U.ID\n\t\t\t\t\t\t\tAND SLE.ENTITY_TYPE = '" . $entity_type . "'\n\t\t\t\t\t\t\tAND SLE.ENTITY_CB = 'N'\n\t\t\t\t\t\t\tAND SLE.ENTITY_ID = " . $entity_id . "\n\t\t\t\t\t\t\tAND SLE.EVENT_ID = '" . $event_id . "'\n\t\t\t\t\t\t\tAND " . ($visibleFilter ? "SLE.VISIBLE = 'I'" : "SLE.TRANSPORT = 'I'") . "\n\t\t\t\t\t)\n\t\t\t\t)";
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:log_counter.php

示例5: GetSubSelect

	public static function GetSubSelect($log_id, $entity_type = false, $entity_id = false, $event_id = false, $created_by_id = false, $arOfEntities = false, $arAdmin = false, $transport = false, $visible = "Y", $type = "L", $params = array())
	{
		global $DB;

		if (intval($log_id) <= 0)
			return false;

		$bGroupCounters = ($type === "group");
		$params = (is_array($params) ? $params : array());
		$params['CODE'] = (!empty($params['CODE']) ? $params['CODE'] : ($bGroupCounters ? "SLR0.GROUP_CODE" : "'**'"));

		if ($type == "L" && ($arLog = CSocNetLog::GetByID($log_id)))
		{
			$entity_type = $arLog["ENTITY_TYPE"];
			$entity_id = $arLog["ENTITY_ID"];
			$event_id = $arLog["EVENT_ID"];
			$created_by_id = $arLog["USER_ID"];
			$log_user_id = $arLog["USER_ID"];
		}
		elseif ($type == "LC" && ($arLogComment = CSocNetLogComments::GetByID($log_id)))
		{
			$entity_type = $arLogComment["ENTITY_TYPE"];
			$entity_id = $arLogComment["ENTITY_ID"];
			$event_id = $arLogComment["EVENT_ID"];
			$created_by_id = $arLogComment["USER_ID"];
			$log_id = $arLogComment["LOG_ID"]; // recalculate log_id
			$log_user_id = $arLogComment["LOG_USER_ID"];
		}

		if (!in_array($entity_type, $GLOBALS["arSocNetAllowedSubscribeEntityTypes"]))
			return false;

		if (intval($entity_id) <= 0)
			return false;

		if (strlen($event_id) <= 0)
			return false;

		if (!$arOfEntities)
		{
			if (
				array_key_exists($entity_type, $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"])
				&& array_key_exists("HAS_MY", $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$entity_type])
				&& $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$entity_type]["HAS_MY"] == "Y"
				&& array_key_exists("CLASS_OF", $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$entity_type])
				&& array_key_exists("METHOD_OF", $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$entity_type])
				&& strlen($GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$entity_type]["CLASS_OF"]) > 0
				&& strlen($GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$entity_type]["METHOD_OF"]) > 0
				&& method_exists($GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$entity_type]["CLASS_OF"], $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$entity_type]["METHOD_OF"])
			)
				$arOfEntities = call_user_func(array($GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$entity_type]["CLASS_OF"], $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$entity_type]["METHOD_OF"]), $entity_id);
			else
				$arOfEntities = array();
		}

		if (
			(!defined("DisableSonetLogVisibleSubscr") || DisableSonetLogVisibleSubscr !== true) 
			&& $visible 
			&& strlen($visible) > 0
		)
		{
			$key_res = CSocNetGroup::GetFilterOperation($visible);
			$strField = $key_res["FIELD"];
			$strNegative = $key_res["NEGATIVE"];
			$strOperation = $key_res["OPERATION"];
			$visibleFilter = "AND (".($strNegative == "Y" ? " SLE.VISIBLE IS NULL OR NOT " : "")."(SLE.VISIBLE ".$strOperation." '".$DB->ForSql($strField)."'))";

			$transportFilter = "";
		}
		else
		{
			$visibleFilter = "";

			if ($transport && strlen($transport) > 0)
			{
				$key_res = CSocNetGroup::GetFilterOperation($transport);
				$strField = $key_res["FIELD"];
				$strNegative = $key_res["NEGATIVE"];
				$strOperation = $key_res["OPERATION"];
				$transportFilter = "AND (".($strNegative == "Y" ? " SLE.TRANSPORT IS NULL OR NOT " : "")."(SLE.TRANSPORT ".$strOperation." '".$DB->ForSql($strField)."'))";
			}
			else
				$transportFilter = "";
		}

		if (
			$type == "LC" 
			&& (
				!defined("DisableSonetLogFollow") 
				|| DisableSonetLogFollow !== true)
			)
		{
			$default_follow = COption::GetOptionString("socialnetwork", "follow_default_type", "Y");

			if ($default_follow == "Y")
			{
				$followJoin = " LEFT JOIN b_sonet_log_follow LFW ON LFW.USER_ID = U.ID AND (LFW.CODE = 'L".$log_id."' OR LFW.CODE = '**') ";
				$followWhere = "AND (LFW.USER_ID IS NULL OR LFW.TYPE = 'Y')";
			}
			else
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:101,代码来源:log_counter.php


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