Eventliste Testversion
Er zeigt mir die Daten jedoch nicht richtig an.
Er soll mir alle Termine ab dem aktuellen heutigen Datum anzeigen.
Vieleicht kann mir da jemand Helfen?
Code: Alles auswählen
<?PHP
$phpbb_root_path = './';
define('IN_PHPBB', true);
include_once $phpbb_root_path . 'extension.inc';
include_once $phpbb_root_path . 'common.'.$phpEx;
// Start session management
$userdata = session_pagestart($user_ip, PAGE_MYCALENDAR);
init_userprefs($userdata);
//
// Start output of page
//
$page_title = $lang['eventlist'];
// set the page title and include the page header
$page_title = $lang['View_calendar'];
include ($phpbb_root_path . 'includes/page_header.'.$phpEx);
//
// Start output of page
//
$template->set_filenames(array(
'body' => 'eventlist_body.tpl')
);
// --> Blätterfunktion
$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
// get the events
$sql = "SELECT
u.*,
c.topic_id, c.cal_date, c.forum_id,
MONTH(c.cal_date) as cal_month,
DAYOFMONTH(c.cal_date) as cal_monthday,
YEAR(c.cal_date) as cal_year,
HOUR(c.cal_date) as cal_hour,
MINUTE(c.cal_date) as cal_min,
SECOND(c.cal_date) as cal_sec,
t.topic_title, t.topic_poster
FROM
" . MYCALENDAR_TABLE . " as c,
" . TOPICS_TABLE . " as t,
" . USERS_TABLE . " as u
WHERE
c.topic_id = t.topic_id
AND (c.cal_date >= CURDATE())
ORDER BY
c.cal_date ASC
LIMIT
0,5";
if (!$result = $db->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Error querying dates for calendar.');
}
if ( $row = $db->sql_fetchrow($result) )
{
$i = 0;
do
{
$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
$month = $row['cal_month'];
$year = $row['cal_year'];
$day = $row['cal_monthday'];
$event_day = " ".$day .".".$month .".".$year."";
$username = $row['username'];
$user_id = $row['user_id'];
if ( !empty($row['user_viewemail']) || $userdata['user_level'] == ADMIN )
{
$email_uri = ( $board_config['board_email_form'] ) ? append_sid("profile.$phpEx?mode=email&" . POST_USERS_URL .'=' . $user_id) : 'mailto:' . $row['user_email'];
$email_img = '<a href="' . $email_uri . '"><img src="' . $images['icon_email'] . '" alt="' . $lang['Send_email'] . '" title="' . $lang['Send_email'] . '" border="0" /></a>';
$email = '<a href="' . $email_uri . '">' . $lang['Send_email'] . '</a>';
}
else
{
$email_img = ' ';
$email = ' ';
}
$temp_url = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id");
$profile_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_profile'] . '" alt="' . $lang['Read_profile'] . '" title="' . $lang['Read_profile'] . '" border="0" /></a>';
$profile = '<a href="' . $temp_url . '">' . $lang['Read_profile'] . '</a>';
$temp_url = append_sid("privmsg.$phpEx?mode=post&" . POST_USERS_URL . "=$user_id");
if ( $row['username'] == Anonymous )
{
$pm = ' ';
$pm_img = ' ';
$email_img = ' ';
$email = ' ';
}else{
$pm_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_pm'] . '" alt="' . $lang['Send_private_message'] . '" title="' . $lang['Send_private_message'] . '" border="0" /></a>';
$pm = '<a href="' . $temp_url . '">' . $lang['Send_private_message'] . '</a>';
}
$template->assign_block_vars('event', array(
'ROW_NUMBER' => $i + ( $start + 1 ),
'ROW_COLOR' => '#' . $row_color,
'ROW_CLASS' => $row_class,
'USERNAME' => $username,
'S_MINI_CAL_EVENT' => $row['topic_title'],
'U_EVENT' => append_sid( $phpbb_root_path . "viewtopic.$phpEx?" . POST_TOPIC_URL . '=' . $row['topic_id'] ),
'EVENT_DATE' => $event_day,
'AUTHOR' => $username,
'FROM' => $from,
'PROFILE_IMG' => $profile_img,
'PROFILE' => $profile,
'PM_IMG' => $pm_img,
'PM' => $pm,
'EMAIL_IMG' => $email_img,
'EMAIL' => $email,
'WWW_IMG' => $www_img,
'WWW' => $www,
'U_VIEWPROFILE' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id"))
);
$i++;
}
while ( $row = $db->sql_fetchrow($result) );
$db->sql_freeresult($result);
}
$sql = 'SELECT COUNT(DISTINCT topic_id) AS total FROM ' . MYCALENDAR_TABLE . ' ';
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error getting total events', '', __LINE__, __FILE__, $sql);
}
if ( $total = $db->sql_fetchrow($result) )
{
$total_events = $total['total'];
$pagination = generate_pagination("events.$phpEx?", $total_event, $board_config['topics_per_page'], $start). ' ';
}
$template->assign_vars(array(
'PAGINATION' => $pagination,
'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $total_events / $board_config['topics_per_page'] )),
'L_GOTO_PAGE' => $lang['Goto_page'])
);
//
// Generate the page
//
$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>
Mfg Maffy