329 lines
14 KiB
PHP
329 lines
14 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use Contao\Database;
|
|
use Contao\Controller;
|
|
use Contao\StringUtil;
|
|
|
|
$GLOBALS['TL_DCA']['tl_module']['palettes']['member_organizations'] = '{title_legend},name,headline,type;{eventmanager_legend},editPage;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID';
|
|
$GLOBALS['TL_DCA']['tl_module']['palettes']['member_events'] = '{title_legend},name,headline,type;{eventmanager_legend},editPage;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID';
|
|
$GLOBALS['TL_DCA']['tl_module']['palettes']['event_filter'] = '{title_legend},name,headline,type;{eventmanager_legend},cal_calendar,eventListDomId;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID';
|
|
$GLOBALS['TL_DCA']['tl_module']['palettes']['eventmanager_map'] = '{title_legend},name,headline,type;{eventmanager_legend},mapShowOrganizations,organizationTypeTags,mapShowExternalOrganizations,mapShowEvents,mapInitialDisplay,mapEventColor,mapOrganizationColor,mapPitch,mapCenterMode;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID';
|
|
$GLOBALS['TL_DCA']['tl_module']['palettes']['organization_edit'] = '{title_legend},name,headline,type;{eventmanager_legend},listPage,logoFolder,organizationTypeTags;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID';
|
|
$GLOBALS['TL_DCA']['tl_module']['palettes']['event_edit'] = '{title_legend},name,headline,type;{eventmanager_legend},listPage,eventFolder,termsPage,frontendAuthorId,frontendArchiveId,eventTypeTags;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID';
|
|
|
|
$GLOBALS['TL_DCA']['tl_module']['fields']['editPage'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_module']['editPage'],
|
|
'exclude' => true,
|
|
'inputType' => 'pageTree',
|
|
'eval' => ['fieldType' => 'radio', 'mandatory' => true, 'tl_class' => 'w50'],
|
|
'sql' => ['type' => 'integer', 'unsigned' => true, 'default' => 0],
|
|
];
|
|
|
|
$GLOBALS['TL_DCA']['tl_module']['fields']['listPage'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_module']['listPage'],
|
|
'exclude' => true,
|
|
'inputType' => 'pageTree',
|
|
'eval' => ['fieldType' => 'radio', 'mandatory' => true, 'tl_class' => 'w50'],
|
|
'sql' => ['type' => 'integer', 'unsigned' => true, 'default' => 0],
|
|
];
|
|
|
|
$GLOBALS['TL_DCA']['tl_module']['fields']['logoFolder'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_module']['logoFolder'],
|
|
'exclude' => true,
|
|
'inputType' => 'fileTree',
|
|
'eval' => ['fieldType' => 'radio', 'files' => false, 'mandatory' => true, 'tl_class' => 'w50'],
|
|
'sql' => ['type' => 'binary', 'length' => 16, 'notnull' => false],
|
|
];
|
|
|
|
$GLOBALS['TL_DCA']['tl_module']['fields']['eventFolder'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_module']['eventFolder'],
|
|
'exclude' => true,
|
|
'inputType' => 'fileTree',
|
|
'eval' => ['fieldType' => 'radio', 'files' => false, 'mandatory' => true, 'tl_class' => 'w50'],
|
|
'sql' => ['type' => 'binary', 'length' => 16, 'notnull' => false],
|
|
];
|
|
|
|
$GLOBALS['TL_DCA']['tl_module']['fields']['termsPage'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_module']['termsPage'],
|
|
'exclude' => true,
|
|
'inputType' => 'pageTree',
|
|
'eval' => ['fieldType' => 'radio', 'mandatory' => false, 'tl_class' => 'w50'],
|
|
'sql' => ['type' => 'integer', 'unsigned' => true, 'default' => 0],
|
|
];
|
|
|
|
$GLOBALS['TL_DCA']['tl_module']['fields']['frontendAuthorId'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_module']['frontendAuthorId'],
|
|
'exclude' => true,
|
|
'inputType' => 'text',
|
|
'eval' => ['mandatory' => true, 'rgxp' => 'digit', 'maxlength' => 10, 'tl_class' => 'w50'],
|
|
'sql' => ['type' => 'integer', 'unsigned' => true, 'default' => 0],
|
|
];
|
|
|
|
$GLOBALS['TL_DCA']['tl_module']['fields']['frontendArchiveId'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_module']['frontendArchiveId'],
|
|
'exclude' => true,
|
|
'inputType' => 'text',
|
|
'eval' => ['mandatory' => true, 'rgxp' => 'digit', 'maxlength' => 10, 'tl_class' => 'w50'],
|
|
'sql' => ['type' => 'integer', 'unsigned' => true, 'default' => 0],
|
|
];
|
|
|
|
$GLOBALS['TL_DCA']['tl_module']['fields']['organizationTypeTags'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_module']['organizationTypeTags'],
|
|
'exclude' => true,
|
|
'inputType' => 'checkbox',
|
|
'options_callback' => static function () {
|
|
$database = Database::getInstance();
|
|
$labelExpression = $database->fieldExists('title', 'tl_tags')
|
|
? "COALESCE(NULLIF(t.title, ''), t.tag)"
|
|
: 't.tag';
|
|
|
|
$rows = Database::getInstance()
|
|
->prepare(sprintf(
|
|
'SELECT DISTINCT t.id, %1$s AS label
|
|
FROM tl_tags_rel r
|
|
INNER JOIN tl_tags t ON t.id=r.tag_id
|
|
WHERE r.ptable=? AND r.field=?
|
|
ORDER BY label ASC',
|
|
$labelExpression,
|
|
))
|
|
->execute('tl_organization', 'tags')
|
|
->fetchAllAssoc();
|
|
|
|
$options = [];
|
|
|
|
foreach ($rows as $row) {
|
|
$label = trim((string) ($row['label'] ?? ''));
|
|
|
|
if ('' === $label) {
|
|
continue;
|
|
}
|
|
|
|
$options[(int) $row['id']] = $label;
|
|
}
|
|
|
|
return $options;
|
|
},
|
|
'eval' => ['multiple' => true, 'tl_class' => 'clr'],
|
|
'sql' => ['type' => 'blob', 'notnull' => false],
|
|
'save_callback' => [
|
|
static function ($value): array {
|
|
return array_values(array_unique(array_map('intval', StringUtil::deserialize($value, true))));
|
|
},
|
|
],
|
|
];
|
|
|
|
$GLOBALS['TL_DCA']['tl_module']['fields']['eventTypeTags'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_module']['eventTypeTags'],
|
|
'exclude' => true,
|
|
'inputType' => 'checkbox',
|
|
'options_callback' => static function () {
|
|
$rows = Database::getInstance()
|
|
->prepare('SELECT DISTINCT t.id, t.tag FROM tl_tags t LEFT JOIN tl_tags_rel r ON r.tag_id=t.id AND r.ptable=? AND r.field=? ORDER BY t.tag ASC')
|
|
->execute('tl_calendar_events', 'tags')
|
|
->fetchAllAssoc();
|
|
|
|
$options = [];
|
|
|
|
foreach ($rows as $row) {
|
|
$options[(int) $row['id']] = (string) $row['tag'];
|
|
}
|
|
|
|
return $options;
|
|
},
|
|
'eval' => ['multiple' => true, 'tl_class' => 'clr'],
|
|
'sql' => ['type' => 'blob', 'notnull' => false],
|
|
'save_callback' => [
|
|
static function ($value): array {
|
|
return array_values(array_unique(array_map('intval', StringUtil::deserialize($value, true))));
|
|
},
|
|
],
|
|
];
|
|
|
|
$GLOBALS['TL_DCA']['tl_module']['fields']['eventListDomId'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_module']['eventListDomId'],
|
|
'exclude' => true,
|
|
'inputType' => 'select',
|
|
'options_callback' => static function (): array {
|
|
$rows = Database::getInstance()
|
|
->prepare('SELECT id, name, cssID FROM tl_module WHERE type=? ORDER BY name ASC, id ASC')
|
|
->execute('eventlist')
|
|
->fetchAllAssoc();
|
|
|
|
$options = [];
|
|
|
|
foreach ($rows as $row) {
|
|
$moduleId = (int) ($row['id'] ?? 0);
|
|
|
|
if ($moduleId <= 0) {
|
|
continue;
|
|
}
|
|
|
|
$cssId = StringUtil::deserialize($row['cssID'] ?? null, true);
|
|
$domId = trim((string) ($cssId[0] ?? ''));
|
|
$domId = '' !== $domId ? $domId : sprintf('mod_eventlist_%d', $moduleId);
|
|
$moduleName = trim((string) ($row['name'] ?? ''));
|
|
|
|
if ('' === $moduleName) {
|
|
$moduleName = sprintf('Eventliste %d', $moduleId);
|
|
}
|
|
|
|
$options[$domId] = sprintf('%s [%s]', $moduleName, $domId);
|
|
}
|
|
|
|
return $options;
|
|
},
|
|
'eval' => ['includeBlankOption' => true, 'chosen' => true, 'tl_class' => 'w50'],
|
|
'sql' => ['type' => 'string', 'length' => 128, 'default' => ''],
|
|
];
|
|
|
|
$GLOBALS['TL_DCA']['tl_module']['palettes']['__selector__'][] = 'mapCenterMode';
|
|
$GLOBALS['TL_DCA']['tl_module']['palettes']['__selector__'][] = 'mapInitialDisplay';
|
|
$GLOBALS['TL_DCA']['tl_module']['subpalettes']['mapCenterMode_custom'] = 'mapCenterLat,mapCenterLng,mapCenterZoom';
|
|
$GLOBALS['TL_DCA']['tl_module']['subpalettes']['mapInitialDisplay_organization_tag'] = 'mapInitialOrganizationTagId';
|
|
|
|
$GLOBALS['TL_DCA']['tl_module']['fields']['mapShowOrganizations'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_module']['mapShowOrganizations'],
|
|
'exclude' => true,
|
|
'inputType' => 'checkbox',
|
|
'eval' => ['tl_class' => 'w50 m12'],
|
|
'sql' => ['type' => 'string', 'length' => 1, 'fixed' => true, 'default' => ''],
|
|
];
|
|
|
|
$GLOBALS['TL_DCA']['tl_module']['fields']['mapShowExternalOrganizations'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_module']['mapShowExternalOrganizations'],
|
|
'exclude' => true,
|
|
'inputType' => 'checkbox',
|
|
'eval' => ['tl_class' => 'w50 m12'],
|
|
'sql' => ['type' => 'string', 'length' => 1, 'fixed' => true, 'default' => ''],
|
|
];
|
|
|
|
$GLOBALS['TL_DCA']['tl_module']['fields']['mapShowEvents'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_module']['mapShowEvents'],
|
|
'exclude' => true,
|
|
'inputType' => 'checkbox',
|
|
'eval' => ['tl_class' => 'w50 m12'],
|
|
'sql' => ['type' => 'string', 'length' => 1, 'fixed' => true, 'default' => ''],
|
|
];
|
|
|
|
$GLOBALS['TL_DCA']['tl_module']['fields']['mapInitialDisplay'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_module']['mapInitialDisplay'],
|
|
'exclude' => true,
|
|
'inputType' => 'select',
|
|
'options' => ['random', 'events', 'organization_tag'],
|
|
'reference' => &$GLOBALS['TL_LANG']['tl_module']['mapInitialDisplay_options'],
|
|
'eval' => ['mandatory' => true, 'submitOnChange' => true, 'tl_class' => 'w50', 'includeBlankOption' => false],
|
|
'sql' => ['type' => 'string', 'length' => 32, 'default' => 'random'],
|
|
];
|
|
|
|
$GLOBALS['TL_DCA']['tl_module']['fields']['mapInitialOrganizationTagId'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_module']['mapInitialOrganizationTagId'],
|
|
'exclude' => true,
|
|
'inputType' => 'select',
|
|
'options_callback' => static function (): array {
|
|
$database = Database::getInstance();
|
|
$labelExpression = $database->fieldExists('title', 'tl_tags')
|
|
? "COALESCE(NULLIF(t.title, ''), t.tag)"
|
|
: 't.tag';
|
|
|
|
$rows = $database
|
|
->prepare(sprintf(
|
|
'SELECT DISTINCT t.id, %1$s AS label
|
|
FROM tl_tags_rel r
|
|
INNER JOIN tl_tags t ON t.id=r.tag_id
|
|
WHERE r.ptable=? AND r.field=?
|
|
ORDER BY label ASC',
|
|
$labelExpression,
|
|
))
|
|
->execute('tl_organization', 'tags')
|
|
->fetchAllAssoc();
|
|
|
|
$options = [];
|
|
|
|
foreach ($rows as $row) {
|
|
$label = trim((string) ($row['label'] ?? ''));
|
|
|
|
if ('' === $label) {
|
|
continue;
|
|
}
|
|
|
|
$options[(int) $row['id']] = $label;
|
|
}
|
|
|
|
return $options;
|
|
},
|
|
'eval' => ['includeBlankOption' => true, 'chosen' => true, 'tl_class' => 'w50'],
|
|
'sql' => ['type' => 'integer', 'unsigned' => true, 'default' => 0],
|
|
];
|
|
|
|
$GLOBALS['TL_DCA']['tl_module']['fields']['mapEventColor'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_module']['mapEventColor'],
|
|
'exclude' => true,
|
|
'inputType' => 'text',
|
|
'eval' => ['maxlength' => 7, 'rgxp' => 'hexcolor', 'colorpicker' => true, 'tl_class' => 'w50'],
|
|
'sql' => ['type' => 'string', 'length' => 7, 'default' => '#BC5067'],
|
|
];
|
|
|
|
$GLOBALS['TL_DCA']['tl_module']['fields']['mapOrganizationColor'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_module']['mapOrganizationColor'],
|
|
'exclude' => true,
|
|
'inputType' => 'text',
|
|
'eval' => ['maxlength' => 7, 'rgxp' => 'hexcolor', 'colorpicker' => true, 'tl_class' => 'w50'],
|
|
'sql' => ['type' => 'string', 'length' => 7, 'default' => '#BC5067'],
|
|
];
|
|
|
|
$GLOBALS['TL_DCA']['tl_module']['fields']['mapCenterMode'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_module']['mapCenterMode'],
|
|
'exclude' => true,
|
|
'inputType' => 'select',
|
|
'options' => ['markers', 'custom'],
|
|
'reference' => &$GLOBALS['TL_LANG']['tl_module']['mapCenterMode_options'],
|
|
'eval' => ['submitOnChange' => true, 'mandatory' => true, 'tl_class' => 'clr w50', 'includeBlankOption' => false],
|
|
'sql' => ['type' => 'string', 'length' => 16, 'default' => 'markers'],
|
|
];
|
|
|
|
$GLOBALS['TL_DCA']['tl_module']['fields']['mapCenterLat'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_module']['mapCenterLat'],
|
|
'exclude' => true,
|
|
'inputType' => 'text',
|
|
'eval' => ['maxlength' => 32, 'tl_class' => 'w50'],
|
|
'sql' => ['type' => 'string', 'length' => 32, 'default' => ''],
|
|
];
|
|
|
|
$GLOBALS['TL_DCA']['tl_module']['fields']['mapCenterLng'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_module']['mapCenterLng'],
|
|
'exclude' => true,
|
|
'inputType' => 'text',
|
|
'eval' => ['maxlength' => 32, 'tl_class' => 'w50'],
|
|
'sql' => ['type' => 'string', 'length' => 32, 'default' => ''],
|
|
];
|
|
|
|
$GLOBALS['TL_DCA']['tl_module']['fields']['mapCenterZoom'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_module']['mapCenterZoom'],
|
|
'exclude' => true,
|
|
'inputType' => 'text',
|
|
'eval' => ['rgxp' => 'digit', 'maxlength' => 2, 'tl_class' => 'w50'],
|
|
'sql' => ['type' => 'smallint', 'unsigned' => true, 'default' => 12],
|
|
];
|
|
|
|
$GLOBALS['TL_DCA']['tl_module']['fields']['mapPitch'] = [
|
|
'label' => &$GLOBALS['TL_LANG']['tl_module']['mapPitch'],
|
|
'exclude' => true,
|
|
'inputType' => 'text',
|
|
'eval' => ['rgxp' => 'digit', 'maxlength' => 2, 'tl_class' => 'w50'],
|
|
'sql' => ['type' => 'smallint', 'unsigned' => true, 'default' => 0],
|
|
];
|
|
|
|
if (isset($GLOBALS['TL_DCA']['tl_module']['fields']['list_layout'])) {
|
|
$GLOBALS['TL_DCA']['tl_module']['fields']['list_layout']['options_callback'] = static function (): array {
|
|
$options = Controller::getTemplateGroup('list_');
|
|
|
|
if (!isset($options['list_default_organisationen'])) {
|
|
$options['list_default_organisationen'] = 'list_default_organisationen';
|
|
}
|
|
|
|
return $options;
|
|
};
|
|
}
|