Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phame/controller/PhameHomeController.php
| Show All 29 Lines | if ($blogs) { | ||||
| $blog_phids = mpull($blogs, 'getPHID'); | $blog_phids = mpull($blogs, 'getPHID'); | ||||
| $pager = id(new AphrontCursorPagerView()) | $pager = id(new AphrontCursorPagerView()) | ||||
| ->readFromRequest($request); | ->readFromRequest($request); | ||||
| $posts = id(new PhamePostQuery()) | $posts = id(new PhamePostQuery()) | ||||
| ->setViewer($viewer) | ->setViewer($viewer) | ||||
| ->withBlogPHIDs($blog_phids) | ->withBlogPHIDs($blog_phids) | ||||
| ->withVisibility(PhameConstants::VISIBILITY_PUBLISHED) | ->withVisibility(array(PhameConstants::VISIBILITY_PUBLISHED)) | ||||
| ->executeWithCursorPager($pager); | ->executeWithCursorPager($pager); | ||||
| if ($posts) { | if ($posts) { | ||||
| $post_list = id(new PhamePostListView()) | $post_list = id(new PhamePostListView()) | ||||
| ->setPosts($posts) | ->setPosts($posts) | ||||
| ->setViewer($viewer) | ->setViewer($viewer) | ||||
| ->showBlog(true); | ->showBlog(true); | ||||
| } else { | } else { | ||||
| ▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | $blog_list = id(new PhameBlogListView()) | ||||
| ->setViewer($viewer); | ->setViewer($viewer); | ||||
| $draft_list = null; | $draft_list = null; | ||||
| if ($viewer->isLoggedIn() && $blogs) { | if ($viewer->isLoggedIn() && $blogs) { | ||||
| $drafts = id(new PhamePostQuery()) | $drafts = id(new PhamePostQuery()) | ||||
| ->setViewer($viewer) | ->setViewer($viewer) | ||||
| ->withBloggerPHIDs(array($viewer->getPHID())) | ->withBloggerPHIDs(array($viewer->getPHID())) | ||||
| ->withBlogPHIDs(mpull($blogs, 'getPHID')) | ->withBlogPHIDs(mpull($blogs, 'getPHID')) | ||||
| ->withVisibility(PhameConstants::VISIBILITY_DRAFT) | ->withVisibility(array(PhameConstants::VISIBILITY_DRAFT)) | ||||
| ->setLimit(5) | ->setLimit(5) | ||||
| ->execute(); | ->execute(); | ||||
| $draft_list = id(new PhameDraftListView()) | $draft_list = id(new PhameDraftListView()) | ||||
| ->setPosts($drafts) | ->setPosts($drafts) | ||||
| ->setBlogs($blogs) | ->setBlogs($blogs) | ||||
| ->setViewer($viewer); | ->setViewer($viewer); | ||||
| } | } | ||||
| Show All 23 Lines | |||||