- Desde
- 9 Sep 2012
- Mensajes
- 15
Nuevamente con una consulta... Tengo un Widget con los próximos eventos de calendario que se ve así:
Pero me gustaría que se viera en el formato de:
15/09/2012: Tonga...
16/09/2012: Leo corre...
18/09/2012: Leo corre...
No se si se entiende lo que digo. Por las dudas, dejo el código que estoy usando en el Widget.
Espero me puedan ayudar! Saludos!
Pero me gustaría que se viera en el formato de:
15/09/2012: Tonga...
16/09/2012: Leo corre...
18/09/2012: Leo corre...
No se si se entiende lo que digo. Por las dudas, dejo el código que estoy usando en el Widget.
Insertar CODE, HTML o PHP:
ob_start(); //Change $show_count to change how many events to display in the block
$show_count = 5;
//Get the user's time zone
$user_tz = vB::$vbulletin->userinfo['timezoneoffset'];
$tz_adjust = $user_tz * 3600;
$mydate = mktime(0, 0, 0, date("m"), date("d")-1, date("Y"));
//Get events from the table
//Use the code below to pull from ALL calendars
$query = sprintf(" SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from >= '$mydate' || (dateline_from >= '$mydate' AND dateline_to <= '$mydate' ) || ('$mydate' BETWEEN dateline_from AND dateline_to)) ORDER BY dateline_from ASC LIMIT $show_count");
//To pull from just certain calendars, comment out the above $query and uncomment the line below. Change the "AND calendarids in (1, 2, 3)" to match your calendar IDs to pull
//$query = sprintf(" SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from >= '$mydate' || (dateline_from >= '$mydate' AND dateline_to <= '$mydate' ) || ('$mydate' BETWEEN dateline_from AND dateline_to)) AND calendarids in (1, 2, 3) ORDER BY dateline_from ASC LIMIT $show_count");
$event_get = vB::$db->query_read($query);
$output_bits = '';
while($event = vB::$db->fetch_array($event_get)) {
// Convert user timezone offset into minutes
$offset = $user_tz;
// Only adjust start times for ranged events; all-day events should keep their midnight start time.
if($event['dateline_to'] == 0 )
{
$from = $event['dateline_from'];
} else {
$from = $event['dateline_from'] + $tz_adjust;
}
$to = $event['dateline_to'] + $tz_adjust;
$fromDate = trim(vbdate(vB::$vbulletin->options['dateformat'], $from, false, true, false, true));
$toDate = trim(vbdate(vB::$vbulletin->options['dateformat'], $to, false, true, false, true));
$fromTime = trim(vbdate(vB::$vbulletin->options['timeformat'], $from, false, true, false, true));
$toTime = trim(vbdate(vB::$vbulletin->options['timeformat'], $to, false, true, false, true));
if($event['dateline_to'] == 0 )
{
$format = sprintf("%s",$fromDate);
} else {
$format = sprintf("%s %s - %s",$fromDate, $fromTime, $toTime);
}
$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();
Espero me puedan ayudar! Saludos!