public function build(WikiPage $page)
 {
     parent::build($page);
     $this->last_version = (int) $page->getLastVersionId();
     $this->versions = $this->getVerisonsRepresentations();
 }
Exemplo n.º 2
0
 /**
  * @return array {@type Tuleap\REST\v1\PhpWikiPageRepresentation}
  */
 private function getLegacyPhpWiki(PFUser $user, $id, $limit, $offset, $pagename)
 {
     $this->userCanAccessPhpWikiService($user, $id);
     $pages = array();
     $wiki_pages_factory = new PaginatedWikiPagesFactory(new WikiDao());
     $all_pages = $wiki_pages_factory->getPaginatedUserPages($user, $id, $limit, $offset, $pagename);
     foreach ($all_pages->getPages() as $page) {
         $representation = new PhpWikiPageRepresentation();
         $representation->build($page);
         $pages[] = $representation;
     }
     return $pages;
 }
Exemplo n.º 3
0
 /**
  * Get PhpWiki pages
  *
  * Get info about project non empty PhpWiki pages.
  *
  * @url GET {id}/phpwiki
  *
  * @access hybrid
  *
  * @param int $id          Id of the project
  * @param int $limit       Number of elements displayed per page {@from path}
  * @param int $offset      Position of the first element to display {@from path}
  * @param string $pagename Part of the pagename or the full pagename to search {@from path}
  *
  * @return array {@type Tuleap\REST\v1\PhpWikiPageRepresentation}
  */
 public function getPhpWiki($id, $limit = 10, $offset = 0, $pagename = '')
 {
     $this->checkAccess();
     $this->getProjectForUser($id);
     $current_user = UserManager::instance()->getCurrentUser();
     $this->userCanAccessPhpWikiService($current_user, $id);
     $wiki_pages = array('pages' => array());
     $wiki_pages_factory = new PaginatedWikiPagesFactory(new WikiDao());
     $all_pages = $wiki_pages_factory->getPaginatedUserPages($current_user, $id, $limit, $offset, $pagename);
     foreach ($all_pages->getPages() as $page) {
         $representation = new PhpWikiPageRepresentation();
         $representation->build($page);
         $wiki_pages['pages'][] = $representation;
     }
     $this->sendAllowHeadersForProject();
     $this->sendPaginationHeaders($limit, $offset, $all_pages->getTotalSize());
     return $wiki_pages;
 }