Exemplo n.º 1
0
 public function processMethodRequest($name, $nameDetails, $arParams, $nav, $server)
 {
     $descriptions = null;
     $name = strtoupper($name);
     if ($name === 'OWNERTYPE') {
         $descriptions = CCrmOwnerType::GetDescriptions(array(CCrmOwnerType::Lead, CCrmOwnerType::Deal, CCrmOwnerType::Contact, CCrmOwnerType::Company));
     } elseif ($name === 'CONTENTTYPE') {
         $descriptions = CCrmContentType::GetAllDescriptions();
     } elseif ($name === 'ACTIVITYTYPE') {
         $descriptions = CCrmActivityType::GetAllDescriptions();
     } elseif ($name === 'ACTIVITYPRIORITY') {
         $descriptions = CCrmActivityPriority::GetAllDescriptions();
     } elseif ($name === 'ACTIVITYDIRECTION') {
         $descriptions = CCrmActivityDirection::GetAllDescriptions();
     } elseif ($name === 'ACTIVITYNOTIFYTYPE') {
         $descriptions = CCrmActivityNotifyType::GetAllDescriptions();
     }
     if (!is_array($descriptions)) {
         return parent::processMethodRequest($name, $nameDetails, $arParams, $nav, $server);
     }
     $result = array();
     foreach ($descriptions as $k => &$v) {
         $result[] = array('ID' => $k, 'NAME' => $v);
     }
     unset($v);
     return $result;
 }
Exemplo n.º 2
0
            }
        }
    } elseif ($_SERVER['REQUEST_METHOD'] == 'GET' && isset($_GET['delete'])) {
        if (CCrmMailTemplate::Exists($elementID) && !CCrmMailTemplate::Delete($elementID)) {
            $errors = CCrmMailTemplate::GetErrorMessages();
            if (empty($errors)) {
                $errors[] = GetMessage('CRM_MAIL_TEMPLATE_DELETE_UNKNOWN_ERROR');
            }
            ShowError(implode("\n", $errors));
            return;
        }
        LocalRedirect(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_MAIL_TEMPLATE_LIST']));
    }
}
$arResult['ELEMENT_ID'] = $elementID;
$arResult['ELEMENT'] = $element;
$isEditMode = $elementID > 0;
$arResult['FORM_ID'] = $arResult['GRID_ID'] = 'CRM_MAIL_TEMPLATE_EDIT';
$arResult['BACK_URL'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_MAIL_TEMPLATE_LIST'], array());
$arResult['FIELDS']['tab_1'][] = array('ID' => 'TITLE', 'NAME' => GetMessage('CRM_MAIL_TEMPLATE_TITLE'), 'VALUE' => isset($element['TITLE']) ? $element['TITLE'] : '', 'REQUIRED' => true);
$arResult['FIELDS']['tab_1'][] = array('ID' => 'SORT', 'NAME' => GetMessage('CRM_MAIL_TEMPLATE_SORT'), 'VALUE' => isset($element['SORT']) ? intval($element['SORT']) : 100);
if (CCrmPerms::IsAdmin()) {
    $arResult['FIELDS']['tab_1'][] = array('ID' => 'SCOPE', 'NAME' => GetMessage('CRM_MAIL_TEMPLATE_SCOPE'), 'VALUE' => isset($element['SCOPE']) ? $element['SCOPE'] : CCrmMailTemplateScope::Personal, 'ALL_VALUES' => CCrmMailTemplateScope::GetAllDescriptions());
}
$arResult['FIELDS']['tab_1'][] = array('ID' => 'IS_ACTIVE', 'NAME' => GetMessage('CRM_MAIL_TEMPLATE_IS_ACTIVE'), 'VALUE' => isset($element['IS_ACTIVE']) && $element['IS_ACTIVE'] === 'Y' ? 'Y' : 'N');
$arResult['FIELDS']['tab_1'][] = array('ID' => 'EMAIL_FROM', 'NAME' => GetMessage('CRM_MAIL_TEMPLATE_EMAIL_FROM'), 'VALUE' => isset($element['EMAIL_FROM']) ? $element['EMAIL_FROM'] : '');
$arResult['FIELDS']['tab_1'][] = array('ID' => 'SUBJECT', 'NAME' => GetMessage('CRM_MAIL_TEMPLATE_SUBJECT'), 'VALUE' => isset($element['SUBJECT']) ? $element['SUBJECT'] : '');
$ownerTypes = CCrmOwnerType::GetDescriptions(array(CCrmOwnerType::Lead, CCrmOwnerType::Deal, CCrmOwnerType::Contact, CCrmOwnerType::Company));
$arResult['FIELDS']['tab_1'][] = array('ID' => 'ENTITY_TYPE_ID', 'NAME' => GetMessage('CRM_MAIL_ENTITY_TYPE'), 'VALUE' => isset($element['ENTITY_TYPE_ID']) ? $element['ENTITY_TYPE_ID'] : CCrmOwnerType::Lead, 'ALL_VALUES' => $ownerTypes, 'REQUIRED' => true);
$arResult['FIELDS']['tab_1'][] = array('ID' => 'BODY', 'NAME' => GetMessage('CRM_MAIL_TEMPLATE_BODY'), 'VALUE' => isset($element['BODY']) ? $element['BODY'] : '');
$this->IncludeComponentTemplate();