Example #1
0
 private static function PrepareAdapters()
 {
     if (self::$ADAPTERS !== null) {
         return self::$ADAPTERS;
     }
     self::$ADAPTERS = array(new CCrmTemplateAdapter());
     return self::$ADAPTERS;
 }
Example #2
0
        echo CUtil::PhpToJSObject(array('ERROR' => 'Invalid data'));
        die;
    }
    $templateOwnerID = isset($fields['OWNER_ID']) ? intval($fields['OWNER_ID']) : 0;
    $templateScope = isset($fields['SCOPE']) ? intval($fields['SCOPE']) : CCrmMailTemplateScope::Undefined;
    if ($templateScope !== CCrmMailTemplateScope::Common && $templateOwnerID !== intval($curUser->GetID())) {
        echo CUtil::PhpToJSObject(array('ERROR' => 'Invalid data'));
        die;
    }
    $body = isset($fields['BODY']) ? $fields['BODY'] : '';
    if ($body !== '') {
        $contentTypeID = isset($_POST['CONTENT_TYPE']) ? CCrmContentType::ResolveTypeID($_POST['CONTENT_TYPE']) : CCrmContentType::Undefined;
        if (!CCrmContentType::IsDefined($contentTypeID)) {
            $contentTypeID = CCrmContentType::PlainText;
        }
        $body = CCrmTemplateManager::PrepareTemplate($body, CCrmOwnerType::ResolveID($ownerTypeName), $ownerID, $contentTypeID);
    }
    echo CUtil::PhpToJSObject(array('DATA' => array('ID' => $templateID, 'OWNER_TYPE' => $ownerTypeName, 'OWNER_ID' => $ownerID, 'FROM' => isset($fields['EMAIL_FROM']) ? $fields['EMAIL_FROM'] : '', 'SUBJECT' => isset($fields['SUBJECT']) ? $fields['SUBJECT'] : '', 'BODY' => $body)));
    die;
} elseif ($action == 'GET_ACTIVITY_COMMUNICATIONS') {
    $ID = isset($_POST['ID']) ? intval($_POST['ID']) : 0;
    echo CUtil::PhpToJSObject(array('ACTIVITY_COMMUNICATIONS' => GetCrmActivityCommunications($ID)));
    die;
} elseif ($action == 'GET_ACTIVITY_COMMUNICATIONS_PAGE') {
    $ID = isset($_POST['ID']) ? intval($_POST['ID']) : 0;
    $pageSize = isset($_POST['PAGE_SIZE']) ? intval($_POST['PAGE_SIZE']) : 20;
    $pageNumber = isset($_POST['PAGE_NUMBER']) ? intval($_POST['PAGE_NUMBER']) : 1;
    echo CUtil::PhpToJSObject(array('ACTIVITY_COMMUNICATIONS_PAGE' => GetCrmActivityCommunicationsPage($ID, $pageSize, $pageNumber)));
    die;
} elseif ($action == 'GET_ACTIVITY_VIEW_DATA') {
    $result = array();
Example #3
0
					BX.bind(form, 'submit',
						function()
						{
							window['oLheMailTemplateBody'].SaveContent();
						}
					);

					var selector = BX.CrmEntityFieldSelector.create(
							'<?php 
        echo $selectorContainerID;
        ?>
',
							{
								'editorName': 'oLheMailTemplateBody',
								'map': <?php 
        echo CUtil::PhpToJSObject(CCrmTemplateManager::GetAllMaps());
        ?>
							}
					);
					selector.registerEntityTypeSelector(
						BX.findChild(
								form,
								{ 'tag': 'SELECT',  'property': { 'name': 'ENTITY_TYPE_ID' } },
								true
						)
					);
					selector.layout(BX('<?php 
        echo $selectorContainerID;
        ?>
'));
				}