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


PHP CSocNetLog::SendEvent方法代码示例

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


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

示例1: Execute

 public function Execute()
 {
     if (!CModule::IncludeModule("socialnetwork")) {
         CBPActivityExecutionStatus::Closed;
     }
     $rootActivity = $this->GetRootActivity();
     $documentId = $rootActivity->GetDocumentId();
     $documentService = $this->workflow->GetService("DocumentService");
     $document = $documentService->GetDocument($documentId);
     $entityType = $this->EntityType;
     if ($entityType == "user") {
         $entityType = SONET_ENTITY_USER;
     } elseif ($entityType == "group") {
         $entityType = SONET_ENTITY_GROUP;
     }
     $USER_ID = false;
     if ($GLOBALS["USER"]->IsAuthorized()) {
         $USER_ID = $GLOBALS["USER"]->GetID();
     }
     $logID = CSocNetLog::Add(array("ENTITY_TYPE" => $entityType, "ENTITY_ID" => $this->EntityId, "EVENT_ID" => $this->Event, "=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "TITLE_TEMPLATE" => $this->LogTitle, "TITLE" => $document["NAME"], "MESSAGE" => nl2br($this->LogText), "TEXT_MESSAGE" => $this->LogText, "URL" => $documentService->GetDocumentAdminPage($documentId), "MODULE_ID" => false, "CALLBACK_FUNC" => false, "USER_ID" => $USER_ID), false);
     if (intval($logID > 0)) {
         CSocNetLog::Update($logID, array("TMP_ID" => $logID));
     }
     CSocNetLog::SendEvent($logID, "SONET_NEW_EVENT", $logID);
     return CBPActivityExecutionStatus::Closed;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:26,代码来源:socnetlogactivity.php

示例2: NewUserMessage

 public static function NewUserMessage($USER_ID)
 {
     global $DB, $APPLICATION;
     if (!CModule::IncludeModule('socialnetwork')) {
         return false;
     }
     $USER_ID = intval($USER_ID);
     if ($USER_ID <= 0) {
         return false;
     }
     $arRights = self::GetRights($USER_ID);
     if (!$arRights) {
         return false;
     }
     $dbRes = CUser::GetByID($USER_ID);
     if ($arUser = $dbRes->Fetch()) {
         $arSoFields = array("ENTITY_TYPE" => SONET_INTRANET_NEW_USER_ENTITY, "EVENT_ID" => SONET_INTRANET_NEW_USER_EVENT_ID, "ENTITY_ID" => $USER_ID, "SOURCE_ID" => $USER_ID, "USER_ID" => $USER_ID, "=LOG_DATE" => $DB->CurrentTimeFunction(), "MODULE_ID" => "intranet", "TITLE_TEMPLATE" => "#TITLE#", "TITLE" => GetMessage('I_NEW_USER_TITLE'), "MESSAGE" => '', "TEXT_MESSAGE" => '', "CALLBACK_FUNC" => false, "SITE_ID" => SITE_ID, "ENABLE_COMMENTS" => "Y", "RATING_TYPE_ID" => "INTRANET_NEW_USER", "RATING_ENTITY_ID" => $USER_ID);
         // check that there wasn't message for this user
         $dbRes = CSocNetLog::GetList(array(), array('ENTITY_TYPE' => $arSoFields['ENTITY_TYPE'], 'ENTITY_ID' => $arSoFields['ENTITY_ID'], 'EVENT_ID' => $arSoFields['EVENT_ID'], 'SOURCE_ID' => $arSoFields['SOURCE_ID']));
         if (!$dbRes->Fetch()) {
             $logID = CSocNetLog::Add($arSoFields, false);
             if (intval($logID) > 0) {
                 CSocNetLog::Update($logID, array("TMP_ID" => $logID));
                 CSocNetLogRights::Add($logID, $arRights);
             }
         }
         if (intval($logID) > 0) {
             CSocNetLog::SendEvent($logID, "SONET_NEW_EVENT", $logID);
         }
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:notify.php

示例3: SendMessage

 public static function SendMessage($ENTRY_ID, $SEND_TYPE = false)
 {
     global $DB, $APPLICATION, $USER;
     $ENTRY_ID = intval($ENTRY_ID);
     if ($ENTRY_ID <= 0) {
         return false;
     }
     $dbEntry = CTimeManEntry::GetList(array(), array("ID" => $ENTRY_ID), false, false, array("ID", "USER_ID", "DATE_START", "USER_GENDER", "INACTIVE_OR_ACTIVATED"));
     if (CModule::IncludeModule("socialnetwork") && ($arEntry = $dbEntry->Fetch())) {
         $arRights = self::GetRights($arEntry["USER_ID"]);
         if (!$arRights) {
             return false;
         }
         $date = strlen($arEntry["DATE_START"]) > 0 ? MakeTimeStamp($arEntry["DATE_START"], CSite::GetDateFormat("FULL", $site_id)) > time() + CTimeZone::GetOffset() ? $DB->CharToDateFunction($arEntry["DATE_START"], "FULL", $site_id) : $DB->CurrentTimeFunction() : $DB->CurrentTimeFunction();
         $arSoFields = array("EVENT_ID" => "timeman_entry", "=LOG_DATE" => $date, "MODULE_ID" => "timeman", "TITLE_TEMPLATE" => "#TITLE#", "TITLE" => GetMessage("TIMEMAN_NOTIFY_TITLE") . $date_text, "MESSAGE" => '', "TEXT_MESSAGE" => '', "CALLBACK_FUNC" => false, "SOURCE_ID" => $ENTRY_ID, "SITE_ID" => SITE_ID, "ENABLE_COMMENTS" => "Y", "PARAMS" => serialize(array("FORUM_ID" => COption::GetOptionInt("timeman", "report_forum_id", ""))));
         $arSoFields["ENTITY_TYPE"] = SONET_TIMEMAN_ENTRY_ENTITY;
         $arSoFields["ENTITY_ID"] = $arEntry["USER_ID"];
         $arSoFields["USER_ID"] = $USER->GetID();
         //$arEntry["USER_ID"];
         $dbRes = CSocNetLog::GetList(array(), array('ENTITY_TYPE' => $arSoFields['ENTITY_TYPE'], 'ENTITY_ID' => $arSoFields['ENTITY_ID'], 'EVENT_ID' => $arSoFields['EVENT_ID'], 'SOURCE_ID' => $arSoFields['SOURCE_ID']));
         $arRes = $dbRes->Fetch();
         $bSend = false;
         if ($arRes) {
             $logID = $arRes['ID'];
             if ($SEND_TYPE != 'A') {
                 $arSoFields["=LOG_UPDATE"] = $date;
                 CSocNetLog::Update($logID, $arSoFields);
                 $bSend = true;
                 if (IsModuleInstalled("im")) {
                     $arEntry["LOG_ID"] = $logID;
                     $arEntry["DATE_TEXT"] = FormatDate("j F", MakeTimeStamp($arEntry["DATE_START"], CSite::GetDateFormat("FULL", SITE_ID)));
                     if ($SEND_TYPE == "U") {
                         self::NotifyImApprove($arEntry);
                     } else {
                         self::NotifyImNew($arEntry);
                     }
                 }
             }
         } else {
             if ($SEND_TYPE != 'U') {
                 $logID = CSocNetLog::Add($arSoFields, false);
                 if (intval($logID) > 0) {
                     CSocNetLog::Update($logID, array("TMP_ID" => $logID));
                     CSocNetLogRights::Add($logID, $arRights);
                     if ($arEntry["INACTIVE_OR_ACTIVATED"] == "Y" && IsModuleInstalled("im")) {
                         $arEntry["LOG_ID"] = $logID;
                         $arEntry["DATE_TEXT"] = FormatDate("j F", MakeTimeStamp($arEntry["DATE_START"], CSite::GetDateFormat("FULL", SITE_ID)));
                         self::NotifyImNew($arEntry);
                     }
                     $bSend = true;
                 }
             }
         }
         if ($bSend && intval($logID) > 0) {
             CSocNetLog::SendEvent($logID, "SONET_NEW_EVENT", $logID);
         }
         return $logID;
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:59,代码来源:timeman_notify.php

示例4: SendEventAgent

	public static function SendEventAgent($ID, $mailTemplate = "SONET_NEW_EVENT", $tmp_id = false)
	{
		if (CSocNetLog::SendEvent($ID, $mailTemplate, $tmp_id, true))
			return "";
		else
			return "CSocNetLog::SendEventAgent(".$ID.", '".$mailTemplate."', ".($tmp_id ? $tmp_id : 'false').");";
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:7,代码来源:log.php

示例5: NotifyError

 private function NotifyError()
 {
     if ($this->arExternalSale == null) {
         $this->arExternalSale = CCrmExternalSale::GetDefaultSettings($this->externalSaleId);
     }
     if (intval($this->arExternalSale["GROUP_ID"]) <= 0) {
         return true;
     }
     static $isSNIncluded = null;
     if ($isSNIncluded === null) {
         $isSNIncluded = CModule::IncludeModule("socialnetwork");
     }
     if (!$isSNIncluded) {
         return;
     }
     $ar = array("#NAME#" => $this->arExternalSale["NAME"], "#URL#" => "/crm/configs/external_sale/", "#DATE#" => date($GLOBALS["DB"]->DateFormatToPHP(FORMAT_DATETIME), time()));
     $message = GetMessage("CRM_GCES_NOTIFY_ERROR_MESSAGE", $ar);
     $arFields = array("EVENT_ID" => "crm_10_errors", "=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "TITLE_TEMPLATE" => "SYSTEM MESSAGE", "TITLE" => GetMessage("CRM_GCES_NOTIFY_ERROR_TITLE", array("#NAME#" => $this->arExternalSale["NAME"])), "MESSAGE" => $message, "TEXT_MESSAGE" => HTMLToTxt($message), "MODULE_ID" => "crm", "CALLBACK_FUNC" => false, "SOURCE_ID" => false, "ENABLE_COMMENTS" => "Y", "ENTITY_TYPE" => SONET_ENTITY_GROUP, "ENTITY_ID" => $this->arExternalSale["GROUP_ID"], "URL" => "");
     $logId = CSocNetLog::Add($arFields, false);
     if (intval($logId) > 0) {
         $arPerms = array("SG" . $this->arExternalSale["GROUP_ID"], "SG" . $this->arExternalSale["GROUP_ID"] . "_A", "SG" . $this->arExternalSale["GROUP_ID"] . "_E", "SG" . $this->arExternalSale["GROUP_ID"] . "_K");
         CSocNetLog::Update($logId, array("TMP_ID" => $logId));
         CSocNetLogRights::Add($logId, $arPerms);
         CSocNetLog::SendEvent($logId, "SONET_NEW_EVENT", $logId);
         return $logId;
     }
     if (($ex = $GLOBALS["APPLICATION"]->GetException()) !== false) {
         $this->AddError($ex->GetID(), $ex->GetString());
     } else {
         $this->AddError("CDA", "Notify error");
     }
     return false;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:33,代码来源:crm_external_sale_import.php

示例6: Add

 function Add($arFields, $bSendEvent = true)
 {
     global $DB;
     $arSocNetAllowedSubscribeEntityTypesDesc = CSocNetAllowed::GetAllowedEntityTypesDesc();
     $arFields1 = array();
     foreach ($arFields as $key => $value) {
         if (substr($key, 0, 1) == "=") {
             $arFields1[substr($key, 1)] = $value;
             unset($arFields[$key]);
         }
     }
     if (!CSocNetLog::CheckFields("ADD", $arFields)) {
         return false;
     } else {
         $arSiteID = array();
         if (array_key_exists("SITE_ID", $arFields)) {
             if (is_array($arFields["SITE_ID"])) {
                 foreach ($arFields["SITE_ID"] as $site_id) {
                     $arSiteID[$site_id] = $DB->ForSQL($site_id);
                 }
             } else {
                 $arSiteID[$arFields["SITE_ID"]] = $DB->ForSQL($arFields["SITE_ID"]);
             }
         }
     }
     if (empty($arSiteID)) {
         unset($arFields["SITE_ID"]);
     } else {
         $arFields["SITE_ID"] = end($arSiteID);
     }
     unset($arFields["LOG_UPDATE"]);
     if (empty($arFields1["LOG_UPDATE"])) {
         $arFields["~LOG_UPDATE"] = $DB->CurrentTimeFunction();
     }
     $arInsert = $DB->PrepareInsert("b_sonet_log", $arFields);
     foreach ($arFields1 as $key => $value) {
         if (strlen($arInsert[0]) > 0) {
             $arInsert[0] .= ", ";
         }
         $arInsert[0] .= $key;
         if (strlen($arInsert[1]) > 0) {
             $arInsert[1] .= ", ";
         }
         $arInsert[1] .= $value;
     }
     $ID = false;
     if (strlen($arInsert[0]) > 0) {
         $strSql = "INSERT INTO b_sonet_log(" . $arInsert[0] . ") " . "VALUES(" . $arInsert[1] . ")";
         $DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         $ID = IntVal($DB->LastID());
         if ($ID > 0 && intval($arFields["USER_ID"]) > 0 && strlen($arFields["ENTITY_TYPE"]) > 0 && array_key_exists($arFields["ENTITY_TYPE"], $arSocNetAllowedSubscribeEntityTypesDesc) && is_array($arSocNetAllowedSubscribeEntityTypesDesc[$arFields["ENTITY_TYPE"]]) && $arSocNetAllowedSubscribeEntityTypesDesc[$arFields["ENTITY_TYPE"]]["USE_CB_FILTER"] == "Y") {
             CSocNetLogFollow::Set($arFields["USER_ID"], "L" . $ID, "Y");
         }
         if ($ID > 0 && $bSendEvent) {
             CSocNetLog::SendEvent($ID, "SONET_NEW_EVENT");
         }
         if ($ID > 0 && !empty($arSiteID)) {
             $DB->Query("\n\t\t\t\t\t\tDELETE FROM b_sonet_log_site WHERE LOG_ID = " . $ID . "\n\t\t\t\t\t", false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
             $DB->Query("\n\t\t\t\t\t\tINSERT INTO b_sonet_log_site(LOG_ID, SITE_ID)\n\t\t\t\t\t\tSELECT " . $ID . ", LID\n\t\t\t\t\t\tFROM b_lang\n\t\t\t\t\t\tWHERE LID IN ('" . implode("', '", $arSiteID) . "')\n\t\t\t\t\t", false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
         }
         if ($ID > 0) {
             $GLOBALS["USER_FIELD_MANAGER"]->Update("SONET_LOG", $ID, $arFields);
         }
     }
     CSocNetLogTools::SetCacheLastLogID("log", $ID);
     return $ID;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:67,代码来源:log.php

示例7: substr

     $workgroups_path = COption::GetOptionString("socialnetwork", "workgroups_page", false, SITE_ID);
     $workgroups_path = "#GROUPS_PATH#" . substr($arParams["~URL_TEMPLATES_MESSAGE"], strlen($workgroups_path), strlen($arParams["~URL_TEMPLATES_MESSAGE"]) - strlen($workgroups_path));
 }
 $arSonetFields = array("ENTITY_TYPE" => $arParams["MODE"] == "GROUP" ? SONET_ENTITY_GROUP : SONET_ENTITY_USER, "ENTITY_ID" => $arParams["MODE"] == "GROUP" ? $arParams["SOCNET_GROUP_ID"] : $arParams["USER_ID"], "EVENT_ID" => "forum", "=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "TITLE_TEMPLATE" => str_replace("#AUTHOR_NAME#", $arResult["MESSAGE"]["AUTHOR_NAME"], GetMessage("SONET_FORUM_LOG_TEMPLATE")), "TITLE" => $arFieldsG["TITLE"], "MESSAGE" => $sText, "TEXT_MESSAGE" => $parser->convert4mail($sText), "URL" => $sURL, "PARAMS" => serialize(array("PATH_TO_MESSAGE" => CComponentEngine::MakePathFromTemplate(!empty($workgroups_path) ? $workgroups_path : $arParams["~URL_TEMPLATES_MESSAGE"], array("TID" => $arParams["TID"])), "PARSED" => "N")), "MODULE_ID" => false, "CALLBACK_FUNC" => false, "SOURCE_ID" => $MID1, "RATING_TYPE_ID" => "FORUM_TOPIC", "RATING_ENTITY_ID" => intval($arParams["TID"]));
 if (intVal($arResult["MESSAGE"]["AUTHOR_ID"]) > 0) {
     $arSonetFields["USER_ID"] = $arResult["MESSAGE"]["AUTHOR_ID"];
 }
 if ($arParams["MESSAGE_TYPE"] == "NEW") {
     if ($arParams["MODE"] == "GROUP") {
         CSocNetGroup::SetLastActivity($arParams["SOCNET_GROUP_ID"]);
     }
     $logID = CSocNetLog::Add($arSonetFields, false);
     if (intval($logID) > 0) {
         CSocNetLog::Update($logID, array("TMP_ID" => $logID));
         CSocNetLogRights::SetForSonet($logID, $arSonetFields["ENTITY_TYPE"], $arSonetFields["ENTITY_ID"], "forum", "view", true);
         CSocNetLog::SendEvent($logID, "SONET_NEW_EVENT", $logID);
     }
 } elseif ($arParams["MESSAGE_TYPE"] == "EDIT") {
     $dbRes = CSocNetLog::GetList(array(), array("EVENT_ID" => "forum", "SOURCE_ID" => $MID1), false, false, array("ID"));
     if ($arRes = $dbRes->Fetch()) {
         // topic
         $arSonetFields = array_intersect_key($arSonetFields, array_flip(array("TITLE_TEMPLATE", "TITLE", "MESSAGE", "TEXT_MESSAGE", "PARAMS")));
         CSocNetLog::Update($arRes["ID"], $arSonetFields);
         CSocNetLogRights::SetForSonet($arRes["ID"], $arParams["MODE"] == "GROUP" ? SONET_ENTITY_GROUP : SONET_ENTITY_USER, $arParams["MODE"] == "GROUP" ? $arParams["SOCNET_GROUP_ID"] : $arParams["USER_ID"], "forum", "view");
     } else {
         $dbRes = CSocNetLogComments::GetList(array(), array("EVENT_ID" => "forum", "SOURCE_ID" => $MID1), false, false, array("ID"));
         if ($arRes = $dbRes->Fetch()) {
             // message/comment
             $arSonetFields = array_intersect_key($arSonetFields, array_flip(array("MESSAGE", "TEXT_MESSAGE", "PARAMS")));
             CSocNetLogComments::Update($arRes["ID"], $arSonetFields);
         }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:component.php

示例8: UpdateActivityIBlock

 function UpdateActivityIBlock(&$arFields)
 {
     if ($arFields['RESULT']) {
         // absence
         $iblock = COption::GetOptionInt('intranet', 'iblock_absence');
         if (!$iblock) {
             $iblock = array();
             $dbRes = CSite::GetList($b = 'SORT', $o = 'ASC');
             while ($arRes = $dbRes->Fetch()) {
                 if ($ib = COption::GetOptionInt('intranet', 'iblock_absence', false, $arRes['ID'])) {
                     $iblock[] = $ib;
                 }
             }
         } else {
             $iblock = array($iblock);
         }
         if (count($iblock) > 0) {
             foreach ($iblock as $ib) {
                 if ($arFields['IBLOCK_ID'] == $ib) {
                     static $PROPERTY_USER = 0;
                     if ($PROPERTY_USER <= 0) {
                         $dbRes = CIBlockProperty::GetByID('USER', $arFields['IBLOCK_ID']);
                         if ($arRes = $dbRes->Fetch()) {
                             $PROPERTY_USER = $arRes['ID'];
                         }
                     }
                     if ($PROPERTY_USER > 0) {
                         //							$arPropertyValue = array_values($arFields['PROPERTY_VALUES']);
                         //							$USER_ID = $arPropertyValue[0];
                         $USER_ID = $arFields['PROPERTY_VALUES']['USER'];
                         $dbRes = CUser::GetByID($USER_ID);
                         if ($arUser = $dbRes->Fetch()) {
                             CIBlockElement::SetPropertyValues($arFields['ID'], $arFields['IBLOCK_ID'], $arUser['ACTIVE'], 'USER_ACTIVE');
                         }
                     }
                 }
             }
         }
         // -- absence
         // news
         if (intval($arFields["IBLOCK_ID"]) > 0) {
             $rsIBlock = CIBlock::GetByID($arFields["IBLOCK_ID"]);
             if ($arIBlock = $rsIBlock->Fetch()) {
                 if ($arIBlock["IBLOCK_TYPE_ID"] == "news" && CModule::IncludeModule("socialnetwork")) {
                     CSocNetAllowed::GetAllowedEntityTypes();
                     $dbLog = CSocNetLog::GetList(array("ID" => "DESC"), array("EVENT_ID" => "news", "SOURCE_ID" => $arFields["ID"]));
                     if ($arLog = $dbLog->Fetch()) {
                         if ($arFields["ACTIVE"] == "Y" && (strlen($arFields["PREVIEW_TEXT"]) > 0 || strlen($arFields["DETAIL_TEXT"]) > 0) && (!array_key_exists("WF", $arFields) || $arFields["WF"] == "N" || $arFields["WF_STATUS_ID"] == 1 && $arFields["WF_PARENT_ELEMENT_ID"] == $arFields["ID"])) {
                             $arSoFields = array("=LOG_DATE" => strlen($arFields["ACTIVE_FROM"]) > 0 ? MakeTimeStamp($arFields["ACTIVE_FROM"], CSite::GetDateFormat("FULL", $site_id)) > time() ? $GLOBALS["DB"]->CharToDateFunction($arFields["ACTIVE_FROM"], "FULL", $site_id) : $GLOBALS["DB"]->CurrentTimeFunction() : $GLOBALS["DB"]->CurrentTimeFunction(), "=LOG_UPDATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "TITLE" => $arFields["NAME"], "MESSAGE" => strlen($arFields["DETAIL_TEXT"]) > 0 ? $arFields["DETAIL_TEXT_TYPE"] == "text" ? htmlspecialcharsbx($arFields["DETAIL_TEXT"]) : $arFields["DETAIL_TEXT"] : ($arFields["PREVIEW_TEXT_TYPE"] == "text" ? htmlspecialcharsbx($arFields["PREVIEW_TEXT"]) : $arFields["PREVIEW_TEXT"]));
                             $logID = CSocNetLog::Update($arLog["ID"], $arSoFields);
                             if (intval($logID) > 0) {
                                 $rsRights = CSocNetLogRights::GetList(array(), array("LOG_ID" => $logID));
                                 $arRights = $rsRights->Fetch();
                                 if (!$arRights) {
                                     CSocNetLogRights::Add($logID, "G2");
                                 }
                                 CSocNetLog::SendEvent($logID, "SONET_NEW_EVENT");
                             }
                         } else {
                             CSocNetLog::Delete($arLog["ID"]);
                         }
                     } else {
                         if ($arFields["ACTIVE"] == "Y" && (strlen($arFields["PREVIEW_TEXT"]) > 0 || strlen($arFields["DETAIL_TEXT"]) > 0) && (!array_key_exists("WF", $arFields) || $arFields["WF"] == "N" || $arFields["WF_STATUS_ID"] == 1 && $arFields["WF_PARENT_ELEMENT_ID"] == $arFields["ID"])) {
                             $dbIBlock = CIBlock::GetByID($arFields["IBLOCK_ID"]);
                             if ($arIBlock = $dbIBlock->Fetch()) {
                                 $rsSite = CIBlock::GetSite($arFields["IBLOCK_ID"]);
                                 if ($arSite = $rsSite->Fetch()) {
                                     $site_id = $arSite["SITE_ID"];
                                 }
                                 $val = COption::GetOptionString("intranet", "sonet_log_news_iblock", "", $site_id);
                                 if (strlen($val) > 0) {
                                     $arIBCode = unserialize($val);
                                     if (!is_array($arIBCode) || count($arIBCode) <= 0) {
                                         $arIBCode = array();
                                     }
                                 } else {
                                     $arIBCode = array();
                                 }
                                 if (in_array($arIBlock["CODE"], $arIBCode)) {
                                     $entity_url = str_replace("#SITE_DIR#", $arSite["DIR"], $arIBlock["LIST_PAGE_URL"]);
                                     if (strpos($entity_url, "/") === 0) {
                                         $entity_url = "/" . ltrim($entity_url, "/");
                                     }
                                     $url = str_replace(array("#SITE_DIR#", "#ID#", "#CODE#"), array($arSite["DIR"], $arFields["ID"], $arFields["CODE"]), $arIBlock["DETAIL_PAGE_URL"]);
                                     if (strpos($url, "/") === 0) {
                                         $url = "/" . ltrim($url, "/");
                                     }
                                     $val = COption::GetOptionString("intranet", "sonet_log_news_iblock_forum");
                                     if (strlen($val) > 0) {
                                         $arIBlockForum = unserialize($val);
                                     } else {
                                         $arIBlockForum = array();
                                     }
                                     $strMessage = strlen($arFields["DETAIL_TEXT"]) > 0 ? $arFields["DETAIL_TEXT_TYPE"] == "text" ? htmlspecialcharsbx($arFields["DETAIL_TEXT"]) : $arFields["DETAIL_TEXT"] : ($arFields["PREVIEW_TEXT_TYPE"] == "text" ? htmlspecialcharsbx($arFields["PREVIEW_TEXT"]) : $arFields["PREVIEW_TEXT"]);
                                     $dtFormatSite = defined("ADMIN_SECTION") && ADMIN_SECTION === true ? SITE_ID : $site_id;
                                     $dtValue = strlen($arFields["ACTIVE_FROM"]) > 0 ? MakeTimeStamp($arFields["ACTIVE_FROM"], CSite::GetDateFormat("FULL", $dtFormatSite)) > time() ? $GLOBALS["DB"]->CharToDateFunction($arFields["ACTIVE_FROM"], "FULL", $dtFormatSite) : $GLOBALS["DB"]->CurrentTimeFunction() : $GLOBALS["DB"]->CurrentTimeFunction();
                                     $arSoFields = array("SITE_ID" => $site_id, "ENTITY_TYPE" => SONET_SUBSCRIBE_ENTITY_NEWS, "ENTITY_ID" => $arIBlock["ID"], "EVENT_ID" => "news", "USER_ID" => $GLOBALS["USER"]->GetID(), "=LOG_DATE" => $dtValue, "=LOG_UPDATE" => $dtValue, "TITLE_TEMPLATE" => GetMessage("INTR_SOCNET_LOG_NEWS_TITLE"), "TITLE" => $arFields["NAME"], "MESSAGE" => $strMessage, "TEXT_MESSAGE" => "", "URL" => $url, "MODULE_ID" => "intranet", "CALLBACK_FUNC" => false, "TMP_ID" => false, "PARAMS" => serialize(array("ENTITY_NAME" => $arIBlock["NAME"], "ENTITY_URL" => $entity_url)), "SOURCE_ID" => $arFields["ID"], "ENABLE_COMMENTS" => array_key_exists($arIBlock["ID"], $arIBlockForum) ? "Y" : "N");
                                     $logID = CSocNetLog::Add($arSoFields, false);
                                     if (intval($logID) > 0) {
                                         CSocNetLog::Update($logID, array("TMP_ID" => $logID));
//.........这里部分代码省略.........
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:include.php

示例9: DeleteRelation

	function DeleteRelation($senderUserID, $targetUserID)
	{
		global $APPLICATION;

		$senderUserID = IntVal($senderUserID);
		if ($senderUserID <= 0)
		{
			$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_SENDER_USER_ID"), "ERROR_SENDER_USER_ID");
			return false;
		}

		$targetUserID = IntVal($targetUserID);
		if ($targetUserID <= 0)
		{
			$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_TARGET_USER_ID"), "ERROR_TARGET_USER_ID");
			return false;
		}

		$arRelation = CSocNetUserRelations::GetByUserID($senderUserID, $targetUserID);
		if (!$arRelation)
		{
			$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_RELATION_NOT_FOUND"), "ERROR_RELATION_NOT_FOUND");
			return false;
		}

		if (CSocNetUserRelations::Delete($arRelation["ID"]))
		{
			$logID = CSocNetLog::Add(
				array(
					"ENTITY_TYPE" => SONET_ENTITY_USER,
					"ENTITY_ID" => $senderUserID,
					"EVENT_ID" => "system_friends",
					"=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(),
					"TITLE_TEMPLATE" => false,
					"TITLE" => "unfriend",
					"MESSAGE" => $targetUserID,
					"URL" => false,
					"MODULE_ID" => false,
					"CALLBACK_FUNC" => false,
					"USER_ID" => $targetUserID,
				),
				false
			);
			if (intval($logID) > 0)
			{
				CSocNetLog::Update($logID, array("TMP_ID" => $logID));

				$perm = CSocNetUserPerms::GetOperationPerms($senderUserID, "viewfriends");
				if (in_array($perm, array(SONET_RELATIONS_TYPE_FRIENDS2, SONET_RELATIONS_TYPE_FRIENDS)))
					CSocNetLogRights::Add($logID, array("SA", "U".$senderUserID, "S".SONET_ENTITY_USER.$senderUserID."_".$perm));
				elseif ($perm == SONET_RELATIONS_TYPE_NONE)
					CSocNetLogRights::Add($logID, array("SA", "U".$senderUserID));
				elseif ($perm == SONET_RELATIONS_TYPE_AUTHORIZED)
					CSocNetLogRights::Add($logID, array("SA", "AU"));
				elseif ($perm == SONET_RELATIONS_TYPE_ALL)
					CSocNetLogRights::Add($logID, array("SA", "G2"));

				$tmpID = $logID;
			}

			$logID2 = CSocNetLog::Add(
				array(
					"ENTITY_TYPE" => SONET_ENTITY_USER,
					"ENTITY_ID" => $targetUserID,
					"EVENT_ID" => "system_friends",
					"=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(),
					"TITLE_TEMPLATE" => false,
					"TITLE" => "unfriend",
					"MESSAGE" => $senderUserID,
					"URL" => false,
					"MODULE_ID" => false,
					"CALLBACK_FUNC" => false,
					"USER_ID" => $senderUserID,
					"TMP_ID" => (intval($tmpID) > 0 ? $tmpID : false),
				),
				false
			);

			if (intval($logID2) > 0)
			{
				$perm = CSocNetUserPerms::GetOperationPerms($targetUserID, "viewfriends");
				if (in_array($perm, array(SONET_RELATIONS_TYPE_FRIENDS2, SONET_RELATIONS_TYPE_FRIENDS)))
					CSocNetLogRights::Add($logID2, array("SA", "U".$targetUserID, "S".SONET_ENTITY_USER.$targetUserID."_".$perm));
				elseif ($perm == SONET_RELATIONS_TYPE_NONE)
					CSocNetLogRights::Add($logID2, array("SA", "U".$targetUserID));
				elseif ($perm == SONET_RELATIONS_TYPE_AUTHORIZED)
					CSocNetLogRights::Add($logID2, array("SA", "AU"));
				elseif ($perm == SONET_RELATIONS_TYPE_ALL)
					CSocNetLogRights::Add($logID2, array("SA", "G2"));
			}

			CSocNetLog::SendEvent($logID, "SONET_NEW_EVENT", $tmpID);			

			if ($arRelation["RELATION"] == SONET_RELATIONS_FRIEND)
				$GLOBALS["DB"]->Query("DELETE FROM b_sonet_event_user_view WHERE
					ENTITY_TYPE = '".SONET_ENTITY_USER."'
					AND (
						(USER_ID = ".$arRelation["FIRST_USER_ID"]." AND ENTITY_ID = ".$arRelation["SECOND_USER_ID"].")
						OR (USER_ID = ".$arRelation["SECOND_USER_ID"]." AND ENTITY_ID = ".$arRelation["FIRST_USER_ID"].")
						OR (ENTITY_ID = ".$arRelation["FIRST_USER_ID"]." AND USER_IM_ID = ".$arRelation["SECOND_USER_ID"].")
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:101,代码来源:user_relations.php

示例10: GetMessage

             $arResult['ERROR_MESSAGE'] = GetMessage('WIKI_ERROR_RENAME');
             break;
         }
         $iBlockSectId = CWikiSocnet::$iCatId ? CWikiSocnet::$iCatId : false;
         $CWiki->RenameLinkOnPages($arParams['IBLOCK_ID'], $arParams['ELEMENT_NAME'], $newName, $iBlockSectId);
         //post to feed
         if (CWikiSocnet::IsSocNet()) {
             $postUrl = str_replace(array('#group_id#', '#wiki_name#'), array(intval($arParams['SOCNET_GROUP_ID']), urlencode($newName)), $arParams['~PATH_TO_POST']);
             $dbLog = CSocNetLog::GetList(array('ID' => 'DESC'), array('SOURCE_ID' => $arParams['ELEMENT_ID']));
             if ($arLog = $dbLog->Fetch()) {
                 $arSoFields = array('=LOG_DATE' => $GLOBALS['DB']->CurrentTimeFunction(), '=LOG_UPDATE' => $GLOBALS['DB']->CurrentTimeFunction(), 'USER_ID' => $GLOBALS['USER']->GetID(), 'TITLE' => $newName, 'TEXT_MESSAGE' => "\n" . GetMessage('WIKI_MODIFY_COMMENT') . ": " . GetMessage('WIKI_PAGE_RENAMED', array("%OLD_NAME%" => $arParams['ELEMENT_NAME'], "%NEW_NAME%" => $newName)) . "\n", 'URL' => $postUrl);
                 //die(print_r($arSoFields,true));
                 $logID = CSocNetLog::Update($arLog['ID'], $arSoFields);
                 if (intval($logID) > 0) {
                     CSocNetLogRights::SetForSonet($arLog['ID'], SONET_SUBSCRIBE_ENTITY_GROUP, intval($arParams['SOCNET_GROUP_ID']), "wiki", "view");
                     CSocNetLog::SendEvent($logID, 'SONET_NEW_EVENT');
                 }
             }
         }
         $arParams['ELEMENT_NAME'] = $newName;
         break;
 }
 if (empty($arResult['ERROR_MESSAGE'])) {
     if (!isset($_POST['apply'])) {
         LocalRedirect(CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_POST'], array('wiki_name' => urlencode($arParams['ELEMENT_NAME']), 'group_id' => CWikiSocnet::$iSocNetId)), array('wiki_page_cache_clear' => 'Y')));
     } else {
         LocalRedirect(CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_POST_EDIT'], array('wiki_name' => urlencode($arParams['ELEMENT_NAME']), 'group_id' => CWikiSocnet::$iSocNetId)), $arParams['IN_COMPLEX'] == 'Y' && $arParams['SEF_MODE'] == 'N' ? array($arParams['OPER_VAR'] => $arResult['WIKI_oper']) : array()));
     }
 } else {
     $arParams['ELEMENT_NAME'] = $arResult['ELEMENT']['NAME'];
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:component.php

示例11: SocnetLogMessageAdd

 public static function SocnetLogMessageAdd($arParams, $arMessageFields, $action = "")
 {
     static $parser = null;
     if ($parser == null) {
         $parser = new forumTextParser();
     }
     $arAllow = array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "LIST" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "SMILES" => "N", "UPLOAD" => "Y", "NL2BR" => "N", "TABLE" => "N", "ALIGN" => "N");
     //		$arParams["LOG_ID"], $arParams["LANG"] ....
     $arFieldsForSocnet = array("ENTITY_TYPE" => SONET_ENTITY_GROUP, "ENTITY_ID" => $arParams["ENTITY_ID"], "EVENT_ID" => "forum", "=LOG_DATE" => !!$arMessageFields["DATE_CREATE"] ? $arMessageFields["DATE_CREATE"] : $GLOBALS["DB"]->CurrentTimeFunction(), "LOG_UPDATE" => !!$arMessageFields["POST_DATE"] ? $arMessageFields["POST_DATE"] : null, "TITLE_TEMPLATE" => str_replace("#AUTHOR_NAME#", $arMessageFields["AUTHOR_NAME"], CForumEmail::GetLangMessage("FORUM_MAIL_SOCNET_TITLE_TOPIC", $arParams["LANG"])), "TITLE" => $arMessageFields["TITLE"], "MESSAGE" => $parser->convert($arMessageFields["POST_MESSAGE"], $arAllow), "TEXT_MESSAGE" => $parser->convert4mail($arMessageFields["POST_MESSAGE"]), "URL" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("UID" => $arMessageFields["AUTHOR_ID"], "FID" => $arMessageFields["FORUM_ID"], "TID" => $arMessageFields["TOPIC_ID"], "TITLE_SEO" => $arMessageFields["TOPIC_ID"], "MID" => $arMessageFields["ID"])), "PARAMS" => serialize(array("PATH_TO_MESSAGE" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("TID" => $arMessageFields["TOPIC_ID"])))), "MODULE_ID" => false, "CALLBACK_FUNC" => false, "SOURCE_ID" => $arMessageFields["ID"], "RATING_TYPE_ID" => "FORUM_TOPIC", "RATING_ENTITY_ID" => $arMessageFields["TOPIC_ID"]);
     if ($arMessageFields["AUTHOR_ID"] > 0) {
         $arFieldsForSocnet["USER_ID"] = $arMessageFields["AUTHOR_ID"];
     }
     $db_res = CForumFiles::GetList(array("ID" => "ASC"), array("MESSAGE_ID" => $arMessageFields["ID"]));
     $ufFileID = array();
     while ($res = $db_res->Fetch()) {
         $ufFileID[] = $res["FILE_ID"];
     }
     $ufDocID = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFieldValue("FORUM_MESSAGE", "UF_FORUM_MESSAGE_DOC", $arMessageFields["ID"], LANGUAGE_ID);
     $logID = $arParams["LOG_ID"];
     if ($logID <= 0) {
         if (!empty($ufFileID)) {
             $arFieldsForSocnet["UF_SONET_LOG_FILE"] = $ufFileID;
         }
         if ($ufDocID) {
             $arFieldsForSocnet["UF_SONET_LOG_DOC"] = $ufDocID;
         }
         $logID = CSocNetLog::Add($arFieldsForSocnet, false);
         if (intval($logID) > 0) {
             CSocNetLog::Update($logID, array("TMP_ID" => $logID));
             CSocNetLogRights::SetForSonet($logID, $arFieldsForSocnet["ENTITY_TYPE"], $arFieldsForSocnet["ENTITY_ID"], "forum", "view", true);
             if ($action == "SEND_EVENT") {
                 CSocNetLog::SendEvent($logID, "SONET_NEW_EVENT", $logID);
             }
         }
     }
     if ($logID > 0 && $action == "ADD_COMMENT") {
         if (!empty($ufFileID)) {
             $arFieldsForSocnet["UF_SONET_COM_FILE"] = $ufFileID;
         }
         if ($ufDocID) {
             $arFieldsForSocnet["UF_SONET_COM_DOC"] = $ufDocID;
         }
         $arFieldsForSocnet["LOG_ID"] = $logID;
         $arFieldsForSocnet["RATING_TYPE_ID"] = "FORUM_POST";
         $arFieldsForSocnet["RATING_ENTITY_ID"] = $arMessageFields["ID"];
         $commentID = CSocNetLogComments::Add($arFieldsForSocnet);
         CSocNetLog::CounterIncrement($commentID, false, false, "LC");
         return $commentID;
     }
     return $logID;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:51,代码来源:mail.php

示例12: DeleteRelation

	function DeleteRelation($userID, $groupID)
	{
		global $APPLICATION;

		$userID = IntVal($userID);
		if ($userID <= 0)
		{
			$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_USERID"), "ERROR_USER_ID");
			return false;
		}

		$groupID = IntVal($groupID);
		if ($groupID <= 0)
		{
			$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_GROUPID"), "ERROR_GROUPID");
			return false;
		}

		$dbResult = CSocNetUserToGroup::GetList(
			array(),
			array(
				"GROUP_ID" => $groupID,
				"USER_ID" => $userID,
			),
			false,
			false,
			array("ID", "ROLE", "GROUP_VISIBLE")
		);

		if ($arResult = $dbResult->Fetch())
		{
			if ($arResult["ROLE"] != SONET_ROLES_USER && $arResult["ROLE"] != SONET_ROLES_MODERATOR)
				return false;

			if (CSocNetUserToGroup::Delete($arResult["ID"]))
			{
				$arGroupSiteID = array();
				$rsGroupSite = CSocNetGroup::GetSite($groupID);
				while($arGroupSite = $rsGroupSite->Fetch())
				{
					$arGroupSiteID[] = $arGroupSite["LID"];

					//get server name
					$rsSites = CSite::GetByID($arGroupSite["LID"]);
					$arSite = $rsSites->Fetch();
					$serverName = $arSite["SERVER_NAME"];
					if (strlen($serverName) <= 0)
					{
						if (defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0)
							$serverName = SITE_SERVER_NAME;
						else
							$serverName = COption::GetOptionString("main", "server_name", $GLOBALS["SERVER_NAME"]);
					}

					if (strlen($serverName) > 0)
					{
						$protocol = (CMain::IsHTTPS() ? "https" : "http");
						$serverName = $protocol."://".$serverName;
					}
				}

				$fullWorkgroupsUrl = $serverName.COption::GetOptionString("socialnetwork", "workgroups_page", false, $arGroupSiteID["0"]);

				$logID = CSocNetLog::Add(
					array(
						"ENTITY_TYPE" => SONET_ENTITY_GROUP,
						"ENTITY_ID" => $groupID,
						"EVENT_ID" => "system",
						"=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(),
						"TITLE_TEMPLATE" => false,
						"TITLE" => "unjoin",
						"MESSAGE" => $userID,
						"URL" => $fullWorkgroupsUrl,
						"MODULE_ID" => false,
						"CALLBACK_FUNC" => false,
						"USER_ID" => $userID,
						"SITE_ID" => $arGroupSiteID
					),
					false
				);
				if (intval($logID) > 0)
				{
					$tmpID = $logID;
					CSocNetLog::Update($logID, array("TMP_ID" => $tmpID));
					CSocNetLogRights::Add($logID, array("SA", "U".$userID, "S".SONET_ENTITY_GROUP.$groupID, "S".SONET_ENTITY_GROUP.$groupID."_".SONET_ROLES_OWNER, "S".SONET_ENTITY_GROUP.$groupID."_".SONET_ROLES_MODERATOR, "S".SONET_ENTITY_GROUP.$groupID."_".SONET_ROLES_USER));
					CSocNetLog::SendEvent($logID, "SONET_NEW_EVENT", $tmpID);
				}
			}
			else
			{
				$errorMessage = "";
				if ($e = $APPLICATION->GetException())
					$errorMessage = $e->GetString();
				if (StrLen($errorMessage) <= 0)
					$errorMessage = GetMessage("SONET_UR_ERROR_CREATE_USER2GROUP");

				$GLOBALS["APPLICATION"]->ThrowException($errorMessage, "ERROR_DELETE_RELATION");
				return false;
			}
		}
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:101,代码来源:user_group.php

示例13: SendMessageToSocNet


//.........这里部分代码省略.........
     }
     // rating entity id (ilike)
     $arSoFields["RATING_ENTITY_ID"] = $taskId;
     $arSoFields["RATING_TYPE_ID"] = "TASK";
     // Do we need add new item to socnet?
     // We adds new item, if it is not exists.
     $logID = false;
     if (IsModuleInstalled("webdav") || IsModuleInstalled("disk")) {
         $ufDocID = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFieldValue("TASKS_TASK", "UF_TASK_WEBDAV_FILES", $taskId, LANGUAGE_ID);
         if ($ufDocID) {
             $arSoFields["UF_SONET_LOG_DOC"] = $ufDocID;
         }
     }
     if ($bSocNetAddNewItem) {
         $arSoFields['=LOG_DATE'] = $logDate;
         $arSoFields['CALLBACK_FUNC'] = false;
         $arSoFields['SOURCE_ID'] = $taskId;
         $arSoFields['ENABLE_COMMENTS'] = 'Y';
         $arSoFields['URL'] = CTaskNotifications::GetNotificationPath(array('ID' => (int) $arFields["CREATED_BY"]), $taskId, false);
         $arSoFields['USER_ID'] = $arFields['CREATED_BY'];
         $arSoFields['TITLE_TEMPLATE'] = '#TITLE#';
         // Set all sites because any user from any site may be
         // added to task in future. For example, new auditor, etc.
         $arSoFields['SITE_ID'] = $cachedAllSitesIds;
         $logID = CSocNetLog::Add($arSoFields, false);
         if (intval($logID) > 0) {
             CSocNetLog::Update($logID, array("TMP_ID" => $logID));
             $arTaskParticipant = CTaskNotifications::GetRecipientsIDs($arFields, false);
             // Exclude author
             $arLogCanViewedBy = array_diff($arTaskParticipant, array($arFields['CREATED_BY']));
             $arRights = CTaskNotifications::__UserIDs2Rights($arLogCanViewedBy);
             if (isset($arFields['GROUP_ID'])) {
                 $arRights = array_merge($arRights, self::prepareRightsCodesForViewInGroupLiveFeed($logID, $arFields['GROUP_ID']));
             }
             CSocNetLogRights::Add($logID, $arRights);
             CSocNetLog::SendEvent($logID, "SONET_NEW_EVENT", $logID);
         }
     } else {
         $arSoFields['=LOG_DATE'] = $logDate;
         $arSoFields['=LOG_UPDATE'] = $logDate;
         // All tasks posts in live feed should be from director
         if (isset($arFields['CREATED_BY'])) {
             $arSoFields['USER_ID'] = $arFields['CREATED_BY'];
         } elseif (isset($arTask['CREATED_BY'])) {
             $arSoFields['USER_ID'] = $arTask['CREATED_BY'];
         } elseif ($occurAsUserId) {
             $arSoFields['USER_ID'] = $occurAsUserId;
         } else {
             unset($arSoFields['USER_ID']);
         }
         $rsSocNetLogItems = CSocNetLog::GetList(array("ID" => "DESC"), $arLogFilter, false, false, array("ID", "ENTITY_TYPE", "ENTITY_ID"));
         while ($arRes = $rsSocNetLogItems->Fetch()) {
             CSocNetLog::Update($arRes["ID"], $arSoFields);
             $arTaskParticipant = CTaskNotifications::GetRecipientsIDs($arFields, false, true);
             $bAuthorMustBeExcluded = false;
             $authorUserId = false;
             if (isset($arFields['CREATED_BY'])) {
                 $authorUserId = (int) $arFields['CREATED_BY'];
             } elseif (isset($arTask['CREATED_BY'])) {
                 $authorUserId = (int) $arTask['CREATED_BY'];
             }
             // Get current rights
             $rsRights = CSocNetLogRights::GetList(array(), array('LOG_ID' => $arRes['ID']));
             $arCurrentRights = array();
             while ($arRights = $rsRights->fetch()) {
                 $arCurrentRights[] = $arRights['GROUP_CODE'];
             }
             // If author changes the task and author doesn't have
             // access to task yet, don't give access to him.
             if ($authorUserId === $effectiveUserId) {
                 $authorGroupCode = 'U' . $authorUserId;
                 // If task's author hasn't rights yet, still exclude him
                 if (!in_array($authorGroupCode, $arCurrentRights, true)) {
                     $bAuthorMustBeExcluded = true;
                 }
             }
             if ($bAuthorMustBeExcluded) {
                 $arLogCanViewedBy = array_diff($arTaskParticipant, array($authorUserId));
             } else {
                 $arLogCanViewedBy = $arTaskParticipant;
             }
             $arNewRights = CTaskNotifications::__UserIDs2Rights($arLogCanViewedBy);
             $bGroupChanged = false;
             if (isset($arFields['GROUP_ID'], $arTask['GROUP_ID']) && $arFields['GROUP_ID'] && $arFields['GROUP_ID'] != $arTask['GROUP_ID']) {
                 $bGroupChanged = true;
             }
             // If rights really changed, update them
             if (count(array_diff($arCurrentRights, $arNewRights)) || count(array_diff($arNewRights, $arCurrentRights)) || $bGroupChanged) {
                 if (isset($arFields['GROUP_ID'])) {
                     $arNewRights = array_merge($arNewRights, self::prepareRightsCodesForViewInGroupLiveFeed($logID, $arFields['GROUP_ID']));
                 } elseif (isset($arTask['GROUP_ID'])) {
                     $arNewRights = array_merge($arNewRights, self::prepareRightsCodesForViewInGroupLiveFeed($logID, $arTask['GROUP_ID']));
                 }
                 CSocNetLogRights::DeleteByLogID($arRes["ID"], true);
                 CSocNetLogRights::Add($arRes["ID"], $arNewRights);
             }
         }
     }
     return $logID;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:tasknotifications.php

示例14: OnAfterPhotoUpload

 function OnAfterPhotoUpload($arFields, $arComponentParams, $arComponentResult)
 {
     static $arSiteWorkgroupsPage;
     if (!CModule::IncludeModule("iblock")) {
         return;
     }
     if (!array_key_exists("IS_SOCNET", $arComponentParams) || $arComponentParams["IS_SOCNET"] != "Y") {
         return;
     }
     $arComponentResult["SECTION"]["PATH"] = array();
     $rsPath = CIBlockSection::GetNavChain(intval($arComponentParams["IBLOCK_ID"]), intval($arFields["IBLOCK_SECTION"]));
     while ($arPath = $rsPath->Fetch()) {
         $arComponentResult["SECTION"]["PATH"][] = $arPath;
     }
     foreach ($arComponentResult["SECTION"]["PATH"] as $arPathSection) {
         if (strlen(trim($arPathSection["PASSWORD"])) > 0) {
             return;
         }
     }
     if (array_key_exists("USER_ALIAS", $arComponentParams) && strlen($arComponentParams["USER_ALIAS"]) > 0) {
         $arTmp = explode("_", $arComponentParams["USER_ALIAS"]);
         if (is_array($arTmp) && count($arTmp) == 2) {
             $entity_type = $arTmp[0];
             $entity_id = $arTmp[1];
             if ($entity_type == "group") {
                 $entity_type = SONET_ENTITY_GROUP;
             } elseif ($entity_type == "user") {
                 $entity_type = SONET_ENTITY_USER;
             }
         }
         if ((!in_array($entity_type, array(SONET_ENTITY_GROUP, SONET_ENTITY_USER)) || intval($entity_id) <= 0) && count($arComponentResult["SECTION"]["PATH"]) > 0) {
             $entity_type = SONET_ENTITY_USER;
             $entity_id = $arComponentResult["SECTION"]["PATH"][0]["CREATED_BY"];
         }
     }
     if (!in_array($entity_type, array(SONET_ENTITY_GROUP, SONET_ENTITY_USER)) || intval($entity_id) <= 0) {
         return;
     }
     if (!$arSiteWorkgroupsPage && IsModuleInstalled("extranet") && $entity_type == SONET_ENTITY_GROUP) {
         $rsSite = CSite::GetList($by = "sort", $order = "desc", array("ACTIVE" => "Y"));
         while ($arSite = $rsSite->Fetch()) {
             $arSiteWorkgroupsPage[$arSite["ID"]] = COption::GetOptionString("socialnetwork", "workgroup_page", $arSite["DIR"] . "workgroups/", $arSite["ID"]);
         }
     }
     if (is_set($arComponentParams["DETAIL_URL"]) && is_array($arSiteWorkgroupsPage) && $entity_type == SONET_ENTITY_GROUP) {
         foreach ($arSiteWorkgroupsPage as $groups_page) {
             if (strpos($arComponentParams["DETAIL_URL"], $groups_page) === 0) {
                 $arComponentParams["DETAIL_URL"] = "#GROUPS_PATH#" . substr($arComponentParams["DETAIL_URL"], strlen($groups_page), strlen($arComponentParams["DETAIL_URL"]) - strlen($groups_page));
             }
         }
     }
     $db_res = CSocNetLog::GetList(array(), array("ENTITY_TYPE" => $entity_type, "ENTITY_ID" => $entity_id, "EVENT_ID" => "photo", "EXTERNAL_ID" => $arFields["IBLOCK_SECTION"] . "_" . $arFields["MODIFIED_BY"], ">=LOG_UPDATE" => ConvertTimeStamp(AddToTimeStamp(array("MI" => -5)) + CTimeZone::GetOffset(), "FULL")));
     if ($db_res && ($res = $db_res->Fetch())) {
         if (strlen($res["PARAMS"]) > 0) {
             $arResParams = unserialize($res["PARAMS"]);
             array_push($arResParams["arItems"], $arFields["ID"]);
         } else {
             return;
         }
         $arLogParams = array("COUNT" => $arResParams["COUNT"] + 1, "IBLOCK_TYPE" => $arComponentParams["IBLOCK_TYPE"], "IBLOCK_ID" => $arComponentParams["IBLOCK_ID"], "ALIAS" => $arComponentParams["USER_ALIAS"], "DETAIL_URL" => $arResParams["DETAIL_URL"], "arItems" => $arResParams["arItems"]);
         $arSonetFields = array("=LOG_UPDATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "PARAMS" => serialize($arLogParams));
         CSocNetLog::Update($res["ID"], $arSonetFields);
         CSocNetLogRights::SetForSonet($res["ID"], $entity_type, $entity_id, "photo", "view");
     } else {
         $arLogParams = array("COUNT" => 1, "IBLOCK_TYPE" => $arComponentParams["IBLOCK_TYPE"], "IBLOCK_ID" => $arComponentParams["IBLOCK_ID"], "DETAIL_URL" => $arComponentParams["DETAIL_URL"], "ALIAS" => $arComponentParams["USER_ALIAS"], "arItems" => array($arFields["ID"]));
         $sAuthorName = GetMessage("SONET_LOG_GUEST");
         $sAuthorUrl = "";
         if ($GLOBALS["USER"]->IsAuthorized()) {
             $sAuthorName = trim($GLOBALS["USER"]->GetFullName());
             $sAuthorName = empty($sAuthorName) ? $GLOBALS["USER"]->GetLogin() : $sAuthorName;
         }
         $arSonetFields = array("ENTITY_TYPE" => $entity_type, "ENTITY_ID" => $entity_id, "EVENT_ID" => "photo", "=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "TITLE_TEMPLATE" => str_replace("#AUTHOR_NAME#", $sAuthorName, GetMessage("SONET_PHOTO_LOG_1")), "TITLE" => str_replace("#COUNT#", "1", GetMessage("SONET_PHOTO_LOG_2")), "MESSAGE" => "", "URL" => str_replace(array("#SECTION_ID#", "#section_id#"), $arFields["IBLOCK_SECTION"], $arComponentResult["URL"]["SECTION_EMPTY"]), "MODULE_ID" => false, "CALLBACK_FUNC" => false, "EXTERNAL_ID" => $arFields["IBLOCK_SECTION"] . "_" . $arFields["MODIFIED_BY"], "PARAMS" => serialize($arLogParams), "SOURCE_ID" => $arFields["IBLOCK_SECTION"]);
         $serverName = defined("SITE_SERVER_NAME") && strLen(SITE_SERVER_NAME) > 0 ? SITE_SERVER_NAME : COption::GetOptionString("main", "server_name");
         $arSonetFields["TEXT_MESSAGE"] = str_replace(array("#TITLE#"), array($arComponentResult["SECTION"]["TITLE"]), GetMessage("SONET_PHOTO_LOG_MAIL_TEXT"));
         if ($GLOBALS["USER"]->IsAuthorized()) {
             $arSonetFields["USER_ID"] = $GLOBALS["USER"]->GetID();
         }
         $logID = CSocNetLog::Add($arSonetFields, false);
         if (intval($logID) > 0) {
             CSocNetLog::Update($logID, array("TMP_ID" => $logID));
             CSocNetLogRights::SetForSonet($logID, $entity_type, $entity_id, "photo", "view", true);
             CSocNetLog::SendEvent($logID, "SONET_NEW_EVENT", $logID);
         }
     }
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:85,代码来源:log_tools.php


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