Exemplo n.º 1
0
 public function modifyPalette()
 {
     $objModule = \ModuleModel::findByPk(\Input::get('id'));
     $arrDca =& $GLOBALS['TL_DCA']['tl_module'];
     if (\HeimrichHannot\Haste\Util\Module::isSubModuleOf($objModule->type, 'HeimrichHannot\\PinBoard\\ModulePinBoard')) {
         $objModule->formHybridDataContainer = 'tl_news';
         $objModule->formHybridPalette = 'pinboard';
         $objModule->showInitialResults = true;
         $objModule->addDetailsCol = true;
         $objModule->sortingMode = OPTION_FORMHYBRID_SORTINGMODE_FIELD;
         if (!$objModule->itemSorting) {
             $objModule->itemSorting = 'date_desc';
         }
         if (!$objModule->updateDeleteConditions) {
             $objModule->updateDeleteConditions = deserialize(array(array('field' => 'memberAuthor', 'value' => '{{user::id}}')));
         }
         if (!$objModule->additionalWhereSql) {
             $objModule->additionalWhereSql = '(tl_news.published=1 OR tl_news.memberAuthor="{{user::id}}")';
         }
         $objModule->save();
         $arrDca['fields']['jumpToCreate']['eval']['tl_class'] = 'w50 clr';
         $arrDca['fields']['createMemberGroups']['eval']['tl_class'] = 'w50 clr';
         $arrDca['fields']['jumpToEdit']['eval']['tl_class'] = 'w50';
     }
     if (\HeimrichHannot\Haste\Util\Module::isSubModuleOf($objModule->type, 'HeimrichHannot\\PinBoard\\ModulePinBoardEditor')) {
         $objModule->formHybridDataContainer = 'tl_news';
         $objModule->formHybridPalette = 'pinboard';
         if (!$objModule->updateDeleteConditions) {
             $objModule->updateDeleteConditions = serialize(array(array('field' => 'memberAuthor', 'value' => '{{user::id}}')));
         }
         if (!$objModule->formHybridDefaultValues) {
             $objModule->formHybridDefaultValues = serialize(array(array('field' => 'date', 'value' => '{{date::U}}', 'label' => ''), array('field' => 'time', 'value' => '{{date::U}}', 'label' => ''), array('field' => 'source', 'value' => 'default', 'label' => ''), array('field' => 'type', 'value' => 'pinboard', 'label' => ''), array('field' => 'memberAuthor', 'value' => '{{user::id}}', 'label' => ''), array('field' => 'useMemberAuthor', 'value' => true, 'label' => '')));
         }
         $objModule->save();
         $arrDca['fields']['setPageTitle']['eval']['tl_class'] = 'w50 clr';
     }
     if (\HeimrichHannot\Haste\Util\Module::isSubModuleOf($objModule->type, 'HeimrichHannot\\PinBoard\\ModulePinBoardReader')) {
         $objModule->formHybridDataContainer = 'tl_news';
         $objModule->formHybridPalette = 'pinboard';
         if (!$objModule->itemTemplate) {
             $objModule->itemTemplate = 'formhybrid_reader_pinboard';
         }
         $objModule->save();
     }
 }
 public static function modifyPalette(\DataContainer $dc, $blnFrontend = false)
 {
     $id = strlen(\Input::get('id')) ? \Input::get('id') : CURRENT_ID;
     $objModule = \ModuleModel::findByPk($id);
     $arrDca =& $GLOBALS['TL_DCA']['tl_module'];
     $type = \Input::post('type') ?: $objModule->type;
     if (\HeimrichHannot\Haste\Util\Module::isSubModuleOf($type, 'HeimrichHannot\\Submissions\\Creator\\ModuleSubmissionReader')) {
         $objModule->formHybridDataContainer = 'tl_submission';
         $objModule->formHybridPalette = 'default';
         $objModule->noIdBehavior = 'create';
         $objModule->allowDelete = '';
         $objModule->deactivateTokens = true;
         $arrDca['fields']['defaultArchive']['eval']['mandatory'] = true;
         $arrDca['fields']['defaultArchive']['eval']['tl_class'] = 'clr';
         if ($objModule->addSubmissionRelation) {
             if ($arrRelation = $GLOBALS['SUBMISSION_RELATIONS'][$objModule->submissionRelation]) {
                 if ($arrRelation['moduleFields']) {
                     $arrDca['subpalettes']['addSubmissionRelation'] = str_replace('submissionRelation', 'submissionRelation,' . $arrRelation['moduleFields'], $arrDca['subpalettes']['addSubmissionRelation']);
                 }
             }
         }
         $objModule->save();
     }
 }
 public static function adjustPalettesForLists(\DataContainer $objDc)
 {
     \Controller::loadDataContainer('tl_module');
     \System::loadLanguageFile('tl_module');
     if (($objModule = \ModuleModel::findByPk($objDc->id)) !== null) {
         $arrDca =& $GLOBALS['TL_DCA']['tl_module'];
         if (\HeimrichHannot\Haste\Util\Module::isSubModuleOf($objModule->type, 'HeimrichHannot\\FrontendEdit\\ModuleList')) {
             $arrDca['palettes'][MODULE_FRONTENDEDIT_MEMBER_LIST] = str_replace('filterArchives', 'filterGroups', $arrDca['palettes'][MODULE_FRONTENDEDIT_MEMBER_LIST]);
             // override labels for suiting a list module
             $arrDca['fields']['formHybridAddDefaultValues']['label'] =& $GLOBALS['TL_LANG']['tl_module']['formHybridAddDefaultFilterValues'];
             $arrDca['fields']['formHybridDefaultValues']['label'] =& $GLOBALS['TL_LANG']['tl_module']['formHybridDefaultFilterValues'];
         }
     }
 }
 public static function modifyPalette(\DataContainer $objDc)
 {
     \Controller::loadDataContainer('tl_module');
     \System::loadLanguageFile('tl_module');
     if (($objModule = \ModuleModel::findByPk($objDc->id)) !== null) {
         $arrDca =& $GLOBALS['TL_DCA']['tl_module'];
         if (\HeimrichHannot\Haste\Util\Module::isSubModuleOf($objModule->type, 'HeimrichHannot\\FormHybridList\\ModuleReader')) {
             unset($arrDca['fields']['itemTemplate']['options_callback']);
             $arrDca['fields']['itemTemplate']['options'] = \Controller::getTemplateGroup('formhybrid_reader_');
         }
     }
 }
 /**
  * @deprecated since 1.1 - use \HeimrichHannot\Haste\Util\Module
  * @param      $strModuleType
  * @param      $strModuleGroup
  * @param      $strParentModuleType
  * @param bool $blnBackendModule
  *
  * @return bool
  */
 public static function isSubModuleOf($strModuleType, $strModuleGroup, $strParentModuleType, $blnBackendModule = false)
 {
     return \HeimrichHannot\Haste\Util\Module::isSubModuleOf($strModuleType, $strModuleGroup, $strParentModuleType, $blnBackendModule);
 }