diff -r fb7cd02b9848 -r 561aa6d282f6 web/wp-content/plugins/event-calendar/template-functions.php
--- 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
« ' . $prev->month_abbrev() . " | \n";
-
- echo "\t \n";
+
+ // --------------------------------------------------------------------------
+ // start modified by sam
+
+ /*
// iCalendar link.
$webcal=get_option('home') . "/?ec3_ical";
// Macintosh always understands webcal:// protocol.
@@ -90,9 +93,11 @@
echo "\t \n"
. "\t \n"
- . "\t \n";
+ . "\t \n";*/
echo "\t | \n";
-
+ // -------------------------------------------------------------------------- stop
+
+
// Next
$next=$date->plus_months($num_months);
echo "\tmonth_name(),$date->year_num);
- echo "\n"
+ echo "";
+ echo "\n\n ";
}
@@ -320,12 +325,16 @@
$this_month=$next_month;
}
+ // ------------------------------
+ //modified
+
+ echo "\n";
+
// Display navigation panel.
if(1==$ec3->navigation)
ec3_get_calendar_nav(new ec3_Date(),$ec3->num_months);
- echo "\n";
-
+
if(!$ec3->disable_popups)
echo "\t\n";
@@ -338,12 +347,13 @@
{
foreach($data as $k=>$v)
$format=str_replace("%$k%",$v,$format);
+ echo ("");
return $format;
}
define('EC3_DEFAULT_TEMPLATE_EVENT','%TITLE% (%TIME%)');
-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 "";
echo "\n";
- echo "";
+ 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 " \n";
+ if($current_month)
+ echo " \n";
+ echo ""
+ . ec3_format_str($template_month,$data)."\n\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 " \n";
+ echo ""
+ . ec3_format_str($template_day,$data)."\n\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 " - ".ec3_format_str($template_event,$data)."
\n";
+ }
+ if($current_date)
+ echo " \n";
+ if($current_month)
+ echo "\n";
+ }
+ else
+ {
+ echo "".__('No events.','ec3')."\n";
+ }
+ echo "\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 "\n";
+ echo "";
// echo "- test
";
if($calendar_entries)
{
@@ -472,9 +604,143 @@
{
echo "- ".__('No events.','ec3')."
\n";
}
+ echo " \n \n ";
+}
+
+// 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("");
+
+ // 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 "\n";
+ echo "";
+ // echo "- test
";
+ 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 " \n";
+ if($current_month)
+ $id_accordion=str_replace(" ", "_",ec3_format_str($template_month,$data));
+ $id_accordion=str_replace(":", "",$id_accordion);
+ echo " \n";
+ echo " ".ec3_format_str($template_month,$data)." \n\n";
+ echo "";
+ $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 " \n";
+ $id_accordion=str_replace(" ", "_",ec3_format_str($template_day,$data));
+ $id_accordion=str_replace(":", "",$id_accordion);
+ echo " ".ec3_format_str($template_day,$data).$data['YEAR']." \n \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 " - ".ec3_format_str($template_event,$data)."
\n";
+ echo " ".$data['TITLE']."\n";
+ }
+ if($current_date)
+ echo " \n";
+ if($current_month)
+ echo "\n";
+ }
+ else
+ {
+ echo "".__('No events.','ec3')."\n";
+ }
echo " \n \n";
}
+
define('EC3_DEFAULT_FORMAT_SINGLE',' | %s |
');
define('EC3_DEFAULT_FORMAT_RANGE','%1$s | '
. '%3$s | %2$s |
');