2013-06-05 08:41:43 -07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PHUIDocumentExample extends PhabricatorUIExample {
|
|
|
|
|
|
|
|
public function getName() {
|
|
|
|
return pht('Document View');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getDescription() {
|
|
|
|
return pht('Useful for areas of large content navigation');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function renderExample() {
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$user = $request->getUser();
|
|
|
|
|
|
|
|
$action = id(new PHUIListItemView())
|
2015-05-22 17:27:56 +10:00
|
|
|
->setName(pht('Actions'))
|
2013-06-05 08:41:43 -07:00
|
|
|
->setType(PHUIListItemView::TYPE_LABEL);
|
|
|
|
|
|
|
|
$action1 = id(new PHUIListItemView())
|
2015-05-22 17:27:56 +10:00
|
|
|
->setName(pht('Edit Document'))
|
2013-06-05 08:41:43 -07:00
|
|
|
->setHref('#')
|
2014-05-12 10:08:32 -07:00
|
|
|
->setIcon('fa-edit')
|
2013-06-05 08:41:43 -07:00
|
|
|
->setType(PHUIListItemView::TYPE_LINK);
|
|
|
|
|
|
|
|
$action2 = id(new PHUIListItemView())
|
2015-05-22 17:27:56 +10:00
|
|
|
->setName(pht('Move Document'))
|
2013-06-05 08:41:43 -07:00
|
|
|
->setHref('#')
|
2014-05-12 10:08:32 -07:00
|
|
|
->setIcon('fa-arrows')
|
2013-06-05 08:41:43 -07:00
|
|
|
->setType(PHUIListItemView::TYPE_LINK);
|
|
|
|
|
|
|
|
$action3 = id(new PHUIListItemView())
|
2015-05-22 17:27:56 +10:00
|
|
|
->setName(pht('Delete Document'))
|
2013-06-05 08:41:43 -07:00
|
|
|
->setHref('#')
|
2014-05-12 10:08:32 -07:00
|
|
|
->setIcon('fa-times')
|
2013-06-05 08:41:43 -07:00
|
|
|
->setType(PHUIListItemView::TYPE_LINK);
|
|
|
|
|
|
|
|
$action4 = id(new PHUIListItemView())
|
2015-05-22 17:27:56 +10:00
|
|
|
->setName(pht('View History'))
|
2013-06-05 08:41:43 -07:00
|
|
|
->setHref('#')
|
2014-05-12 10:08:32 -07:00
|
|
|
->setIcon('fa-list')
|
2013-06-05 08:41:43 -07:00
|
|
|
->setType(PHUIListItemView::TYPE_LINK);
|
|
|
|
|
|
|
|
$action5 = id(new PHUIListItemView())
|
2015-05-22 17:27:56 +10:00
|
|
|
->setName(pht('Subscribe'))
|
2013-06-05 08:41:43 -07:00
|
|
|
->setHref('#')
|
2014-05-12 10:08:32 -07:00
|
|
|
->setIcon('fa-plus-circle')
|
2013-06-05 08:41:43 -07:00
|
|
|
->setType(PHUIListItemView::TYPE_LINK);
|
|
|
|
|
2014-10-08 00:01:04 +11:00
|
|
|
$divider = id(new PHUIListItemView())
|
2013-06-05 08:41:43 -07:00
|
|
|
->setType(PHUIListItemView::TYPE_DIVIDER);
|
|
|
|
|
2013-09-17 09:12:37 -07:00
|
|
|
$header = id(new PHUIHeaderView())
|
2015-05-22 17:27:56 +10:00
|
|
|
->setHeader(pht('Installation'));
|
2013-06-05 08:41:43 -07:00
|
|
|
|
|
|
|
$label1 = id(new PHUIListItemView())
|
2015-05-22 17:27:56 +10:00
|
|
|
->setName(pht('Getting Started'))
|
2013-06-05 08:41:43 -07:00
|
|
|
->setType(PHUIListItemView::TYPE_LABEL);
|
|
|
|
|
|
|
|
$label2 = id(new PHUIListItemView())
|
2015-05-22 17:27:56 +10:00
|
|
|
->setName(pht('Documentation'))
|
2013-06-05 08:41:43 -07:00
|
|
|
->setType(PHUIListItemView::TYPE_LABEL);
|
|
|
|
|
|
|
|
$item1 = id(new PHUIListItemView())
|
2015-05-22 17:27:56 +10:00
|
|
|
->setName(pht('Installation'))
|
2013-06-05 08:41:43 -07:00
|
|
|
->setHref('#')
|
|
|
|
->setType(PHUIListItemView::TYPE_LINK);
|
|
|
|
|
|
|
|
$item2 = id(new PHUIListItemView())
|
2015-05-22 17:27:56 +10:00
|
|
|
->setName(pht('Webserver Config'))
|
2013-06-05 08:41:43 -07:00
|
|
|
->setHref('#')
|
|
|
|
->setType(PHUIListItemView::TYPE_LINK);
|
|
|
|
|
|
|
|
$item3 = id(new PHUIListItemView())
|
2015-05-22 17:27:56 +10:00
|
|
|
->setName(pht('Adding Users'))
|
2013-06-05 08:41:43 -07:00
|
|
|
->setHref('#')
|
|
|
|
->setType(PHUIListItemView::TYPE_LINK);
|
|
|
|
|
|
|
|
$item4 = id(new PHUIListItemView())
|
2015-05-22 17:27:56 +10:00
|
|
|
->setName(pht('Debugging'))
|
2013-06-05 08:41:43 -07:00
|
|
|
->setHref('#')
|
|
|
|
->setType(PHUIListItemView::TYPE_LINK);
|
|
|
|
|
|
|
|
$sidenav = id(new PHUIListView())
|
2013-06-05 15:03:56 -07:00
|
|
|
->setType(PHUIListView::SIDENAV_LIST)
|
2013-06-05 08:41:43 -07:00
|
|
|
->addMenuItem($action)
|
|
|
|
->addMenuItem($action1)
|
|
|
|
->addMenuItem($action2)
|
|
|
|
->addMenuItem($action3)
|
|
|
|
->addMenuItem($action4)
|
|
|
|
->addMenuItem($action5)
|
|
|
|
->addMenuItem($divider)
|
|
|
|
->addMenuItem($label1)
|
|
|
|
->addMenuItem($item1)
|
|
|
|
->addMenuItem($item2)
|
|
|
|
->addMenuItem($item3)
|
|
|
|
->addMenuItem($item4)
|
|
|
|
->addMenuItem($label2)
|
|
|
|
->addMenuItem($item2)
|
|
|
|
->addMenuItem($item3)
|
|
|
|
->addMenuItem($item4)
|
|
|
|
->addMenuItem($item1);
|
|
|
|
|
|
|
|
$home = id(new PHUIListItemView())
|
2015-03-02 12:08:04 -08:00
|
|
|
->setIcon('fa-home')
|
2013-06-05 08:41:43 -07:00
|
|
|
->setHref('#')
|
|
|
|
->setType(PHUIListItemView::TYPE_ICON);
|
|
|
|
|
|
|
|
$item1 = id(new PHUIListItemView())
|
2015-05-22 17:27:56 +10:00
|
|
|
->setName(pht('Installation'))
|
2013-06-05 08:41:43 -07:00
|
|
|
->setHref('#')
|
|
|
|
->setSelected(true)
|
|
|
|
->setType(PHUIListItemView::TYPE_LINK);
|
|
|
|
|
|
|
|
$item2 = id(new PHUIListItemView())
|
2015-05-22 17:27:56 +10:00
|
|
|
->setName(pht('Webserver Config'))
|
2013-06-05 08:41:43 -07:00
|
|
|
->setHref('#')
|
|
|
|
->setType(PHUIListItemView::TYPE_LINK);
|
|
|
|
|
|
|
|
$item3 = id(new PHUIListItemView())
|
2015-05-22 17:27:56 +10:00
|
|
|
->setName(pht('Adding Users'))
|
2013-06-05 08:41:43 -07:00
|
|
|
->setHref('#')
|
|
|
|
->setType(PHUIListItemView::TYPE_LINK);
|
|
|
|
|
|
|
|
$item4 = id(new PHUIListItemView())
|
2015-05-22 17:27:56 +10:00
|
|
|
->setName(pht('Debugging'))
|
2013-06-05 08:41:43 -07:00
|
|
|
->setHref('#')
|
|
|
|
->setType(PHUIListItemView::TYPE_LINK);
|
|
|
|
|
|
|
|
$topnav = id(new PHUIListView())
|
2013-06-05 15:03:56 -07:00
|
|
|
->setType(PHUIListView::NAVBAR_LIST)
|
2013-06-05 08:41:43 -07:00
|
|
|
->addMenuItem($home)
|
|
|
|
->addMenuItem($item1)
|
|
|
|
->addMenuItem($item2)
|
|
|
|
->addMenuItem($item3)
|
|
|
|
->addMenuItem($item4);
|
|
|
|
|
|
|
|
$document = hsprintf(
|
|
|
|
'<p class="pl">Lorem ipsum dolor sit amet, consectetur adipisicing, '.
|
|
|
|
'sed do eiusmod tempor incididunt ut labore et dolore magna '.
|
|
|
|
'aliqua. Ut enim ad minim veniam, quis nostrud exercitation '.
|
|
|
|
'ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis '.
|
|
|
|
'aute irure dolor in reprehenderit in voluptate velit esse cillum '.
|
|
|
|
'dolore eu fugiat nulla pariatur. Excepteur sint occaecat '.
|
|
|
|
'cupidatat non proident, sunt in culpa qui officia deserunt '.
|
|
|
|
'mollit anim id est laborum.</p>'.
|
|
|
|
'<p class="plr pll plb">Lorem ipsum dolor sit amet, consectetur, '.
|
|
|
|
'sed do eiusmod tempor incididunt ut labore et dolore magna '.
|
|
|
|
'aliqua. Ut enim ad minim veniam, quis nostrud exercitation '.
|
|
|
|
'ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis '.
|
|
|
|
'aute irure dolor in reprehenderit in voluptate velit esse cillum '.
|
|
|
|
'dolore eu fugiat nulla pariatur. Excepteur sint occaecat '.
|
|
|
|
'cupidatat non proident, sunt in culpa qui officia deserunt '.
|
|
|
|
'mollit anim id est laborum.</p>'.
|
|
|
|
'<p class="plr pll plb">Lorem ipsum dolor sit amet, consectetur, '.
|
|
|
|
'sed do eiusmod tempor incididunt ut labore et dolore magna '.
|
|
|
|
'aliqua. Ut enim ad minim veniam, quis nostrud exercitation '.
|
|
|
|
'ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis '.
|
|
|
|
'aute irure dolor in reprehenderit in voluptate velit esse cillum '.
|
|
|
|
'dolore eu fugiat nulla pariatur. Excepteur sint occaecat '.
|
|
|
|
'cupidatat non proident, sunt in culpa qui officia deserunt '.
|
|
|
|
'mollit anim id est laborum.</p>'.
|
|
|
|
'<p class="plr pll plb">Lorem ipsum dolor sit amet, consectetur, '.
|
|
|
|
'sed do eiusmod tempor incididunt ut labore et dolore magna '.
|
|
|
|
'aliqua. Ut enim ad minim veniam, quis nostrud exercitation '.
|
|
|
|
'ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis '.
|
|
|
|
'aute irure dolor in reprehenderit in voluptate velit esse cillum '.
|
|
|
|
'dolore eu fugiat nulla pariatur. Excepteur sint occaecat '.
|
|
|
|
'cupidatat non proident, sunt in culpa qui officia deserunt '.
|
|
|
|
'mollit anim id est laborum.</p>'.
|
|
|
|
'<p class="plr pll plb">Lorem ipsum dolor sit amet, consectetur, '.
|
|
|
|
'sed do eiusmod tempor incididunt ut labore et dolore magna '.
|
|
|
|
'aliqua. Ut enim ad minim veniam, quis nostrud exercitation '.
|
|
|
|
'ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis '.
|
|
|
|
'aute irure dolor in reprehenderit in voluptate velit esse cillum '.
|
|
|
|
'dolore eu fugiat nulla pariatur. Excepteur sint occaecat '.
|
|
|
|
'cupidatat non proident, sunt in culpa qui officia deserunt '.
|
|
|
|
'mollit anim id est laborum.</p>'.
|
|
|
|
'<p class="plr pll plb">Lorem ipsum dolor sit amet, consectetur, '.
|
|
|
|
'sed do eiusmod tempor incididunt ut labore et dolore magna '.
|
|
|
|
'aliqua. Ut enim ad minim veniam, quis nostrud exercitation '.
|
|
|
|
'ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis '.
|
|
|
|
'aute irure dolor in reprehenderit in voluptate velit esse cillum '.
|
|
|
|
'dolore eu fugiat nulla pariatur. Excepteur sint occaecat '.
|
|
|
|
'cupidatat non proident, sunt in culpa qui officia deserunt '.
|
|
|
|
'mollit anim id est laborum.</p>');
|
|
|
|
|
|
|
|
$content = new PHUIDocumentView();
|
2015-05-22 17:27:56 +10:00
|
|
|
$content->setBook(pht('Book or Project Name'), pht('Article'));
|
2013-06-05 08:41:43 -07:00
|
|
|
$content->setHeader($header);
|
2015-03-02 12:08:04 -08:00
|
|
|
$content->setFluid(true);
|
2013-06-05 08:41:43 -07:00
|
|
|
$content->setTopNav($topnav);
|
|
|
|
$content->setSidenav($sidenav);
|
|
|
|
$content->appendChild($document);
|
|
|
|
|
|
|
|
return $content;
|
|
|
|
}
|
|
|
|
}
|