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


PHP CSocNetLogComments::UpdateLogData方法代码示例

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


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

示例1: Delete

 function Delete($ID)
 {
     global $DB;
     $ID = IntVal($ID);
     if ($ID <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GLC_WRONG_PARAMETER_ID"), "ERROR_NO_ID");
         return false;
     }
     $arComment = CSocNetLogComments::GetByID($ID);
     $bSuccess = True;
     if ($bSuccess) {
         $bSuccess = $DB->Query("DELETE FROM b_sonet_log_comment WHERE ID = " . $ID . "", true);
     }
     if ($bSuccess && intval($arComment["LOG_ID"]) > 0) {
         CSocNetLogComments::UpdateLogData($arComment["LOG_ID"], false, true);
     }
     if ($bSuccess && defined("BX_COMP_MANAGED_CACHE")) {
         $GLOBALS["CACHE_MANAGER"]->ClearByTag("SONET_LOG_COMMENT_" . $ID);
     }
     return $bSuccess;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:21,代码来源:log_comments.php

示例2: Delete

 public static function Delete($ID, $bSetSource = false)
 {
     global $DB;
     $ID = IntVal($ID);
     if ($ID <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GLC_WRONG_PARAMETER_ID"), "ERROR_NO_ID");
         return false;
     }
     $bSuccess = false;
     if ($arComment = CSocNetLogComments::GetByID($ID)) {
         if ($bSetSource) {
             if (strlen($arComment["EVENT_ID"]) > 0) {
                 $arCommentEvent = CSocNetLogTools::FindLogCommentEventByID($arComment["EVENT_ID"]);
                 if (!$arCommentEvent || !array_key_exists("DELETE_CALLBACK", $arCommentEvent) || !is_callable($arCommentEvent["DELETE_CALLBACK"])) {
                     $bSetSource = false;
                 }
             }
         }
         $bSuccess = true;
         if ($bSetSource) {
             $arSource = CSocNetLogComments::SetSource($arComment, "DELETE");
         }
         if (!$bSetSource || is_array($arSource) && (!isset($arSource["ERROR"]) || empty($arSource["ERROR"]))) {
             if ($bSuccess) {
                 $bSuccess = $DB->Query("DELETE FROM b_sonet_log_comment WHERE ID = " . $ID . "", true);
             }
             if ($bSuccess) {
                 $GLOBALS["USER_FIELD_MANAGER"]->Delete("SONET_COMMENT", $ID);
                 $db_events = GetModuleEvents("socialnetwork", "OnSocNetLogCommentDelete");
                 while ($arEvent = $db_events->Fetch()) {
                     ExecuteModuleEventEx($arEvent, array($ID));
                 }
                 if (intval($arComment["LOG_ID"]) > 0) {
                     CSocNetLogComments::UpdateLogData($arComment["LOG_ID"], false, true);
                     $cache = new CPHPCache();
                     $cache->CleanDir("/sonet/log/" . intval(intval($arComment["LOG_ID"]) / 1000) . "/" . $arComment["LOG_ID"] . "/comments/");
                 }
             }
         } elseif (is_array($arSource) && isset($arSource["ERROR"]) && is_string($arSource["ERROR"]) && !empty($arSource["ERROR"])) {
             $GLOBALS["APPLICATION"]->ThrowException($arSource["ERROR"], "ERROR_DELETE_SOURCE");
             $bSuccess = false;
         }
     }
     return $bSuccess;
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:45,代码来源:log_comments.php

示例3: Delete

 public static function Delete($ID, $bSetSource = false)
 {
     global $DB;
     $ID = IntVal($ID);
     if ($ID <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GLC_WRONG_PARAMETER_ID"), "ERROR_NO_ID");
         return false;
     }
     $bSuccess = false;
     if ($arComment = CSocNetLogComments::GetByID($ID)) {
         if ($bSetSource) {
             if (strlen($arComment["EVENT_ID"]) > 0) {
                 $arCommentEvent = CSocNetLogTools::FindLogCommentEventByID($arComment["EVENT_ID"]);
                 if (!$arCommentEvent || !array_key_exists("DELETE_CALLBACK", $arCommentEvent) || !is_callable($arCommentEvent["DELETE_CALLBACK"])) {
                     $bSetSource = false;
                 }
             }
         }
         $bSuccess = true;
         if ($bSetSource) {
             $arSource = CSocNetLogComments::SetSource($arComment, "DELETE");
         }
         if (!$bSetSource || is_array($arSource) && (!isset($arSource["ERROR"]) || empty($arSource["ERROR"]))) {
             if ($bSuccess) {
                 $bSuccess = $DB->Query("DELETE FROM b_sonet_log_comment WHERE ID = " . $ID . "", true);
             }
             if ($bSuccess) {
                 $GLOBALS["USER_FIELD_MANAGER"]->Delete("SONET_COMMENT", $ID);
             }
             if ($bSuccess && intval($arComment["LOG_ID"]) > 0) {
                 CSocNetLogComments::UpdateLogData($arComment["LOG_ID"], false, true);
             }
             if ($bSuccess && defined("BX_COMP_MANAGED_CACHE")) {
                 $GLOBALS["CACHE_MANAGER"]->ClearByTag("SONET_LOG_COMMENT_" . $ID);
             }
         } elseif (is_array($arSource) && isset($arSource["ERROR"]) && is_string($arSource["ERROR"]) && !empty($arSource["ERROR"])) {
             $GLOBALS["APPLICATION"]->ThrowException($arSource["ERROR"], "ERROR_DELETE_SOURCE");
             $bSuccess = false;
         }
     }
     return $bSuccess;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:42,代码来源:log_comments.php

示例4: Add


//.........这里部分代码省略.........
				$arInsert[1] .= $value;
			}

			$ID = false;
			if (strlen($arInsert[0]) > 0)
			{
				$strSql =
					"INSERT INTO b_sonet_log_comment(".$arInsert[0].") ".
					"VALUES(".$arInsert[1].")";
				$DB->Query($strSql, False, "File: ".__FILE__."<br>Line: ".__LINE__);

				$ID = IntVal($DB->LastID());

				if ($ID > 0)
				{
					if (
						!array_key_exists("RATING_TYPE_ID", $arFields)
						|| empty($arFields["RATING_TYPE_ID"])
					)
						CSocNetLogComments::Update($ID, array(
							"RATING_TYPE_ID" => "LOG_COMMENT",
							"RATING_ENTITY_ID" => $ID
						));

					CSocNetLogFollow::Set(
						$arFields["USER_ID"], 
						"L".$arFields["LOG_ID"], 
						"Y", 
						ConvertTimeStamp(time() + CTimeZone::GetOffset(), "FULL")
					);

					$rsLog = CSocNetLog::GetList(
						array(),
						array("ID" => $arFields["LOG_ID"]),
						false,
						false,
						array("ID", "USER_ID")
					);
					if (
						($arLog = $rsLog->Fetch())
						&& (intval($arLog["USER_ID"]) > 0)
					)
					{
						$default_follow = CSocNetLogFollow::GetDefaultValue($arLog["USER_ID"]);
						if ($default_follow != "Y")
						{
							$rsLogFollow = CSocNetLogFollow::GetList(
								array(
									"USER_ID" => $arLog["USER_ID"],
									"CODE" => "L".$arFields["LOG_ID"]
								), 
								array("TYPE")
							);

							$arLogFollow = $rsLogFollow->Fetch();
							if (!$arLogFollow)
								CSocNetLogFollow::Set($arLog["USER_ID"], "L".$arFields["LOG_ID"], "Y");
						}
					}

					if ($bSendEvent)
					{
						CSocNetLogComments::SendEvent($ID, "SONET_NEW_EVENT");
					}

					CSocNetLogComments::UpdateLogData($arFields["LOG_ID"], $bSetLogUpDate);

					$db_events = GetModuleEvents("socialnetwork", "OnAfterSocNetLogCommentAdd");
					while ($arEvent = $db_events->Fetch())
					{
						ExecuteModuleEventEx($arEvent, array($ID, $arFields));
					}

					$GLOBALS["USER_FIELD_MANAGER"]->Update("SONET_COMMENT", $ID, $arFields);

					if(defined("BX_COMP_MANAGED_CACHE"))
					{
						$GLOBALS["CACHE_MANAGER"]->ClearByTag("SONET_LOG_".$arFields["LOG_ID"]);
					}
					else
					{
						$cache = new CPHPCache;
						$cache->CleanDir("/sonet/log/".$arFields["LOG_ID"]."/comments/");
					}

					CSocNetLogComments::SendMentionNotification(array_merge($arFields, array("ID" => $ID)));
				}
			}

			CSocNetLogTools::SetCacheLastLogID("comment", $ID);
			return $ID;
		}
		elseif ($bSetSource && strlen($strMessage) > 0)
			return array(
				"ID" => false,
				"MESSAGE" => $strMessage
			);
		else
			return false;
	}
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:101,代码来源:log_comments.php

