Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F109940893
PhabricatorNotificationListController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Apr 24, 01:46
Size
2 KB
Mime Type
text/x-php
Expires
Sat, Apr 26, 01:46 (2 d)
Engine
blob
Format
Raw Data
Handle
25727294
Attached To
rPH Phabricator
PhabricatorNotificationListController.php
View Options
<?php
final
class
PhabricatorNotificationListController
extends
PhabricatorNotificationController
{
private
$filter
;
public
function
willProcessRequest
(
array
$data
)
{
$this
->
filter
=
idx
(
$data
,
'filter'
);
}
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
$user
=
$request
->
getUser
();
$nav
=
new
AphrontSideNavFilterView
();
$nav
->
setBaseURI
(
new
PhutilURI
(
'/notification/'
));
$nav
->
addFilter
(
'all'
,
'All Notifications'
);
$nav
->
addFilter
(
'unread'
,
'Unread Notifications'
);
$filter
=
$nav
->
selectFilter
(
$this
->
filter
,
'all'
);
$pager
=
new
AphrontPagerView
();
$pager
->
setURI
(
$request
->
getRequestURI
(),
'offset'
);
$pager
->
setOffset
(
$request
->
getInt
(
'offset'
));
$query
=
new
PhabricatorNotificationQuery
();
$query
->
setViewer
(
$user
);
$query
->
setUserPHID
(
$user
->
getPHID
());
switch
(
$filter
)
{
case
'unread'
:
$query
->
withUnread
(
true
);
$header
=
pht
(
'Unread Notifications'
);
$no_data
=
pht
(
'You have no unread notifications.'
);
break
;
default
:
$header
=
pht
(
'Notifications'
);
$no_data
=
pht
(
'You have no notifications.'
);
break
;
}
$notifications
=
$query
->
executeWithOffsetPager
(
$pager
);
if
(
$notifications
)
{
$builder
=
new
PhabricatorNotificationBuilder
(
$notifications
);
$view
=
$builder
->
buildView
();
}
else
{
$view
=
'<div class="phabricator-notification no-notifications">'
.
$no_data
.
'</div>'
;
}
$view
=
array
(
'<div class="phabricator-notification-list">'
,
$view
,
'</div>'
,
);
$panel
=
new
AphrontPanelView
();
$panel
->
setHeader
(
$header
);
$panel
->
setWidth
(
AphrontPanelView
::
WIDTH_FORM
);
$panel
->
addButton
(
javelin_tag
(
'a'
,
array
(
'href'
=>
'/notification/clear/'
,
'class'
=>
'button'
,
'sigil'
=>
'workflow'
,
),
'Mark All Read'
));
$panel
->
appendChild
(
$view
);
$panel
->
appendChild
(
$pager
);
$nav
->
appendChild
(
$panel
);
return
$this
->
buildStandardPageResponse
(
$nav
,
array
(
'title'
=>
'Notifications'
,
));
}
}
Event Timeline
Log In to Comment