DatabaseTypes() public static method

Returns an array of valid field data types.
public static DatabaseTypes ( $p_numericDigits = null, $p_numericPrecision = null ) : array
return array
 /**
  * Extends article type table with configured fields
  * NOTE: This ia a hack, should be converted to new ArticleType Entity
  */
 private function extendArticleTypeTable()
 {
     // Create article type
     $tableName = $this->getTableName();
     $query = '';
     $types = \ArticleTypeField::DatabaseTypes(null, null);
     $articleTypeFields = $this->getArticleTypeConfiguration();
     foreach ($articleTypeFields as $fieldId => $fieldData) {
         $query .= "ALTER TABLE `" . $tableName . "` ADD COLUMN `F" . $fieldId . '` ' . $types[$fieldData['type']] . ';';
     }
     $this->connection->exec($query);
 }
Exemplo n.º 2
0
$editorSize = Input::Get('f_editor_size');
$editorSizeCustom = Input::Get('f_editor_size_custom');
$maxsize = Input::Get('f_maxsize');
$eventColor = Input::Get('f_event_color');
$field = new ArticleTypeField($articleTypeName, $fieldName);
$correct = true;
$errorMsgs = array();
if (!ArticleType::IsValidFieldName($fieldName)) {
    $errorMsgs[] = $translator->trans('The $1  must not be void and may only contain letters and underscore (_) character.', array('$1' => $translator->trans('Name')), 'article_type_fields');
    $correct = false;
}
if ($field->exists()) {
    $errorMsgs[] = $translator->trans('The field $1 already exists.', array('$1' => '<B>' . urlencode($fieldName) . '</B>'), 'article_type_fields');
    $correct = false;
}
$validTypes = array_keys(ArticleTypeField::DatabaseTypes());
if (!in_array($fieldType, $validTypes)) {
    $errorMsgs[] = $translator->trans('Invalid field type.', array(), 'article_type_fields');
    $correct = false;
}
$article = new MetaArticle();
if ($article->has_property($fieldName) || method_exists($article, $fieldName)) {
    $correct = false;
    $errorMsgs[] = $translator->trans("The property \$1 is already in use.", array('$1' => $fieldName), 'article_type_fields');
}
if ($correct) {
    if ($editorSize == 'small') {
        $editorSize = ArticleTypeField::BODY_ROWS_SMALL;
    } else {
        if ($editorSize == 'medium') {
            $editorSize = ArticleTypeField::BODY_ROWS_MEDIUM;
Exemplo n.º 3
0
if ($cacheService->contains($cacheKey)) {
    $topics = $cacheService->fetch($cacheKey);
} else {
    $topicsQuery = $repository->getTranslatableTopics($langObj->getCode());
    $topics = $topicsQuery->getResult();
    $cacheService->save($cacheKey, $topics);
}
$crumbs = array();
$crumbs[] = array($translator->trans('Configure'), "");
$crumbs[] = array($translator->trans('Article Types'), "/{$ADMIN}/article_types/");
$crumbs[] = array($articleTypeName, '');
$crumbs[] = array($translator->trans("Article type fields", array(), 'article_type_fields'), "/{$ADMIN}/article_types/fields/?f_article_type=" . urlencode($articleTypeName));
$crumbs[] = array($translator->trans("Add new field", array(), 'article_type_fields'), "");
echo camp_html_breadcrumbs($crumbs);
include_once $GLOBALS['g_campsiteDir'] . "/{$ADMIN_DIR}/javascript_common.php";
foreach (ArticleTypeField::DatabaseTypes() as $type => $sqlDesc) {
    $options[$type] = ArticleTypeField::VerboseTypeName($type, $currentLanguageId);
}
?>
<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')
    }