コード例 #1
0
ファイル: edit_event.php プロジェクト: highchair/hcd-trunk
function edit_eventUpdateRecurrences()
{
    $event_id = getRequestVarAtIndex(4);
    $sunday = getPostValueAsArray("recurrence_Sunday");
    $monday = getPostValueAsArray("recurrence_Monday");
    $tuesday = getPostValueAsArray("recurrence_Tuesday");
    $wednesday = getPostValueAsArray("recurrence_Wednesday");
    $thursday = getPostValueAsArray("recurrence_Thursday");
    $friday = getPostValueAsArray("recurrence_Friday");
    $saturday = getPostValueAsArray("recurrence_Saturday");
    Recurrence::ClearForEvent($event_id);
    foreach ($sunday as $modifier) {
        $recurrence = Recurrence::Create('Recurrence', array('event_id' => "{$event_id}", 'day' => "Sunday", 'modifier' => "{$modifier}"));
        $recurrence->save();
    }
    foreach ($monday as $modifier) {
        $recurrence = Recurrence::Create('Recurrence', array('event_id' => "{$event_id}", 'day' => "Monday", 'modifier' => "{$modifier}"));
        $recurrence->save();
    }
    foreach ($tuesday as $modifier) {
        $recurrence = Recurrence::Create('Recurrence', array('event_id' => "{$event_id}", 'day' => "Tuesday", 'modifier' => "{$modifier}"));
        $recurrence->save();
    }
    foreach ($wednesday as $modifier) {
        $recurrence = Recurrence::Create('Recurrence', array('event_id' => "{$event_id}", 'day' => "Wednesday", 'modifier' => "{$modifier}"));
        $recurrence->save();
    }
    foreach ($thursday as $modifier) {
        $recurrence = Recurrence::Create('Recurrence', array('event_id' => "{$event_id}", 'day' => "Thursday", 'modifier' => "{$modifier}"));
        $recurrence->save();
    }
    foreach ($friday as $modifier) {
        $recurrence = Recurrence::Create('Recurrence', array('event_id' => "{$event_id}", 'day' => "Friday", 'modifier' => "{$modifier}"));
        $recurrence->save();
    }
    foreach ($saturday as $modifier) {
        $recurrence = Recurrence::Create('Recurrence', array('event_id' => "{$event_id}", 'day' => "Saturday", 'modifier' => "{$modifier}"));
        $recurrence->save();
    }
}