PHP-Code:
<?php if (!defined('TL_ROOT')) die('You can not access this file directly!');
$GLOBALS['TL_DCA']['tl_feedback'] = array
(
// Config
'config' => array
(
'dataContainer' => 'Table',
'switchToEdit' => true,
'enableVersioning' => true,
'markAsCopy' => 'title',
'sql' => array
(
'keys' => array
(
'id' => 'primary'
)
),
),
// List
'list' => array
(
'sorting' => array
(
'mode' => 1,
'flag' => 8,
'fields' => array('created_time'),
'headerFields' => array('title', 'tstamp' ,'created_time'),
'panelLayout' => 'sort,search,limit',
),
'label' => array
(
'fields' => array('tstamp', 'created_time'),
'format' => '%s',
'label_callback' => array('Feedback', 'listFeedbacks')
),
'global_operations' => array
(
'all' => array
(
'label' => &$GLOBALS['TL_LANG']['MSC']['all'],
'href' => 'act=select',
'class' => 'header_edit_all',
'attributes' => 'onclick="Backend.getScrollOffset();" accesskey="e"'
)
),
'operations' => array
(
'editheader' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_feedback']['editheader'],
'href' => 'act=edit',
'icon' => 'header.gif'
),
'copy' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_feedback']['copy'],
'href' => 'act=copy',
'icon' => 'copy.gif'
),
'delete' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_feedback']['delete'],
'href' => 'act=delete',
'icon' => 'delete.gif',
'attributes' => 'onclick="if (!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\')) return false; Backend.getScrollOffset();"'
),
'toggle' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_feedback']['toggle'],
'icon' => 'visible.svg',
'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"',
'button_callback' => array('Feedback', 'toggleIcon')
),
'show' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_feedback']['show'],
'href' => 'act=show',
'icon' => 'show.gif'
)
)
),
// Palettes
'palettes' => array
(
'__selector__' => array(''),
'default' => '
{feedback_legend},title,created_time;
{feedback_contact_legend},vorname,nachname,email,ip,feedback_text,upload_file;
{element_extra_legend:hide},invisible
'
),
// Fields
'fields' => array
(
'id' => array
(
'sql' => "int(10) unsigned NOT NULL auto_increment",
),
'tstamp' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_feedback']['tstamp'],
'sql' => "int(10) unsigned NOT NULL default '0'",
),
'title' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_feedback']['title'],
'exclude' => true,
'inputType' => 'text',
'search' => true,
'sorting' => true,
'eval' => array('mandatory'=>true, 'minlength'=>1, 'maxlength'=>255, 'tl_class'=>'w50 clr'),
'sql' => "varchar(255) NOT NULL default ''"
),
'created_time' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_feedback']['created_time'],
'default' => time(),
'inputType' => 'text',
'eval' => array('rgxp'=>'datim', 'mandatory'=>true, 'doNotCopy'=>true, 'datepicker'=>true, 'tl_class'=>'w50 wizard'),
'sql' => "int(10) unsigned NULL"
),
'vorname' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_feedback']['vorname'],
'exclude' => true,
'search' => true,
'inputType' => 'text',
'eval' => array('mandatory'=>true, 'doNotCopy'=>true, 'tl_class'=>'w50 clr'),
'sql' => "varchar(255) NOT NULL default ''"
),
'nachname' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_feedback']['nachname'],
'exclude' => true,
'search' => true,
'inputType' => 'text',
'eval' => array('mandatory'=>true, 'doNotCopy'=>true, 'tl_class'=>'w50'),
'sql' => "varchar(255) NOT NULL default ''"
),
'email' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_feedback']['email'],
'exclude' => true,
'search' => true,
'inputType' => 'text',
'eval' => array('rgxp'=>'email', 'doNotCopy'=>true, 'tl_class'=>'w50 clr'),
'sql' => "varchar(255) NOT NULL default ''"
),
'ip' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_feedback']['ip'],
'exclude' => true,
'search' => true,
'inputType' => 'text',
'eval' => array('doNotCopy'=>true, 'readonly'=> true, 'tl_class'=>'w50'),
'sql' => "varchar(255) NOT NULL default ''"
),
'feedback_text' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_feedback']['feedback_text'],
'exclude' => false,
'inputType' => 'textarea',
'sorting' => true,
'eval' => array('mandatory'=>true, 'rte'=>'tinyMCE', 'helpwizard'=>true, 'tl_class'=>'clr w100'),
'sql' => "mediumtext NULL"
),
'upload_file' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_feedback']['upload_file'],
'exclude' => true,
'inputType' => 'fileTree',
'eval' => array('filesOnly'=>true, 'fieldType'=>'radio', 'mandatory'=>false, 'tl_class'=>'clr'),
'load_callback' => array
(
array('Feedback', 'setSingleSrcFlags')
),
'sql' => "binary(16) NULL"
),
'invisible' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_feedback']['invisible'],
'exclude' => true,
'filter' => true,
'inputType' => 'checkbox',
'default' => '0',
'sql' => "char(1) NOT NULL default ''"
)
)
);
class Feedback extends \Backend
{
[...]der ganze Kram der da sonst für toogleView usw. reingehört[...]
public function setSingleSrcFlags($varValue, Contao\DataContainer $dc)
{
if ($dc->activeRecord)
{
switch ($dc->activeRecord->type)
{
case 'text':
case 'hyperlink':
case 'image':
case 'accordionSingle':
$GLOBALS['TL_DCA'][$dc->table]['fields'][$dc->field]['eval']['extensions'] = Contao\Config::get('validContao\ImageTypes');
break;
case 'download':
$GLOBALS['TL_DCA'][$dc->table]['fields'][$dc->field]['eval']['extensions'] = Contao\Config::get('allowedDownload');
break;
}
}
return $varValue;
}
}
FeedbackFormModule.php:
Lesezeichen