当前位置: 首页>>代码示例>>PHP>>正文


PHP CompositeField::push方法代码示例

本文整理汇总了PHP中CompositeField::push方法的典型用法代码示例。如果您正苦于以下问题:PHP CompositeField::push方法的具体用法?PHP CompositeField::push怎么用?PHP CompositeField::push使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CompositeField的用法示例。


在下文中一共展示了CompositeField::push方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getCompositeField

 /**
  * @return Comosite FieldSet with Categorys and Items
  */
 function getCompositeField()
 {
     //create new composite field group for each category
     $oCatFieldSet = new CompositeField();
     // Set the field group ID
     $oCatFieldSet->setID('Cat' . $this->ID);
     $oCatFieldSet->addExtraClass('category');
     //create new composite field group for each category
     $oCatField = new TextField($this->ID . '_' . $this->FieldName, $this->Title, null, null);
     $oCatField->addExtraClass('category-field');
     //Add Category Percentage Field to the Form
     $oCatFieldSet->push($oCatField);
     if ($this->Description) {
         $oCatDescField = new LiteralField($this->ID . '_Description', '<p class="category-field-desc">' . $this->Description . '</p>');
         $oCatDescField->addExtraClass('category-field');
         $oCatFieldSet->push($oCatDescField);
     }
     //Add item Composite Field to this Composite Field
     //now get all of the items matched with this category
     $oFormCategoryItems = self::FormCategoryItems();
     foreach ($oFormCategoryItems as $item) {
         $oCatFieldSet->push($item->getFormField());
     }
     return $oCatFieldSet;
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:28,代码来源:FormCategory.php

示例2: getColumnContent

 public function getColumnContent($gridField, $record, $columnName)
 {
     if (!$record->canEdit()) {
         return;
     }
     $field = new CompositeField();
     if (!$record instanceof ElementVirtualLinked) {
         $field->push(GridField_FormAction::create($gridField, 'UnlinkRelation' . $record->ID, false, "unlinkrelation", array('RecordID' => $record->ID))->addExtraClass('gridfield-button-unlink')->setAttribute('title', _t('GridAction.UnlinkRelation', "Unlink"))->setAttribute('data-icon', 'chain--minus'));
     }
     if ($record->canDelete() && $record->VirtualClones()->count() == 0) {
         $field->push(GridField_FormAction::create($gridField, 'DeleteRecord' . $record->ID, false, "deleterecord", array('RecordID' => $record->ID))->addExtraClass('gridfield-button-delete')->setAttribute('title', _t('GridAction.Delete', "Delete"))->setAttribute('data-icon', 'cross-circle')->setDescription(_t('GridAction.DELETE_DESCRIPTION', 'Delete')));
     }
     return $field->Field();
 }
开发者ID:dnadesign,项目名称:silverstripe-elemental,代码行数:14,代码来源:ElementalGridFieldDeleteAction.php

示例3: push

 public function push(FormField $field)
 {
     parent::push($field);
     if ($field instanceof ComponentFieldHolder_Item) {
         $field->setHolder($this);
     }
 }
开发者ID:milkyway-multimedia,项目名称:ss-mwm-formfields,代码行数:7,代码来源:ComponentFieldHolder.php

示例4: CompositeField

    /**                                                              
     * Constructor                                                   
     *                                                               
     * @param  object $controller The controller class                           
     * @param  string $name       The name of the form class              
     * @return object The form                                       
     */
    function __construct($controller, $name)
    {
        //FILTER BLOCK 1 : WHERE ARE YOU
        // Create new group
        $oFilterField1 = new CompositeField();
        // Set the field group ID
        $oFilterField1->setID('Group1');
        // Add fields to the group
        $oFilterField1->push(new LiteralField('Group1Title', '<div class="filter-title-block">Where are you?</div>'));
        $oFilterField1->push(new DropdownField('Country', '', Geoip::getCountryDropDown(), 'NZ'));
        //FILTER BLOCK 2: UPLOAD IMAGE
        // Create new group
        $oFilterField2 = new CompositeField();
        // Set the field group ID
        $oFilterField2->setID('Group2');
        // Add fields to the group
        $oFilterField2->push(new LiteralField('Group2Title', '<div class="filter-title-block">When can you help?</div>'));
        //Set Date Defaults
        $tToday = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
        $dToday = date("d/m/Y", $tToday);
        $tNextMonth = mktime(0, 0, 0, date("m") + 2, date("d"), date("Y"));
        $dNextMonth = date("d/m/Y", $tNextMonth);
        //Check if Dates are Set otherwise use Defaults
        $sFromDate = $this->sFromDate != '' ? $this->sFromDate : $dToday;
        $sToDate = $this->sToDate != '' ? $this->sToDate : $dNextMonth;
        //Date Fields
        $oFromDate = new DatePickerField('FromDate', 'From', $sFromDate);
        $oToDate = new DatePickerField('ToDate', 'To', $sToDate);
        $oFilterField2->push($oFromDate);
        $oFilterField2->push($oToDate);
        DatePickerField::$showclear = false;
        // Create new fieldset
        $oFields = new FieldSet();
        // Add the groups to the fieldset
        $oFields->push($oFilterField1);
        $oFields->push($oFilterField2);
        // Create the form action
        $oAction = new FieldSet(new FormAction('SubmitFilter', 'Find events'));
        // Add custom jQuery validation script for requred fields
        Requirements::customScript('
			
		');
        // Construct the form
        parent::__construct($controller, $name, $oFields, $oAction);
    }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:52,代码来源:EventFilterForm.php

示例5: TranslatePagesForm

 /**
  * Presents a form to select a language to translate the pages selected with batch actions into.
  *
  * @param string $pageIDs | null
  * @return Form $form
  */
 public function TranslatePagesForm($pageIDs = null)
 {
     Versioned::reading_stage('Stage');
     // Needs this for changes to effect draft tree
     $languages = Translatable::get_allowed_locales();
     $action = FormAction::create('doTranslatePages', 'Translate')->setUseButtonTag('true')->addExtraClass('ss-ui-button ss-ui-action-constructive batch-form-actions')->setUseButtonTag(true);
     $actions = FieldList::create($action);
     $allFields = new CompositeField();
     $allFields->addExtraClass('batch-form-body');
     if ($pageIDs == null) {
         $pageIDs = $this->getRequest()->getVar('PageIDs');
     } else {
         $allFields->push(new LiteralField("ErrorParent", '<p class="message bad">Invalid parent selected, please choose another</p>'));
     }
     $allFields->push(new HiddenField("PageIDs", "PageIDs", $pageIDs));
     $allFields->push(LanguageDropdownField::create("NewTransLang", _t('Translatable.NEWLANGUAGE', 'New language'), $languages));
     $headings = new CompositeField(new LiteralField('Heading', sprintf('<h3 class="">%s</h3>', _t('HtmlEditorField.MOVE', 'Choose Language...'))));
     $headings->addExtraClass('cms-content-header batch-pages');
     $fields = new FieldList($headings, $allFields);
     $form = Form::create($this, 'TranslatePagesForm', $fields, $actions);
     return $form;
 }
开发者ID:helpfulrobot,项目名称:mspacemedia-batchtranslate,代码行数:28,代码来源:CMSBatchAction_TranslateController.php

示例6: FieldList

 /**
  * @param Controller $controller
  * @param String $name
  * @param Order $order
  * @param String
  */
 function __construct(Controller $controller, $name, Order $order, $returnToLink = '')
 {
     $fields = new FieldList(new HiddenField('OrderID', '', $order->ID));
     if ($returnToLink) {
         $fields->push(new HiddenField("returntolink", "", convert::raw2att($returnToLink)));
     }
     $bottomFields = new CompositeField();
     $bottomFields->addExtraClass('bottomOrder');
     if ($order->Total() > 0) {
         $paymentFields = EcommercePayment::combined_form_fields($order->getTotalAsMoney()->NiceLongSymbol(false), $order);
         foreach ($paymentFields as $paymentField) {
             $bottomFields->push($paymentField);
         }
         if ($paymentRequiredFields = EcommercePayment::combined_form_requirements($order)) {
             $requiredFields = array_merge($requiredFields, $paymentRequiredFields);
         }
     } else {
         $bottomFields->push(new HiddenField("PaymentMethod", "", ""));
     }
     $fields->push($bottomFields);
     $actions = new FieldList(new FormAction('dopayment', _t('OrderForm.PAYORDER', 'Pay balance')));
     $requiredFields = array();
     $validator = OrderForm_Payment_Validator::create($requiredFields);
     $form = parent::__construct($controller, $name, $fields, $actions, $validator);
     //extension point
     $this->extend('updateFields', $fields);
     $this->setFields($fields);
     $this->extend('updateActions', $actions);
     $this->setActions($actions);
     $this->extend('updateValidator', $validator);
     $this->setValidator($validator);
     $this->setFormAction($controller->Link($name));
     $oldData = Session::get("FormInfo.{$this->FormName()}.data");
     if ($oldData && (is_array($oldData) || is_object($oldData))) {
         $this->loadDataFrom($oldData);
     }
     $this->extend('updateOrderForm_Payment', $this);
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-ecommerce,代码行数:44,代码来源:OrderForm_Payment.php

示例7: testPushAndUnshift

 public function testPushAndUnshift()
 {
     $composite = new CompositeField(new TextField('Middle'));
     $composite->push(new TextField('End'));
     /* There are now 2 fields in the set */
     $this->assertEquals(2, $composite->getChildren()->Count());
     /* The most recently added field is at the end of the set */
     $this->assertEquals('End', $composite->getChildren()->Last()->getName());
     $composite->unshift(new TextField('Beginning'));
     /* There are now 3 fields in the set */
     $this->assertEquals(3, $composite->getChildren()->Count());
     /* The most recently added field is at the beginning of the set */
     $this->assertEquals('Beginning', $composite->getChildren()->First()->getName());
 }
开发者ID:XDdesigners,项目名称:silverstripe-framework,代码行数:14,代码来源:CompositeFieldTest.php

示例8: getEditForm

 /**
  * Return a {@link Form} instance with a
  * a {@link TableListField} for the current
  * {@link LinkCheckRun} record that we're currently
  * looking it, the ID for that LinkCheckRun record
  * is accessible from the URL as the "ID" parameter.
  * 
  * @uses LinkCheckAdmin->getLinkCheckRun()
  * @todo Fix up the hardcoded english strings
  * @todo Split functionality to separate methods
  * 
  * @return Form
  */
 public function getEditForm($id = null)
 {
     $run = $this->getLinkCheckRun($id);
     if (!$run) {
         return false;
     }
     $runCMSFields = $run->getCMSFields();
     $runCompFields = new CompositeField();
     $runCompFields->setID('RunFields');
     if ($runCMSFields) {
         foreach ($runCMSFields as $runCMSField) {
             $runCompFields->push($runCMSField);
         }
     }
     $brokenLinkCount = $run->BrokenLinks() ? $run->BrokenLinks()->Count() : 0;
     $finishedDate = $run->obj('FinishDate')->Nice();
     $pagesChecked = $run->PagesChecked;
     if ($run->IsComplete) {
         // Run is complete
         if ($brokenLinkCount == 1) {
             $resultNumField = new LiteralField('ResultNo', "<p>Finished at {$finishedDate}. {$pagesChecked} pages were checked. 1 broken link was found.</p>");
         } elseif ($brokenLinkCount > 0) {
             $resultNumField = new LiteralField('ResultNo', "<p>Finished at {$finishedDate}. {$pagesChecked} pages were checked. {$brokenLinkCount} broken links were found.</p>");
         } else {
             $resultNumField = new LiteralField('ResultNo', "<p>Finished at {$finishedDate}. {$pagesChecked} pages were checked. No broken links were found.</p>");
         }
     } else {
         // Run not completed yet
         if ($brokenLinkCount == 1) {
             $resultNumField = new LiteralField('ResultNo', '<p>This link check run is not completed yet. 1 broken link found so far.</p>');
         } elseif ($brokenLinkCount > 0) {
             $resultNumField = new LiteralField('ResultNo', "<p>This link check run is not completed yet. {$brokenLinkCount} broken links found so far.</p>");
         } else {
             $resultNumField = new LiteralField('ResultNo', '<p>This link check run is not completed yet. No broken links found so far.</p>');
         }
     }
     $runDate = $run->obj('Created')->Nice();
     $fields = new FieldSet(new TabSet('Root', new Tab(_t('LinkCheckAdmin.CHECKRUN', 'Results'), new HeaderField('Link check run', 2), new LiteralField('ResultText', "<p>Run at {$runDate}</p>"), $resultNumField, $runCompFields)));
     $fields->push(new HiddenField('LinkCheckRunID', '', $run->ID));
     $fields->push(new HiddenField('ID', '', $run->ID));
     $actions = new FieldSet(new FormAction('save', 'Save'));
     $form = new Form($this, 'EditForm', $fields, $actions);
     $form->loadDataFrom($run);
     return $form;
 }
开发者ID:halkyon,项目名称:silverstripe-linkchecker,代码行数:58,代码来源:LinkCheckAdmin.php

示例9: getFields

 /**
  * Puts together the fields for the Order Form (and other front-end purposes).
  * @return Fieldset
  **/
 public function getFields($member = null)
 {
     $fields = parent::getEcommerceFields();
     if (EcommerceConfig::get("OrderAddress", "use_separate_shipping_address")) {
         $shippingFieldsHeader = new CompositeField(new HeaderField('SendGoodsToADifferentAddress', _t('OrderAddress.SENDGOODSTODIFFERENTADDRESS', 'Send goods to different address'), 3), new LiteralField('ShippingNote', '<p class="message warning">' . _t('OrderAddress.SHIPPINGNOTE', 'Your goods will be sent to the address below.') . '</p>'), new LiteralField('ShippingHelp', '<p>' . _t('OrderAddress.SHIPPINGHELP', 'You can use this for gift giving. No billing information will be disclosed to this address.') . '</p>'));
         if ($member) {
             if ($member->exists()) {
                 $addresses = $this->previousAddressesFromMember($member);
                 if ($addresses) {
                     if ($addresses->count() > 1) {
                         $shippingFieldsHeader->push(new SelectOrderAddressField('SelectShippingAddressField', _t('OrderAddress.SELECTBILLINGADDRESS', 'Select Shipping Address'), $addresses));
                     }
                 }
             }
             $shippingFields = new CompositeField(new TextField('ShippingFirstName', _t('OrderAddress.FIRSTNAME', 'First Name')), new TextField('ShippingSurname', _t('OrderAddress.SURNAME', 'Surname')));
         } else {
             $shippingFields = new CompositeField(new TextField('ShippingFirstName', _t('OrderAddress.FIRSTNAME', 'First Name')), new TextField('ShippingSurname', _t('OrderAddress.SURNAME', 'Surname')));
         }
         $shippingFields->push(new TextField('ShippingPrefix', _t('OrderAddress.PREFIX', 'Title (e.g. Ms)')));
         $shippingFields->push(new TextField('ShippingAddress', _t('OrderAddress.ADDRESS', 'Address')));
         $shippingFields->push(new TextField('ShippingAddress2', _t('OrderAddress.ADDRESS2', '&nbsp;')));
         $shippingFields->push(new TextField('ShippingCity', _t('OrderAddress.CITY', 'Town')));
         $shippingFields->push($this->getPostalCodeField("ShippingPostalCode"));
         $shippingFields->push($this->getRegionField("ShippingRegionID"));
         $shippingFields->push($this->getCountryField("ShippingCountry"));
         $shippingFields->push(new TextField('ShippingPhone', _t('OrderAddress.PHONE', 'Phone')));
         $shippingFields->push(new TextField('ShippingMobilePhone', _t('OrderAddress.MOBILEPHONE', 'Mobile Phone')));
         $this->makeSelectedFieldsReadOnly($shippingFields);
         $shippingFieldsHeader->SetID("ShippingFieldsHeader");
         $shippingFields->addExtraClass("orderAddressHolder");
         $fields->push($shippingFieldsHeader);
         $shippingFields->SetID('ShippingFields');
         $fields->push($shippingFields);
     }
     $this->extend('augmentEcommerceShippingAddressFields', $fields);
     return $fields;
 }
开发者ID:nieku,项目名称:silverstripe-ecommerce,代码行数:41,代码来源:ShippingAddress.php

示例10: scrub

 public function scrub($request)
 {
     if (!Director::is_cli()) {
         $renderer = DebugView::create();
         $renderer->writeHeader();
         $renderer->writeInfo("Environment Builder", Director::absoluteBaseURL());
         echo "<div class=\"scrub\">";
     }
     $cruft = array();
     $tableList = DB::getConn()->tableList();
     $dataClasses = ClassInfo::subclassesFor('DataObject');
     array_shift($dataClasses);
     foreach ($tableList as $table) {
         if (!in_array($table, $dataClasses)) {
             $cruftTables[$table] = array("DataClass" => $table, "WholeTable" => true);
         }
     }
     foreach ($dataClasses as $dataClass) {
         if (class_exists($dataClass)) {
             $SNG = singleton($dataClass);
             if (!$SNG instanceof TestOnly) {
                 $classCruft = $SNG->Cruft();
                 if (!empty($classCruft)) {
                     $cruft[] = $classCruft;
                 }
                 foreach ($SNG->many_many() as $relationship => $childClass) {
                     unset($cruftTables["{$dataClass}_{$relationship}"]);
                 }
             }
             if ($SNG->hasExtension("Versioned")) {
                 unset($cruftTables["{$dataClass}_versions"]);
                 unset($cruftTables["{$dataClass}_Live"]);
                 unset($cruftTables["{$dataClass}_Stage"]);
             }
         }
     }
     $cruft = array_merge(array_values($cruftTables), $cruft);
     $form = $this->FormDeleteCruft();
     $form->setFormAction("/DatabaseAdmin/FormDeleteCruft");
     $fields = $form->Fields();
     foreach ($cruft as $classCruft) {
         $group = new CompositeField(array(new HeaderField($classCruft["DataClass"])));
         if (!empty($classCruft["WholeTable"]) && $classCruft["WholeTable"]) {
             $group->push(new CompositeField(array(new CheckboxField("DeleteSpec[{$classCruft["DataClass"]}][WholeTable]", "Whole {$classCruft["DataClass"]} Table"))));
         }
         if (!empty($classCruft["Fields"])) {
             $fieldsGroup = new CompositeField(array(new HeaderField("DeleteSpec[{$classCruft["DataClass"]}][Fields]", "Fields", 3)));
             foreach ($classCruft["Fields"] as $fieldName => $field) {
                 $fieldsGroup->push(new CheckboxField("DeleteSpec[{$classCruft["DataClass"]}][Fields][{$fieldName}]", "{$fieldName} ({$field["Type"]})"));
             }
             $group->push($fieldsGroup);
         }
         if (!empty($classCruft["Indexes"])) {
             $indexesGroup = new CompositeField(array(new HeaderField("DeleteSpec[{$classCruft["DataClass"]}][Indexes]", "Indexes", 3)));
             foreach ($classCruft["Indexes"] as $indexName => $index) {
                 $indexesGroup->push(new CheckboxField("DeleteSpec[{$classCruft["DataClass"]}][Indexes][{$indexName}]", "{$indexName} ({$index["Column_name"]})"));
             }
             $group->push($indexesGroup);
         }
         if (!empty($classCruft["ManyManyFields"]) || !empty($classCruft["ManyManyIndexes"])) {
             $relationships = array_unique(array_merge(array_keys(isset($classCruft["ManyManyFields"]) ? $classCruft["ManyManyFields"] : array()), array_keys(isset($classCruft["ManyManyIndexes"]) ? $classCruft["ManyManyIndexes"] : array())));
             foreach ($relationships as $relationship) {
                 $manyManyGroup = new CompositeField(array(new HeaderField("DeleteSpec[{$classCruft["DataClass"]}][ManyMany][{$relationship}]", "Many-Many: {$relationship}", 4)));
                 if (!empty($classCruft["ManyManyFields"][$relationship])) {
                     $manyManyGroup->push($fieldsGroup = new CompositeField(array(new HeaderField("DeleteSpec[{$classCruft["DataClass"]}][ManyMany][{$relationship}][Fields]", "Fields", 5))));
                     foreach ($classCruft["ManyManyFields"][$relationship] as $fieldName => $field) {
                         $fieldsGroup->push(new CheckboxField("DeleteSpec[{$classCruft["DataClass"]}][ManyMany][{$relationship}][Fields][{$fieldName}]", "{$fieldName} ({$field["Type"]})"));
                     }
                 }
                 if (!empty($classCruft["ManyManyIndexes"][$relationship])) {
                     $manyManyGroup->push($fieldsGroup = new CompositeField(array(new HeaderField("DeleteSpec[{$classCruft["DataClass"]}][ManyMany][{$relationship}][Indexes]", "Indexes", 5))));
                     foreach ($classCruft["ManyManyIndexes"][$relationship] as $indexName => $index) {
                         $fieldsGroup->push(new CheckboxField("DeleteSpec[{$classCruft["DataClass"]}][ManyMany][{$relationship}][Indexes][{$indexName}]", "{$indexName} ({$index["Column_name"]})"));
                     }
                 }
                 $group->push($manyManyGroup);
             }
         }
         $fields->push($group);
     }
     echo $this->owner->renderWith(array("DatabaseAdminCleaner", "ContentController"), array("FormDeleteCruft" => $form));
     if (!Director::is_cli()) {
         echo "</div>";
         $renderer->writeFooter();
     }
 }
开发者ID:helpfulrobot,项目名称:thefrozenfire-dataobjectcruft,代码行数:86,代码来源:DatabaseAdminCleaner.php

示例11: addPaymentFields

 /**
  * Add pament fields for the current payment method. Also adds payment method as a required field.
  * 
  * @param Array $fields Array of fields
  * @param OrderFormValidator $validator Checkout form validator
  * @param Order $order The current order
  */
 private function addPaymentFields(&$fields, &$validator, $order)
 {
     $paymentFields = new CompositeField();
     foreach (Payment::combined_form_fields($order->Total->getAmount()) as $field) {
         //Bit of a nasty hack to customize validation error message
         if ($field->Name() == 'PaymentMethod') {
             $field->setCustomValidationMessage(_t('CheckoutPage.SELECT_PAYMENT_METHOD', "Please select a payment method."));
         }
         $paymentFields->push($field);
     }
     $paymentFields->setID('PaymentFields');
     $fields['Payment'][] = $paymentFields;
     //TODO need to check required payment fields
     //$requiredPaymentFields = Payment::combined_form_requirements();
     $validator->addRequiredField('PaymentMethod');
 }
开发者ID:helpfulrobot,项目名称:swipestripe-swipestripe,代码行数:23,代码来源:CheckoutPage.php

示例12: CompositeField

    /**                                                              
     * Constructor                                                   
     *                                                               
     * @param  object $controller The controller class                           
     * @param  string $name       The name of the form class              
     * @return object The form                                       
     */
    function __construct($controller, $name)
    {
        //DATA STEP 1 : BASIC INFO
        // Create new group
        $oDataField1 = new CompositeField();
        // Set the field group ID
        $oDataField1->setID('Group1');
        // Add fields to the group
        $oDataField1->push(new LiteralField('Group1Title', '<div class="data-title-block"><img src="themes/lyc2012/img/s1.jpg" />
		<h2>Overview</h2><span>Basic event results. If you do not know the exact numbers, simply make an estimate.</span></div>'));
        $oDataField1->push(new DropdownField('CleanUpGroupID', 'Select an Event to add data for', self::mapCleanUps()));
        $oDataField1->push(new TextField('Participants', 'Number of participants'));
        $oDataField1->push(new LiteralField('Help1', '<p class="category-field-desc">How many people turned-up to help? Your number will be added to the tally at the top of this page.</p>'));
        $oDataField1->push(new TextField('Sacks', 'Sacks of rubbish'));
        $oDataField1->push(new LiteralField('Help2', '<p class="category-field-desc">How many full rubbish sacks did you collect? Your number will be added to the tally at the top of this page.</p>'));
        $oDataField1->push(new TextField('Distance', 'Distance covered'));
        $oDataField1->push(new LiteralField('Help3', '<p class="category-field-desc">How far did participants walk while cleaning-up? This provides an idea of the state of your coastlines.</p>'));
        $oDataField1->push(new TextField('Time', 'Time spent'));
        $oDataField1->push(new LiteralField('Help3', '<p class="category-field-desc">How long did participants spend cleaning-up? This provides an idea of the effort involved.</p>'));
        $oDataField1->push(new LiteralField('Group1Anchor', '
		<div class="Actions margin-top">
			<p class="continue">Got a photo or rubbish data? If yes, continue below. Otherwise</p><a class="orange action" href="#end">Finish now</a>
		</div>'));
        //DATA STEP 2 : UPLOAD IMAGE
        // Create new group
        $oDataField2 = new CompositeField();
        // Set the field group ID
        $oDataField2->setID('Group2');
        //Set-up uploadify Field
        $oDataField2->push(new LiteralField('Group2Title', '<div class="data-title-block"><img src="themes/lyc2012/img/s2.jpg" />
		<h2>Photo</h2><span>(optional) If you do not have any photos from your event, skip this step. </span></div>'));
        $oDataField2->push(new SimpleImageField('DataImageFile', 'Upload event photo'));
        $oDataField2->push(new LiteralField('Help3', '<p class="category-field-desc">Any event photo, but the preference is for a photo of the rubbish collected or of your event participants. Max file size 100KB.</p>'));
        $oDataField2->push(new LiteralField('Group1Anchor', '
		<div class="Actions margin-top">
			<p class="continue">Got rubbish data? If yes, continue below. Otherwise</p><a class="orange action" href="#end">Finish now</a>
		</div>'));
        //DATA STEP 3 : DATA FIELDS
        // Create new group
        $oFieldsCat = new CompositeField();
        $oFieldsCat->setID('Group3');
        $oFieldsCat->push(new LiteralField('Group3Title', '<div class="data-title-block"><img src="themes/lyc2012/img/s3.jpg" />
		<h2>Results</h2><span>(optional) Complete this section if you have estimated or counted the types of rubbish collected.</span></div>'));
        $oFieldsCat->push(new LiteralField('Group3Title2', '<div class="data-title-block"><img src="themes/lyc2012/img/either.png" />
		<h2>Upload</h2><span>Choose this option if you have filled-in your data electronically on our Event Results Spreadsheet.</span></div>'));
        $oFieldsCat->push(new FileField('DataSheetFile', 'Upload a spreadsheet containing your data'));
        //$oFieldsCat->push(new LiteralField('Help3', '<p class="category-field-desc">Choose this option if you have filled-in your data electronically on our Event Results Spreadsheet.</p>'));
        $oFieldsCat->push(new LiteralField('Group1Anchor', '
		<div class="Actions margin-top">
			<p class="continue">Skip this step and enter data below. Otherwise</p><a class="action orange" href="#end">Finish now</a>
		</div>'));
        $oFieldsCat->push(new LiteralField('Group3Title2', '<div class="data-title-block"><img src="themes/lyc2012/img/OR.png" />
		<h2>Enter</h2><span>Choose this option if you have recorded data but do not have it in our spreadsheet (e.g. you recorded it on paper).</span></div>'));
        //Get all FormCategorys
        $oFormCategorys = DataObject::get('FormCategory');
        if ($oFormCategorys) {
            foreach ($oFormCategorys as $category) {
                $oFieldsCat->push($category->getCompositeField());
            }
        }
        $oFieldsCat->push(new LiteralField('Group4Anchor', '
		<a name="end">&nbsp;</a>
		'));
        // Create new fieldset
        $oFields = new FieldSet();
        // Add the groups to the fieldset
        $oFields->push($oDataField1);
        $oFields->push($oDataField2);
        $oFields->push($oFieldsCat);
        //$oFields->push($oDataField4);
        // Create the form action
        $oAction = new FieldSet(new FormAction('SubmitDataSheet', 'Share Results'));
        // Add custom jQuery validation script for requred fields
        Requirements::javascript("mysite/javascript/DataFormVal.js");
        // Construct the form
        parent::__construct($controller, $name, $oFields, $oAction);
    }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:84,代码来源:DataEntryForm.php

示例13: push

 /**
  * Pushes the given field to the group
  *
  * @param FormField $field       Field to push
  * @param bool      $breakBefore Insert a line break before the field?
  * @param bool      $breakAfter  Insert a line break after the field?
  * 
  * @return void
  * 
  * @author Sebastian Diel <sdiel@pixeltricks.de>
  * @since 06.06.2012
  */
 public function push(FormField $field, $breakBefore = false, $breakAfter = false)
 {
     $field->BreakAfter = $breakAfter;
     $field->BreakBefore = $breakBefore;
     parent::push($field);
     $fields = $this->getFields();
     if (!is_null($fields)) {
         $fields->removeByName($field->getName());
     }
 }
开发者ID:silvercart,项目名称:silvercart,代码行数:22,代码来源:SilvercartFieldGroup.php

示例14: getFields

 /**
  * @param Member $member
  * @return FieldList
  **/
 public function getFields(Member $member = null)
 {
     $fields = parent::getEcommerceFields();
     $fields->push(new HeaderField('BillingDetails', _t('OrderAddress.BILLINGDETAILS', 'Billing Address'), 3));
     $fields->push(new TextField('Phone', _t('OrderAddress.PHONE', 'Phone')));
     $billingFields = new CompositeField();
     $hasPreviousAddresses = false;
     if ($member) {
         if ($member->exists() && !$member->IsShopAdmin()) {
             $this->FillWithLastAddressFromMember($member, true);
             $addresses = $member->previousOrderAddresses($this->baseClassLinkingToOrder(), $this->ID, $onlyLastRecord = false, $keepDoubles = false);
             //we want MORE than one here not just one.
             if ($addresses->count() > 1) {
                 $fields->push(SelectOrderAddressField::create('SelectBillingAddressField', _t('OrderAddress.SELECTBILLINGADDRESS', 'Select Billing Address'), $addresses));
                 $hasPreviousAddresses = true;
             }
         }
     }
     //$billingFields->push(new TextField('MobilePhone', _t('OrderAddress.MOBILEPHONE','Mobile Phone')));
     $mappingArray = $this->Config()->get("fields_to_google_geocode_conversion");
     if (is_array($mappingArray) && count($mappingArray)) {
         if (!class_exists("GoogleAddressField")) {
             user_error("You must install the Sunny Side Up google_address_field module OR remove entries from: BillingAddress.fields_to_google_geocode_conversion");
         }
         $billingFields->push($billingEcommerceGeocodingField = new GoogleAddressField('BillingEcommerceGeocodingField', _t('OrderAddress.FIND_ADDRESS', 'Find address'), Session::get("BillingEcommerceGeocodingFieldValue")));
         $billingEcommerceGeocodingField->setFieldMap($mappingArray);
         //$billingFields->push(new HiddenField('Address2', "NOT SET", "NOT SET"));
         //$billingFields->push(new HiddenField('City', "NOT SET", "NOT SET"));
     }
     //$billingFields->push(new TextField('Prefix', _t('OrderAddress.PREFIX','Title (e.g. Ms)')));
     $billingFields->push(new TextField('Address', _t('OrderAddress.ADDRESS', 'Address')));
     $billingFields->push(new TextField('Address2', _t('OrderAddress.ADDRESS2', '')));
     $billingFields->push(new TextField('City', _t('OrderAddress.CITY', 'Town')));
     $billingFields->push($this->getPostalCodeField("PostalCode"));
     $billingFields->push($this->getRegionField("RegionID", "RegionCode"));
     $billingFields->push($this->getCountryField("Country"));
     $billingFields->addExtraClass('billingFields');
     $billingFields->addExtraClass("orderAddressHolder");
     $this->makeSelectedFieldsReadOnly($billingFields->FieldList());
     $fields->push($billingFields);
     $this->extend('augmentEcommerceBillingAddressFields', $fields);
     return $fields;
 }
开发者ID:TouchtechLtd,项目名称:silverstripe-ecommerce,代码行数:47,代码来源:BillingAddress.php

示例15: getEcommerceFieldsForCMS

 /**
  * get CMS fields describing the member in the CMS when viewing the order.
  *
  * @return CompositeField
  **/
 public function getEcommerceFieldsForCMS()
 {
     $fields = new CompositeField();
     $memberTitle = new ReadonlyField("MemberTitle", _t("Member.TITLE", "Name"), "<p>" . _t("Member.TITLE", "Name") . ": " . $this->owner->getTitle() . "</p>");
     $memberTitle->dontEscape = true;
     $fields->push($memberTitle);
     $memberEmail = new ReadonlyField("MemberEmail", _t("Member.EMAIL", "Email"), "<p>" . _t("Member.EMAIL", "Email") . ": " . $this->owner->Email . "</p>");
     $memberEmail->dontEscape = true;
     $fields->push($memberEmail);
     $lastLogin = new ReadonlyField("MemberLastLogin", _t("Member.LASTLOGIN", "Last Login"), "<p>" . _t("Member.LASTLOGIN", "Last Login") . ": " . $this->owner->dbObject('LastVisited')->Nice() . "</p>");
     $lastLogin->dontEscape = true;
     $fields->push($lastLogin);
     $group = EcommerceRole::get_customer_group();
     if (!$group) {
         $group = new Group();
     }
     $linkField = new LiteralField("MemberLinkField", "\n\t\t\t<h3>" . _t("Member.EDIT_CUSTOMER", "Edit Customer") . "</h3>\n\t\t\t<ul>\n\t\t\t\t<li><a href=\"/admin/security/EditForm/field/Members/item/" . $this->owner->ID . "/edit\"  data-popup=\"true\">" . _t("Member.EDIT", "Edit") . " <i>" . $this->owner->getTitle() . "</i></a></li>\n\t\t\t\t<li><a href=\"/admin/security/show/" . $group->ID . "/\"  data-popup=\"true\">" . _t("Member.EDIT_ALL_CUSTOMERS", "Edit All Customers") . "</a></li>\n\t\t\t</ul>\n\t\t\t");
     $fields->push($linkField);
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-ecommerce,代码行数:25,代码来源:EcommerceRole.php


注:本文中的CompositeField::push方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。