Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F77566654
PhamePostListBaseController.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, Aug 15, 05:33
Size
2 KB
Mime Type
text/x-php
Expires
Sat, Aug 17, 05:33 (2 d)
Engine
blob
Format
Raw Data
Handle
19889211
Attached To
rPH Phabricator
PhamePostListBaseController.php
View Options
<?php
/*
* Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @group phame
*/
abstract
class
PhamePostListBaseController
extends
PhameController
{
private
$phamePostQuery
;
private
$actions
;
private
$pageTitle
;
protected
function
setPageTitle
(
$page_title
)
{
$this
->
pageTitle
=
$page_title
;
return
$this
;
}
private
function
getPageTitle
()
{
return
$this
->
pageTitle
;
}
protected
function
setActions
(
$actions
)
{
$this
->
actions
=
$actions
;
return
$this
;
}
private
function
getActions
()
{
return
$this
->
actions
;
}
protected
function
setPhamePostQuery
(
PhamePostQuery
$query
)
{
$this
->
phamePostQuery
=
$query
;
return
$this
;
}
private
function
getPhamePostQuery
()
{
return
$this
->
phamePostQuery
;
}
protected
function
isDraft
()
{
return
false
;
}
protected
function
getNoticeView
()
{
return
null
;
}
private
function
loadBloggersFromPosts
(
array
$posts
)
{
assert_instances_of
(
$posts
,
'PhamePost'
);
if
(
empty
(
$posts
))
{
return
array
();
}
$blogger_phids
=
mpull
(
$posts
,
'getBloggerPHID'
,
'getBloggerPHID'
);
return
$this
->
loadViewerHandles
(
$blogger_phids
);
}
protected
function
buildPostListPageResponse
()
{
$request
=
$this
->
getRequest
();
$pager
=
$this
->
getPager
();
$query
=
$this
->
getPhamePostQuery
();
$posts
=
$query
->
executeWithOffsetPager
(
$pager
);
$bloggers
=
$this
->
loadBloggersFromPosts
(
$posts
);
$panel
=
id
(
new
PhamePostListView
())
->
setUser
(
$this
->
getRequest
()->
getUser
())
->
setBloggers
(
$bloggers
)
->
setPosts
(
$posts
)
->
setActions
(
$this
->
getActions
())
->
setRequestURI
(
$request
->
getRequestURI
())
->
setDraftList
(
$this
->
isDraft
());
return
$this
->
buildStandardPageResponse
(
array
(
$this
->
getNoticeView
(),
$panel
,
$pager
),
array
(
'title'
=>
$this
->
getPageTitle
(),
));
}
}
Event Timeline
Log In to Comment