Path: blob/master/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php
12256 views
<?php12final class PhabricatorCalendarEventEditController3extends PhabricatorCalendarController {45public function handleRequest(AphrontRequest $request) {6$viewer = $this->getViewer();78$engine = id(new PhabricatorCalendarEventEditEngine())9->setController($this);1011$id = $request->getURIData('id');12if ($id) {13$event = id(new PhabricatorCalendarEventQuery())14->setViewer($viewer)15->withIDs(array($id))16->executeOne();17$response = $this->newImportedEventResponse($event);18if ($response) {19return $response;20}2122$cancel_uri = $event->getURI();2324$page = $request->getURIData('pageKey');25if ($page == 'recurring') {26if ($event->isChildEvent()) {27return $this->newDialog()28->setTitle(pht('Series Event'))29->appendParagraph(30pht(31'This event is an instance in an event series. To change '.32'the behavior for the series, edit the parent event.'))33->addCancelButton($cancel_uri);34}35} else if ($event->getIsRecurring()) {3637// If the user submits a comment or makes an edit via comment actions,38// always target only the current event. It doesn't make sense to add39// comments to every instance of an event, and the other actions don't40// make much sense to apply to all instances either.41if ($engine->isCommentAction()) {42$mode = PhabricatorCalendarEventEditEngine::MODE_THIS;43} else {44$mode = $request->getStr('mode');45}4647if (!$mode) {48$start_time = phutil_tag(49'strong',50array(),51phabricator_datetime($event->getStartDateTimeEpoch(), $viewer));5253$form = id(new AphrontFormView())54->setViewer($viewer)55->appendControl(56id(new AphrontFormRadioButtonControl())57->setName('mode')58->setValue(PhabricatorCalendarEventEditEngine::MODE_THIS)59->addButton(60PhabricatorCalendarEventEditEngine::MODE_THIS,61pht('Edit Only This Event'),62pht(63'Edit only the event which occurs at %s.',64$start_time))65->addButton(66PhabricatorCalendarEventEditEngine::MODE_FUTURE,67pht('Edit This And All Later Events'),68pht(69'Edit this event and all events in the series which '.70'occur on or after %s. This will overwrite previous '.71'edits!',72$start_time)));73return $this->newDialog()74->setTitle(pht('Edit Event'))75->setWidth(AphrontDialogView::WIDTH_FORM)76->appendParagraph(77pht(78'This event is part of a series. Which events do you '.79'want to edit?'))80->appendForm($form)81->addSubmitButton(pht('Continue'))82->addCancelButton($cancel_uri)83->setDisableWorkflowOnSubmit(true);84}8586$engine87->addContextParameter('mode', $mode)88->setSeriesEditMode($mode);89}90}9192return $engine->buildResponse();93}9495}969798