public static function toggleFavorites(array $params) { $params['TASK_ID'] = intval($params['TASK_ID']); $params['USER_ID'] = intval($params['USER_ID']); if ($params['TASK_ID'] && $params['USER_ID'] && static::includeModule()) { // get all soc net log records considering this task and user $res = \CSocNetLog::GetList(array(), array('SOURCE_ID' => $params['TASK_ID'], 'USER_ID' => $params['USER_ID'])); while ($item = $res->fetch()) { // add them to favorite if ($params['OPERATION'] == 'ADD') { \CSocNetLogFavorites::Add($item['USER_ID'], $item['ID'], array('TRIGGER_EVENT' => false)); } else { \CSocNetLogFavorites::Change($item['USER_ID'], $item['ID'], array('TRIGGER_EVENT' => false)); } } } }
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"; } } else