Final version of reccurence and some minor changes.
This commit is contained in:
parent
dd5e0e7d98
commit
f72d82f709
2 changed files with 51 additions and 45 deletions
|
@ -120,6 +120,7 @@ class kolab_calendar
|
|||
$events = array();
|
||||
foreach ($this->events as $id => $event) {
|
||||
// TODO: filter events by search query
|
||||
|
||||
if (!empty($search)) {
|
||||
|
||||
}
|
||||
|
@ -347,6 +348,7 @@ class kolab_calendar
|
|||
$priority_map = $this->priority_map;
|
||||
$daymap = array('MO'=>'monday','TU'=>'tuesday','WE'=>'wednesday','TH'=>'thursday','FR'=>'friday','SA'=>'saturday','SU'=>'sunday');
|
||||
|
||||
|
||||
$object = array
|
||||
(
|
||||
// kolab => roundcube
|
||||
|
@ -387,65 +389,69 @@ class kolab_calendar
|
|||
}
|
||||
|
||||
//recurr object/array
|
||||
$ra = $event['recurrence'];
|
||||
|
||||
//Frequency abd interval
|
||||
$object['recurrence']['cycle'] = strtolower($ra['FREQ']);
|
||||
$object['recurrence']['interval'] = intval($ra['INTERVAL']);
|
||||
|
||||
//Range Type
|
||||
if($ra['UNTIL']){
|
||||
$object['recurrence']['range-type']='date';
|
||||
$object['recurrence']['range']=$ra['UNTIL'];
|
||||
}
|
||||
if($ra['COUNT']){
|
||||
$object['recurrence']['range-type']='number';
|
||||
$object['recurrence']['range']=$ra['COUNT'];
|
||||
}
|
||||
//weekly
|
||||
|
||||
if ($ra['FREQ']=='WEEKLY'){
|
||||
if (count($event['recurrence'])>1){
|
||||
|
||||
$weekdays = split(",",$ra['BYDAY']);
|
||||
foreach ($weekdays as $days){
|
||||
$weekly[]=$daymap[$days];
|
||||
$ra = $event['recurrence'];
|
||||
|
||||
//Frequency abd interval
|
||||
$object['recurrence']['cycle'] = strtolower($ra['FREQ']);
|
||||
$object['recurrence']['interval'] = intval($ra['INTERVAL']);
|
||||
|
||||
//Range Type
|
||||
if($ra['UNTIL']){
|
||||
$object['recurrence']['range-type']='date';
|
||||
$object['recurrence']['range']=$ra['UNTIL'];
|
||||
}
|
||||
|
||||
$object['recurrence']['day']=$weekly;
|
||||
if($ra['COUNT']){
|
||||
$object['recurrence']['range-type']='number';
|
||||
$object['recurrence']['range']=$ra['COUNT'];
|
||||
}
|
||||
|
||||
//monthly (temporary hack to follow current Horde logic)
|
||||
if ($ra['FREQ']=='MONTHLY'){
|
||||
//weekly
|
||||
|
||||
if($ra['BYDAY']=='NaN'){
|
||||
|
||||
|
||||
$object['recurrence']['daynumber']=1;
|
||||
$object['recurrence']['day']=array(date('L',$event['start']));
|
||||
$object['recurrence']['cycle']='monthly';
|
||||
$object['recurrence']['type']='weekday';
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
$object['recurrence']['daynumber']=date('j',$event['start']);
|
||||
$object['recurrence']['cycle']='monthly';
|
||||
$object['recurrence']['type']="daynumber";
|
||||
if ($ra['FREQ']=='WEEKLY'){
|
||||
|
||||
$weekdays = split(",",$ra['BYDAY']);
|
||||
foreach ($weekdays as $days){
|
||||
$weekly[]=$daymap[$days];
|
||||
}
|
||||
|
||||
$object['recurrence']['day']=$weekly;
|
||||
}
|
||||
|
||||
//monthly (temporary hack to follow current Horde logic)
|
||||
if ($ra['FREQ']=='MONTHLY'){
|
||||
|
||||
if($ra['BYDAY']=='NaN'){
|
||||
|
||||
|
||||
$object['recurrence']['daynumber']=1;
|
||||
$object['recurrence']['day']=array(date('L',$event['start']));
|
||||
$object['recurrence']['cycle']='monthly';
|
||||
$object['recurrence']['type']='weekday';
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
$object['recurrence']['daynumber']=date('j',$event['start']);
|
||||
$object['recurrence']['cycle']='monthly';
|
||||
$object['recurrence']['type']="daynumber";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//year
|
||||
if ($ra['FREQ']=='YEARLY'){
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//exclusion
|
||||
$object['recurrence']['type']=array(split(',',$ra['UNTIL']));
|
||||
|
||||
}
|
||||
//whole dday event
|
||||
if($event['allday']==1)
|
||||
$object['_is_all_day']=1;
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
|
|
|
@ -311,7 +311,7 @@ class calendar_ui
|
|||
$select->add($this->calendar->gettext('daily'), 'DAILY');
|
||||
$select->add($this->calendar->gettext('weekly'), 'WEEKLY');
|
||||
$select->add($this->calendar->gettext('monthly'), 'MONTHLY');
|
||||
$select->add($this->calendar->gettext('yearly'), 'YEARLY');
|
||||
// $select->add($this->calendar->gettext('yearly'), 'YEARLY');
|
||||
$html = html::label('edit-frequency', $this->calendar->gettext('frequency')) . $select->show('');
|
||||
break;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue