kopia lustrzana https://github.com/friendica/SG-iCalendar
add event method : isWholeDay()
rodzic
8f7f806293
commit
f9e8612eb6
|
@ -179,6 +179,18 @@ class SG_iCal_VEvent {
|
|||
return $this->end - $this->start;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if duration is multiple of 86400
|
||||
* @return bool
|
||||
*/
|
||||
public function isWholeDay() {
|
||||
$dur = $this->getDuration();
|
||||
if ($dur > 0 && ($dur % 86400) == 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the given property of the event.
|
||||
* @param string $prop
|
||||
|
|
|
@ -17,14 +17,14 @@ $evts = $query->Between($ical,strtotime('20100901'),strtotime('20101131'));
|
|||
|
||||
$data = array();
|
||||
foreach($evts as $id => $ev) {
|
||||
|
||||
$jsEvt = array(
|
||||
"id" => ($id+1),
|
||||
"title" => $ev->getProperty('summary'),
|
||||
"start" => $ev->getStart(),
|
||||
"end" => $ev->getEnd(),
|
||||
"allDay" => false
|
||||
"end" => $ev->getEnd()-1,
|
||||
"allDay" => $ev->isWholeDay()
|
||||
);
|
||||
|
||||
$data[] = $jsEvt;
|
||||
|
||||
if (isset($ev->recurrence)) {
|
||||
|
@ -36,13 +36,15 @@ foreach($evts as $id => $ev) {
|
|||
$count++;
|
||||
$start = $next;
|
||||
$jsEvt["start"] = $start;
|
||||
$jsEvt["end"] = $start + $ev->getDuration();
|
||||
$jsEvt["end"] = $start + $ev->getDuration()-1;
|
||||
|
||||
$data[] = $jsEvt;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//echo(date('Ymd\n',$data[0][start]));
|
||||
//echo(date('Ymd\n',$data[1][start]));
|
||||
//dump_t($data);
|
||||
|
||||
$events = "events:".json_encode($data).',';
|
||||
|
|
Ładowanie…
Reference in New Issue