8 private $Notify = NULL;
9 private static $Enable =
true;
13 $this->Notify = $parent;
18 return CModule::IncludeModule(
'socialnetwork') && CModule::IncludeModule(
'blog') && NULL!=$this->Notify && self::$Enable;
24 public static function AddLogEvent(&
$arFields)
29 'TITLE' =>
GetMessage(
"IDEA_SONET_NOTIFY_TITLE"),
30 'TITLE_SETTINGS' =>
GetMessage(
'IDEA_SONET_GROUP_SETTINGS'),
31 'TITLE_SETTINGS_1' =>
GetMessage(
'IDEA_SONET_GROUP_SETTINGS_1'),
32 'TITLE_SETTINGS_2' =>
GetMessage(
'IDEA_SONET_GROUP_SETTINGS_2')
35 'CLASS_FORMAT' => __CLASS__,
36 'METHOD_FORMAT' =>
'FormatMessage',
37 'FULL_SET' =>
array(
'idea',
'idea_comment'),
38 'COMMENT_EVENT' =>
array(
39 'EVENT_ID' =>
'idea_comment',
40 'CLASS_FORMAT' => __CLASS__,
41 'METHOD_FORMAT' =>
'FormatComment',
42 'ADD_CALLBACK' =>
array(__CLASS__,
'CallBack_AddComment'),
43 'UPDATE_CALLBACK' =>
array(__CLASS__,
'CallBack_UpdateComment'),
44 'DELETE_CALLBACK' =>
array(__CLASS__,
'CallBack_DeleteComment'),
45 'RATING_TYPE_ID' =>
"BLOG_COMMENT"
53 public static function CallBack_AddComment(
$arFields)
55 if(!CModule::IncludeModule(
'blog'))
61 array(
"ID" =>
"DESC"),
65 array(
"ID",
"SOURCE_ID",
"SITE_ID",
"RATING_ENTITY_ID")
70 $arIdeaPost = CBlogPost::GetById($arLog[
"SOURCE_ID"]);
74 $arBlogCommentFields =
array(
75 "BLOG_ID" => $arIdeaPost[
"BLOG_ID"],
76 "POST_ID" => $arIdeaPost[
"ID"],
79 "DATE_CREATE" => ConvertTimeStamp(time()+CTimeZone::GetOffset(),
"FULL"),
81 "AUTHOR_IP" => $UserIP[0],
82 "AUTHOR_IP1" => $UserIP[1],
87 && is_array(
$arFields[
"UF_SONET_COM_DOC"])
90 $arBlogCommentFields[
"UF_BLOG_COMMENT_FILE"] =
$arFields[
"UF_SONET_COM_DOC"];
96 "SOURCE_ID" => $IdeaCommentId,
98 if($arLog[
"RATING_ENTITY_ID"]>0)
100 $arResult[
"RATING_TYPE_ID"] =
"BLOG_COMMENT";
101 $arResult[
"RATING_ENTITY_ID"] = $IdeaCommentId;
104 if(intval($IdeaCommentId)==0)
115 BXClearCache(True,
"/".
SITE_ID.
"/idea/".$arIdeaPost[
"BLOG_ID"].
"/comment/".$arIdeaPost[
"ID"].
"/");
116 BXClearCache(True,
"/".
SITE_ID.
"/idea/".$arIdeaPost[
"BLOG_ID"].
"/post/".$arIdeaPost[
"ID"].
"/");
124 public static function CallBack_UpdateComment(
$arFields)
126 if(!CModule::IncludeModule(
'blog'))
146 $arBlogCommentFields =
array(
150 $GLOBALS[
"USER_FIELD_MANAGER"]->EditFormAddFields(
"SONET_COMMENT",
$arTmp);
153 if (array_key_exists(
"UF_SONET_COM_DOC",
$arTmp))
155 $arBlogCommentFields[
"UF_BLOG_COMMENT_FILE"] =
$arTmp[
"UF_SONET_COM_DOC"];
161 $ufDocID =
$GLOBALS[
"USER_FIELD_MANAGER"]->GetUserFieldValue(
"BLOG_COMMENT",
"UF_BLOG_COMMENT_FILE",
$messageId, LANGUAGE_ID);
162 $sNote =
GetMessage(
"IDEA_SONET_UPDATE_COMMENT_SOURCE_SUCCESS");
164 $cache =
new CPHPCache;
165 $cache->CleanDir(
SITE_ID.
"/idea/".$arBlogComment[
"BLOG_ID"].
"/comment/".$arBlogComment[
"POST_ID"].
"/");
169 BXClearCache(True,
"/".
SITE_ID.
"/idea/".$arBlogComment[
"BLOG_ID"].
"/comment/".$arBlogComment[
"POST_ID"].
"/");
170 BXClearCache(True,
"/".
SITE_ID.
"/idea/".$arBlogComment[
"BLOG_ID"].
"/post/".$arBlogComment[
"POST_ID"].
"/");
174 if ($ex =
$GLOBALS[
"APPLICATION"]->GetException())
176 $sError = $ex->GetString();
180 $sError =
GetMessage(
"IDEA_SONET_UPDATE_COMMENT_SOURCE_ERROR");
186 $sError =
GetMessage(
"IDEA_SONET_UPDATE_COMMENT_SOURCE_ERROR");
199 public static function CallBack_DeleteComment(
$arFields)
201 if (!CModule::IncludeModule(
"blog"))
221 $strOKMessage =
GetMessage(
"IDEA_SONET_DELETE_COMMENT_SOURCE_SUCCESS");
223 $cache =
new CPHPCache;
224 $cache->CleanDir(
SITE_ID.
"/idea/".$arBlogComment[
"BLOG_ID"].
"/comment/".$arBlogComment[
"POST_ID"].
"/");
228 BXClearCache(True,
"/".
SITE_ID.
"/idea/".$arBlogComment[
"BLOG_ID"].
"/comment/".$arBlogComment[
"POST_ID"].
"/");
229 BXClearCache(True,
"/".
SITE_ID.
"/idea/".$arBlogComment[
"BLOG_ID"].
"/post/".$arBlogComment[
"POST_ID"].
"/");
238 "NOTES" => $strOKMessage
265 private function AddMessage()
268 $arNotification = $this->Notify->getNotification();
271 "EVENT_ID" =>
"idea",
272 "=LOG_DATE" =>
$DB->CurrentTimeFunction(),
273 "URL" => $arNotification[
"PATH"],
274 "TITLE" => $arNotification[
"TITLE"],
275 "TITLE_24" => $arNotification[
"TITLE_24"],
276 "MESSAGE" => $arNotification[
"DETAIL_TEXT"],
277 "CALLBACK_FUNC" =>
false,
278 "SOURCE_ID" => $arNotification[
"ID"],
280 "ENABLE_COMMENTS" =>
"Y",
282 "ENTITY_ID" => $arNotification[
"AUTHOR_ID"],
283 "USER_ID" => $arNotification[
"AUTHOR_ID"],
284 "MODULE_ID" =>
'idea',
288 if($arNotification[
"SHOW_RATING"] ==
"Y")
290 $arNotify[
"RATING_ENTITY_ID"] = $arNotification[
"ID"];
291 $arNotify[
"RATING_TYPE_ID"] =
"BLOG_POST";
294 if($arNotification[
"ACTION"] ==
"ADD")
297 if (intval($LogID) > 0)
303 elseif($arNotification[
"ACTION"] ==
"UPDATE")
306 array(
"ID" =>
"DESC"),
309 "EVENT_ID" =>
"idea",
310 "SOURCE_ID" => $arNotification[
"ID"]
318 $LogID = $arLog[
"ID"];
329 private function AddComment()
332 $arNotification = $this->Notify->getNotification();
335 array(
"ID" =>
"DESC"),
338 "EVENT_ID" =>
"idea",
339 "SOURCE_ID" => $arNotification[
"POST_ID"]),
342 array(
"ID",
"RATING_ENTITY_ID")
348 "EVENT_ID" =>
"idea_comment",
349 "URL" => $arNotification[
"PATH"],
350 "MESSAGE" => $arNotification[
"POST_TEXT"],
351 "SOURCE_ID" => $arNotification[
"ID"],
353 "ENTITY_ID" => $arNotification[
"AUTHOR_ID"],
354 "USER_ID" => $arNotification[
"AUTHOR_ID"],
355 "MODULE_ID" =>
'idea',
356 "LOG_ID" => $arLog[
"ID"],
359 if (isset($arNotification[
"LOG_DATE"]))
361 $arNotify[
"LOG_DATE"] = $arNotification[
"LOG_DATE"];
365 $arNotify[
"=LOG_DATE"] =
$DB->CurrentTimeFunction();
368 if($arLog[
"RATING_ENTITY_ID"]>0)
370 $arNotify[
"RATING_ENTITY_ID"] = $arNotification[
"ID"];
371 $arNotify[
"RATING_TYPE_ID"] =
"BLOG_COMMENT";
374 if($arNotification[
"ACTION"] ==
"ADD")
379 elseif($arNotification[
"ACTION"] ==
"UPDATE")
382 array(
"ID" =>
"DESC"),
385 "EVENT_ID" =>
"idea_comment",
386 "SOURCE_ID" => $arNotification[
"ID"]),
394 unset($arNotify[
"USER_ID"]);
400 return $LogCommentID>0;
408 $arNotification = $this->Notify->getNotification();
409 if($arNotification[
"TYPE"] ==
'IDEA')
410 return $this->AddMessage();
411 elseif($arNotification[
"TYPE"] ==
'IDEA_COMMENT')
412 return $this->AddComment();
422 $arNotification = $this->Notify->getNotification();
425 array(
"ID" =>
"DESC"),
427 "EVENT_ID" =>
'idea',
428 "SOURCE_ID" => $arNotification[
"ID"]
432 array(
"ID",
"USER_ID")
434 while ($arLog = $oLog->Fetch())
448 $arNotification = $this->Notify->getNotification();
451 array(
"ID" =>
"DESC"),
453 "EVENT_ID" =>
'idea',
454 "SOURCE_ID" => $arNotification[
"ID"]
460 while ($arLog = $oLog->Fetch())
472 private function RemoveComment($CommentId =
false)
474 $arNotification = $this->Notify->getNotification();
476 array(
"ID" =>
"DESC"),
479 "EVENT_ID" =>
'idea_comment',
480 "SOURCE_ID" => $CommentId?$CommentId:$arNotification[
"ID"]
486 while($arLogComment = $oLogComment->Fetch())
492 private function RemoveMessage($MessageId =
false)
494 $arNotification = $this->Notify->getNotification();
500 "POST_ID" => $MessageId?$MessageId:$arNotification[
"ID"],
506 while ($arComment = $oComment->Fetch())
507 $this->RemoveComment($arComment[
"ID"]);
511 array(
"ID" =>
"DESC"),
514 "EVENT_ID" =>
'idea',
515 "SOURCE_ID" => $MessageId?$MessageId:$arNotification[
"ID"]
521 while($arLogMessage = $oLogMessage->Fetch())
530 $arNotification = $this->Notify->getNotification();
531 if($arNotification[
"TYPE"] ==
'IDEA')
533 $this->RemoveMessage();
536 elseif($arNotification[
"TYPE"] ==
'IDEA_COMMENT')
538 $this->RemoveComment();
547 self::$Enable =
false;
552 self::$Enable =
true;
if(! $messageFields||!isset($messageFields['message_id'])||!isset($messageFields['status'])||!CModule::IncludeModule("messageservice")) $messageId
static CounterIncrement( $entityId, $eventId='', $entitiesList=false, $type=CSocNetLogCounter::TYPE_LOG_ENTRY, $forAllAccess=false, $userIdToPushList=[])
static Add($arFields, $bSendEvent=true)
static GetList($arOrder=Array("ID"=> "DESC"), $arFilter=Array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array(), $arParams=array())
static Update($ID, $arFields)
static DeleteByLogID($LOG_ID)
static Add($LOG_ID, $GROUP_CODE, $bShare=false, $followSet=true)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Class CIdeaManagmentSonetNotify
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
GetMessage($name, $aReplace=null)
BXClearCache($full=false, $initdir='')
if(intval($iTestTransaction) > 0) $arTmp
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
const SONET_SUBSCRIBE_ENTITY_USER
$GLOBALS['_____370096793']