+// Generates an URL to the given booking package
+function generateSurfbarPackageLink ($packageId) {
+ // Base URL
+ $url = '{%url=modules.php?module=admin&what=list_surfbar_packages';
+
+ // Is package id given?
+ if (isValidId($packageId)) {
+ // Then add it
+ $url .= '&package_id=' . bigintval($packageId);
+ } // END - if
+
+ // Finish URL EL code
+ $url .= '%}';
+
+ // Return it
+ return $url;
+}
+
+//-----------------------------------------------------------------------------
+// Wrapper function
+//-----------------------------------------------------------------------------
+
+// "Getter" for surfbar_dynamic_percent
+function getSurfbarDynamicPercent () {
+ // Is there cache?
+ if (!isset($GLOBALS[__FUNCTION__])) {
+ // Determine it
+ $GLOBALS[__FUNCTION__] = getConfig('surfbar_dynamic_percent');
+ } // END - if
+
+ // Return cache
+ return $GLOBALS[__FUNCTION__];
+}
+
+// "Getter" for surfbar_static_reward
+function getSurfbarStaticReward () {
+ // Is there cache?
+ if (!isset($GLOBALS[__FUNCTION__])) {
+ // Determine it
+ $GLOBALS[__FUNCTION__] = getConfig('surfbar_static_reward');
+ } // END - if
+
+ // Return cache
+ return $GLOBALS[__FUNCTION__];
+}
+
+// "Getter" for surfbar_static_time
+function getSurfbarStaticTime () {
+ // Is there cache?
+ if (!isset($GLOBALS[__FUNCTION__])) {
+ // Determine it
+ $GLOBALS[__FUNCTION__] = getConfig('surfbar_static_time');
+ } // END - if
+
+ // Return cache
+ return $GLOBALS[__FUNCTION__];
+}
+
+// "Getter" for surfbar_max_order
+function getSurfbarMaxOrder () {
+ // Is there cache?
+ if (!isset($GLOBALS[__FUNCTION__])) {
+ // Determine it
+ $GLOBALS[__FUNCTION__] = getConfig('surfbar_max_order');
+ } // END - if
+
+ // Return cache
+ return $GLOBALS[__FUNCTION__];
+}
+
+// "Getter" for surfbar_payment_model
+function getSurfbarPaymentModel () {
+ // Is there cache?
+ if (!isset($GLOBALS[__FUNCTION__])) {
+ // Determine it
+ $GLOBALS[__FUNCTION__] = getConfig('surfbar_payment_model');
+ } // END - if
+
+ // Return cache
+ return $GLOBALS[__FUNCTION__];
+}
+
+// "Getter" for surfbar_stats_reload
+function getSurfbarStatsReload () {
+ // Is there cache?
+ if (!isset($GLOBALS[__FUNCTION__])) {
+ // Determine it
+ $GLOBALS[__FUNCTION__] = getConfig('surfbar_stats_reload');
+ } // END - if
+
+ // Return cache
+ return $GLOBALS[__FUNCTION__];
+}
+
+// "Getter" for surfbar_restart_time
+function getSurfbarRestartTime () {
+ // Is there cache?
+ if (!isset($GLOBALS[__FUNCTION__])) {
+ // Determine it
+ $GLOBALS[__FUNCTION__] = getConfig('surfbar_restart_time');
+ } // END - if
+
+ // Return cache
+ return $GLOBALS[__FUNCTION__];
+}
+
+// "Getter" for surfbar_auto_start
+function getSurfbarAutoStart () {
+ // Is there cache?
+ if (!isset($GLOBALS[__FUNCTION__])) {
+ // Determine it
+ $GLOBALS[__FUNCTION__] = getConfig('surfbar_auto_start');
+ } // END - if
+
+ // Return cache
+ return $GLOBALS[__FUNCTION__];
+}
+
+// Checks whether auto-start is enabled
+function isSurfbarAutoStartEnabled () {
+ // Is there cache?
+ if (!isset($GLOBALS[__FUNCTION__])) {
+ // Determine it
+ $GLOBALS[__FUNCTION__] = (getSurfbarAutoStart() == 'Y');
+ } // END - if
+
+ // Return cache
+ return $GLOBALS[__FUNCTION__];
+}
+
+// "Getter" for surfbar_daily_counter
+function getSurfbarDailyCounter () {
+ // Is there cache?
+ if (!isset($GLOBALS[__FUNCTION__])) {
+ // Determine it
+ $GLOBALS[__FUNCTION__] = getConfig('surfbar_daily_counter');
+ } // END - if
+
+ // Return cache
+ return $GLOBALS[__FUNCTION__];
+}
+
+// "Getter" for surfbar_yester_counter
+function getSurfbarYesterCounter () {
+ // Is there cache?
+ if (!isset($GLOBALS[__FUNCTION__])) {
+ // Determine it
+ $GLOBALS[__FUNCTION__] = getConfig('surfbar_yester_counter');
+ } // END - if
+
+ // Return cache
+ return $GLOBALS[__FUNCTION__];
+}
+
+// "Getter" for surfbar_weekly_counter
+function getSurfbarWeeklyCounter () {
+ // Is there cache?
+ if (!isset($GLOBALS[__FUNCTION__])) {
+ // Determine it
+ $GLOBALS[__FUNCTION__] = getConfig('surfbar_weekly_counter');
+ } // END - if
+
+ // Return cache
+ return $GLOBALS[__FUNCTION__];
+}
+
+// "Getter" for surfbar_monthly_counter
+function getSurfbarMonthlyCounter () {
+ // Is there cache?
+ if (!isset($GLOBALS[__FUNCTION__])) {
+ // Determine it
+ $GLOBALS[__FUNCTION__] = getConfig('surfbar_monthly_counter');
+ } // END - if
+
+ // Return cache
+ return $GLOBALS[__FUNCTION__];
+}
+
+// "Getter" for surfbar_total_counter
+function getSurfbarTotalCounter () {
+ // Is there cache?
+ if (!isset($GLOBALS[__FUNCTION__])) {
+ // Determine it
+ $GLOBALS[__FUNCTION__] = getConfig('surfbar_total_counter');
+ } // END - if
+
+ // Return cache
+ return $GLOBALS[__FUNCTION__];
+}
+
+//------------------------------------------------------------------------------
+// Template helper functions
+//------------------------------------------------------------------------------
+
+// Template helper to generate a selection box for surfbar actions
+function doTemplateSurfbarActionsActionSelectionBox ($templateName, $clear = FALSE, $default = NULL) {
+ // Init array
+ $actionsAction = array(
+ 0 => array('actions_action' => 'EDIT'),
+ 1 => array('actions_action' => 'DELETE'),
+ 2 => array('actions_action' => 'PAUSE'),
+ 3 => array('actions_action' => 'UNPAUSE'),
+ 4 => array('actions_action' => 'FRAMETEST'),
+ 5 => array('actions_action' => 'RETREAT'),
+ 6 => array('actions_action' => 'RESUBMIT'),
+ 7 => array('actions_action' => 'BOOKNOW')
+ );
+
+ // Handle it over to generateSelectionBoxFromArray()
+ $content = generateSelectionBoxFromArray($actionsAction, 'actions_action', 'actions_action', '', '_surfbar', '', $default, '', FALSE, TRUE);
+
+ // Return prepared content
+ return $content;
+}
+
+// Template helper to generate a selection box for surfbar status
+function doTemplateSurfbarActionsStatusSelectionBox ($templateName, $clear = FALSE, $default = NULL) {
+ // Init array
+ $status = array(
+ 0 => array('actions_status' => 'PENDING'),
+ 1 => array('actions_status' => 'ACTIVE'),
+ 2 => array('actions_status' => 'LOCKED'),
+ 3 => array('actions_status' => 'STOPPED'),
+ 4 => array('actions_status' => 'REJECTED'),
+ 5 => array('actions_status' => 'DELETED'),
+ 6 => array('actions_status' => 'MIGRATED'),
+ 7 => array('actions_status' => 'DEPLETED')
+ );
+
+ // Handle it over to generateSelectionBoxFromArray()
+ $content = generateSelectionBoxFromArray($status, 'actions_status', 'actions_status', '', '_surfbar', '', $default, '', FALSE, TRUE);
+
+ // Return prepared content
+ return $content;
+}
+
+// Template helper to generate a selection box for surfbar status
+function doTemplateSurfbarActionsNewStatusSelectionBox ($templateName, $clear = FALSE, $default = NULL) {
+ // Init array
+ $status = array(
+ 0 => array('actions_new_status' => 'PENDING'),
+ 1 => array('actions_new_status' => 'ACTIVE'),
+ 2 => array('actions_new_status' => 'LOCKED'),
+ 3 => array('actions_new_status' => 'STOPPED'),
+ 4 => array('actions_new_status' => 'REJECTED'),
+ 5 => array('actions_new_status' => 'DELETED'),
+ 6 => array('actions_new_status' => 'MIGRATED'),
+ 7 => array('actions_new_status' => 'DEPLETED')
+ );
+
+ // Handle it over to generateSelectionBoxFromArray()
+ $content = generateSelectionBoxFromArray($status, 'actions_new_status', 'actions_new_status', '', '_surfbar', '', $default, '', TRUE, TRUE);
+
+ // Return prepared content
+ return $content;
+}
+
+//------------------------------------------------------------------------------