<?php

$GLOBALS['TL_DCA']['tl_competition_review'] = array('config' => array('dataContainer' => 'Table', 'ptable' => 'tl_competition_review_archive', 'enableVersioning' => true, 'onload_callback' => array('setDateAdded' => array('HeimrichHannot\\HastePlus\\Utilities', 'setDateAdded', true)), 'sql' => array('keys' => array('id' => 'primary'))), 'list' => array('sorting' => array('mode' => 4, 'fields' => array('dateAdded DESC'), 'headerFields' => array('title'), 'panelLayout' => 'filter;search,limit', 'child_record_callback' => array('tl_competition_review', 'listReviews')), 'global_operations' => array('export' => \HeimrichHannot\Exporter\ModuleExporter::getGlobalOperation('export', $GLOBALS['TL_LANG']['tl_competition_review']['export'], 'system/modules/competition/assets/img/icon_export.png'), 'export_xls' => \HeimrichHannot\Exporter\ModuleExporter::getGlobalOperation('export_xls', $GLOBALS['TL_LANG']['tl_competition_review']['export_xls'], 'system/modules/competition/assets/img/icon_export.png'), 'all' => array('label' => &$GLOBALS['TL_LANG']['MSC']['all'], 'href' => 'act=select', 'class' => 'header_edit_all', 'attributes' => 'onclick="Backend.getScrollOffset();"')), 'operations' => array('edit' => array('label' => &$GLOBALS['TL_LANG']['tl_competition_review']['edit'], 'href' => 'act=edit', 'icon' => 'edit.gif'), 'copy' => array('label' => &$GLOBALS['TL_LANG']['tl_competition_review']['copy'], 'href' => 'act=copy', 'icon' => 'copy.gif'), 'delete' => array('label' => &$GLOBALS['TL_LANG']['tl_competition_review']['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_competition_review']['toggle'], 'icon' => 'visible.gif', 'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"', 'button_callback' => array('tl_competition_review', 'toggleIcon')), 'show' => array('label' => &$GLOBALS['TL_LANG']['tl_competition_review']['show'], 'href' => 'act=show', 'icon' => 'show.gif'))), 'palettes' => array('default' => '{general_legend},jid,sid,pdfExportFile;{publish_legend},published;'), 'fields' => array('id' => array('label' => &$GLOBALS['TL_LANG']['MSC']['id'], 'sql' => "int(10) unsigned NOT NULL auto_increment"), 'pid' => array('foreignKey' => 'tl_competition_review_archive.title', 'sql' => "int(10) unsigned NOT NULL default '0'", 'relation' => array('type' => 'belongsTo', 'load' => 'eager')), 'tstamp' => array('sql' => "int(10) unsigned NOT NULL default '0'"), 'dateAdded' => array('label' => &$GLOBALS['TL_LANG']['MSC']['dateAdded'], 'sorting' => true, 'flag' => 6, 'eval' => array('rgxp' => 'datim', 'doNotCopy' => true), 'sql' => "int(10) unsigned NOT NULL default '0'"), 'jid' => array('label' => &$GLOBALS['TL_LANG']['tl_competition_review']['jid'], 'exclude' => true, 'filter' => true, 'search' => true, 'inputType' => 'select', 'default' => \FrontendUser::getInstance() && \FrontendUser::getInstance()->id ? \FrontendUser::getInstance()->id : 0, 'foreignKey' => 'tl_member.id', 'options_callback' => array('tl_competition_review', 'getAllowedMembersAsOptions'), 'eval' => array('mandatory' => true, 'tl_class' => 'w50', 'includeBlankOption' => true, 'submitOnChange' => true), 'sql' => "int(10) unsigned NOT NULL default '0'", 'relation' => array('type' => 'belongsTo', 'load' => 'lazy')), 'sid' => array('label' => &$GLOBALS['TL_LANG']['tl_competition_review']['sid'], 'exclude' => true, 'search' => true, 'inputType' => 'select', 'foreignKey' => 'tl_competition_submission.id', 'options_callback' => array('tl_competition_review', 'getAllowedSubmissionsAsOptions'), 'eval' => array('mandatory' => true, 'tl_class' => 'w50', 'includeBlankOption' => true, 'submitOnChange' => true, 'rgxp' => 'uniquesid'), 'sql' => "varchar(10) NOT NULL default ''", 'relation' => array('type' => 'belongsTo', 'load' => 'lazy')), 'pdfExportFile' => array('label' => &$GLOBALS['TL_LANG']['tl_competition_review']['pdfExportFile'], 'inputType' => 'fileTree', 'exclude' => true, 'eval' => array('filesOnly' => true, 'extensions' => 'pdf', 'fieldType' => 'radio', 'tl_class' => 'long clr'), 'sql' => "binary(16) NULL"), 'published' => array('label' => &$GLOBALS['TL_LANG']['tl_competition_review']['published'], 'exclude' => true, 'filter' => true, 'inputType' => 'checkbox', 'eval' => array('tl_class' => 'w50', 'doNotCopy' => true), 'sql' => "char(1) NOT NULL default ''")));
class tl_competition_review extends \Backend
{
    public function listReviews($arrRow)
    {
        $strReview = '<div>';
        if (($objMember = \MemberModel::findByPk($arrRow['jid'])) !== null) {
            $strReview .= $objMember->firstname . ' ' . $objMember->lastname;
        }
        if (($objSubmission = \HeimrichHannot\Competition\SubmissionModel::findByPk($arrRow['sid'])) !== null) {
            if ($objSubmission->companyTeamName) {
                $strReview .= ' <span style="color:#b3b3b3; padding-left:3px">[' . $objSubmission->companyTeamName . ']</span>';
            }
        }
        $strReview .= '</div>';
        return $strReview;
    }
    /**
     * Check permissions to edit table tl_competition_review
     */
    public function checkPermission()
    {
        $objUser = \BackendUser::getInstance();
        $objSession = \Session::getInstance();
        $objDatabase = \Database::getInstance();
        // TODO!
        if (true || $objUser->isAdmin) {
            return;
        }
<?php

$GLOBALS['TL_DCA']['tl_competition_submission'] = array('config' => array('dataContainer' => 'Table', 'ptable' => 'tl_competition_submission_archive', 'enableVersioning' => true, 'onload_callback' => array('setDateAdded' => array('HeimrichHannot\\HastePlus\\Utilities', 'setDateAdded', true)), 'sql' => array('keys' => array('id' => 'primary'))), 'list' => array('sorting' => array('mode' => 4, 'fields' => array('dateAdded DESC'), 'headerFields' => array('title'), 'panelLayout' => 'filter;search,limit', 'child_record_callback' => array('tl_competition_submission', 'listSubmissions')), 'global_operations' => array('export' => \HeimrichHannot\Exporter\ModuleExporter::getGlobalOperation('export', $GLOBALS['TL_LANG']['tl_competition_submission']['export'], 'system/modules/competition/assets/img/icon_export.png'), 'export_xls' => \HeimrichHannot\Exporter\ModuleExporter::getGlobalOperation('export_xls', $GLOBALS['TL_LANG']['tl_competition_submission']['export_xls'], 'system/modules/competition/assets/img/icon_export.png'), 'clean_members' => array('label' => &$GLOBALS['TL_LANG']['tl_competition_submission']['clean_members'], 'href' => 'key=clean_members', 'class' => 'header_clean_members_entities', 'icon' => 'system/modules/competition/assets/img/icon_clean.png', 'attributes' => 'onclick="return confirm(\'' . $GLOBALS['TL_LANG']['tl_competition_submission']['reallyProceed'] . '\')"'), 'all' => array('label' => &$GLOBALS['TL_LANG']['MSC']['all'], 'href' => 'act=select', 'class' => 'header_edit_all', 'attributes' => 'onclick="Backend.getScrollOffset();"')), 'operations' => array('edit' => array('label' => &$GLOBALS['TL_LANG']['tl_competition_submission']['edit'], 'href' => 'act=edit', 'icon' => 'edit.gif'), 'copy' => array('label' => &$GLOBALS['TL_LANG']['tl_competition_submission']['copy'], 'href' => 'act=copy', 'icon' => 'copy.gif'), 'delete' => array('label' => &$GLOBALS['TL_LANG']['tl_competition_submission']['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_competition_submission']['toggle'], 'icon' => 'visible.gif', 'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"', 'button_callback' => array('tl_competition_submission', 'toggleIcon')), 'show' => array('label' => &$GLOBALS['TL_LANG']['tl_competition_submission']['show'], 'href' => 'act=show', 'icon' => 'show.gif'))), 'palettes' => array('default' => '
		{general_legend},mid,allowedJids,pdfExportFile,pdfExportFileForJudges;
		{publish_legend},published;'), 'fields' => array('id' => array('label' => &$GLOBALS['TL_LANG']['MSC']['id'], 'sql' => "int(10) unsigned NOT NULL auto_increment"), 'pid' => array('foreignKey' => 'tl_competition_submission_archive.title', 'sql' => "int(10) unsigned NOT NULL default '0'", 'relation' => array('type' => 'belongsTo', 'load' => 'eager')), 'tstamp' => array('sql' => "int(10) unsigned NOT NULL default '0'"), 'dateAdded' => array('label' => &$GLOBALS['TL_LANG']['MSC']['dateAdded'], 'sorting' => true, 'flag' => 6, 'eval' => array('rgxp' => 'datim', 'doNotCopy' => true), 'sql' => "int(10) unsigned NOT NULL default '0'"), 'mid' => array('label' => &$GLOBALS['TL_LANG']['tl_competition_submission']['mid'], 'exclude' => true, 'search' => true, 'inputType' => 'select', 'default' => \FrontendUser::getInstance() && \FrontendUser::getInstance()->id ? \FrontendUser::getInstance()->id : 0, 'foreignKey' => 'tl_member.id', 'options_callback' => array('tl_competition_submission', 'getAllowedMembersAsOptions'), 'eval' => array('mandatory' => true, 'tl_class' => 'w50 clr', 'includeBlankOption' => true, 'chosen' => true), 'sql' => "int(10) unsigned NOT NULL default '0'", 'relation' => array('type' => 'belongsTo', 'load' => 'lazy')), 'allowedJids' => array('label' => &$GLOBALS['TL_LANG']['tl_competition_submission']['allowedJids'], 'exclude' => true, 'search' => true, 'filter' => true, 'inputType' => 'select', 'foreignKey' => 'tl_member.id', 'options_callback' => array('tl_competition_submission', 'getAllowedJudgesAsOptions'), 'sql' => "blob NULL", 'relation' => array('type' => 'belongsToMany', 'load' => 'lazy'), 'eval' => array('tl_class' => 'clr', 'multiple' => true, 'chosen' => true)), 'pdfExportFile' => array('label' => &$GLOBALS['TL_LANG']['tl_competition_submission']['pdfExportFile'], 'inputType' => 'fileTree', 'exclude' => true, 'eval' => array('filesOnly' => true, 'extensions' => 'pdf', 'fieldType' => 'radio', 'tl_class' => 'long clr'), 'sql' => "binary(16) NULL"), 'pdfExportFileForJudges' => array('label' => &$GLOBALS['TL_LANG']['tl_competition_submission']['pdfExportFileForJudges'], 'inputType' => 'fileTree', 'exclude' => true, 'eval' => array('filesOnly' => true, 'extensions' => 'pdf', 'fieldType' => 'radio', 'tl_class' => 'long clr'), 'sql' => "binary(16) NULL"), 'published' => array('label' => &$GLOBALS['TL_LANG']['tl_competition_submission']['published'], 'exclude' => true, 'filter' => true, 'inputType' => 'checkbox', 'eval' => array('tl_class' => 'w50', 'doNotCopy' => true), 'sql' => "char(1) NOT NULL default ''")));
class tl_competition_submission extends \Backend
{
    public function listSubmissions($arrRow)
    {
        $objMember = \MemberModel::findByPk($arrRow['mid']);
        return '<div class="tl_content_left">' . 'Bewerber: ' . $objMember->firstname . ' ' . $objMember->lastname . ' <small>(ID: ' . $objMember->id . ')</small>' . ' <span style="color:#b3b3b3;padding-left:3px">[' . Date::parse(Config::get('datimFormat'), trim($arrRow['dateAdded'])) . ']</span></div>';
    }
    public static function getAllowedMembersAsOptions(\DataContainer $objDc)
    {
        if ($objDc->activeRecord->pid) {
            $intId = $objDc->activeRecord->pid;
        } else {
            $intId = \Input::get('id');
        }
        return \HeimrichHannot\Competition\Competition::getAllowedMembersAsOptions($intId, \HeimrichHannot\Competition\Competition::MODE_SUBMISSION);
    }
    public static function getAllowedJudgesAsOptions(\DataContainer $objDc)
    {
        if ($objDc->activeRecord->pid) {
            $intId = $objDc->activeRecord->pid;
        } else {
            $intId = \Input::get('id');
        }
        return \HeimrichHannot\Competition\Competition::getAllowedMembersAsOptions($intId, \HeimrichHannot\Competition\Competition::MODE_REVIEW);
    }
    /**
<?php

$arrDca =& $GLOBALS['TL_DCA']['tl_submission'];
$arrDca = array('config' => array('dataContainer' => 'Table', 'ptable' => 'tl_submission_archive', 'enableVersioning' => true, 'doNotCopyRecords' => true, 'onload_callback' => array(array('HeimrichHannot\\Haste\\Dca\\General', 'setDateAdded', true), array('HeimrichHannot\\Submissions\\Backend\\SubmissionBackend', 'checkPermission'), array('HeimrichHannot\\Submissions\\Backend\\SubmissionBackend', 'modifyPalette', true)), 'onsubmit_callback' => array(array('HeimrichHannot\\Submissions\\Backend\\SubmissionBackend', 'moveAttachments')), 'sql' => array('keys' => array('id' => 'primary'))), 'list' => array('label' => array('fields' => array('id'), 'format' => '%s'), 'sorting' => array('mode' => 4, 'fields' => array('dateAdded DESC'), 'headerFields' => array('title'), 'panelLayout' => 'filter;search,limit', 'child_record_callback' => array('HeimrichHannot\\Submissions\\Backend\\SubmissionBackend', 'listChildren'), 'filter' => array(array('tstamp>?', 0))), 'global_operations' => array('export_csv' => \HeimrichHannot\Exporter\ModuleExporter::getGlobalOperation('export_csv', $GLOBALS['TL_LANG']['MSC']['export_csv'], 'system/modules/exporter/assets/img/icon_export.png'), 'export_xls' => \HeimrichHannot\Exporter\ModuleExporter::getGlobalOperation('export_xls', $GLOBALS['TL_LANG']['MSC']['export_xls'], 'system/modules/exporter/assets/img/icon_export.png'), 'all' => array('label' => &$GLOBALS['TL_LANG']['MSC']['all'], 'href' => 'act=select', 'class' => 'header_edit_all', 'attributes' => 'onclick="Backend.getScrollOffset();"')), 'operations' => array('edit' => array('label' => &$GLOBALS['TL_LANG']['tl_submission']['edit'], 'href' => 'act=edit', 'icon' => 'edit.gif'), 'copy' => array('label' => &$GLOBALS['TL_LANG']['tl_submission']['copy'], 'href' => 'act=copy', 'icon' => 'copy.gif'), 'delete' => array('label' => &$GLOBALS['TL_LANG']['tl_submission']['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_submission']['toggle'], 'icon' => 'visible.gif', 'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"', 'button_callback' => array('HeimrichHannot\\Submissions\\Backend\\SubmissionBackend', 'toggleIcon')), 'send_confirmation' => array('label' => &$GLOBALS['TL_LANG']['tl_submission']['send_confirmation'], 'icon' => 'system/modules/submissions/assets/img/icon_send_confirmation.png', 'href' => 'key=send_confirmation', 'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['sendConfirmationConfirm'] . '\'))return false;Backend.getScrollOffset()"', 'button_callback' => array('HeimrichHannot\\Submissions\\Backend\\SubmissionBackend', 'sendConfirmation')), 'show' => array('label' => &$GLOBALS['TL_LANG']['tl_submission']['show'], 'href' => 'act=show', 'icon' => 'show.gif'))), 'palettes' => array('default' => '{general_legend},authorType,author;' . '{submission_legend},gender,academicTitle,firstname,lastname,dateOfBirth,street,' . 'postal,city,country,email,phone,fax,notes,captcha,attachments;{publish_legend},published;'), 'fields' => array('id' => array('sql' => "int(10) unsigned NOT NULL auto_increment"), 'pid' => array('foreignKey' => 'tl_submission_archive.title', 'sql' => "int(10) unsigned NOT NULL default '0'", 'relation' => array('type' => 'belongsTo', 'load' => 'eager')), 'tstamp' => array('sql' => "int(10) unsigned NOT NULL default '0'"), 'dateAdded' => array('label' => &$GLOBALS['TL_LANG']['MSC']['dateAdded'], 'sorting' => true, 'flag' => 6, 'eval' => array('rgxp' => 'datim', 'doNotCopy' => true), 'sql' => "int(10) unsigned NOT NULL default '0'"), 'type' => array('label' => &$GLOBALS['TL_LANG']['tl_submission']['type'], 'exclude' => true, 'filter' => true, 'inputType' => 'select', 'reference' => &$GLOBALS['TL_LANG']['tl_submission']['reference']['type'], 'eval' => array('includeBlankOption' => true, 'mandatory' => true, 'tl_class' => 'w50'), 'sql' => "varchar(64) NOT NULL default ''"), 'gender' => array('label' => &$GLOBALS['TL_LANG']['tl_submission']['gender'], 'exclude' => true, 'inputType' => 'select', 'options' => array('male', 'female'), 'reference' => &$GLOBALS['TL_LANG']['MSC'], 'eval' => array('mandatory' => true, 'tl_class' => 'w50 clr'), 'sql' => "varchar(32) NOT NULL default ''"), 'academicTitle' => array('label' => &$GLOBALS['TL_LANG']['tl_submission']['academicTitle'], 'exclude' => true, 'inputType' => 'select', 'options' => array('Dr.', 'Prof.'), 'eval' => array('maxlength' => 255, 'includeBlankOption' => true, 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'additionalTitle' => array('label' => &$GLOBALS['TL_LANG']['tl_submission']['additionalTitle'], 'exclude' => true, 'search' => true, 'inputType' => 'text', 'eval' => array('maxlength' => 255, 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'firstname' => array('label' => &$GLOBALS['TL_LANG']['tl_submission']['firstname'], 'exclude' => true, 'search' => true, 'sorting' => true, 'flag' => 1, 'inputType' => 'text', 'eval' => array('mandatory' => true, 'maxlength' => 255, 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'lastname' => array('label' => &$GLOBALS['TL_LANG']['tl_submission']['lastname'], 'exclude' => true, 'search' => true, 'sorting' => true, 'flag' => 1, 'inputType' => 'text', 'eval' => array('mandatory' => true, 'maxlength' => 255, 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'company' => array('label' => &$GLOBALS['TL_LANG']['tl_submission']['company'], 'exclude' => true, 'search' => true, 'sorting' => true, 'flag' => 1, 'inputType' => 'text', 'eval' => array('maxlength' => 255, 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'dateOfBirth' => array('label' => &$GLOBALS['TL_LANG']['tl_submission']['dateOfBirth'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('datepicker' => true, 'rgxp' => 'date', 'tl_class' => 'w50 wizard'), 'sql' => "varchar(10) NOT NULL default ''"), 'street' => array('label' => &$GLOBALS['TL_LANG']['tl_submission']['street'], 'exclude' => true, 'search' => true, 'inputType' => 'text', 'eval' => array('maxlength' => 255, 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'street2' => array('label' => &$GLOBALS['TL_LANG']['tl_submission']['street2'], 'exclude' => true, 'search' => true, 'inputType' => 'text', 'eval' => array('maxlength' => 255, 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'postal' => array('label' => &$GLOBALS['TL_LANG']['tl_submission']['postal'], 'exclude' => true, 'search' => true, 'inputType' => 'text', 'eval' => array('maxlength' => 32, 'tl_class' => 'w50'), 'sql' => "varchar(32) NOT NULL default ''"), 'city' => array('label' => &$GLOBALS['TL_LANG']['tl_submission']['city'], 'exclude' => true, 'filter' => true, 'search' => true, 'sorting' => true, 'inputType' => 'text', 'eval' => array('maxlength' => 255, 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'country' => array('label' => &$GLOBALS['TL_LANG']['tl_submission']['country'], 'exclude' => true, 'filter' => true, 'sorting' => true, 'inputType' => 'select', 'options' => \System::getCountries(), 'eval' => array('includeBlankOption' => true, 'chosen' => true, 'autoCompletionHiddenField' => true, 'tl_class' => 'w50'), 'sql' => "varchar(2) NOT NULL default ''"), 'email' => array('label' => &$GLOBALS['TL_LANG']['tl_submission']['email'], 'exclude' => true, 'search' => true, 'inputType' => 'text', 'save_callback' => array(array('HeimrichHannot\\Haste\\Dca\\General', 'lowerCase')), 'eval' => array('mandatory' => true, 'maxlength' => 255, 'autoCompletionHiddenField' => true, 'rgxp' => 'email', 'decodeEntities' => true, 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'phone' => array('label' => &$GLOBALS['TL_LANG']['tl_submission']['phone'], 'exclude' => true, 'search' => true, 'inputType' => 'text', 'eval' => array('maxlength' => 64, 'rgxp' => 'phone', 'decodeEntities' => true, 'tl_class' => 'w50'), 'sql' => "varchar(64) NOT NULL default ''"), 'fax' => array('label' => &$GLOBALS['TL_LANG']['tl_submission']['fax'], 'exclude' => true, 'search' => true, 'inputType' => 'text', 'eval' => array('maxlength' => 64, 'rgxp' => 'phone', 'decodeEntities' => true, 'tl_class' => 'w50'), 'sql' => "varchar(64) NOT NULL default ''"), 'subject' => array('label' => &$GLOBALS['TL_LANG']['tl_submission']['subject'], 'exclude' => true, 'search' => true, 'inputType' => 'text', 'eval' => array('maxlength' => 255, 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'notes' => array('label' => &$GLOBALS['TL_LANG']['tl_submission']['notes'], 'exclude' => true, 'inputType' => 'textarea', 'eval' => array('tl_class' => 'long clr'), 'sql' => "text NULL"), 'agreement' => array('label' => &$GLOBALS['TL_LANG']['tl_submission']['agreement'], 'exclude' => true, 'filter' => true, 'inputType' => 'checkbox', 'eval' => array('mandatory' => true, 'tl_class' => 'w50', 'doNotCopy' => true), 'sql' => "char(1) NOT NULL default ''"), 'privacy' => array('label' => &$GLOBALS['TL_LANG']['tl_submission']['privacy'], 'exclude' => true, 'filter' => true, 'inputType' => 'checkbox', 'eval' => array('mandatory' => true, 'tl_class' => 'w50', 'doNotCopy' => true), 'sql' => "char(1) NOT NULL default ''"), 'published' => array('label' => &$GLOBALS['TL_LANG']['tl_submission']['published'], 'exclude' => true, 'filter' => true, 'inputType' => 'checkbox', 'eval' => array('tl_class' => 'w50', 'doNotCopy' => true), 'sql' => "char(1) NOT NULL default ''"), 'captcha' => array('label' => $GLOBALS['TL_LANG']['MSC']['securityQuestion'], 'inputType' => 'captcha', 'eval' => array('mandatory' => true, 'required' => true, 'tableless' => true)), 'formHybridBlob' => array('label' => &$GLOBALS['TL_LANG']['tl_submission']['formHybridBlob'], 'sql' => "blob NULL")));
// add attachment field
if (in_array('multifileupload', \ModuleLoader::getActive())) {
    $arrDca['fields']['attachments'] = array('label' => &$GLOBALS['TL_LANG']['tl_submission']['attachments'], 'exclude' => true, 'inputType' => 'multifileupload', 'eval' => array('explanation' => &$GLOBALS['TL_LANG']['tl_submission']['attachmentsExplanation'], 'tl_class' => 'clr', 'filesOnly' => true, 'maxFiles' => 5, 'fieldType' => 'checkbox', 'extensions' => \Config::get('uploadTypes'), 'maxUploadSize' => 10, 'uploadFolder' => \HeimrichHannot\Submissions\Submissions::getDefaultAttachmentSRC(), 'addRemoveLinks' => true, 'multiple' => true), 'sql' => "blob NULL");
}
\HeimrichHannot\Haste\Dca\General::addAuthorFieldAndCallback('tl_submission');
<?php

$GLOBALS['TL_DCA']['tl_iso_subscription'] = array('config' => array('dataContainer' => 'Table', 'ptable' => 'tl_iso_subscription_archive', 'enableVersioning' => true, 'onsubmit_callback' => array(array('tl_iso_subscription', 'setDateAdded')), 'sql' => array('keys' => array('id' => 'primary'))), 'list' => array('sorting' => array('mode' => 4, 'fields' => array('dateAdded DESC'), 'headerFields' => array('title'), 'panelLayout' => 'filter;search,limit', 'child_record_callback' => array('tl_iso_subscription', 'listSubscriptions')), 'global_operations' => array('export_xls' => \HeimrichHannot\Exporter\ModuleExporter::getGlobalOperation('export_xls', $GLOBALS['TL_LANG']['MSC']['export_xls'], 'system/modules/exporter/assets/img/icon_export.png'), 'all' => array('label' => &$GLOBALS['TL_LANG']['MSC']['all'], 'href' => 'act=select', 'class' => 'header_edit_all', 'attributes' => 'onclick="Backend.getScrollOffset();"')), 'operations' => array('edit' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_subscription']['edit'], 'href' => 'act=edit', 'icon' => 'edit.gif'), 'copy' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_subscription']['copy'], 'href' => 'act=copy', 'icon' => 'copy.gif'), 'delete' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_subscription']['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_iso_subscription']['toggle'], 'icon' => 'visible.gif', 'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"', 'button_callback' => array('tl_iso_subscription', 'toggleIcon')), 'show' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_subscription']['show'], 'href' => 'act=show', 'icon' => 'show.gif'))), 'palettes' => array('default' => '{subscription_legend},quantity,order_id,disable;'), 'fields' => array('id' => array('sql' => "int(10) unsigned NOT NULL auto_increment"), 'pid' => array('foreignKey' => 'tl_iso_subscription_archive.title', 'sql' => "int(10) unsigned NOT NULL default '0'", 'relation' => array('type' => 'belongsTo', 'load' => 'eager')), 'tstamp' => array('sql' => "int(10) unsigned NOT NULL default '0'"), 'comment' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_subscription']['comment'], 'inputType' => 'textarea'), 'source' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_subscription']['source'], 'eval' => array('fieldType' => 'checkbox', 'files' => true, 'filesOnly' => true, 'extensions' => 'csv', 'class' => 'mandatory')), 'dateAdded' => array('label' => &$GLOBALS['TL_LANG']['MSC']['dateAdded'], 'sorting' => true, 'flag' => 6, 'eval' => array('rgxp' => 'datim'), 'sql' => "int(10) unsigned NOT NULL default '0'"), 'quantity' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_subscription']['quantity'], 'inputType' => 'text', 'default' => 1, 'eval' => array('rgxp' => 'digit', 'mandatory' => true, 'tl_class' => 'w50'), 'sql' => "int(10) unsigned NOT NULL default '1'"), 'order_id' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_subscription']['order_id'], 'inputType' => 'select', 'options_callback' => array('tl_iso_subscription', 'getOrders'), 'eval' => array('tl_class' => 'w50', 'chosen' => true, 'includeBlankOption' => true), 'wizard' => array(array('tl_iso_subscription', 'editOrder')), 'sql' => "int(10) unsigned NOT NULL default '0'"), 'disable' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_subscription']['disable'], 'exclude' => true, 'filter' => true, 'inputType' => 'checkbox', 'eval' => array('tl_class' => 'w50'), 'sql' => "char(1) NOT NULL default ''"), 'activation' => array('sql' => "varchar(255) NOT NULL default ''")));
// if not set, all fields are used
\Isotope\IsotopeSubscriptions::importIsotopeAddressFields();
class tl_iso_subscription extends \Backend
{
    public function listSubscriptions($arrRow)
    {
        $strText = trim($arrRow['firstname'] . ' ' . $arrRow['lastname']);
        if ($arrRow['gender'] && trim($arrRow['firstname']) == '') {
            $strText = $GLOBALS['TL_LANG']['tl_iso_subscription']['salutation' . ucfirst($arrRow['gender'])] . ' ' . $strText;
        }
        if ($arrRow['company']) {
            $strText = $arrRow['company'] . (trim($strText) ? ' (' . $strText . ')' : '');
        }
        return $strText;
    }
    public function setDateAdded(\DataContainer $objDc)
    {
        // Return if there is no active record (override all)
        if (!$objDc->activeRecord || $objDc->activeRecord->dateAdded > 0) {
            return;
        }
        // Fallback solution for existing accounts
        if ($objDc->activeRecord->lastLogin > 0) {
            $time = $objDc->activeRecord->lastLogin;
        } else {
            $time = time();
        }
        \Database::getInstance()->prepare("UPDATE tl_iso_subscription SET dateAdded=? WHERE id=?")->execute($time, $objDc->id);