Version: current

     1 <?php
     2
     3 class BookingWidget extends Extension {
     4
     5     static $allowed_actions = array('BookingWidgetForm');
     6
     7     /**
     8      *
     9      *
    10      *
    11      * @return <type>
    12      */
    13     function BookingWidgetForm() {
    14         $fields = new FieldSet();
    15         $fields->push(new TextField('FilterStartDate', _t('BookingOrder.StartDate')));
    16         $fields->push(new TextField('FilterEndDate', _t('BookingOrder.EndDate')));
    17         $form = new Form(
    18             $this->owner,
    19             'BookingWidgetForm',
    20             $fields,
    21             new FieldSet(new FormAction('goBooking', _t('BookingPage.DoSearch')))
    22         );
    23
    24         return $form;
    25     }
    26
    27     /**
    28      *
    29      *
    30      * @param <type> $data
    31      * @param <type> $form
    32      *
    33      * @return <type>
    34      */
    35     function goBooking($data, $form) {
    36         Session::set('Filter', $data);
    37         if ($bookingLink = BookingPage::find_links()) {
    38             $this->owner->redirect(BookingPage::find_links());
    39             return;
    40         }
    41         $this->owner->redirectBack();
    42         return;
    43     }
    44 }

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -