Example #1
0
 /**
  * Standard modular run function.
  *
  * @param  MEMBER		The ID of the member we are getting link hooks for
  * @return array		List of tuples for results. Each tuple is: type,title,url
  */
 function run($member_id)
 {
     if (!has_actual_page_access(get_member(), 'cms_booking')) {
         return array();
     }
     require_lang('booking');
     require_code('booking');
     require_code('booking2');
     $zone = get_module_zone('cms_booking');
     $request = get_member_booking_request($member_id);
     $links = array();
     foreach ($request as $i => $r) {
         $from = get_timezoned_date(mktime(0, 0, 0, $r['start_month'], $r['start_day'], $r['start_year']), false);
         $to = get_timezoned_date(mktime(0, 0, 0, $r['end_month'], $r['end_day'], $r['end_year']), false);
         $links[] = array('content', do_lang_tempcode('BOOKING_EDIT', $from, $to, get_translated_tempcode($GLOBALS['SITE_DB']->query_value('bookable', 'title', array('id' => $r['bookable_id'])))), build_url(array('page' => 'cms_booking', 'type' => '_eb', 'id' => strval($member_id) . '_' . strval($i)), $zone));
     }
     return $links;
 }
Example #2
0
/**
 * Find the re-constituted booking ID a specific booking row ID is in.
 *
 * @param  MEMBER		Member ID is for.
 * @param  AUTO_LINK	Booking row ID.
 * @return ID_TEXT	Re-constituted booking ID.
 */
function find_booking_under($member_id, $id)
{
    $all = get_member_booking_request($member_id);
    foreach ($all as $i => $r) {
        foreach ($r['_rows'] as $row) {
            if ($row['id'] == $id) {
                break;
            }
        }
    }
    return strval($member_id) . '_' . strval($i);
}
Example #3
0
 /**
  * Standard aed_module delete actualiser.
  *
  * @param  ID_TEXT		The entry being deleted
  */
 function delete_actualisation($_id)
 {
     list($member_id, $i) = array_map('intval', explode('_', $_id, 2));
     $request = get_member_booking_request($member_id);
     foreach ($request[$i]['_rows'] as $row) {
         delete_booking($row['id']);
     }
 }