Esempio n. 1
0
$arResult['MESSAGE_TITLE_FIELD_NAME'] = $arParams['UID'] = $uid;
$cacheManager = $GLOBALS['CACHE_MANAGER'];
$allowLiveFeedToAll = $defaultLiveFeedToAll = false;
$arParams['USE_CUT'] = isset($arParams['USE_CUT']) && $arParams['USE_CUT'] === 'Y' ? 'Y' : 'N';
global $USER_FIELD_MANAGER;
$sonetFields = $USER_FIELD_MANAGER->GetUserFields('SONET_LOG', 0);
$arResult['WEB_DAV_FILE_FIELD_NAME'] = 'UF_SONET_LOG_DOC';
$arResult['WEB_DAV_FILE_FIELD'] = isset($sonetFields['UF_SONET_LOG_DOC']) ? $sonetFields['UF_SONET_LOG_DOC'] : null;
$arResult['EVENT'] = array('MESSAGE' => '', 'TITLE' => '');
$arResult['ENTITY_DATA'] = array();
$arResult['ENABLE_TITLE'] = false;
$arResult['FEED_DESTINATION'] = array('LAST' => array('CONTACTS' => array(), 'COMPANIES' => array(), 'LEADS' => array(), 'DEALS' => array()), 'SELECTED' => array());
$arResult['ERROR_MESSAGES'] = array();
if ($_SERVER['REQUEST_METHOD'] == 'POST' && check_bitrix_sessid()) {
    if (isset($_POST['save']) && $_POST['save'] === 'Y') {
        $res = CCrmLiveFeedComponent::ProcessLogEventEditPOST($_POST, $entityTypeID, $entityID, $arResult);
        if (!is_array($res) && intval($res) > 0) {
            LocalRedirect($GLOBALS['APPLICATION']->GetCurPage());
        } else {
            foreach ($res as $error) {
                $arResult['ERROR_MESSAGES'][] = $error;
            }
        }
    }
}
//$arResult['FEED_DESTINATION']['LAST']['SONETGROUPS'] = CSocNetLogDestination::GetLastSocnetGroup();
// ALLOWED SONET GROUPS -->
$isManagedCacheEnabled = defined('BX_COMP_MANAGED_CACHE');
$cacheTtl = $isManagedCacheEnabled ? 3153600 : 3600 * 4;
$eventDestCacheID = 'crm_sl_event_dest_' . SITE_ID . '_' . $userID;
$eventDestCacheDir = '/crm/sl_event/dest/' . SITE_ID . '/' . $userID;
Esempio n. 2
0
 public function processMethodRequest($name, $nameDetails, $arParams, $nav, $server)
 {
     $name = strtoupper($name);
     if ($name === 'ADD') {
         $fields = $this->resolveArrayParam($arParams, 'fields');
         $arComponentResult = array('USER_ID' => $this->getCurrentUserID());
         $arPOST = array('ENABLE_POST_TITLE' => 'Y', 'MESSAGE' => $fields['MESSAGE'], 'SPERM' => $fields['SPERM']);
         if (isset($fields['POST_TITLE']) && strlen($fields['POST_TITLE']) > 0) {
             $arPOST['POST_TITLE'] = $fields['POST_TITLE'];
         }
         $entityTypeID = $fields['ENTITYTYPEID'];
         $entityID = $fields['ENTITYID'];
         $entityTypeName = CCrmOwnerType::ResolveName($entityTypeID);
         $userPerms = CCrmPerms::GetCurrentUserPermissions();
         if ($entityTypeName !== '' && !CCrmAuthorizationHelper::CheckUpdatePermission($entityTypeName, $entityID, $userPerms)) {
             throw new RestException('Access denied.');
         }
         $res = CCrmLiveFeedComponent::ProcessLogEventEditPOST($arPOST, $entityTypeID, $entityID, $arComponentResult);
         if (is_array($res)) {
             throw new RestException(implode(", ", $res));
         }
         return $res;
     }
     throw new RestException('Method not found!', RestException::ERROR_METHOD_NOT_FOUND, CRestServer::STATUS_NOT_FOUND);
 }