Seite 1 von 1

MYCalender erweiteren

Verfasst: 14.10.2005 14:07
von Maffy
Ich möchte den Eventkalender von MYCalender mojavelinux dahingehend erweiteren, das er mir die Events des Aktuellen Monats in einer Tabelle anzeigt.

Das soll dann als Tabelle so aussehen:

ID | Titel | Wann | Poster

oder dann wenn kein Daten für den Monat Vorhanden sind eine entsprechende Meldung.

Im Augenblick weis ich jetzt nicht so recht weiter.

Villeicht kann mir da jemand weiter Helfen.

Das Blättern durch die Monate funktioniert schon soweit.


Code: Alles auswählen

<?PHP

#################################################################
## Mod Title:mycalendar Mod w/selected forum integration
## Mod Version: 2.2.7
## Author: marksten
## Author: mojavelinux <dan@mojavelinux.com>
## Description: Enables users to add events to the calendar
##              through a chosen forum.
#################################################################

#################################################################
## --> myeventlist Mod
#################################################################

#################################################################
## Mod Title: myeventlist Mod
## Mod Version: 0.0.1 
## Orginal Author: mojavelinux <dan@mojavelinux.com>
## Author: Matthias Reichert <matthias-reichert@mr-73.de>
## Description: Zeigt die Events des Aktuellen Monats
##				als Tabelle an.
#################################################################

$phpbb_root_path = './';
define('IN_PHPBB', true);
include_once $phpbb_root_path . 'extension.inc';
include_once $phpbb_root_path . 'common.'.$phpEx;
include_once $phpbb_root_path . 'includes/bbcode.'.$phpEx;

// Start session management
$userdata = session_pagestart($user_ip, PAGE_MYCALENDAR);
init_userprefs($userdata);

// determine the information for the current date
list($today['year'], $today['month'], $today['day']) = explode('-', create_date('Y-m-d', time(), $board_config['board_timezone']));

// get the month/year offset from the get variables, or else use first day of this month
if (isset($HTTP_GET_VARS['month']) && isset($HTTP_GET_VARS['year'])) {
    $view_isodate = sprintf('%04d', $HTTP_GET_VARS['year']) . '-' . sprintf('%02d', $HTTP_GET_VARS['month']) . '-01 00:00:00';
} 
// get the first day of the month as an isodate
else {
    $view_isodate = $today['year'] . '-' . $today['month'] . '-01 00:00:00';
}

// setup the current view information
$query = "SELECT
             MONTHNAME('$view_isodate') as monthName,
             DATE_FORMAT('$view_isodate', '%m') as month,
             YEAR('$view_isodate') as year,
             DATE_FORMAT(CONCAT(YEAR('$view_isodate'), '-', MONTH('$view_isodate' + INTERVAL 1 MONTH), '-01') - INTERVAL 1 DAY, '%e') as numDays,
             WEEKDAY('$view_isodate') as offset";
$result = $db->sql_query($query);
$monthView = $db->sql_fetchrow($result);
$monthView['monthName'] = $lang['datetime'][$monthView['monthName']];

// set the page title and include the page header
$page_title = " Übersicht der Termine und Veranstaltungen ";
include ($phpbb_root_path . 'includes/page_header.'.$phpEx);

$template->set_filenames(array(
    'body' => 'eventlist_body.tpl')
);

// Datensätze des Monats anzeigen

        // get the events 
    	$sql = "SELECT 
                  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 
    	        FROM 
    	          " . MYCALENDAR_TABLE . " as c,
    	          " . TOPICS_TABLE . " as t
    	        WHERE 
                  c.topic_id = t.topic_id 
                  AND (c.cal_date >= CURDATE()) 
    	        ORDER BY 
    	          c.cal_date ASC ";
	
	if(!$ergebnis = $db->sql_query($sql)) {
	message_die(GENERAL_ERROR, 'Fehler beim auslesen der Daten', '', __LINE__, __FILE__, $cat_sql);
	}

// Datensätze anzeigen


				     
// Blätterfunktion für den Kalender
if ($monthView['month'] == '12') {
    $nextmonth = 1;
    $nextyear = $monthView['year'] + 1; 
} 
else {
    $nextmonth = sprintf('%02d', $monthView['month'] + 1);
    $nextyear = $monthView['year'];
}

