Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / settings / panel / PhabricatorContactNumbersSettingsPanel.php
blob7056fd02de9778b749e53436db01795cebc775b8
1 <?php
3 final class PhabricatorContactNumbersSettingsPanel
4 extends PhabricatorSettingsPanel {
6 public function getPanelKey() {
7 return 'contact';
10 public function getPanelName() {
11 return pht('Contact Numbers');
14 public function getPanelMenuIcon() {
15 return 'fa-hashtag';
18 public function getPanelGroupKey() {
19 return PhabricatorSettingsAuthenticationPanelGroup::PANELGROUPKEY;
22 public function isMultiFactorEnrollmentPanel() {
23 return true;
26 public function processRequest(AphrontRequest $request) {
27 $user = $this->getUser();
28 $viewer = $request->getUser();
30 $numbers = id(new PhabricatorAuthContactNumberQuery())
31 ->setViewer($viewer)
32 ->withObjectPHIDs(array($user->getPHID()))
33 ->execute();
34 $numbers = msortv($numbers, 'getSortVector');
36 $rows = array();
37 $row_classes = array();
38 foreach ($numbers as $number) {
39 if ($number->getIsPrimary()) {
40 $primary_display = pht('Primary');
41 $row_classes[] = 'highlighted';
42 } else {
43 $primary_display = null;
44 $row_classes[] = null;
47 $rows[] = array(
48 $number->newIconView(),
49 phutil_tag(
50 'a',
51 array(
52 'href' => $number->getURI(),
54 $number->getDisplayName()),
55 $primary_display,
56 phabricator_datetime($number->getDateCreated(), $viewer),
60 $table = id(new AphrontTableView($rows))
61 ->setNoDataString(
62 pht("You haven't added any contact numbers to your account."))
63 ->setRowClasses($row_classes)
64 ->setHeaders(
65 array(
66 null,
67 pht('Number'),
68 pht('Status'),
69 pht('Created'),
71 ->setColumnClasses(
72 array(
73 null,
74 'wide pri',
75 null,
76 'right',
77 ));
79 $buttons = array();
81 $buttons[] = id(new PHUIButtonView())
82 ->setTag('a')
83 ->setIcon('fa-plus')
84 ->setText(pht('Add Contact Number'))
85 ->setHref('/auth/contact/edit/')
86 ->setColor(PHUIButtonView::GREY);
88 return $this->newBox(pht('Contact Numbers'), $table, $buttons);