Version: current

     1 <?php
     2
     3 class BookingOrderAdmin extends ModelAdmin {
     4     static $url_segment = 'booking_orders';
     5     static $menu_title = 'Заказы номеров';
     6     static $managed_models = 'BookingOrder';
     7
     8     public static $collection_controller_class = "BookingOrderAdmin_CollectionController";
     9
    10 }
    11
    12 class BookingOrderAdmin_CollectionController  extends ModelAdmin_CollectionController {
    13
    14     function SearchForm() {
    15         $form = parent::SearchForm();
    16         $fields = $form->Fields();
    17         $statuses = array(
    18             'New' => '',
    19             'Query' => '',
    20             'Paid' => '',
    21             'Complete' => '',
    22             'MemberCancelled' => '',
    23             'AdminCancelled' => '',
    24         );
    25         $object = BookingOrderAdmin::$managed_models;
    26         $statusValues = singleton($object)->dbObject('Status')->enumValues();
    27         unset($statusValues['Basket']);
    28         foreach ($statusValues as $statusItem => $statusName) {
    29             $statusValues[$statusItem] = $object::status_title($statusItem);
    30         }
    31
    32         $f = new CheckboxSetField('Status', singleton(BookingOrderAdmin::$managed_models)->fieldLabel('Status'), $statusValues);
    33         $f->setDefaultItems(array('New'));
    34
    35         $fields->replaceField('Status', $f);
    36         return $form;
    37     }
    38 }

[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. -