if ($monthView['month'] == '01') {
    $previousmonth = '12';
    $previousyear = $monthView['year'] - 1;
} 
else {
    $previousmonth = sprintf('%02d', $monthView['month'] - 1); 
    $previousyear = $monthView['year'];
}

// prepare images and links for month navigation
$image_prev_month = "<img src=\"" . $images['icon_left_arrow'] . "\" align=\"middle\" border=\"0\" title=\"{$lang['View_previous_month']}\" alt=\"" . $lang['View_previous_month'] . "\" />";
$image_next_month = "<img src=\"" . $images['icon_right_arrow'] . "\" align=\"middle\" border=\"0\" title=\"{$lang['View_next_month']}\" alt=\"" . $lang['View_next_month'] . "\" />";
$url_prev_month = append_sid('eventlist.' . $phpEx . "?month=$previousmonth&year=$previousyear");
$url_next_month = append_sid('eventlist.' . $phpEx . "?month=$nextmonth&year=$nextyear");

$image_prev_year = "<img src=\"" . $images['icon_double_left_arrow'] . "\" align=\"middle\" border=\"0\" title=\"{$lang['View_previous_year']}\" alt=\"" . $lang['View_previous_year'] . "\" />";
$image_next_year = "<img src=\"" . $images['icon_double_right_arrow'] . "\" align=\"middle\" border=\"0\" title=\"{$lang['View_next_year']}\" alt=\"" . $lang['View_next_year'] . "\" />";
$url_prev_year = append_sid('eventlist.' . $phpEx . '?month=' . $monthView['month'] . '&year=' . ($monthView['year'] - 1));
$url_next_year = append_sid('eventlist.' . $phpEx . '?month=' . $monthView['month'] . '&year=' . ($monthView['year'] + 1));


$template->assign_vars(array(
    'L_CURRENT_MONTH' => $monthView['monthName'],
    'L_CURRENT_YEAR' => $monthView['year'],
    'I_PREV_MONTH' => $image_prev_month,
    'I_NEXT_MONTH' => $image_next_month,
    'U_PREV_MONTH' => $url_prev_month,
    'U_NEXT_MONTH' => $url_next_month,
    'I_PREV_YEAR'  => $image_prev_year,
    'I_NEXT_YEAR'  => $image_next_year,
    'U_PREV_YEAR'  => $url_prev_year,
    'U_NEXT_YEAR'  => $url_next_year,
    )
);

$template->pparse('body');
 
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

?>

Code: Alles auswählen


<style>
div.domTT {
  background-color: {T_TD_COLOR2}; 
  padding: 3px;
  border: 1px {T_TH_COLOR1} solid;
}
div.domTTContent {
  font-size : {T_FONTSIZE3}px; 
}
</style>
<script language="Javascript" src="js/domTT.js"></script>
<table width="100%" cellspacing="2" cellpadding="2" border="0">
  <tr> 
    <td align="left" valign="middle" width="100%"> <span class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a> 
      :: <a href="{U_CALENDAR}" class="nav">{L_CALENDAR}</a> :: <a href="{U_EVENTLIST}" class="nav">{L_EVENTLIST}</a></span> 
    </td>
  </tr>
</table>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
  <tr> 
	<td><span class="nav">{PAGE_NUMBER}</span></td>
	<td align="right"><span class="gensmall">{S_TIMEZONE}</span><br /><span class="nav">{PAGINATION}</span></td>
  </tr>
</table></form>

<table width="100%" cellspacing="2" border="0" align="center">
  <tr> 
	<td valign="top" align="right">{JUMPBOX}</td>
  </tr>
</table>


<table class="forumline" width="100%" cellspacing="1" cellpadding="3" border="0">
  <tr>
    <td class="catHead" height="28">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><a href="{U_PREV_YEAR}">{I_PREV_YEAR}</a><a href="{U_PREV_MONTH}">{I_PREV_MONTH}</a></td>
          <td style="text-align: center;"><span class="cattitle">{L_CURRENT_MONTH} {L_CURRENT_YEAR}</span></td>
          <td style="text-align: right;"><a href="{U_NEXT_MONTH}">{I_NEXT_MONTH}</a><a href="{U_NEXT_YEAR}">{I_NEXT_YEAR}</a></td>
        </tr>
      </table>
    </td>
  </tr>
</table>

<!-- BEGIN event_row -->
            
<!-- END event_row  -->