(eventcalendar 3.1.1._rc3)
this is something I did to be able to add a location to each event.
I think that function should be improved and implemented to ec3 !
1) If it's an old install, you have to modify your database :
ALTER TABLE wp_ec3_schedule ADD location LONGTEXT NULL AFTER allday ;
2) files to modify : eventcalendar3.php, template-functions.php, admin.php.
This patch has been "hand-made",
+ = lines to add
- = lines to delete
****eventcalendar3.php LINE 58 ****
- "SELECT post_id,start,end,allday,rpt,IF(end>='$ec3->today',1,0) AS active
+ "SELECT post_id,start,end,allday,location,rpt,IF(end>='$ec3->today',1,0) AS active
****eventcalendar3.php LINE 362****
"SELECT
post_id,
post_title,
post_excerpt,
DATE_FORMAT(start,IF(allday,'%Y%m%d','%Y-%m-%d %H:%i')) AS dt_start,
IF( allday,
DATE_FORMAT(DATE_ADD(end, INTERVAL 1 DAY),'%Y%m%d'),
DATE_FORMAT(end,'%Y-%m-%d %H:%i')
) AS dt_end,
$ec3->wp_user_nicename AS user_nicename,
IF(allday,'TRANSPARENT','OPAQUE') AS transp,
-allday
+allday,
location
****template-functions.php LINE 482****
foreach($post->ec3_schedule as $s)
{
$date_start=mysql2date($date_format,$s->start);
$date_end =mysql2date($date_format,$s->end);
$time_start=mysql2date($time_format,$s->start);
$time_end =mysql2date($time_format,$s->end);
+ $location = $s->location;
****template-functions.php LINE 517****
if($time_start==$time_end)
$result.=sprintf($format_single,$time_start);
else
$result.=sprintf($format_range,$time_start,$time_end,__('to','ec3'));
}
}
+ if ($location) {
+ $result.=' ('.$location.')';
+ }
}
****admin.php LINE 59****
function filter_edit_form()
{
global $ec3,$wp_version,$wpdb,$post_ID;
if(isset($post_ID))
$schedule = $wpdb->get_results(
"SELECT
sched_id,
DATE_FORMAT(start,'%Y-%m-%d %H:%i') AS start,
DATE_FORMAT(end,'%Y-%m-%d %H:%i') AS end,
allday,
+ location,
rpt
****admin.php LINE 86****
<table width="100%" cellspacing="2" cellpadding="5" class="editform">
<thead><tr>
<th><?php _e('Start','ec3'); ?></th>
<th><?php _e('End','ec3'); ?></th>
<th><?php _e('All Day','ec3'); ?></th>
+ <th><?php _e('Location','ec3'); ?></th>
<!-- th><?php _e('Repeat','ec3'); ?></th -->
****admin.php LINE 96****
<?php
$ec3_rows=0;
if($schedule)
{
foreach($schedule as $s)
$this->schedule_row(
- $s->start,$s->end,$s->sched_id,'update',$s->allday,$s->location
+ $s->start,$s->end,$s->sched_id,'update',$s->allday
);
$ec3_rows=count($schedule);
}
$default=ec3_strftime('%Y-%m-%d %H:00',3600+time());
- $this->schedule_row($default,$default,'_','create',False);
+ $this->schedule_row($default,$default,'_','create',False,'');
?>
****admin.php LINE 131****
- function schedule_row($start,$end,$sid,$action,$allday)
+ function schedule_row($start,$end,$sid,$action,$allday,$location='')
{
+ global $wpdb;
$s="ec3_start_$sid";
$e="ec3_end_$sid";
****admin.php LINE 151****
<button type="reset" id="trigger_<?php echo $e; ?>">…</button>
</td>
+ <td>
+ <input type="checkbox" name="ec3_allday_<?php echo $sid;
+ ?>" value="1"<?php if($allday){ echo ' checked="checked"'; } ?> />
+ </td>
+ <td>
+ <input type="text" name="ec3_location_<?php echo $sid;?>"/>
+ </td>
****admin.php LINE 214****
// Find all of our parameters
$sched_entries=array();
- $fields =array('start','end','allday','rpt');
+ $fields =array('start','end','allday','location','rpt');
****admin.php LINE 313****
if(!$table_exists)
{
$wpdb->query(
"CREATE TABLE $ec3->schedule (
sched_id BIGINT(20) AUTO_INCREMENT,
post_id BIGINT(20),
start DATETIME,
end DATETIME,
allday BOOL,
+ location LONGTEXT,
rpt VARCHAR(64),
PRIMARY KEY(sched_id),
KEY post_id (post_id)
)");
} // end if(!$table_exists)