public static function GetEntityTypes() { if (self::$ENTITY_TYPES === null) { self::$ENTITY_TYPES = array('PHONE' => array('WORK' => array('FULL' => GetMessage('CRM_FM_ENTITY_PHONE_WORK'), 'SHORT' => GetMessage('CRM_FM_ENTITY_PHONE_WORK_SHORT'), 'ABBR' => GetMessage('CRM_FM_ENTITY_PHONE_WORK_ABBR'), 'TEMPLATE' => '<a href="' . CCrmCallToUrl::Format('#VALUE#') . '">#VALUE_HTML#</a>'), 'MOBILE' => array('FULL' => GetMessage('CRM_FM_ENTITY_PHONE_MOBILE'), 'SHORT' => GetMessage('CRM_FM_ENTITY_PHONE_MOBILE_SHORT'), 'ABBR' => GetMessage('CRM_FM_ENTITY_PHONE_MOBILE_ABBR'), 'TEMPLATE' => '<a href="' . CCrmCallToUrl::Format('#VALUE#') . '">#VALUE_HTML#</a>'), 'FAX' => array('FULL' => GetMessage('CRM_FM_ENTITY_PHONE_FAX'), 'SHORT' => GetMessage('CRM_FM_ENTITY_PHONE_FAX_SHORT'), 'ABBR' => GetMessage('CRM_FM_ENTITY_PHONE_FAX_ABBR'), 'TEMPLATE' => '<a href="' . CCrmCallToUrl::Format('#VALUE#') . '">#VALUE_HTML#</a>'), 'HOME' => array('FULL' => GetMessage('CRM_FM_ENTITY_PHONE_HOME'), 'SHORT' => GetMessage('CRM_FM_ENTITY_PHONE_HOME_SHORT'), 'ABBR' => GetMessage('CRM_FM_ENTITY_PHONE_HOME_ABBR'), 'TEMPLATE' => '<a href="' . CCrmCallToUrl::Format('#VALUE#') . '">#VALUE_HTML#</a>'), 'PAGER' => array('FULL' => GetMessage('CRM_FM_ENTITY_PHONE_PAGER'), 'SHORT' => GetMessage('CRM_FM_ENTITY_PHONE_PAGER_SHORT'), 'ABBR' => GetMessage('CRM_FM_ENTITY_PHONE_PAGER_ABBR'), 'TEMPLATE' => '<a href="' . CCrmCallToUrl::Format('#VALUE#') . '">#VALUE_HTML#</a>'), 'OTHER' => array('FULL' => GetMessage('CRM_FM_ENTITY_PHONE_OTHER'), 'SHORT' => GetMessage('CRM_FM_ENTITY_PHONE_OTHER_SHORT'), 'ABBR' => GetMessage('CRM_FM_ENTITY_PHONE_OTHER_ABBR'), 'TEMPLATE' => '<a href="' . CCrmCallToUrl::Format('#VALUE#') . '">#VALUE_HTML#</a>')), 'WEB' => array('WORK' => array('FULL' => GetMessage('CRM_FM_ENTITY_WEB_WORK'), 'SHORT' => GetMessage('CRM_FM_ENTITY_WEB_WORK_SHORT'), 'TEMPLATE' => '<a href="http://#VALUE_URL#" target="_blank">#VALUE_HTML#</a>'), 'HOME' => array('FULL' => GetMessage('CRM_FM_ENTITY_WEB_HOME'), 'SHORT' => GetMessage('CRM_FM_ENTITY_WEB_HOME_SHORT'), 'TEMPLATE' => '<a href="http://#VALUE_URL#" target="_blank">#VALUE_HTML#</a>'), 'FACEBOOK' => array('FULL' => GetMessage('CRM_FM_ENTITY_WEB_FACEBOOK'), 'SHORT' => GetMessage('CRM_FM_ENTITY_WEB_FACEBOOK_SHORT'), 'TEMPLATE' => '<a href="http://www.facebook.com/#VALUE_URL#/" target="_blank">#VALUE_HTML#</a>'), 'LIVEJOURNAL' => array('FULL' => GetMessage('CRM_FM_ENTITY_WEB_LIVEJOURNAL'), 'SHORT' => GetMessage('CRM_FM_ENTITY_WEB_LIVEJOURNAL_SHORT'), 'TEMPLATE' => '<a href="http://#VALUE_URL#.livejournal.com/" target="_blank">#VALUE_HTML#</a>'), 'TWITTER' => array('FULL' => GetMessage('CRM_FM_ENTITY_WEB_TWITTER'), 'SHORT' => GetMessage('CRM_FM_ENTITY_WEB_TWITTER_SHORT'), 'TEMPLATE' => '<a href="http://twitter.com/#VALUE_URL#/" target="_blank">#VALUE_HTML#</a>'), 'OTHER' => array('FULL' => GetMessage('CRM_FM_ENTITY_WEB_OTHER'), 'SHORT' => GetMessage('CRM_FM_ENTITY_WEB_OTHER_SHORT'), 'TEMPLATE' => '<a href="http://#VALUE_URL#" target="_blank">#VALUE_HTML#</a>')), 'EMAIL' => array('WORK' => array('FULL' => GetMessage('CRM_FM_ENTITY_EMAIL_WORK'), 'SHORT' => GetMessage('CRM_FM_ENTITY_EMAIL_WORK_SHORT'), 'ABBR' => GetMessage('CRM_FM_ENTITY_EMAIL_WORK_ABBR'), 'TEMPLATE' => '<a href="mailto:#VALUE_URL#">#VALUE_HTML#</a>'), 'HOME' => array('FULL' => GetMessage('CRM_FM_ENTITY_EMAIL_HOME'), 'SHORT' => GetMessage('CRM_FM_ENTITY_EMAIL_HOME_SHORT'), 'ABBR' => GetMessage('CRM_FM_ENTITY_EMAIL_HOME_ABBR'), 'TEMPLATE' => '<a href="mailto:#VALUE_URL#">#VALUE_HTML#</a>'), 'OTHER' => array('FULL' => GetMessage('CRM_FM_ENTITY_EMAIL_OTHER'), 'SHORT' => GetMessage('CRM_FM_ENTITY_EMAIL_OTHER_SHORT'), 'ABBR' => GetMessage('CRM_FM_ENTITY_EMAIL_OTHER_ABBR'), 'TEMPLATE' => '<a href="mailto:#VALUE_URL#">#VALUE_HTML#</a>')), 'IM' => array('SKYPE' => array('FULL' => GetMessage('CRM_FM_ENTITY_IM_SKYPE'), 'SHORT' => GetMessage('CRM_FM_ENTITY_IM_SKYPE_SHORT'), 'TEMPLATE' => '<a href="skype:#VALUE_URL#?chat">#VALUE_HTML#</a>'), 'ICQ' => array('FULL' => GetMessage('CRM_FM_ENTITY_IM_ICQ'), 'SHORT' => GetMessage('CRM_FM_ENTITY_IM_ICQ_SHORT'), 'TEMPLATE' => '<a href="http://www.icq.com/people/#VALUE_URL#/" target="_blank">#VALUE_HTML#</a>'), 'MSN' => array('FULL' => GetMessage('CRM_FM_ENTITY_IM_MSN'), 'SHORT' => GetMessage('CRM_FM_ENTITY_IM_MSN_SHORT'), 'TEMPLATE' => '<a href="msn:#VALUE_URL#">#VALUE_HTML#</a>'), 'JABBER' => array('FULL' => GetMessage('CRM_FM_ENTITY_IM_JABBER'), 'SHORT' => GetMessage('CRM_FM_ENTITY_IM_JABBER_SHORT'), 'TEMPLATE' => '#VALUE_HTML#'), 'OTHER' => array('FULL' => GetMessage('CRM_FM_ENTITY_IM_OTHER'), 'SHORT' => GetMessage('CRM_FM_ENTITY_IM_OTHER_SHORT'), 'TEMPLATE' => '#VALUE_HTML#'))); } return self::$ENTITY_TYPES; }
public static function PrepareCallToUrl($value) { return CCrmCallToUrl::Format($value); }
if ($typeID === 'PHONE' || $typeID === 'EMAIL' || $typeID === 'WEB') { $templateType = '_LINK_'; if ($typeID === 'WEB' && $valueType !== 'WORK' && $valueType !== 'HOME' && $valueType !== 'OTHER') { $editorFieldType .= '-' . strtolower($valueType); } } elseif ($typeID === 'IM') { $templateType = $valueType === 'SKYPE' || $valueType === 'ICQ' || $valueType === 'MSN' ? '_LINK_' : '_INPUT_'; $editorFieldType .= '-' . strtolower($valueType); } $template = isset($crmFieldMultiViewTemplates[$templateType]) ? $crmFieldMultiViewTemplates[$templateType] : ''; if ($template === '') { echo CCrmFieldMulti::GetTemplate($typeID, $valueType, $value); } else { $viewValue = $value; if ($typeID === 'PHONE') { $viewValue = CCrmCallToUrl::Format($value); } elseif ($typeID === 'EMAIL') { $viewValue = "mailto:{$value}"; } elseif ($typeID === 'WEB') { if ($valueType === 'OTHER' || $valueType === 'WORK' || $valueType === 'HOME') { $hasProto = preg_match('/^http(?:s)?:\\/\\/(.+)/', $value, $urlMatches) > 0; if ($hasProto) { $value = $urlMatches[1]; } else { $viewValue = "http://{$value}"; } } elseif ($valueType === 'FACEBOOK') { $viewValue = "http://www.facebook.com/{$value}/"; } elseif ($valueType === 'TWITTER') { $viewValue = "http://twitter.com/{$value}/"; } elseif ($valueType === 'LIVEJOURNAL') {
public static function CreateMultiFields($fieldTypeID, &$fieldValues, &$formFields, $fieldParams = array(), $readOnlyMode = true) { $fieldTypeID = strtoupper(strval($fieldTypeID)); if ($fieldTypeID === '' || !is_array($fieldValues) || count($fieldValues) === 0 || !is_array($formFields)) { return false; } if (!is_array($fieldParams)) { $fieldParams = array(); } foreach ($fieldValues as $ID => &$data) { $valueType = isset($data['VALUE_TYPE']) ? strtoupper($data['VALUE_TYPE']) : ''; $value = isset($data['VALUE']) ? $data['VALUE'] : ''; $fieldID = "FM.{$fieldTypeID}.{$valueType}"; $field = array('id' => $fieldID, 'name' => CCrmFieldMulti::GetEntityName($fieldTypeID, $valueType, true)); if ($readOnlyMode) { $field['type'] = 'label'; $field['value'] = CCrmFieldMulti::GetTemplate($fieldTypeID, $valueType, $value); } else { $templateType = 'INPUT'; $editorFieldType = strtolower($fieldTypeID); if ($fieldTypeID === 'PHONE' || $fieldTypeID === 'EMAIL' || $fieldTypeID === 'WEB') { $templateType = '_LINK_'; if ($fieldTypeID === 'WEB') { if ($valueType !== 'WORK' && $valueType !== 'HOME' && $valueType !== 'OTHER') { $editorFieldType .= '-' . strtolower($valueType); } } } elseif ($fieldTypeID === 'IM') { $templateType = $valueType === 'SKYPE' || $valueType === 'ICQ' || $valueType === 'MSN' ? '_LINK_' : 'INPUT'; $editorFieldType .= '-' . strtolower($valueType); } $template = isset(self::$TEMPLATES[$templateType]) ? self::$TEMPLATES[$templateType] : ''; if ($template === '') { $field['type'] = 'label'; $field['value'] = CCrmFieldMulti::GetTemplate($fieldTypeID, $valueType, $value); } else { $viewValue = $value; if ($fieldTypeID === 'PHONE') { $viewValue = CCrmCallToUrl::Format($value); } elseif ($fieldTypeID === 'EMAIL') { $viewValue = "mailto:{$value}"; } elseif ($fieldTypeID === 'WEB') { if ($valueType === 'OTHER' || $valueType === 'WORK' || $valueType === 'HOME') { $hasProto = preg_match('/^http(?:s)?:\\/\\/(.+)/', $value, $urlMatches) > 0; if ($hasProto) { $value = $urlMatches[1]; } else { $viewValue = "http://{$value}"; } } elseif ($valueType === 'FACEBOOK') { $viewValue = "http://www.facebook.com/{$value}/"; } elseif ($valueType === 'TWITTER') { $viewValue = "http://twitter.com/{$value}/"; } elseif ($valueType === 'LIVEJOURNAL') { $viewValue = "http://{$value}.livejournal.com/"; } } elseif ($fieldTypeID === 'IM') { if ($valueType === 'SKYPE') { $viewValue = "skype:{$value}?chat"; } elseif ($valueType === 'ICQ') { $viewValue = "http://www.icq.com/people/{$value}/"; } elseif ($valueType === 'MSN') { $viewValue = "msn:{$value}"; } } $field['type'] = 'custom'; $field['value'] = str_replace(array('#NAME#', '#FIELD_TYPE#', '#VALUE#', '#VIEW_VALUE#'), array($fieldID, htmlspecialcharsbx($editorFieldType), htmlspecialcharsbx($value), htmlspecialcharsbx($viewValue)), $template); } } $formFields[] = !empty($fieldParams) ? array_merge($field, $fieldParams) : $field; } unset($data); return true; }
?> <?php $phone = isset($arPhone['NUMBER']) ? trim($arPhone['NUMBER']) : ''; if (strlen($phone) === 0) { continue; } ?> <span class="crm-phone-text"><?php echo ($phoneCount > 0 ? ', ' : '') . htmlspecialcharsbx(isset($arPhone['TITLE']) ? $arPhone['TITLE'] : ''); ?> </span> <a class="crm-phone-number-link" onclick="addToDescription('<?php echo htmlspecialcharsbx(str_replace(array('#NAME#', '#PHONE#'), array($groupTitle, $phone), $descrTemplate)); ?> ');" href="<?php echo CCrmCallToUrl::Format(urlencode($arPhone['NUMBER'])); ?> "><?php echo htmlspecialcharsbx($arPhone['NUMBER']); ?> </a> <?php $phoneCount++; ?> <?php } ?> </span> </div> <?php }