/**
  * input fields for editing
  *
  * @param mixed $params optional
  *
  * @return FieldList
  */
 public function getCMSFields($params = null)
 {
     $fields = parent::getCMSFieldsForModules($params);
     $fields->removeByName('InvoiceInfo');
     $fields->removeByName('TextBankAccountInfo');
     // Add fields to default tab ------------------------------------------
     $channelField = new ReadonlyField('DisplayPaymentChannel', _t('SilvercartPaymentPrepayment.PAYMENT_CHANNEL'), $this->getPaymentChannelName($this->PaymentChannel));
     $fields->addFieldToTab('Root.Basic', $channelField, 'mode');
     // Additional tabs and fields -----------------------------------------
     $tabTextTemplates = new Tab(_t('SilvercartPaymentPrepayment.TEXT_TEMPLATES', 'text templates', null, 'Textvorlagen'));
     $fields->fieldByName('Root')->push($tabTextTemplates);
     // text templates for tab fields
     // Textvorlagen Tab Felder --------------------------------------------
     $languageFields = SilvercartLanguageHelper::prepareCMSFields($this->getLanguageClassName());
     switch ($this->PaymentChannel) {
         case 'invoice':
             $tabTextTemplates->setChildren(new FieldList($languageFields->fieldByName('InvoiceInfo')));
             break;
         case 'prepayment':
         default:
             $tabTextTemplates->setChildren(new FieldList($languageFields->fieldByName('TextBankAccountInfo')));
     }
     $translations = new GridField('SilvercartPaymentPrepaymentLanguages', $this->fieldLabel('SilvercartPaymentPrepaymentLanguages'), $this->SilvercartPaymentPrepaymentLanguages(), SilvercartGridFieldConfig_ExclusiveRelationEditor::create());
     $fields->addFieldToTab('Root.Translations', $translations);
     return $fields;
 }
Пример #2
0
 /**
  * customizes the backends fields, mainly for ModelAdmin
  *
  * @return FieldList the fields for the backend
  *
  * @author Roland Lehmann <*****@*****.**>, Sebastian Diel <*****@*****.**>
  * @since 13.02.2013
  */
 public function getCMSFields()
 {
     $fields = SilvercartDataObject::getCMSFields($this);
     $paymentMethodsTable = $fields->dataFieldByName('SilvercartPaymentMethods');
     $paymentMethodsTable->setConfig(SilvercartGridFieldConfig_RelationEditor::create());
     $languageFields = SilvercartLanguageHelper::prepareCMSFields($this->getLanguageClassName());
     foreach ($languageFields as $languageField) {
         $fields->insertBefore($languageField, 'ISO2');
     }
     $displayPositionMap = array('0' => _t('SilvercartOrderSearchForm.PLEASECHOOSE'));
     for ($x = 1; $x <= self::getPrioritiveCountryCount(false) + 1; $x++) {
         $displayPositionMap[$x] = $x;
     }
     $displayPositionField = new DropdownField('DisplayPosition', $this->fieldLabel('DisplayPosition'), $displayPositionMap);
     $fields->insertAfter($displayPositionField, 'IsPrioritive');
     return $fields;
 }
 /**
  * adjust CMS fields for display in the popup window
  *
  * @param FieldList $fields the FieldList from getCMSFields()
  *
  * @return void 
  * 
  * @author Roland Lehmann <*****@*****.**>
  * @since 06.01.2012
  */
 public function updateCMSFields(FieldList $fields)
 {
     $fields = SilvercartLanguageHelper::prepareCMSFields($this->owner->class);
     $localeDropdown = SilvercartLanguageHelper::prepareLanguageDropdownField($this->owner);
     $fields->push($localeDropdown);
 }
 /**
  * Clone of DataObject::getCMSFields() with some additional SilverCart
  * related features.
  * <ul>
  *  <li>Restricted fields can be updated by DataExtension (updateRestrictCMSFields).</li>
  *  <li>Translation fields of DataObjects with SilverCart based translation model will be scaffolded.</li>
  * </ul>
  * 
  * @param DataObject $dataObject                     DataObject to get CMS fields for
  * @param string     $neighbourFieldOfLanguageFields Name of the field to insert language fields after or before
  * @param bool       $insertLangugeFieldsAfter       Determines whether to add language fields before or after the given neighbour field
  * @param bool       $tabbed                         Determines whether get tabbed fields or not
  * 
  * @return FieldList
  */
 public static function getCMSFields(DataObject $dataObject, $neighbourFieldOfLanguageFields = null, $insertLangugeFieldsAfter = true, $tabbed = true)
 {
     $params = array('includeRelations' => $dataObject->isInDB(), 'tabbed' => $tabbed, 'ajaxSafe' => true);
     $restrictFields = array();
     $dataObject->extend('updateRestrictCMSFields', $restrictFields);
     if (!empty($restrictFields)) {
         $params['restrictFields'] = $restrictFields;
     }
     $tabbedFields = self::scaffoldFormFields($dataObject, $params);
     if ($dataObject->has_extension($dataObject->class, 'SilvercartDataObjectMultilingualDecorator')) {
         $languageFields = SilvercartLanguageHelper::prepareCMSFields($dataObject->getLanguageClassName());
         foreach ($languageFields as $languageField) {
             if (!is_null($neighbourFieldOfLanguageFields)) {
                 if ($insertLangugeFieldsAfter) {
                     $tabbedFields->insertAfter($languageField, $neighbourFieldOfLanguageFields);
                     /*
                      * Change the name of the field the insert the next field
                      * Otherwise the sort order would be inverted
                      */
                     $neighbourFieldOfLanguageFields = $languageField->getName();
                 } else {
                     $tabbedFields->insertBefore($languageField, $neighbourFieldOfLanguageFields);
                 }
             } else {
                 $tabbedFields->addFieldToTab('Root.Main', $languageField);
             }
         }
     }
     $dataObject->extend('updateCMSFields', $tabbedFields);
     return $tabbedFields;
 }
