Source for file booking.php
Documentation is available at booking.php
* Object for an individual booking
* @author Stuart Prescott
* @copyright Copyright Stuart Prescott
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
/** Load ancillary functions */
require_once 'inc/typeinfo.php';
require_once 'inc/bb/configreader.php';
/** date manipulation routines */
require_once 'inc/date.php';
require_once 'timeslot.php';
* Object for an individual booking
/** @var integer booking id number */
/** @var integer percentage discount to be applied to the booking */
/** @var string log message for the instrument log book */
/** @var string log message for the booking calendar */
/** @var integer project id number */
/** @var integer user id number for user that will use instrument */
/** @var string username of user for user that will use instrument */
/** @var string full name of user for user that will use instrument */
/** @var string email address for user that will use instrument */
/** @var string phone number for user that will use instrument */
/** @var integer user id number for user that booked the instrument */
/** @var integer full name of user for user that booked the instrument */
/** @var string username of user for user that booked the instrument */
/** @var string email address for user that booked the instrument */
/** @var string instrument name */
/** @var string instrument description */
* Create a booking object
* @param array $arr key => value paids
$this->TimeSlot($arr['bookwhen'], $arr['stoptime'], $arr['duration']);
$this->id =
$arr['bookid'];
$this->log =
$arr['log'];
$this->userid =
$arr['userid'];
$this->name =
$arr['name'];
#echo "Booking from ".$this->start->dateTimeString()." to ".$this->stop->dateTimeString()."<br />\n";
* display the booking as a list of settings
* @param boolean $displayAdmin show admin-only information (discount etc)
* @param boolean $displayOwner show owner-only information (project etc)
* @return string html representation of booking
function display($displayAdmin, $displayOwner) {
* display the booking as a list of settings
* @param boolean $displayAdmin show admin-only information (discount etc)
* @param boolean $displayOwner show owner-only information (project etc)
* @return string html representation of booking
$t =
'<tr><td>'.
T_('Booking ID').
'</td><td>'.
$this->id.
'</td></tr>'.
"\n"
.
'<tr><td>'.
T_('Start').
'</td><td>'.
$this->start->getShortDateTimeString().
'</td></tr>'.
"\n"
.
'<tr><td>'.
T_('Stop').
'</td><td>'.
$this->stop->getShortDateTimeString().
'</td></tr>'.
"\n"
.
'<tr><td>'.
T_('Duration').
'</td><td>'.
$this->duration->getShortString()/*.$bookinglength*/.
'</td></tr>'.
"\n"
.
'<tr><td>'.
T_('Comments').
'</td><td>'.
xssqw($this->comments).
'</td></tr>'.
"\n"
.
'<tr><td>'.
T_('Log').
'</td><td>'.
xssqw($this->log).
'</td></tr>'.
"\n";
if ($displayAdmin ||
$displayOwner) {
$t .=
'<tr><td>'.
T_('Project').
'</td><td>'.
xssqw($this->project).
'</td></tr>'.
"\n";
$t .=
'<tr><td>'.
T_('Discount').
'</td><td>'.
xssqw($this->discount).
'</td></tr>'.
"\n";
* display the booking as a single cell in a calendar
* @return string html representation of booking
$BasePath =
$conf->BasePath;
static $freeBusyStr =
null;
if ($freeBusyStr ===
null) {
$freeBusyStr =
T_('Busy from %s to %s');
$timedescription =
sprintf($freeBusyStr, $start->getShortDateTimeString(), $stop->shortDateTimeString());
return "<div title='$timedescription'>$busyStr</div>";
static $viewEditStr =
null;
if ($viewEditStr ===
null) $viewEditStr =
T_('View or edit booking from %s to %s');
$timedescription =
sprintf($viewEditStr, $start->getShortDateTimeString(), $stop->getShortDateTimeString());
//$timedescription = $this->start->timeString().' - '.$this->stop->timeString();
$isodate =
$start->dateString();
$t .=
"<div style='float:right;'><a href='$this->href&isodate=$isodate&bookid=$this->id' "
.
"title='$timedescription' class='but'><img src='$BasePath/theme/images/editbooking.png' "
.
"alt='$timedescription' class='calicon' /></a></div>";
// Finally include details of the booking:
$t .=
'<div class="calbookperson">'
if ($conf->value('calendar', 'showphone', false)) {
$t .=
'<div class="calphone">'
$t .=
'<div class="calcomment">'
* work out the title (start and stop times) for the booking for display
static $bookingStr =
null;
if ($bookingStr ===
null) $bookingStr =
T_('Booking from %s - %s');
$start = isset
($this->displayStart) ?
$this->displayStart :
$this->start;
$stop = isset
($this->displayStop) ?
$this->displayStop :
$this->stop;
return sprintf($bookingStr, $start->getShortDateTimeString(), $stop->getShortDateTimeString());
* construct a long description of the time slot for pop-ups
* @return string description
if (! $short && isset
($this->children) &&
is_array($this->children)) {
foreach ($this->children as $b) {
$list[] =
$b->generateLongDescription(true);
$s =
'<table class="popup">'.
join($list, "") .
'</table>';
$starttime =
$start->getShortTimeString();
$stoptime =
$stop->getShortTimeString();
$s =
"<tr><td>$instrument</td><td>$user</td><td>$starttime</td><td>$stoptime</td></tr>";
$s =
'<table class="popup">'.
$this->displayInTable(2, false, false) .
'</table>';
Documentation generated on Tue, 06 Mar 2007 10:00:48 +0000 by phpDocumentor 1.3.0