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 iCalendar\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 "\n\n"; echo $thead; @@ -273,7 +278,7 @@ elseif($pad) echo ""; - echo "\n\n
" . '' . $date->month_name() . ' ' . $date->year_num . "
 
"; + 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 "\n"; + echo "
  • " + . ec3_format_str($template_month,$data)."\n
  • \n"; + echo "
  • " + . ec3_format_str($template_day,$data)."\n
  • \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 " \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 "\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"; + $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"; + 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');