protected final function buildDocumentContentDictionary(PhrictionDocument $doc, PhrictionContent $content) { $uri = PhrictionDocument::getSlugURI($content->getSlug()); $uri = PhabricatorEnv::getProductionURI($uri); $doc_status = $doc->getStatus(); return array('phid' => $doc->getPHID(), 'uri' => $uri, 'slug' => $content->getSlug(), 'version' => $content->getVersion(), 'authorPHID' => $content->getAuthorPHID(), 'title' => $content->getTitle(), 'content' => $content->getContent(), 'status' => PhrictionDocumentStatus::getConduitConstant($doc_status), 'description' => $content->getDescription(), 'dateCreated' => $content->getDateCreated()); }
private function buildPropertyListView(PhrictionDocument $document, PhrictionContent $content, $slug) { $viewer = $this->getRequest()->getUser(); $view = id(new PHUIPropertyListView())->setUser($viewer)->setObject($document); $project_phid = null; if (PhrictionDocument::isProjectSlug($slug)) { $project = id(new PhabricatorProjectQuery())->setViewer($viewer)->withPhrictionSlugs(array(PhrictionDocument::getProjectSlugIdentifier($slug)))->executeOne(); if ($project) { $project_phid = $project->getPHID(); } } $phids = array_filter(array($content->getAuthorPHID(), $project_phid)); $this->loadHandles($phids); $project_info = null; if ($project_phid) { $view->addProperty(pht('Project Info'), $this->getHandle($project_phid)->renderLink()); } $view->addProperty(pht('Last Author'), $this->getHandle($content->getAuthorPHID())->renderLink()); $age = time() - $content->getDateCreated(); $age = floor($age / (60 * 60 * 24)); if ($age < 1) { $when = pht('Today'); } else { if ($age == 1) { $when = pht('Yesterday'); } else { $when = pht('%d Days Ago', $age); } } $view->addProperty(pht('Last Updated'), $when); return $view; }