/**
  * Return uid from given field marker and form
  *
  * @param string $marker
  * @param int $formUid
  * @return Field
  */
 public function findByMarkerAndForm($marker, $formUid = 0)
 {
     if (ConfigurationUtility::isReplaceIrreWithElementBrowserActive()) {
         return $this->findByMarkerAndFormAlternative($marker, $formUid);
     }
     $query = $this->createQuery();
     $query->getQuerySettings()->setRespectStoragePage(false);
     $query->getQuerySettings()->setRespectSysLanguage(false);
     $query->matching($query->logicalAnd([$query->equals('marker', $marker), $query->equals('pages.forms.uid', $formUid)]));
     $query->setLimit(1);
     $result = $query->execute()->getFirst();
     return $result;
 }
 /**
  * Check if showNote should be active or not
  *
  * @param array $params Config Array
  * @return bool
  */
 protected function showNoteActive($params)
 {
     if (!isset($params['row']['uid']) || !is_numeric($params['row']['uid']) || ConfigurationUtility::isReplaceIrreWithElementBrowserActive()) {
         return false;
     }
     return true;
 }
 /**
  * Get array with related fields to a form
  *
  * @param int $uid
  * @return array
  */
 protected function getFieldsFromForm($uid)
 {
     if (ConfigurationUtility::isReplaceIrreWithElementBrowserActive()) {
         return $this->getFieldsFromFormAlternative($uid);
     }
     $result = array();
     $select = 'f.title';
     $from = 'tx_powermail_domain_model_forms fo ' . 'LEFT JOIN tx_powermail_domain_model_pages p ON p.forms = fo.uid ' . 'LEFT JOIN tx_powermail_domain_model_fields f ON f.pages = p.uid';
     $where = 'fo.uid = ' . (int) $uid . ' and p.deleted = 0 and f.deleted = 0';
     $groupBy = '';
     $orderBy = '';
     $limit = 1000;
     $res = $this->databaseConnection->exec_SELECTquery($select, $from, $where, $groupBy, $orderBy, $limit);
     if ($res) {
         while ($row = $this->databaseConnection->sql_fetch_assoc($res)) {
             $result[] = $row['title'];
         }
     }
     return $result;
 }
예제 #4
0
 /**
  * Returns the pages
  *
  * @return ObjectStorage
  */
 public function getPages()
 {
     // if elementbrowser instead of IRRE (sorting workarround)
     if (ConfigurationUtility::isReplaceIrreWithElementBrowserActive()) {
         $formSorting = GeneralUtility::trimExplode(',', $this->formRepository->getPagesValue($this->uid), true);
         $formSorting = array_flip($formSorting);
         $pageArray = array();
         foreach ($this->pages as $page) {
             $pageArray[$formSorting[$page->getUid()]] = $page;
         }
         ksort($pageArray);
         return $pageArray;
     }
     return $this->pages;
 }
예제 #5
0
 /**
  * @return Form
  */
 public function getForms()
 {
     // if elementbrowser instead of IRRE (get related form)
     if (ConfigurationUtility::isReplaceIrreWithElementBrowserActive()) {
         return $this->formRepository->findByPages($this->uid);
     }
     return $this->forms;
 }
<?php

