Quote:
Originally Posted by nealohara
Nice. Is there a way of refining this a little?
Let's say we've got a room booked on Thursday the 7th January between 20:00 and 21:00 and we add it to the default calendar. Currently what we get is
Event
7th Jan 2010 to 7th Jan 2010
ideally I'd like it to display as follows:
Event
7th Jan 2010 between 20:00 and 21:00
The dates and times are all stored as variables but I don't want to screw it up
Any ideas?
|
PHP Code:
ob_start();
// %d
$show_count = 5;
$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from > '%d' || ( dateline_from > '%d' AND dateline_to < '%d' )) ORDER BY dateline_from ASC LIMIT %d",TIMENOW,TIMENOW,TIMENOW,$show_count);
$event_get = vB::$db->query_read($query);
$output_bits = '';
while($event = vB::$db->fetch_array($event_get)) {
if($event['dateline_to'] == 0 )
{
$format = sprintf("<b>Am:</b> %s", vbdate(VB::$vbulletin->options['dateformat'],$event['dateline_from']));
} else {
$format = sprintf("<b>Vom:</b> %s<br /><b>Bis:</b> %s", vbdate(VB::$vbulletin->options['dateformat'] . ' ' . VB::$vbulletin->options['timeformat'],$event['dateline_from']), vbdate(VB::$vbulletin->options['dateformat'] . ' ' . VB::$vbulletin->options['timeformat'],$event['dateline_to']));
}
$output_bits .= sprintf('
<div class = "cms_widget_post_bit"><h4 class="cms_widget_post_header"><a href="calendar.php?do=getinfo&e=%d">%s</a></h4>
<p class="cms_widget_post_content">%s</p>
</div>
',$event['eventid'],$event['title'],$format);
}
$output = $output_bits;
ob_end_clean();