[Hastymail-cvs] SF.net SVN: hastymail:[663] trunk/hastymail2/plugins/calendar/page.php
Brought to you by:
sailfrog,
slushpupie
From: <sai...@us...> - 2008-12-19 05:40:05
|
Revision: 663 http://hastymail.svn.sourceforge.net/hastymail/?rev=663&view=rev Author: sailfrog Date: 2008-12-19 05:40:03 +0000 (Fri, 19 Dec 2008) Log Message: ----------- some cleanup and preperation for calendar events Modified Paths: -------------- trunk/hastymail2/plugins/calendar/page.php Modified: trunk/hastymail2/plugins/calendar/page.php =================================================================== --- trunk/hastymail2/plugins/calendar/page.php 2008-12-19 05:03:04 UTC (rev 662) +++ trunk/hastymail2/plugins/calendar/page.php 2008-12-19 05:40:03 UTC (rev 663) @@ -184,6 +184,7 @@ $final_week = 5; } } + $events = get_calendar_events($month, $year, $day, $dsp_page, $week, $tools); /* Build some more values for the display and stick everything into the $page_data array */ @@ -192,6 +193,7 @@ $next_month = strtolower(date('F', mktime(0, 0, 0, ($month + 1), 1, $year))); $next_month_url = '?page=calendar&year='.(date('Y', mktime(0, 0, 0, ($month + 1), 1, $year))).'&month='. $next_month; $page_data['cal_data'] = array( + 'events' => $events, 'month' => $month, 'year' => $year, 'day' => $day, @@ -210,28 +212,11 @@ return $page_data; } -/* PRINT FUNCTION - Second of 2 required functions for plugins that have their own pages. - The name of this function is always print_<plugin name> - and it's called when the URL "page" variable is set to "calendar" such as: +function print_calendar($page_data, $tools) { + /* $page_data['dsp_page'] should be set to one of 4 values: calendar_month, + calendar_year, calendar_week, or calendar_day. Each has a corresponding + function to build the XHTML for that view that is called from here */ - http://hastymail.org?page=calendar - - The single input argument is whatever was returned from the url_action_<plugin name> - function. Output from this function should be bulit into a string then retrned when - complete. If present a css file will automatically be included for you to use to style - the output. The css file should be located in a sub-directory called "css" and be named - with the plugin name like so: - - plugins/<plugin name>/css/<plugin name>.css - - for this plugin the file is located at: - plugins/calendar/css/calendar.css -*/ -function print_calendar($page_data) { - /* $page_data['dsp_page'] should be set to one of 4 values: calendar_month, calendar_year, calendar_week, or calendar_day. - Each has a corresponding function to build the XHTML for that view that is called from here */ - if (isset($page_data['dsp_page'])) { if (function_exists('calendar_print_'.$page_data['dsp_page'])) { $function_name = 'calendar_print_'.$page_data['dsp_page']; @@ -240,21 +225,17 @@ } } -/* OPTIONAL HELPER FUNCTIONS - The remaining functions are not required for plugins with their own pages, - all are helpers called from the print_<plugin name> function above -*/ - - /* print out a yearly view of the calendar. Called by print_calendar */ function calendar_print_calendar_year($page_data) { $year = $page_data['cal_data']['year']; $data = '<div>'; $data .= '<h2 id="mailbox_title2">Calendar</h2>'; - $data .= '<div class="cal_links"><a href="?page=calendar&year='.($year - 1).'" title="'.($year - 1).'"><<</a> '; + $data .= '<div class="cal_links"><a href="?page=calendar&year='.($year - 1). + '" title="'.($year - 1).'"><<</a> '; $data .= '  '.$year.'   '; - $data .= '<a href="?page=calendar&year='.($year + 1).'" title="'.($year + 1).'">>></a></div>'; + $data .= '<a href="?page=calendar&year='.($year + 1).'" title="'.($year + 1). + '">>></a></div>'; $data .= '<table class="cal_year" cellpadding="0" cellspacing="0"><tr>'; for ($i=1;$i<13;$i++) { $last_day = date('d', mktime(0, 0, 0, ($i + 1), 0, $year)); @@ -294,7 +275,8 @@ $data .= '<br /><table class="mini_month" cellpadding="0" cellspacing="0">'; $days = false; $day_num = 1; - $data .= '<tr><th colspan="8"><a href="?page=calendar&year='.$cal_data['year'].'&month='.strtolower($cal_data['month_label']).'">'. + $data .= '<tr><th colspan="8"><a href="?page=calendar&year='.$cal_data['year']. + '&month='.strtolower($cal_data['month_label']).'">'. $cal_data['month_label'].'</a><br /></th></tr>'; for ($row = 1; $row < 7; $row++) { $data .= '<tr><td valign="top"><a href="?page=calendar&year='.$cal_data['year']. @@ -309,7 +291,8 @@ if ($days) { if ($day_num <= $cal_data['last_day']) { $data .= '<td><div class="cal_mini_month_day">'; - $data .= '<a href="?page=calendar&year='.$cal_data['year'].'&month='.strtolower($cal_data['month_label']).'&day='.$day_num.'" '; + $data .= '<a href="?page=calendar&year='.$cal_data['year'].'&month='. + strtolower($cal_data['month_label']).'&day='.$day_num.'" '; if ($cal_data['month'].'-'.sprintf('%02u', $day_num).'-'.$cal_data['year'] == $cal_data['today']) { $data .= ' style="font-weight: bold; text-decoration: underline;"'; } @@ -344,7 +327,8 @@ <a href="'.$cal_data['prev_month_url'].'" title="'.ucfirst($cal_data['prev_month']).'"><<</a> '; $data .= '  '.ucfirst($cal_data['month_label']).'   '; $data .= '<a href="'.$cal_data['next_month_url'].'" title="'.ucfirst($cal_data['next_month']).'">>></a>'; - $data .= '</td><td align="right"><a href="?page=calendar&year='.$cal_data['year'].'">'.$cal_data['year'].'</a></td></tr></table></div>'; + $data .= '</td><td align="right"><a href="?page=calendar&year='.$cal_data['year'].'">'.$cal_data['year']. + '</a></td></tr></table></div>'; $data .= '<table class="cal_month" width="100%" cellpadding="0" cellspacing="0"><tr><th></th>'; for ($i=1;$i<8;$i++) { $data .= '<th><div class="cal_month_heading">'.date('l', mktime(0, 0, 0, 4, $i, 2007)).'</div></th>'; @@ -365,7 +349,8 @@ if ($days) { if ($day_num <= $cal_data['last_day']) { $data .= '<td><div class="cal_month_day">'; - $data .= '<a href="?page=calendar&year='.$cal_data['year'].'&month='.strtolower($cal_data['month_label']).'&day='.$day_num.'"'; + $data .= '<a href="?page=calendar&year='.$cal_data['year'].'&month='. + strtolower($cal_data['month_label']).'&day='.$day_num.'"'; if ($cal_data['month'].'-'.sprintf('%02u', $day_num).'-'.$cal_data['year'] == $cal_data['today']) { $data .= ' style="font-weight: bold; text-decoration: underline;"'; } @@ -403,9 +388,11 @@ $data .= '<div class="cal_links"><table cellpadding="0" width="100%" cellspacing="0"><tr><td>'; $data .= '<a href="'.$page_data['last_url'].'"><<</a>'; $data .= '   Week '.$vals['week'].' <span style="font-size: 10pt; font-weight: normal;">of </span>'; - $data .= '<a href="?page=calendar&year='.$vals['year'].'&month='.strtolower($vals['month_label']).'">'.ucfirst($vals['month_label']).'</a>   '; + $data .= '<a href="?page=calendar&year='.$vals['year'].'&month='.strtolower($vals['month_label']).'">'. + ucfirst($vals['month_label']).'</a>   '; $data .= '<a href="'.$page_data['next_url'].'">>></a>'; - $data .= '</td><td align="right"><a href="?page=calendar&year='.$vals['year'].'">'.$vals['year'].'</a></td></tr></table></div>'; + $data .= '</td><td align="right"><a href="?page=calendar&year='.$vals['year'].'">'.$vals['year']. + '</a></td></tr></table></div>'; $data .= '<table cellpadding="0" cellspacing="0" class="cal_month" width="100%"><tr>'; for ($i=1;$i<8;$i++) { $data .= '<th><div class="cal_week_heading">'.date('l', mktime(0, 0, 0, 4, $i, 2007)).'</div></th>'; @@ -421,7 +408,8 @@ if ($vals['month'].'-'.sprintf('%02u', $start_day).'-'.$vals['year'] == $vals['today']) { $data .= ' style="font-weight: bold; text-decoration: underline;"'; } - $data .= 'href="?page=calendar&year='.$vals['year'].'&month='.strtolower($vals['month_label']).'&day='.$start_day.'">'.$start_day.'</a></div></td>'; + $data .= 'href="?page=calendar&year='.$vals['year'].'&month='.strtolower($vals['month_label']). + '&day='.$start_day.'">'.$start_day.'</a></div></td>'; $start_day++; } else { @@ -442,7 +430,8 @@ $data .= '<h2 id="mailbox_title2">Calendar</h2>'; $data .= '<div class="cal_links">'; $data .= '<a href="'.$page_data['last_url'].'"><<</a>'; - $data .= '  '.$week_day.' '.'<a href="?page=calendar&year='.$vals['year'].'&month='.strtolower($vals['month_label']).'">'. + $data .= '  '.$week_day.' '.'<a href="?page=calendar&year='.$vals['year']. + '&month='.strtolower($vals['month_label']).'">'. $vals['month_label'].'</a> '.$vals['day']. ', <a href="?page=calendar&year='.$vals['year'].'">'.$vals['year'].'</a>  '; $data .= '<a href="'.$page_data['next_url'].'">>></a>'; @@ -459,5 +448,19 @@ return $data; } +function get_calendar_events($month, $year, $day, $dsp_page, $week, $tools) { + $events = array(); + if ($tools->get_db()) { + switch ($dsp_page) { + case 'calendar_year': + case 'calendar_month': + case 'calendar_day': + case 'calendar_week': + } + //$res = $tools->db_select(); + } + return $events; +} + ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |