Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2893070
AphlictDropdownDataQuery.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
2 KB
Referenced Files
None
Subscribers
None
AphlictDropdownDataQuery.php
View Options
<?php
final
class
AphlictDropdownDataQuery
extends
Phobject
{
private
$viewer
;
private
$notificationData
;
private
$conpherenceData
;
public
function
setViewer
(
PhabricatorUser
$viewer
)
{
$this
->
viewer
=
$viewer
;
return
$this
;
}
public
function
getViewer
(
)
{
return
$this
->
viewer
;
}
private
function
setNotificationData
(
array
$data
)
{
$this
->
notificationData
=
$data
;
return
$this
;
}
public
function
getNotificationData
(
)
{
if
(
$this
->
notificationData
===
null
)
{
throw
new
Exception
(
pht
(
'You must %s first!'
,
'execute()'
)
)
;
}
return
$this
->
notificationData
;
}
private
function
setConpherenceData
(
array
$data
)
{
$this
->
conpherenceData
=
$data
;
return
$this
;
}
public
function
getConpherenceData
(
)
{
if
(
$this
->
conpherenceData
===
null
)
{
throw
new
Exception
(
pht
(
'You must %s first!'
,
'execute()'
)
)
;
}
return
$this
->
conpherenceData
;
}
public
function
execute
(
)
{
$viewer
=
$this
->
getViewer
(
)
;
$conpherence_app
=
'PhabricatorConpherenceApplication'
;
$is_c_installed
=
PhabricatorApplication
::
isClassInstalledForViewer
(
$conpherence_app
,
$viewer
)
;
if
(
$is_c_installed
)
{
$raw_message_count_number
=
$viewer
->
getUnreadMessageCount
(
)
;
$message_count_number
=
$this
->
formatNumber
(
$raw_message_count_number
)
;
}
else
{
$raw_message_count_number
=
null
;
$message_count_number
=
null
;
}
$conpherence_data
=
array
(
'isInstalled'
=>
$is_c_installed
,
'countType'
=>
'messages'
,
'count'
=>
$message_count_number
,
'rawCount'
=>
$raw_message_count_number
,
)
;
$this
->
setConpherenceData
(
$conpherence_data
)
;
$notification_app
=
'PhabricatorNotificationsApplication'
;
$is_n_installed
=
PhabricatorApplication
::
isClassInstalledForViewer
(
$notification_app
,
$viewer
)
;
if
(
$is_n_installed
)
{
$raw_notification_count_number
=
$viewer
->
getUnreadNotificationCount
(
)
;
$notification_count_number
=
$this
->
formatNumber
(
$raw_notification_count_number
)
;
}
else
{
$notification_count_number
=
null
;
$raw_notification_count_number
=
null
;
}
$notification_data
=
array
(
'isInstalled'
=>
$is_n_installed
,
'countType'
=>
'notifications'
,
'count'
=>
$notification_count_number
,
'rawCount'
=>
$raw_notification_count_number
,
)
;
$this
->
setNotificationData
(
$notification_data
)
;
return
array
(
$notification_app
=>
$this
->
getNotificationData
(
)
,
$conpherence_app
=>
$this
->
getConpherenceData
(
)
,
)
;
}
private
function
formatNumber
(
$number
)
{
$formatted
=
$number
;
if
(
$number
>
999
)
{
$formatted
=
"\xE2\x88\x9E"
;
}
return
$formatted
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Jan 19 2025, 17:48 (5 w, 6 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1127127
Default Alt Text
AphlictDropdownDataQuery.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment