ArticleTypeField::VerboseTypeName PHP Method

VerboseTypeName() public static method

Get a human-readable representation of the column type.
public static VerboseTypeName ( $p_typeName, $p_languageId = 1, $p_rootTopicId = null ) : string
return string
    public static function VerboseTypeName($p_typeName, $p_languageId = 1, $p_rootTopicId = null)
    {
        $translator = \Zend_Registry::get('container')->getService('translator');
        $translator->trans('Invalid security token!', array(), 'api');
        switch ($p_typeName) {
            case self::TYPE_BODY:
                return $translator->trans('Multi-line Text with WYSIWYG', array(), 'api');
            case self::TYPE_TEXT:
                return $translator->trans('Single-line Text', array(), 'api');
            case self::TYPE_LONGTEXT:
                return $translator->trans('Multi-line Text', array(), 'api');
            case self::TYPE_DATE:
                return $translator->trans('Date');
            case self::TYPE_TOPIC:
                if (is_null($p_rootTopicId)) {
                    return $translator->trans('Topic');
                }
                $em = \Zend_Registry::get('container')->getService('em');
                $repository = $em->getRepository('Newscoop\\NewscoopBundle\\Entity\\Topic');
                $locale = $em->getReference("Newscoop\\Entity\\Language", $p_languageId)->getCode();
                $topic = $repository->getTopicByIdOrName($p_rootTopicId, $locale)->getArrayResult();
                return $translator->trans('Topic') . ' (' . $topic[0]['title'] . ')';
                break;
            case self::TYPE_SWITCH:
                return $translator->trans('Switch', array(), 'api');
            case self::TYPE_NUMERIC:
                return $translator->trans('Numeric', array(), 'api');
            case self::TYPE_COMPLEX_DATE:
                return $translator->trans('Complex Date', array(), 'api');
            default:
                return $translator->trans("unknown", array(), 'api');
        }
    }

Usage Example

コード例 #1
0
ファイル: retype.php プロジェクト: nidzix/Newscoop
$articleField = new ArticleTypeField($articleTypeName, $articleTypeFieldName);
$crumbs = array();
$crumbs[] = array(getGS("Configure"), "");
$crumbs[] = array(getGS("Article Types"), "/{$ADMIN}/article_types/");
$crumbs[] = array($articleTypeName, '');
$crumbs[] = array(getGS("Article type fields"), "/{$ADMIN}/article_types/fields/?f_article_type=" . urlencode($articleTypeName));
$crumbs[] = array(getGS("Reassign a field type"), "");
echo camp_html_breadcrumbs($crumbs);
include_once $GLOBALS['g_campsiteDir'] . "/{$ADMIN_DIR}/javascript_common.php";
$lang = camp_session_get('LoginLanguageId', 1);
$languageObj = new Language($lang);
// Verify the merge rules
$options = array();
$convertibleFromTypes = $articleField->getConvertibleToTypes();
foreach ($convertibleFromTypes as $type) {
    $options[$type] = ArticleTypeField::VerboseTypeName($type, $languageObj->getLanguageId());
}
?>
<script>
function UpdateArticleFieldContext() {
	var my_form = document.forms["add_field_form"]
	var field_type = my_form.elements["f_article_field_type"].value
	var is_topic = my_form.elements["is_topic"].value
	if ((is_topic == "false" && field_type == "topic")
			|| (is_topic == "true" && field_type != "topic")) {
		ToggleRowVisibility('topic_list')
		ToggleBoolValue('is_topic')
	}
}
</script>
All Usage Examples Of ArticleTypeField::VerboseTypeName