示例5: Add

 function Add($arFields, $bSetSource = false, $bSendEvent = true, $bSetLogUpDate = true)
 {
     global $DB;
     $arFields1 = array();
     foreach ($arFields as $key => $value) {
         if (substr($key, 0, 1) == "=") {
             $arFields1[substr($key, 1)] = $value;
             unset($arFields[$key]);
         }
     }
     if (!CSocNetLogComments::CheckFields("ADD", $arFields)) {
         return false;
     }
     $arCommentEvent = CSocNetLogTools::FindLogCommentEventByID($arFields["EVENT_ID"]);
     if (!$arCommentEvent || !array_key_exists("ADD_CALLBACK", $arCommentEvent) || !is_callable($arCommentEvent["ADD_CALLBACK"])) {
         $bSetSource = false;
     }
     $db_events = GetModuleEvents("socialnetwork", "OnBeforeSocNetLogCommentAdd");
     while ($arEvent = $db_events->Fetch()) {
         if (ExecuteModuleEventEx($arEvent, array(&$arFields)) === false) {
             return false;
         }
     }
     if ($bSetSource) {
         $arSource = CSocNetLogComments::SetSource($arFields);
         if (intval($arSource["SOURCE_ID"]) > 0) {
             $arFields["SOURCE_ID"] = $arSource["SOURCE_ID"];
             if (array_key_exists("RATING_ENTITY_ID", $arSource) && array_key_exists("RATING_TYPE_ID", $arSource) && intval($arSource["RATING_ENTITY_ID"]) > 0 && strlen($arSource["RATING_TYPE_ID"]) > 0) {
                 $arFields["RATING_TYPE_ID"] = $arSource["RATING_TYPE_ID"];
                 $arFields["RATING_ENTITY_ID"] = $arSource["RATING_ENTITY_ID"];
             }
             if (isset($arSource["MESSAGE"]) && strlen($arSource["MESSAGE"]) > 0) {
                 $arFields["MESSAGE"] = $arSource["MESSAGE"];
             }
             if (isset($arSource["TEXT_MESSAGE"]) && strlen($arSource["TEXT_MESSAGE"]) > 0) {
                 $arFields["TEXT_MESSAGE"] = $arSource["TEXT_MESSAGE"];
             }
         } else {
             $strMessage = array_key_exists("ERROR", $arSource) && strlen($arSource["ERROR"]) > 0 ? $arSource["ERROR"] : (array_key_exists("NOTES", $arSource) && strlen($arSource["NOTES"]) > 0 ? $arSource["NOTES"] : "");
         }
     }
     if (!$bSetSource || is_array($arSource) && array_key_exists("SOURCE_ID", $arFields) && intval($arFields["SOURCE_ID"]) > 0) {
         $arInsert = $DB->PrepareInsert("b_sonet_log_comment", $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_comment(" . $arInsert[0] . ") " . "VALUES(" . $arInsert[1] . ")";
             $DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
             $ID = IntVal($DB->LastID());
             if ($ID > 0) {
                 if (!array_key_exists("RATING_TYPE_ID", $arFields) || empty($arFields["RATING_TYPE_ID"])) {
                     CSocNetLogComments::Update($ID, array("RATING_TYPE_ID" => "LOG_COMMENT", "RATING_ENTITY_ID" => $ID));
                 }
                 CSocNetLogFollow::Set($arFields["USER_ID"], "L" . $arFields["LOG_ID"], "Y");
                 $rsLog = CSocNetLog::GetList(array(), array("ID" => $arFields["LOG_ID"]), false, false, array("ID", "USER_ID"));
                 if (($arLog = $rsLog->Fetch()) && intval($arLog["USER_ID"]) > 0) {
                     $default_follow = CSocNetLogFollow::GetDefaultValue($arLog["USER_ID"]);
                     if ($default_follow != "Y") {
                         $rsLogFollow = CSocNetLogFollow::GetList(array("USER_ID" => $arLog["USER_ID"], "CODE" => "L" . $arFields["LOG_ID"]), array("TYPE"));
                         $arLogFoillow = $rsLogFollow->Fetch();
                         if (!$arLogFoillow) {
                             CSocNetLogFollow::Set($arLog["USER_ID"], "L" . $arFields["LOG_ID"], "Y");
                         }
                     }
                 }
                 if ($bSendEvent) {
                     CSocNetLogComments::SendEvent($ID, "SONET_NEW_EVENT");
                 }
                 CSocNetLogComments::UpdateLogData($arFields["LOG_ID"], $bSetLogUpDate);
                 $db_events = GetModuleEvents("socialnetwork", "OnAfterSocNetLogCommentAdd");
                 while ($arEvent = $db_events->Fetch()) {
                     ExecuteModuleEventEx($arEvent, array($ID, $arFields));
                 }
                 if (defined("BX_COMP_MANAGED_CACHE")) {
                     $GLOBALS["CACHE_MANAGER"]->ClearByTag("SONET_LOG_" . $arFields["LOG_ID"]);
                 }
             }
         }
         CSocNetLogTools::SetCacheLastLogID("comment", $ID);
         return $ID;
     } elseif ($bSetSource && strlen($strMessage) > 0) {
         return array("ID" => false, "MESSAGE" => $strMessage);
     } else {
         return false;
     }
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:95,代码来源:log_comments.php


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