use In2code\Powermail\Utility\ConfigurationUtility;
$formsTca = array('ctrl' => array('title' => 'LLL:EXT:powermail/Resources/Private/Language/locallang_db.xlf:tx_powermail_domain_model_forms', 'label' => 'title', 'tstamp' => 'tstamp', 'crdate' => 'crdate', 'cruser_id' => 'cruser_id', 'dividers2tabs' => true, 'versioningWS' => 2, 'versioning_followPages' => true, 'origUid' => 't3_origuid', 'languageField' => 'sys_language_uid', 'transOrigPointerField' => 'l10n_parent', 'transOrigDiffSourceField' => 'l10n_diffsource', 'default_sortby' => 'ORDER BY title ASC', 'delete' => 'deleted', 'enablecolumns' => array('disabled' => 'hidden', 'starttime' => 'starttime', 'endtime' => 'endtime'), 'iconfile' => ConfigurationUtility::getIconPath('tx_powermail_domain_model_forms.gif')), 'interface' => array('showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, css, pages, note'), 'types' => array('1' => array('showitem' => 'title, pages, note, ' . '--div--;LLL:EXT:powermail/Resources/Private/Language/locallang_db.xlf:' . 'tx_powermail_domain_model_fields.sheet1, ' . 'css, --div--;LLL:EXT:powermail/Resources/Private/Language/locallang_db.xlf:tabs.access, ' . 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, starttime, endtime')), 'columns' => array('sys_language_uid' => array('exclude' => 1, 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.language', 'config' => array('type' => 'select', 'renderType' => 'selectSingle', 'foreign_table' => 'sys_language', 'foreign_table_where' => 'ORDER BY sys_language.title', 'items' => array(array('LLL:EXT:lang/locallang_general.xml:LGL.allLanguages', -1), array('LLL:EXT:lang/locallang_general.xml:LGL.default_value', 0)))), 'l10n_parent' => array('displayCond' => 'FIELD:sys_language_uid:>:0', 'exclude' => 1, 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.l18n_parent', 'config' => array('type' => 'select', 'renderType' => 'selectSingle', 'items' => array(array('', 0)), 'foreign_table' => 'tx_powermail_domain_model_forms', 'foreign_table_where' => 'AND tx_powermail_domain_model_forms.pid=###CURRENT_PID### AND' . ' tx_powermail_domain_model_forms.sys_language_uid IN (-1,0)')), 'l10n_diffsource' => array('config' => array('type' => 'passthrough')), 't3ver_label' => array('label' => 'LLL:EXT:lang/locallang_general.xml:LGL.versionLabel', 'config' => array('type' => 'input', 'size' => 30, 'max' => 255)), 'hidden' => array('l10n_mode' => 'exclude', 'exclude' => 1, 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden', 'config' => array('type' => 'check')), 'starttime' => array('l10n_mode' => 'exclude', 'exclude' => 1, 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.starttime', 'config' => array('type' => 'input', 'size' => 13, 'max' => 20, 'eval' => 'datetime', 'checkbox' => 0, 'default' => 0, 'range' => array('lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y'))))), 'endtime' => array('l10n_mode' => 'exclude', 'exclude' => 1, 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.endtime', 'config' => array('type' => 'input', 'size' => 13, 'max' => 20, 'eval' => 'datetime', 'checkbox' => 0, 'default' => 0, 'range' => array('lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y'))))), 'title' => array('exclude' => 0, 'label' => 'LLL:EXT:powermail/Resources/Private/Language/locallang_db.xlf:' . 'tx_powermail_domain_model_forms.title', 'config' => array('type' => 'input', 'size' => 30, 'eval' => 'trim,required')), 'note' => array('l10n_mode' => 'exclude', 'config' => array('type' => 'user', 'userFunc' => 'In2code\\Powermail\\Utility\\Tca\\ShowFormNoteIfNoEmailOrNameSelected->showNote')), 'css' => array('l10n_mode' => 'exclude', 'exclude' => 1, 'label' => 'LLL:EXT:powermail/Resources/Private/Language/locallang_db.xlf:' . 'tx_powermail_domain_model_forms.css', 'config' => array('type' => 'select', 'renderType' => 'selectSingle', 'items' => array(array('LLL:EXT:powermail/Resources/Private/Language/locallang_db.xlf:pleaseChoose', ''), array('LLL:EXT:powermail/Resources/Private/Language/locallang_db.xlf:' . 'tx_powermail_domain_model_forms.css.1', 'layout1'), array('LLL:EXT:powermail/Resources/Private/Language/locallang_db.xlf:' . 'tx_powermail_domain_model_forms.css.2', 'layout2'), array('LLL:EXT:powermail/Resources/Private/Language/locallang_db.xlf:' . 'tx_powermail_domain_model_forms.css.3', 'layout3'), array('LLL:EXT:powermail/Resources/Private/Language/locallang_db.xlf:' . 'tx_powermail_domain_model_forms.css.4', 'nolabel')), 'size' => 1, 'maxitems' => 1, 'eval' => '')), 'pages' => array('exclude' => 0, 'label' => 'LLL:EXT:powermail/Resources/Private/Language/locallang_db.xlf:' . 'tx_powermail_domain_model_forms.pages', 'config' => array('type' => 'inline', 'foreign_table' => 'tx_powermail_domain_model_pages', 'foreign_table_where' => 'AND tx_powermail_domain_model_pages.deleted = 1 ' . 'AND tx_powermail_domain_model_pages.hidden = 0 ' . 'and tx_powermail_domain_model_pages.sys_language_uid = 0', 'foreign_field' => 'forms', 'foreign_sortby' => 'sorting', 'maxitems' => 1000, 'appearance' => array('collapseAll' => 1, 'expandSingle' => 1, 'useSortable' => 1, 'newRecordLinkAddTitle' => 1, 'levelLinksPosition' => 'top', 'showSynchronizationLink' => 0, 'showAllLocalizationLink' => 1, 'showPossibleLocalizationRecords' => 1, 'showRemovedLocalizationRecords' => 1), 'behaviour' => array('localizeChildrenAtParentLocalization' => 1, 'localizationMode' => 'select')))));
/**
 * Replace IRRE relation with element browser for page selection
 */
if (ConfigurationUtility::isReplaceIrreWithElementBrowserActive()) {
    $formsTca['columns']['pages'] = array('l10n_mode' => 'exclude', 'exclude' => 0, 'label' => 'LLL:EXT:powermail/Resources/Private/Language/locallang_db.xlf:' . 'tx_powermail_domain_model_forms.pages', 'config' => array('type' => 'group', 'internal_type' => 'db', 'allowed' => 'tx_powermail_domain_model_pages', 'foreign_table' => 'tx_powermail_domain_model_pages', 'minitems' => 1, 'maxitems' => 100));
}
/**
 * Switch from l10n_mode "exclude" to "mergeIfNotBlank"
 */
if (ConfigurationUtility::isL10nModeMergeActive()) {
    $formsTca['columns']['css']['l10n_mode'] = 'mergeIfNotBlank';
}
return $formsTca;