本文整理汇总了PHP中CCrmFieldMulti::GetTemplate方法的典型用法代码示例。如果您正苦于以下问题:PHP CCrmFieldMulti::GetTemplate方法的具体用法?PHP CCrmFieldMulti::GetTemplate怎么用?PHP CCrmFieldMulti::GetTemplate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCrmFieldMulti
的用法示例。
在下文中一共展示了CCrmFieldMulti::GetTemplate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: strtolower
echo '<div class="crm-fld-block-readonly">', CCrmFieldMulti::GetTemplate($typeID, $valueType, $value), '</div>';
} else {
$templateType = '_INPUT_';
$editorFieldType = strtolower($typeID);
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') {
示例2: CreateMultiFields
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;
}