--- a/web/wp-content/plugins/event-calendar/template-functions.php Tue Jan 05 09:59:49 2010 +0000
+++ b/web/wp-content/plugins/event-calendar/template-functions.php Mon Feb 01 09:51:57 2010 +0000
@@ -69,6 +69,7 @@
/** Echos the event calendar navigation controls. */
+/* modified by samuel huron 05/01/2010 */
function ec3_get_calendar_nav($date,$num_months)
{
global $ec3;
@@ -78,9 +79,11 @@
$prev=$date->prev_month();
echo "\t<td id='prev'><a id='ec3_prev' href='" . $prev->month_link() . "'"
. '>« ' . $prev->month_abbrev() . "</a></td>\n";
-
- echo "\t<td><img id='ec3_spinner' style='display:none' src='"
- . $ec3->myfiles . "/ec_load.gif' alt='spinner' />\n";
+
+ // --------------------------------------------------------------------------
+ // start modified by sam
+
+ /*
// iCalendar link.
$webcal=get_option('home') . "/?ec3_ical";
// Macintosh always understands webcal:// protocol.
@@ -90,9 +93,11 @@
echo "\t <a id='ec3_publish' href='$webcal'"
. " title='" . __('Subscribe to iCalendar.','ec3') ."'>\n"
. "\t <img src='$ec3->myfiles/publish.gif' alt='iCalendar' />\n"
- . "\t </a>\n";
+ . "\t </a>\n";*/
echo "\t</td>\n";
-
+ // -------------------------------------------------------------------------- stop
+
+
// Next
$next=$date->plus_months($num_months);
echo "\t<td id='next'><a id='ec3_next' href='" . $next->month_link() . "'"
@@ -206,7 +211,7 @@
// Table start.
$title=
sprintf(__('View posts for %1$s %2$s'),$date->month_name(),$date->year_num);
- echo "<table id='" . $date->month_id() . "'>\n<caption>"
+ echo "<table id='" . $date->month_id() . "' >\n<caption>"
. '<a href="' . $date->month_link() . '" title="' . $title . '">'
. $date->month_name() . ' ' . $date->year_num . "</a></caption>\n";
echo $thead;
@@ -273,7 +278,7 @@
elseif($pad)
echo "<td colspan='$pad' class='pad'> </td>";
- echo "</tr>\n</tbody>\n</table>";
+ echo "</tr>\n</tbody>\n</table> <!-- LA --> ";
}
@@ -320,12 +325,16 @@
$this_month=$next_month;
}
+ // ------------------------------
+ //modified
+
+ echo "</div>\n";
+
// Display navigation panel.
if(1==$ec3->navigation)
ec3_get_calendar_nav(new ec3_Date(),$ec3->num_months);
- echo "</div>\n";
-
+
if(!$ec3->disable_popups)
echo "\t<script type='text/javascript' src='"
. $ec3->myfiles . "/popup.js'></script>\n";
@@ -338,12 +347,13 @@
{
foreach($data as $k=>$v)
$format=str_replace("%$k%",$v,$format);
+ echo ("<!-- ".$k."".$v." -->");
return $format;
}
define('EC3_DEFAULT_TEMPLATE_EVENT','<a href="%LINK%">%TITLE% (%TIME%)</a>');
-define('EC3_DEFAULT_TEMPLATE_DAY', '%DATE%:');
+define('EC3_DEFAULT_TEMPLATE_DAY', '%DATE% :');
define('EC3_DEFAULT_DATE_FORMAT', 'j F');
define('EC3_DEFAULT_TEMPLATE_MONTH','');
define('EC3_DEFAULT_MONTH_FORMAT', 'F Y');
@@ -353,7 +363,9 @@
* - template_day: %DATE% %SINCE% (only with Time Since plugin)
* - template_event: %DATE% %TIME% %LINK% %TITLE% %AUTHOR%
*/
-function ec3_get_events(
+
+// version racine
+ function ec3_get_events(
$limit,
$template_event=EC3_DEFAULT_TEMPLATE_EVENT,
$template_day =EC3_DEFAULT_TEMPLATE_DAY,
@@ -405,8 +417,128 @@
ORDER BY start $limit_numposts"
);
+ echo "<ul class='ec3_events'>";
echo "<!-- Generated by Event Calendar v$ec3->version -->\n";
- echo "<ul id='accordion'>";
+ if($calendar_entries)
+ {
+ $time_format=get_option('time_format');
+ $current_month=false;
+ $current_date=false;
+ $data=array();
+ foreach($calendar_entries as $entry)
+ {
+ // To use %SINCE%, you need Dunstan's 'Time Since' plugin.
+ if(function_exists('time_since'))
+ $data['SINCE']=time_since( time(), ec3_to_time($entry->start) );
+
+ // Month changed?
+ $data['MONTH']=mysql2date($month_format,$entry->start);
+ if((!$current_month || $current_month!=$data['MONTH']) && $template_month)
+ {
+ if($current_date)
+ echo "</ul></li>\n";
+ if($current_month)
+ echo "</ul></li>\n";
+ echo "<li class='ec3_list ec3_list_month'>"
+ . ec3_format_str($template_month,$data)."\n<ul>\n";
+ $current_month=$data['MONTH'];
+ $current_date=false;
+ }
+
+ // Date changed?
+ $data['DATE'] =mysql2date($date_format, $entry->start);
+ if((!$current_date || $current_date!=$data['DATE']) && $template_day)
+ {
+ if($current_date)
+ echo "</ul></li>\n";
+ echo "<li class='ec3_list ec3_list_day'>"
+ . ec3_format_str($template_day,$data)."\n<ul>\n";
+ $current_date=$data['DATE'];
+ }
+
+ if($entry->allday)
+ $data['TIME']=__('all day','ec3');
+ else
+ $data['TIME']=mysql2date($time_format,$entry->start);
+
+ $data['TITLE'] =
+ htmlentities(
+ stripslashes(strip_tags($entry->post_title)),
+ ENT_QUOTES,get_option('blog_charset')
+ );
+ $data['LINK'] =get_permalink($entry->id);
+ $data['AUTHOR']=
+ htmlentities($entry->author,ENT_QUOTES,get_option('blog_charset'));
+ echo " <li>".ec3_format_str($template_event,$data)."</li>\n";
+ }
+ if($current_date)
+ echo "</ul></li>\n";
+ if($current_month)
+ echo "</ul></li>\n";
+ }
+ else
+ {
+ echo "<li>".__('No events.','ec3')."</li>\n";
+ }
+ echo "</ul>\n";
+}
+
+
+// version accordeon by samuel huron
+function ec3_get_events_acc(
+ $limit,
+ $template_event=EC3_DEFAULT_TEMPLATE_EVENT,
+ $template_day =EC3_DEFAULT_TEMPLATE_DAY,
+ $date_format =EC3_DEFAULT_DATE_FORMAT,
+ $template_month=EC3_DEFAULT_TEMPLATE_MONTH,
+ $month_format =EC3_DEFAULT_MONTH_FORMAT)
+{
+ if(!ec3_check_installed(__('Upcoming Events','ec3')))
+ return;
+ global $ec3,$wpdb,$wp_version;
+
+ // Parse $limit:
+ // NUMBER - limits number of posts
+ // NUMBER days - next NUMBER of days
+ if(empty($limit))
+ {
+ $limit_numposts='LIMIT 5';
+ }
+ elseif(preg_match('/^ *([0-9]+) *d(ays?)?/',$limit,$matches))
+ {
+ $secs=intval($matches[1])*24*3600;
+ $and_before="AND start<='".ec3_strftime('%Y-%m-%d',time()+$secs)."'";
+ }
+ elseif(intval($limit)<1)
+ {
+ $limit_numposts='LIMIT 5';
+ }
+ else
+ {
+ $limit_numposts='LIMIT '.intval($limit);
+ }
+
+ if(!$date_format)
+ $date_format=get_option('date_format');
+
+ // Find the upcoming events.
+ $calendar_entries = $wpdb->get_results(
+ "SELECT DISTINCT
+ p.id AS id,
+ post_title,
+ start,
+ u.$ec3->wp_user_nicename AS author,
+ allday
+ FROM $ec3->schedule s
+ LEFT JOIN $wpdb->posts p ON s.post_id=p.id
+ LEFT JOIN $wpdb->users u ON p.post_author = u.id
+ WHERE p.post_status='publish'
+ AND end>='$ec3->today' $and_before
+ ORDER BY start $limit_numposts"
+ );
+
+ echo "<!-- Generated by Event Calendar v$ec3->version Modified by samuel huron for acc integration -->\n";
+ echo "<ul id='accordion_nav'>";
// echo "<li id='test'>test</li>";
if($calendar_entries)
{
@@ -472,9 +604,143 @@
{
echo "<li>".__('No events.','ec3')."</li>\n";
}
+ echo " \n </ul> \n <div class='ui-helper-clearfix'> </div>";
+}
+
+// version pour la home by samuel huron
+function ec3_get_events_home(
+ $limit,
+ $template_event=EC3_DEFAULT_TEMPLATE_EVENT,
+ $template_day =EC3_DEFAULT_TEMPLATE_DAY,
+ $date_format =EC3_DEFAULT_DATE_FORMAT,
+ $template_month=EC3_DEFAULT_TEMPLATE_MONTH,
+ $month_format =EC3_DEFAULT_MONTH_FORMAT)
+{
+ if(!ec3_check_installed(__('Upcoming Events','ec3')))
+ return;
+ global $ec3,$wpdb,$wp_version;
+
+ // Parse $limit:
+ // NUMBER - limits number of posts
+ // NUMBER days - next NUMBER of days
+ if(empty($limit))
+ {
+ $limit_numposts='LIMIT 5';
+ }
+ elseif(preg_match('/^ *([0-9]+) *d(ays?)?/',$limit,$matches))
+ {
+ $secs=intval($matches[1])*24*3600;
+ $and_before="AND start<='".ec3_strftime('%Y-%m-%d',time()+$secs)."'";
+ }
+ elseif(intval($limit)<1)
+ {
+ $limit_numposts='LIMIT 5';
+ }
+ else
+ {
+ $limit_numposts='LIMIT '.intval($limit);
+ }
+
+ if(!$date_format)
+ $date_format = get_option('date_format');
+
+ // echo("<!-- ".get_option('date_format')." -->");
+
+ // Find the upcoming events.
+ $calendar_entries = $wpdb->get_results(
+ "SELECT DISTINCT
+ p.id AS id,
+ post_title,
+ post_content,
+ start,
+ u.$ec3->wp_user_nicename AS author,
+ allday
+ FROM $ec3->schedule s
+ LEFT JOIN $wpdb->posts p ON s.post_id=p.id
+ LEFT JOIN $wpdb->users u ON p.post_author = u.id
+ WHERE p.post_status='publish'
+ AND end>='$ec3->today' $and_before
+ ORDER BY start $limit_numposts"
+ );
+
+ echo "<!-- Generated by Event Calendar v$ec3->version Modified by samuel huron for home integration -->\n";
+ echo "<ul>";
+ // echo "<li id='test'>test</li>";
+ if($calendar_entries)
+ {
+ $time_format=get_option('time_format');
+ $current_month=false;
+ $current_date=false;
+ $data=array();
+ foreach($calendar_entries as $entry)
+ {
+ // To use %SINCE%, you need Dunstan's 'Time Since' plugin.
+ if(function_exists('time_since'))
+ $data['SINCE']=time_since( time(), ec3_to_time($entry->start) );
+
+ // Month changed?
+ $data['MONTH']=mysql2date($month_format,$entry->start);
+ if((!$current_month || $current_month!=$data['MONTH']) && $template_month)
+ {
+ if($current_date)
+ echo "</ul></li>\n";
+ if($current_month)
+ $id_accordion=str_replace(" ", "_",ec3_format_str($template_month,$data));
+ $id_accordion=str_replace(":", "",$id_accordion);
+ echo " </ul></li>\n";
+ echo "<li id='ec3_list ec3_list_month'> ".ec3_format_str($template_month,$data)." \n<ul id=".$id_accordion.">\n";
+ echo "<!-- ".$data." -->";
+ $current_month=$data['MONTH'];
+ $current_date=false;
+ }
+
+
+ // Date changed?
+ $data['DATE'] =mysql2date($date_format, $entry->start);
+ if((!$current_date || $current_date!=$data['DATE']) && $template_day)
+ {
+ if($current_date)
+ echo "</ul></li>\n";
+ $id_accordion=str_replace(" ", "_",ec3_format_str($template_day,$data));
+ $id_accordion=str_replace(":", "",$id_accordion);
+ echo "<li > ".ec3_format_str($template_day,$data).$data['YEAR']." \n <ul id=".$id_accordion.">\n";
+ $current_date=$data['DATE'];
+ }
+
+ if($entry->allday)
+ $data['TIME']=__('all day','ec3');
+ else
+ $data['TIME']=mysql2date($time_format,$entry->start);
+
+ $data['TITLE'] =
+ htmlentities(
+ stripslashes(strip_tags($entry->post_title)),
+ ENT_QUOTES,get_option('blog_charset')
+ );
+ $data['RESUME'] =
+ htmlentities(
+ stripslashes(strip_tags(substr($entry->post_content,0,400)."[...]")),
+ ENT_QUOTES,get_option('blog_charset')
+ );
+ $data['LINK'] =get_permalink($entry->id);
+ $data['AUTHOR']=
+ htmlentities($entry->author,ENT_QUOTES,get_option('blog_charset'));
+ //echo " <li>".ec3_format_str($template_event,$data)."</li>\n";
+ echo " <a href='".$data['LINK']."' nicetitle='".$data['RESUME']."' >".$data['TITLE']."</a>\n";
+ }
+ if($current_date)
+ echo "</ul></li>\n";
+ if($current_month)
+ echo "</ul></li>\n";
+ }
+ else
+ {
+ echo "<li>".__('No events.','ec3')."</li>\n";
+ }
echo " \n </ul> \n";
}
+
define('EC3_DEFAULT_FORMAT_SINGLE','<tr><td colspan="3">%s</td></tr>');
define('EC3_DEFAULT_FORMAT_RANGE','<tr><td class="ec3_start">%1$s</td>'
. '<td class="ec3_to">%3$s</td><td class="ec3_end">%2$s</td></tr>');