3 final class PhameHomeController
extends PhamePostController
{
5 public function shouldAllowPublic() {
9 protected function buildApplicationCrumbs() {
10 $crumbs = parent
::buildApplicationCrumbs();
12 id(new PhameBlogEditEngine())
13 ->setViewer($this->getViewer())
14 ->addActionToCrumbs($crumbs);
19 public function handleRequest(AphrontRequest
$request) {
20 $viewer = $request->getViewer();
22 $blogs = id(new PhameBlogQuery())
24 ->withStatuses(array(PhameBlog
::STATUS_ACTIVE
))
25 ->needProfileImage(true)
30 $blog_phids = mpull($blogs, 'getPHID');
32 $pager = id(new AphrontCursorPagerView())
33 ->readFromRequest($request);
35 $posts = id(new PhamePostQuery())
37 ->withBlogPHIDs($blog_phids)
38 ->withVisibility(array(PhameConstants
::VISIBILITY_PUBLISHED
))
39 ->setOrder('datePublished')
40 ->executeWithCursorPager($pager);
43 $post_list = id(new PhamePostListView())
48 $post_list = id(new PHUIBigInfoView())
50 ->setTitle('No Visible Posts')
52 pht('There aren\'t any visible blog posts.'));
55 $create_button = id(new PHUIButtonView())
57 ->setText(pht('Create a Blog'))
58 ->setHref('/phame/blog/edit/')
59 ->setColor(PHUIButtonView
::GREEN
);
61 $post_list = id(new PHUIBigInfoView())
63 ->setTitle('Welcome to Phame')
65 pht('There aren\'t any visible blog posts.'))
66 ->addAction($create_button);
69 $view_all = id(new PHUIButtonView())
71 ->setText(pht('View All'))
72 ->setHref($this->getApplicationURI('post/'))
73 ->setIcon('fa-list-ul');
75 $title = pht('Recent Posts');
77 $header = id(new PHUIHeaderView())
79 ->addActionLink($view_all);
81 $crumbs = $this->buildApplicationCrumbs();
82 $crumbs->setBorder(true);
83 $crumbs->addTextCrumb(
85 $this->getApplicationURI('post/'));
87 $page = id(new PHUIDocumentView())
89 ->appendChild($post_list);
91 $blog_list = id(new PhameBlogListView())
96 if ($viewer->isLoggedIn() && $blogs) {
97 $drafts = id(new PhamePostQuery())
99 ->withBloggerPHIDs(array($viewer->getPHID()))
100 ->withBlogPHIDs(mpull($blogs, 'getPHID'))
101 ->withVisibility(array(PhameConstants
::VISIBILITY_DRAFT
))
105 $draft_list = id(new PhameDraftListView())
108 ->setViewer($viewer);
111 $phame_view = id(new PHUITwoColumnView())
112 ->setMainColumn(array(
115 ->setSideColumn(array(
119 ->addClass('phame-home-container');
121 $phame_home = phutil_tag_div('phame-home-view', $phame_view);
123 return $this->newPage()