/** * @param Sabre_VObject_Component_VEvent $component * @param wdcal_local $localization */ function wdcal_set_component_recurrence(&$component, &$localization) { $component->__unset("RRULE"); $component->__unset("EXRULE"); $component->__unset("EXDATE"); $component->__unset("RDATE"); $part_until = ""; switch ($_REQUEST["rec_until_type"]) { case "date": $date = $localization->date_local2timestamp($_REQUEST["rec_until_date"]); $part_until = ";UNTIL=" . date("Ymd", $date); $datetime_until = new Sabre\VObject\Property\DateTime("UNTIL"); $datetime_until->setDateTime(new DateTime(date("Y-m-d H:i:s", $date)), Sabre\VObject\Property\DateTime::DATE); break; case "count": $part_until = ";COUNT=" . IntVal($_REQUEST["rec_until_count"]); break; } switch ($_REQUEST["rec_frequency"]) { case "daily": $part_freq = "FREQ=DAILY"; if (isset($_REQUEST["rec_daily_byday"])) { $days = array(); foreach ($_REQUEST["rec_daily_byday"] as $x) { if (in_array($x, array("MO", "TU", "WE", "TH", "FR", "SA", "SU"))) { $days[] = $x; } } if (count($days) > 0) { $part_freq .= ";BYDAY=" . implode(",", $days); } } break; case "weekly": $part_freq = "FREQ=WEEKLY"; if (isset($_REQUEST["rec_weekly_wkst"]) && in_array($_REQUEST["rec_weekly_wkst"], array("MO", "SU"))) { $part_freq .= ";WKST=" . $_REQUEST["rec_weekly_wkst"]; } if (isset($_REQUEST["rec_weekly_byday"])) { $days = array(); foreach ($_REQUEST["rec_weekly_byday"] as $x) { if (in_array($x, array("MO", "TU", "WE", "TH", "FR", "SA", "SU"))) { $days[] = $x; } } if (count($days) > 0) { $part_freq .= ";BYDAY=" . implode(",", $days); } } break; case "monthly": $part_freq = "FREQ=MONTHLY"; $part_freq .= wdcal_set_component_recurrence_special($component, $_REQUEST["rec_monthly_day"]); break; case "yearly": /** @var Sabre\VObject\Property\DateTime $start */ $start = $component->__get("DTSTART"); $part_freq = "FREQ=YEARLY"; $part_freq .= ";BYMONTH=" . $start->getDateTime()->format("n"); $part_freq .= wdcal_set_component_recurrence_special($component, $_REQUEST["rec_yearly_day"]); break; default: $part_freq = ""; } if ($part_freq == "") { return; } if (isset($_REQUEST["rec_interval"])) { $part_freq .= ";INTERVAL=" . InTVal($_REQUEST["rec_interval"]); } if (isset($_REQUEST["rec_exceptions"])) { $arr = array(); foreach ($_REQUEST["rec_exceptions"] as $except) { $arr[] = new DateTime(date("Y-m-d H:i:s", $except)); } /** @var Sabre\VObject\Property\MultiDateTime $prop */ $prop = Sabre\VObject\Property::create("EXDATE"); $prop->setDateTimes($arr); $component->add($prop); } $rrule = $part_freq . $part_until; $component->add(new Sabre\VObject\Property("RRULE", $rrule)); }
/** * @param int $ae_id * @return Aenderungsantrag */ public function getAenderungsAntragById($ae_id) { $ae = Aenderungsantrag::model()->findAll("id = " . InTVal($ae_id) . " AND antrag_id = " . IntVal($this->id)); return count($ae) > 0 ? $ae[0] : null; }