Path: blob/master/src/applications/maniphest/controller/ManiphestTaskSubtaskController.php
12256 views
<?php12final class ManiphestTaskSubtaskController3extends ManiphestController {45public function handleRequest(AphrontRequest $request) {6$viewer = $this->getViewer();7$id = $request->getURIData('id');89$task = id(new ManiphestTaskQuery())10->setViewer($viewer)11->withIDs(array($id))12->executeOne();13if (!$task) {14return new Aphront404Response();15}1617$cancel_uri = $task->getURI();1819$edit_engine = id(new ManiphestEditEngine())20->setViewer($viewer)21->setTargetObject($task);2223$subtype_map = $task->newEditEngineSubtypeMap();2425$subtype_options = $subtype_map->getCreateFormsForSubtype(26$edit_engine,27$task);2829if (!$subtype_options) {30return $this->newDialog()31->setTitle(pht('No Forms'))32->appendParagraph(33pht(34'You do not have access to any forms which can be used to '.35'create a subtask.'))36->addCancelButton($cancel_uri, pht('Close'));37}3839$menu = id(new PHUIObjectItemListView())40->setUser($viewer)41->setBig(true)42->setFlush(true);4344foreach ($subtype_options as $form_key => $subtype_form) {45$subtype_key = $subtype_form->getSubtype();46$subtype = $subtype_map->getSubtype($subtype_key);4748$subtask_uri = id(new PhutilURI("/task/edit/form/{$form_key}/"))49->replaceQueryParam('parent', $id)50->replaceQueryParam('template', $id)51->replaceQueryParam('status', ManiphestTaskStatus::getDefaultStatus());52$subtask_uri = $this->getApplicationURI($subtask_uri);5354$item = id(new PHUIObjectItemView())55->setHeader($subtype_form->getDisplayName())56->setHref($subtask_uri)57->setClickable(true)58->setImageIcon($subtype->newIconView())59->addAttribute($subtype->getName());6061$menu->addItem($item);62}6364return $this->newDialog()65->setTitle(pht('Choose Subtype'))66->appendChild($menu)67->addCancelButton($cancel_uri);68}6970}717273