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();
|
$events = array();
|
||||||
foreach ($this->events as $id => $event) {
|
foreach ($this->events as $id => $event) {
|
||||||
// TODO: filter events by search query
|
// TODO: filter events by search query
|
||||||
|
|
||||||
if (!empty($search)) {
|
if (!empty($search)) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -347,6 +348,7 @@ class kolab_calendar
|
||||||
$priority_map = $this->priority_map;
|
$priority_map = $this->priority_map;
|
||||||
$daymap = array('MO'=>'monday','TU'=>'tuesday','WE'=>'wednesday','TH'=>'thursday','FR'=>'friday','SA'=>'saturday','SU'=>'sunday');
|
$daymap = array('MO'=>'monday','TU'=>'tuesday','WE'=>'wednesday','TH'=>'thursday','FR'=>'friday','SA'=>'saturday','SU'=>'sunday');
|
||||||
|
|
||||||
|
|
||||||
$object = array
|
$object = array
|
||||||
(
|
(
|
||||||
// kolab => roundcube
|
// kolab => roundcube
|
||||||
|
@ -387,65 +389,69 @@ class kolab_calendar
|
||||||
}
|
}
|
||||||
|
|
||||||
//recurr object/array
|
//recurr object/array
|
||||||
$ra = $event['recurrence'];
|
if (count($event['recurrence'])>1){
|
||||||
|
|
||||||
//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'){
|
|
||||||
|
|
||||||
$weekdays = split(",",$ra['BYDAY']);
|
$ra = $event['recurrence'];
|
||||||
foreach ($weekdays as $days){
|
|
||||||
$weekly[]=$daymap[$days];
|
//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']['day']=$weekly;
|
$object['recurrence']['range-type']='number';
|
||||||
|
$object['recurrence']['range']=$ra['COUNT'];
|
||||||
}
|
}
|
||||||
|
//weekly
|
||||||
//monthly (temporary hack to follow current Horde logic)
|
|
||||||
if ($ra['FREQ']=='MONTHLY'){
|
|
||||||
|
|
||||||
if($ra['BYDAY']=='NaN'){
|
if ($ra['FREQ']=='WEEKLY'){
|
||||||
|
|
||||||
|
$weekdays = split(",",$ra['BYDAY']);
|
||||||
$object['recurrence']['daynumber']=1;
|
foreach ($weekdays as $days){
|
||||||
$object['recurrence']['day']=array(date('L',$event['start']));
|
$weekly[]=$daymap[$days];
|
||||||
$object['recurrence']['cycle']='monthly';
|
}
|
||||||
$object['recurrence']['type']='weekday';
|
|
||||||
|
$object['recurrence']['day']=$weekly;
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$object['recurrence']['daynumber']=date('j',$event['start']);
|
|
||||||
$object['recurrence']['cycle']='monthly';
|
|
||||||
$object['recurrence']['type']="daynumber";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//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
|
//year
|
||||||
if ($ra['FREQ']=='YEARLY'){
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//exclusion
|
//exclusion
|
||||||
$object['recurrence']['type']=array(split(',',$ra['UNTIL']));
|
$object['recurrence']['type']=array(split(',',$ra['UNTIL']));
|
||||||
|
|
||||||
|
}
|
||||||
|
//whole dday event
|
||||||
|
if($event['allday']==1)
|
||||||
|
$object['_is_all_day']=1;
|
||||||
|
|
||||||
return $object;
|
return $object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -311,7 +311,7 @@ class calendar_ui
|
||||||
$select->add($this->calendar->gettext('daily'), 'DAILY');
|
$select->add($this->calendar->gettext('daily'), 'DAILY');
|
||||||
$select->add($this->calendar->gettext('weekly'), 'WEEKLY');
|
$select->add($this->calendar->gettext('weekly'), 'WEEKLY');
|
||||||
$select->add($this->calendar->gettext('monthly'), 'MONTHLY');
|
$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('');
|
$html = html::label('edit-frequency', $this->calendar->gettext('frequency')) . $select->show('');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue