Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / nuance / controller / NuanceQueueViewController.php
blobf5284f6bfa1c295dd091d360241212cf9ec26667
1 <?php
3 final class NuanceQueueViewController
4 extends NuanceQueueController {
6 public function handleRequest(AphrontRequest $request) {
7 $viewer = $this->getViewer();
9 $queue = id(new NuanceQueueQuery())
10 ->setViewer($viewer)
11 ->withIDs(array($request->getURIData('id')))
12 ->executeOne();
13 if (!$queue) {
14 return new Aphront404Response();
17 $title = $queue->getName();
19 $crumbs = $this->buildApplicationCrumbs();
20 $crumbs->addTextCrumb(pht('Queues'), $this->getApplicationURI('queue/'));
21 $crumbs->addTextCrumb($queue->getName());
22 $crumbs->setBorder(true);
24 $header = $this->buildHeaderView($queue);
25 $curtain = $this->buildCurtain($queue);
27 $timeline = $this->buildTransactionTimeline(
28 $queue,
29 new NuanceQueueTransactionQuery());
30 $timeline->setShouldTerminate(true);
32 $view = id(new PHUITwoColumnView())
33 ->setHeader($header)
34 ->setCurtain($curtain)
35 ->setMainColumn($timeline);
37 return $this->newPage()
38 ->setTitle($title)
39 ->setCrumbs($crumbs)
40 ->appendChild($view);
43 private function buildHeaderView(NuanceQueue $queue) {
44 $viewer = $this->getViewer();
46 $header = id(new PHUIHeaderView())
47 ->setUser($viewer)
48 ->setHeader($queue->getName())
49 ->setPolicyObject($queue);
51 return $header;
54 private function buildCurtain(NuanceQueue $queue) {
55 $viewer = $this->getViewer();
56 $id = $queue->getID();
58 $can_edit = PhabricatorPolicyFilter::hasCapability(
59 $viewer,
60 $queue,
61 PhabricatorPolicyCapability::CAN_EDIT);
63 $curtain = $this->newCurtainView($queue);
65 $curtain->addAction(
66 id(new PhabricatorActionView())
67 ->setName(pht('Edit Queue'))
68 ->setIcon('fa-pencil')
69 ->setHref($this->getApplicationURI("queue/edit/{$id}/"))
70 ->setDisabled(!$can_edit)
71 ->setWorkflow(!$can_edit));
73 $curtain->addAction(
74 id(new PhabricatorActionView())
75 ->setName(pht('Begin Work'))
76 ->setIcon('fa-play-circle-o')
77 ->setHref($this->getApplicationURI("queue/work/{$id}/"))
78 ->setDisabled(!$can_edit)
79 ->setWorkflow(!$can_edit));
81 return $curtain;