Allocated Seating

This project is not covered by Drupal’s security advisory policy.

Preview of the designer and plan elements in use

This module is seeking new co-maintainers, please chime in if you have time to help push it forwards.


Allocated seating provides two field types - an allocated seating designer and a seating plan.
These fields can be used for various purposes - eg the designer can be used on a node edit form to allow users to create a seating plan for an event whilst the plan can be used as part of a checkout workflow to allow customers to nominate which seat they wish to book.


The seat designer features a drag and drop interface powered by jquery_ui. Users can design their seating plan by nominating the number of tickets and the seating layout (number of rows, columns, sections/floors). Users can drag the seats around to set up their desired layout, including dragging between floors.



Recommended modules

This module was originally written for a Transport booking module which is still under active development

How to use

An example of how to add a seating designer to your form:

// Add the necessary js, css and libraries
// Add your field
    $form['ticketing']['ticket_plan'] = array(
      '#description' => t('Enter the number of rows and columns in your layout. You may drag and drop seats to reorder them. You may add another floor/section/level by clicking add floor. You can drag seats from one floor to another by dropping them on the tab of the floor you wish to drag them to.'),
      '#ahah_extra' => 'ticketing/', // This added to the ahah path
      '#default_value' => (isset($form_state['values']['ticket_plan']) ? $form_state['values']['ticket_plan'] : $node->ticket_plan),
      '#type' => 'allocated_seating_seat_design', // Note the field type
      '#seats' => 50 // This is a required property, the designer needs to know how many seats are required - you can make this dynamic if you wish with ahah/use of $form_state

Note the #ahah_extra property is required when you nest your field (as in the example). The fields use ahah to dynamically modify the number of rows/columns/floors. By nominating the parents (imploded with /) the module can accurately traverse the $form array to return the correct element.

To add a seating plan (choose your seat) to your form:

    $form['seats'] = array(
        '#type' => 'allocated_seating_seat_select', //Note the field type
        '#default_value' => $form_state['values']['seats'], //Pre-set the selected seats
        '#required_seats' => $form_state['values']['quantity'], //The quantity of seats the user must choose to continue
        '#plan' => $form_state['storage']['ticket_plan'], // The ticket plan, this is an array of the form returned from the field type 'allocated_seating_seat_design' - see above
        '#not_available' => bookable_instance_get_sold($instance) // An array of seat numbers that are not available (ie already sold)

Note the module comes with a sub-module allocated_seating_example which contains a fully-functional example of how to add a seating plan editor field to a node edit form - see the function allocated_seating_example_node_ticket_layout_form().

Future plans

There is work underway to bundle this into an event ticketing system for Ubercart.
Some more documentation would probably help.

Demos (ogv 7.8 Mb)

Allocated Seating项目的Drush安装命令:复制到剪贴板