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;
|
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.
|
* Returns the given property of the event.
|
||||||
* @param string $prop
|
* @param string $prop
|
||||||
|
|
|
@ -17,14 +17,14 @@ $evts = $query->Between($ical,strtotime('20100901'),strtotime('20101131'));
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
foreach($evts as $id => $ev) {
|
foreach($evts as $id => $ev) {
|
||||||
|
|
||||||
$jsEvt = array(
|
$jsEvt = array(
|
||||||
"id" => ($id+1),
|
"id" => ($id+1),
|
||||||
"title" => $ev->getProperty('summary'),
|
"title" => $ev->getProperty('summary'),
|
||||||
"start" => $ev->getStart(),
|
"start" => $ev->getStart(),
|
||||||
"end" => $ev->getEnd(),
|
"end" => $ev->getEnd()-1,
|
||||||
"allDay" => false
|
"allDay" => $ev->isWholeDay()
|
||||||
);
|
);
|
||||||
|
|
||||||
$data[] = $jsEvt;
|
$data[] = $jsEvt;
|
||||||
|
|
||||||
if (isset($ev->recurrence)) {
|
if (isset($ev->recurrence)) {
|
||||||
|
@ -36,13 +36,15 @@ foreach($evts as $id => $ev) {
|
||||||
$count++;
|
$count++;
|
||||||
$start = $next;
|
$start = $next;
|
||||||
$jsEvt["start"] = $start;
|
$jsEvt["start"] = $start;
|
||||||
$jsEvt["end"] = $start + $ev->getDuration();
|
$jsEvt["end"] = $start + $ev->getDuration()-1;
|
||||||
|
|
||||||
$data[] = $jsEvt;
|
$data[] = $jsEvt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//echo(date('Ymd\n',$data[0][start]));
|
||||||
|
//echo(date('Ymd\n',$data[1][start]));
|
||||||
//dump_t($data);
|
//dump_t($data);
|
||||||
|
|
||||||
$events = "events:".json_encode($data).',';
|
$events = "events:".json_encode($data).',';
|
||||||
|
|
Ładowanie…
Reference in New Issue