Пример #5
0
 /**
  * Returns the CMS fields for the widget context
  *
  * @param array $params Scaffolding params
  * 
  * @return FieldList
  * @deprecated should be removed before release
  */
 public function getCMSFieldsForWidget($params = null)
 {
     $fields = $this->getCMSFieldsForContext(array_merge(array('restrictFields' => array('SortOrder')), (array) $params));
     $languageFields = SilvercartLanguageHelper::prepareCMSFields($this->getLanguageClassName());
     foreach ($languageFields as $languageField) {
         $fields->insertBefore($languageField, 'SortOrder');
     }
     $fields->removeByName('SilvercartProductID');
     $fields->removeByName('SilvercartPaymentMethodID');
     $fields->removeByName('SortOrder');
     return $fields;
 }
 /**
  * Returns modified CMS fields for the payment modules
  *
  * @return FieldList
  */
 public function getCMSFieldsForModules()
 {
     $this->getCMSFieldsIsCalled = true;
     $tabset = new TabSet('Root');
     $fields = new FieldList($tabset);
     // --------------------------------------------------------------------
     // Common GUI elements for all payment methods
     // --------------------------------------------------------------------
     $tabBasic = new Tab('Basic', _t('SilvercartPaymentMethod.BASIC_SETTINGS', 'basic settings'));
     $translationsTab = new Tab('Translations');
     $translationsTab->setTitle(_t('SilvercartConfig.TRANSLATIONS'));
     $tabset->push($tabBasic);
     $tabset->push($translationsTab);
     $tabBasicFieldList = new FieldList();
     $tabBasic->setChildren($tabBasicFieldList);
     //multilingual fields
     $tabBasicFieldList->push(new CheckboxField('isActive', _t('SilvercartShopAdmin.PAYMENT_ISACTIVE', 'activated')));
     $tabBasicFieldList->push(new DropdownField('mode', _t('SilvercartPaymentMethod.MODE', 'mode'), array('Live' => $this->fieldLabel('modeLive'), 'Dev' => $this->fieldLabel('modeDev')), $this->mode));
     if ($this->isExtendingSilvercartPaymentMethod()) {
         $languageFields = SilvercartLanguageHelper::prepareCMSFields($this->getLanguageClassName());
         foreach ($languageFields as $languageField) {
             $tabBasicFieldList->push($languageField);
         }
     }
     $tabBasicFieldList->push(new TextField('minAmountForActivation', _t('SilvercartShopAdmin.PAYMENT_MINAMOUNTFORACTIVATION')));
     $tabBasicFieldList->push(new TextField('maxAmountForActivation', _t('SilvercartShopAdmin.PAYMENT_MAXAMOUNTFORACTIVATION')));
     $tabBasicFieldList->push(new DropdownField('orderStatus', _t('SilvercartPaymentMethod.STANDARD_ORDER_STATUS', 'standard order status for this payment method'), SilvercartOrderStatus::getStatusList()->map('Code', 'Title')->toArray()));
     $tabBasicFieldList->dataFieldByName('orderStatus')->setEmptyString(_t("SilvercartEditAddressForm.EMPTYSTRING_PLEASECHOOSE"));
     // --------------------------------------------------------------------
     // Handling cost table
     // --------------------------------------------------------------------
     $tabHandlingCosts = new Tab('HandlingCosts', _t('SilvercartPaymentMethod.HANDLINGCOSTS_SETTINGS'));
     $tabset->push($tabHandlingCosts);
     $handlingCostField = new GridField('SilvercartHandlingCosts', $this->fieldLabel('SilvercartHandlingCosts'), $this->SilvercartHandlingCosts(), SilvercartGridFieldConfig_RelationEditor::create(50));
     $tabHandlingCosts->setChildren(new FieldList($handlingCostField));
     // --------------------------------------------------------------------
     // GUI for management of logo images
     // --------------------------------------------------------------------
     $tabLogos = new Tab('Logos', _t('SilvercartPaymentMethod.PAYMENT_LOGOS', 'Payment Logos'));
     $tabset->push($tabLogos);
     $paymentLogosTable = new GridField('PaymentLogos', $this->fieldLabel('PaymentLogos'), $this->PaymentLogos(), SilvercartGridFieldConfig_RelationEditor::create());
     $paymentLogosTable->getConfig()->removeComponentsByType('GridFieldAddNewButton');
     $paymentLogosTable->getConfig()->removeComponentsByType('GridFieldAddExistingAutocompleter');
     $paymentLogosTable->getConfig()->addComponent(new GridFieldDeleteAction());
     $paymentLogosUploadField = new SilvercartImageUploadField('UploadPaymentLogos', $this->fieldLabel('AddPaymentLogos'));
     $paymentLogosUploadField->setFolderName('Uploads/payment-images');
     $tabLogos->setChildren(new FieldList(new CheckboxField('showPaymentLogos', _t('SilvercartShopAdmin.SHOW_PAYMENT_LOGOS')), $paymentLogosUploadField, $paymentLogosTable));
     // --------------------------------------------------------------------
     // GUI for access management
     // --------------------------------------------------------------------
     $tabAccessManagement = new Tab('AccessManagement', _t('SilvercartPaymentMethod.ACCESS_SETTINGS', 'Access management'));
     $tabset->push($tabAccessManagement);
     $tabsetAccessManagement = new TabSet('AccessManagementSection');
     $tabAccessManagement->push($tabsetAccessManagement);
     $tabAccessManagementBasic = new Tab('AccessManagementBasic', _t('SilvercartPaymentMethod.ACCESS_MANAGEMENT_BASIC_LABEL', 'General'));
     $tabAccessManagementGroup = new Tab('AccessManagementGroup', _t('SilvercartPaymentMethod.ACCESS_MANAGEMENT_GROUP_LABEL', 'By group(s)'));
     $tabAccessManagementUser = new Tab('AccessManagementUser', _t('SilvercartPaymentMethod.ACCESS_MANAGEMENT_USER_LABEL', 'By user(s)'));
     $tabsetAccessManagement->push($tabAccessManagementBasic);
     $tabsetAccessManagement->push($tabAccessManagementGroup);
     $tabsetAccessManagement->push($tabAccessManagementUser);
     $showOnlyForGroupsTable = new GridField('ShowOnlyForGroups', $this->fieldLabel('ShowOnlyForGroups'), $this->ShowOnlyForGroups(), SilvercartGridFieldConfig_RelationEditor::create());
     $showNotForGroupsTable = new GridField('ShowNotForGroups', $this->fieldLabel('ShowNotForGroups'), $this->ShowNotForGroups(), SilvercartGridFieldConfig_RelationEditor::create());
     $showOnlyForUsersTable = new GridField('ShowOnlyForUsers', $this->fieldLabel('ShowOnlyForUsers'), $this->ShowOnlyForUsers(), SilvercartGridFieldConfig_RelationEditor::create());
     $showNotForUsersTable = new GridField('ShowNotForUsers', $this->fieldLabel('ShowNotForUsers'), $this->ShowNotForUsers(), SilvercartGridFieldConfig_RelationEditor::create());
     $restrictionByOrderQuantityField = new TextField('orderRestrictionMinQuantity', '');
     $restrictionByOrderStatusField = new GridField('OrderRestrictionStatus', $this->fieldLabel('SilvercartOrderStatus'), $this->OrderRestrictionStatus(), SilvercartGridFieldConfig_RelationEditor::create());
     // Access management basic --------------------------------------------
     $tabAccessManagementBasic->push(new HeaderField('RestrictionLabel', _t('SilvercartPaymentMethod.RESTRICTION_LABEL') . ':', 2));
     $tabAccessManagementBasic->push(new LiteralField('separatorForActivationByOrderRestrictions', '<hr />'));
     $tabAccessManagementBasic->push(new CheckboxField('enableActivationByOrderRestrictions', _t('SilvercartPaymentMethod.ENABLE_RESTRICTION_BY_ORDER_LABEL')));
     $tabAccessManagementBasic->push(new LiteralField('RestrictionByOrderQuantityLabel', '<p>' . _t('SilvercartPaymentMethod.RESTRICT_BY_ORDER_QUANTITY') . ':</p>'));
     $tabAccessManagementBasic->push($restrictionByOrderQuantityField);
     $tabAccessManagementBasic->push(new LiteralField('RestrictionByOrderStatusLabel', '<p>' . _t('SilvercartPaymentMethod.RESTRICT_BY_ORDER_STATUS') . ':</p>'));
     $tabAccessManagementBasic->push($restrictionByOrderStatusField);
     // Access management for groups ---------------------------------------
     $tabAccessManagementGroup->push(new HeaderField('ShowOnlyForGroupsLabel', _t('SilvercartPaymentMethod.SHOW_ONLY_FOR_GROUPS_LABEL') . ':', 2));
     $tabAccessManagementGroup->push($showOnlyForGroupsTable);
     $tabAccessManagementGroup->push(new HeaderField('ShowNotForGroupsLabel', _t('SilvercartPaymentMethod.SHOW_NOT_FOR_GROUPS_LABEL') . ':', 2));
     $tabAccessManagementGroup->push($showNotForGroupsTable);
     // Access management for users ----------------------------------------
     $tabAccessManagementUser->push(new HeaderField('ShowOnlyForUsersLabel', _t('SilvercartPaymentMethod.SHOW_ONLY_FOR_USERS_LABEL') . ':', 2));
     $tabAccessManagementUser->push($showOnlyForUsersTable);
     $tabAccessManagementUser->push(new HeaderField('ShowNotForUsersLabel', _t('SilvercartPaymentMethod.SHOW_NOT_FOR_USERS_LABEL') . ':', 2));
     $tabAccessManagementUser->push($showNotForUsersTable);
     // --------------------------------------------------------------------
     // Countries
     // --------------------------------------------------------------------
     $countriesTab = new Tab('SilvercartCountries', $this->fieldLabel('SilvercartCountries'));
     $tabset->push($countriesTab);
     $countriesTable = new GridField('SilvercartCountries', $this->fieldLabel('SilvercartCountries'), $this->SilvercartCountries(), SilvercartGridFieldConfig_RelationEditor::create());
     $countriesTab->push($countriesTable);
     // --------------------------------------------------------------------
     // shipping methods
     // --------------------------------------------------------------------
     $shippingMethodsTab = new Tab('SilvercartShippingMethods', $this->fieldLabel('SilvercartShippingMethods'));
     $shippingMethodsDesc = new HeaderField('SilvercartShippingMethodsDesc', _t('SilvercartPaymentMethod.SHIPPINGMETHOD_DESC'));
     $shippingMethodsTable = new GridField('SilvercartShippingMethods', _t('SilvercartPaymentMethod.SHIPPINGMETHOD', 'shipping method'), $this->SilvercartShippingMethods(), SilvercartGridFieldConfig_RelationEditor::create(50));
     $tabset->push($shippingMethodsTab);
     $shippingMethodsTab->push($shippingMethodsDesc);
     $shippingMethodsTab->push($shippingMethodsTable);
     $this->getFieldsForChargesAndDiscounts($fields);
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
Пример #7
0
 /**
  * customizes the backends fields for file upload on a SilvercartDownloadPage
  * 
  * @param array $params configuration array
  *
  * @return FieldList the fields for the backend
  * 
  * @author Patrick Schneider <*****@*****.**>, Sebastian Diel <*****@*****.**>
  * @since 20.06.2012
  * @deprecated should be removed before release
  */
 public function getCMSFieldsForDownloadPage($params = null)
 {
     $fields = $this->getCMSFieldsForContext($params);
     $languageFields = SilvercartLanguageHelper::prepareCMSFields($this->getLanguageClassName());
     foreach ($languageFields as $languageField) {
         $fields->addFieldToTab('Root.Main', $languageField);
     }
     return $fields;
 }