Postponed (maintainer needs more info)
Project:
Public Bookings
Version:
6.x-3.0-alpha1
Component:
Public Bookings
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
9 Nov 2010 at 06:15 UTC
Updated:
13 Jun 2011 at 09:15 UTC
Jump to comment: Most recent
Comments
Comment #1
Anonymous (not verified) commentedI'm not entirely sure that I understood what you need.
Lets use your example:
You have one system administrating e.g. ten flats for a motel. Each flat has its own page. On this page a calendar is displayed showing for each day whether the given flat is available or not.
Available days are links allowing a user to directly book this flat for the given day, correct?
If yes you could have a look at the Event Booking extension, it might provide the needed functionality. An alternative would be using the "Bookings Free Cache"-submodule (for the display of available times) and an adoption of the "Booking Button"-submodule (for the booking link)
Comment #2
suvannet commentedthanks tirsales,
i used calendar_block module for this, this module has hook where i can write some code to display available days for the flat.
It's very cool module.
Comment #3
Anonymous (not verified) commentedFantastic :) Could you share your code? I'm very interested in seeing new ways to display bookings
Comment #4
suvannet commentedsure, this is a hook_calendar_block, i used it in the publicbookings.module.
function publicbookings_calendar_block(&$calendar, &$date, $op) {
switch($op) {
case 'alter':
$sql = "SELECT start, end
FROM bookings_schedules
WHERE resource_id = '%s' AND status = '4'";
$q = db_query($sql, $calendar->resource_id);
while ($row = db_fetch_array($q))
{
$start_date = strtotime($row['start']);
$end_date = strtotime($row['end']);
$cur_date = strtotime($date->day.".".$date->month.".".$date->year);
if($start_date <= $cur_date && $end_date >= $cur_date)
{
$date->content = '
';
}
}
$sql = "SELECT start, end
FROM bookings_schedules
WHERE resource_id = '%s' AND status = '2'";
$q = db_query($sql, $calendar->resource_id);
while ($row = db_fetch_array($q))
{
$start_date = strtotime($row['start']);
$end_date = strtotime($row['end']);
$cur_date = strtotime($date->day.".".$date->month.".".$date->year);
if($start_date <= $cur_date && $end_date >= $cur_date)
{
$date->content = '
';
}
}
break;
}
}
there i mark calendar of unconfirmed and booked days for the flat.
then, i change some code of calendar_block.module
I was change $calendar object on line 126, i add resource_id param:
// Resource ID used for Booking system
$resource_id = 0;
if (arg(0) == 'node') $resource_id = arg(1);
$calendar = (object) array(
'year' => date('Y'),
'month' => date('m'),
'weekdays' => $weekdays,
'resource_id' => (int)$resource_id,
);
And then i change calendar_block.js file, on line 63 i add this:
ref.ajax_settings.data.resource_id = Drupal.toJson(ref.settings.calendar.resource_id);
Then i put calendar_block block into my page.
That's all.
Comment #5
YK85 commentedsubscribing
Comment #6
doublejosh commentedSubscribing.
Comment #7
easyRider commentedIts possible to include this next releases? Dont like to code, its more dificult to further updates...
Comment #8
easyRider commentedDo you think its possible to use atontimes code in a next release?