@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class PhabricatorAuthInviteActionTableView extends AphrontView {
4
5 private $inviteActions;
6 private $handles;
7
8 public function setInviteActions(array $invite_actions) {
9 $this->inviteActions = $invite_actions;
10 return $this;
11 }
12
13 public function getInviteActions() {
14 return $this->inviteActions;
15 }
16
17 public function setHandles(array $handles) {
18 $this->handles = $handles;
19 return $this;
20 }
21
22 public function render() {
23 $actions = $this->getInviteActions();
24 $handles = $this->handles;
25
26 $rows = array();
27 $rowc = array();
28 foreach ($actions as $action) {
29 $issues = $action->getIssues();
30 foreach ($issues as $key => $issue) {
31 $issues[$key] = $action->getShortNameForIssue($issue);
32 }
33 $issues = implode(', ', $issues);
34
35 if (!$action->willSend()) {
36 $rowc[] = 'highlighted';
37 } else {
38 $rowc[] = null;
39 }
40
41 $action_icon = $action->getIconForAction($action->getAction());
42 $action_name = $action->getShortNameForAction($action->getAction());
43
44 $rows[] = array(
45 $action->getRawInput(),
46 $action->getEmailAddress(),
47 ($action->getUserPHID()
48 ? $handles[$action->getUserPHID()]->renderLink()
49 : null),
50 $issues,
51 $action_icon,
52 $action_name,
53 );
54 }
55
56 $table = id(new AphrontTableView($rows))
57 ->setRowClasses($rowc)
58 ->setHeaders(
59 array(
60 pht('Raw Address'),
61 pht('Parsed Address'),
62 pht('User'),
63 pht('Issues'),
64 null,
65 pht('Action'),
66 ))
67 ->setColumnClasses(
68 array(
69 '',
70 '',
71 '',
72 'wide',
73 'icon',
74 '',
75 ));
76
77 return $table;
78 }
79
80}