New Plugins
The mySeat plugin system is a way to extend mySeat with features and makes it easy for third-party tools to interact with mySeat. This guide should provide everything you need to implement plugins that work with mySeat.

Plugin System

(available soon)

Allows easy modification,customization, and enhancement to your mySeat installation, instead of changing the core programming. You and third party developer can add functionality with Plugins. mySeat plugin API provide a way to load the plug-in scripts into a hook which is embed in main scripts. This API can be used to setup and embed application plug-ins in similar way to how it is done in other open source projects like Wordpress.

Plugins

Is a program, or a set of one or more functions, written in the PHP scripting language be stored in plugins folder, that adds a specific set of features or services to the main mySeat application, which can be seamlessly integrated with the main application using access points(hooks).

Hooks

Hooks are provided by the plugin system to allow your plugin to 'hook into' the main program. That is to call functions in plugins at specific times, and thereby set your plugin in motion.

Administration

Plugins can be activated/deactivated in the backend of mySeat under System>>Plugins by klick on the Play/Pause buttons.


Structure

Folder

All plugins are stored in the particular /plugins folder in the root folder of mySeat.

Name convention

Plugins will be included from the specific /plugins folder, only when named *.plugin.php e.g. 'debug.plugin.php'. The plugin system will also include plugins in subfolders.

Plugin structure - Metadata

Each plugin start with a comment header, which provides the plugin system with neccessary information. This example should be self-explaining:

                /*
                Plugin Name: Show Session
                Plugin URI: http://www.myseat.us
                Description: Debug console. Shows the content of the $_SESSION variable
                Version: 1.0
                Author: Bernd Orttenburger
                Author URI: http://www.openmyseat.com/
                */
            

Plugin structure - Add hook

Define a hook, where to execute aspecific function. Example:

            add_hook('debug','print_session',7);
            
Parameter definition:
  1. The name of the hook.
  2. The function you wish to be called.
  3. optional. Used to specify the order in which the functions associated with a particular action are executed.(range 0~20, 0 first call, 20 last call)

Notice See the 'debug.plugin.php' plugin for more informations as example code.


Hooks

Hooks are provided by the plugin system to allow your plugin to 'hook into' the main program. That is to call functions in plugins at specific times and positions, and thereby set your plugin in motion.


Hook Description
debug Executes plugin at end of each page.
after_booking Executes plugin after a sucessfull reservation/booking.
after_del_res Executes plugin after deleting a reservation.
after_alw_res Executes plugin after taking a reservation from the waitlist to the reservations.
after_del_event Executes plugin after deleting an event.
after_del_outlet Executes plugin after deleting an outlet.
after_del_user Executes plugin after deleting an user.

Variables


Session variable

The information in the session variable can be used throughout all plugins to interact with the main application.
Use it like $_SESSION[selOutlet][outlet_name] to get the outlet's name.

              Array
              (
                  [forwardPage] => The backend homepage; for redirecting
                  [u_id] => Logged in user ID
                  [u_name] => Logged in user login-name
                  [u_email] => Logged in user email
                  [role] => Logged in user role
                  [realname] => Logged in user real-name
                  [autofill] => Autofill the authors field
                  [property] => Property's ID
                  [propertyID] => Property's ID (same as 'property')
                  [prp_name] => Actual selected property name
                  [u_time] => Log in time
                  [u_lang] => Logged in user language
                  [valid_user] => Is logged in user valid (1=yes; 0=no)
                  [language] => Logged in user language (e.g. 'en_EN')
                  [token] => Login token
                  [outletID] => Actual outlet's ID
                  [countryID] => Actual outlet's country ID
                  [city] => Actual outlet's city ID
                  [selOutlet] => Actual outlet's details as array (self explaining)
                    Array (
                          [outlet_id] => 
                          [outlet_name] => 
                          [property_id] => 
                          [outlet_description] => 
                          [outlet_description_en] => 
                          [cuisine_style] => 
                          [outlet_max_capacity] => 
                          [outlet_max_tables] => 
                          [outlet_open_time] => 
                          [outlet_close_time] => 
                          [outlet_timestamp] => 
                          [outlet_closeday] => comma separated (0=sunday, 6=saturday)
                          [saison_start] => format MMDD
                          [saison_end] => format MMDD
                          [saison_year] => 
                          [webform] => (1=bookable; 0=not bookable)
                          [limit_password] => 
                          [confirmation_email] => 
                          [passerby_max_pax] => 
                          [avg_duration] => 
                          [1_open_time] => format hh:mm:ss
                          [1_close_time] =>
                          [2_open ...
                          [2_close ...  => till '6' and '0'
                          [1_open_break] => format hh:mm:ss
                          [1_close_break] => 
                          [2_open ...
                          [2_close ...  => till '6' and '0'
                          [outlet_open_break] => format hh:mm:ss
                          [outlet_close_break] => format hh:mm:ss
                      )
                  [selectedDate] => Actual selected date (in database format YYYY-MM-DD)
                  [selectedDate_user] => Actual selected date (format like selected in general settings)
                  [selectedDate_saison] => Actual selected date (format MMDD)
                  [selectedDate_year] => Actual selected date (format YYYY)
                  [open_time] => Actual selected outlet open time (format hh:mm:ss)
                  [close_time] => Actual selected outlet close time (format hh:mm:ss)
                  [page] => Actual selected page in backend
                  [capability] => User right of actual user (e.g. Settings-General, see database table 'capability')
                  [outlet_max_capacity] => Actual outlet's max. seats
                  [outlet_max_tables] => Actual outlet's max. tables
                  [passerby_max_pax] => Actual outlet's max. persons online bookings
              )
              [errors] => Array holding all error messages
              [messages] => Array holding all message texts
              [booking_number] => The reservation booking number (if a reservation was submitted and successful)
              [form] => The submitted reservation details as array (if a reservation was submitted and successful)
              (
                  [reservation_time] => format hh:mm
                  [reservation_title] => Guests title (format 'M' men,'W' women ,'D' doctor,'P' professor,'F' family,'C' company)
                  [reservation_guest_name] => 
                  [reservation_pax] => number of persons
                  [reservation_hotelguest_yn] => format HG,PASS,WAIT
                  [reservation_guest_phone] => 
                  [reservation_guest_email] => 
                  [email_type] => format yes,no
                  [reservation_advertise] => format YES,NO
                  [reservation_notes] => 
                  [reservation_booker_name] => the authors name
                  [reservation_guest_adress] => 
                  [reservation_guest_city] => 
                  [reservation_discount] => 
                  [reservation_parkticket] => 
                  [reservation_bill] => 
                  [recurring_date] => 
                  [recurring_dbdate] => date is set when reservation is recurring (format YYYY-MM-DD)
                  [recurring_span] => number of day span of recurring reservation
                  [reservation_outlet_id] => ID of booked outlet
                  [reservation_timestamp] => date and time of booking YYYY-MM-DD hh:mm:ss
                  [reservation_ip] => IP of author
              )
              



Contacting mySeat's Plugin Support Team

If you have a specific question about the Plugins, please contact us at developer@myseat.us.


© 2011 by mySeat distributed under the terms of the GNU General Public License