本文整理汇总了PHP中PHUIObjectBoxView::setHeaderText方法的典型用法代码示例。如果您正苦于以下问题:PHP PHUIObjectBoxView::setHeaderText方法的具体用法?PHP PHUIObjectBoxView::setHeaderText怎么用?PHP PHUIObjectBoxView::setHeaderText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHUIObjectBoxView
的用法示例。
在下文中一共展示了PHUIObjectBoxView::setHeaderText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$db_values = id(new PhabricatorConfigEntry())->loadAllWhere('namespace = %s', 'default');
$db_values = mpull($db_values, null, 'getConfigKey');
$rows = array();
$options = PhabricatorApplicationConfigOptions::loadAllOptions();
ksort($options);
foreach ($options as $option) {
$key = $option->getKey();
if ($option->getHidden()) {
$value = phutil_tag('em', array(), pht('Hidden'));
} else {
$value = PhabricatorEnv::getEnvConfig($key);
$value = PhabricatorConfigJSON::prettyPrintJSON($value);
}
$db_value = idx($db_values, $key);
$rows[] = array(phutil_tag('a', array('href' => $this->getApplicationURI('edit/' . $key . '/')), $key), $value, $db_value && !$db_value->getIsDeleted() ? pht('Customized') : '');
}
$table = id(new AphrontTableView($rows))->setColumnClasses(array('', 'wide'))->setHeaders(array(pht('Key'), pht('Value'), pht('Customized')));
$title = pht('Current Settings');
$crumbs = $this->buildApplicationCrumbs()->addTextCrumb($title);
$panel = new PHUIObjectBoxView();
$panel->setHeaderText(pht('Current Settings'));
$panel->setTable($table);
$nav = $this->buildSideNavView();
$nav->selectFilter('all/');
$view = id(new PHUITwoColumnView())->setNavigation($nav)->setMainColumn(array($panel));
return $this->newPage()->setTitle($title)->setCrumbs($crumbs)->appendChild($view);
}
示例2: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$log = id(new PhabricatorDaemonLogQuery())->setViewer($viewer)->withIDs(array($id))->setAllowStatusWrites(true)->executeOne();
if (!$log) {
return new Aphront404Response();
}
$events = id(new PhabricatorDaemonLogEvent())->loadAllWhere('logID = %d ORDER BY id DESC LIMIT 1000', $log->getID());
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Daemon %s', $log->getID()));
$header = id(new PHUIHeaderView())->setHeader($log->getDaemon());
$tag = id(new PHUITagView())->setType(PHUITagView::TYPE_STATE);
$status = $log->getStatus();
switch ($status) {
case PhabricatorDaemonLog::STATUS_UNKNOWN:
$tag->setBackgroundColor(PHUITagView::COLOR_ORANGE);
$tag->setName(pht('Unknown'));
break;
case PhabricatorDaemonLog::STATUS_RUNNING:
$tag->setBackgroundColor(PHUITagView::COLOR_GREEN);
$tag->setName(pht('Running'));
break;
case PhabricatorDaemonLog::STATUS_DEAD:
$tag->setBackgroundColor(PHUITagView::COLOR_RED);
$tag->setName(pht('Dead'));
break;
case PhabricatorDaemonLog::STATUS_WAIT:
$tag->setBackgroundColor(PHUITagView::COLOR_BLUE);
$tag->setName(pht('Waiting'));
break;
case PhabricatorDaemonLog::STATUS_EXITING:
$tag->setBackgroundColor(PHUITagView::COLOR_YELLOW);
$tag->setName(pht('Exiting'));
break;
case PhabricatorDaemonLog::STATUS_EXITED:
$tag->setBackgroundColor(PHUITagView::COLOR_GREY);
$tag->setName(pht('Exited'));
break;
}
$header->addTag($tag);
$env_hash = PhabricatorEnv::calculateEnvironmentHash();
if ($log->getEnvHash() != $env_hash) {
$tag = id(new PHUITagView())->setType(PHUITagView::TYPE_STATE)->setBackgroundColor(PHUITagView::COLOR_YELLOW)->setName(pht('Stale Config'));
$header->addTag($tag);
}
$properties = $this->buildPropertyListView($log);
$event_view = id(new PhabricatorDaemonLogEventsView())->setUser($viewer)->setEvents($events);
$event_panel = new PHUIObjectBoxView();
$event_panel->setHeaderText(pht('Events'));
$event_panel->appendChild($event_view);
$object_box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties);
return $this->buildApplicationPage(array($crumbs, $object_box, $event_panel), array('title' => pht('Daemon Log')));
}
示例3: processDiffusionRequest
protected function processDiffusionRequest(AphrontRequest $request)
{
$drequest = $this->diffusionRequest;
$results = $this->getBrowseQueryResults();
$reason = $results->getReasonForEmptyResultSet();
$content = array();
$actions = $this->buildActionView($drequest);
$properties = $this->buildPropertyView($drequest, $actions);
$object_box = id(new PHUIObjectBoxView())->setHeader($this->buildHeaderView($drequest))->addPropertyList($properties);
$content[] = $object_box;
$content[] = $this->renderSearchForm($collapsed = true);
if (!$results->isValidResults()) {
$empty_result = new DiffusionEmptyResultView();
$empty_result->setDiffusionRequest($drequest);
$empty_result->setDiffusionBrowseResultSet($results);
$empty_result->setView($request->getStr('view'));
$content[] = $empty_result;
} else {
$phids = array();
foreach ($results->getPaths() as $result) {
$data = $result->getLastCommitData();
if ($data) {
if ($data->getCommitDetail('authorPHID')) {
$phids[$data->getCommitDetail('authorPHID')] = true;
}
}
}
$phids = array_keys($phids);
$handles = $this->loadViewerHandles($phids);
$browse_table = new DiffusionBrowseTableView();
$browse_table->setDiffusionRequest($drequest);
$browse_table->setHandles($handles);
$browse_table->setPaths($results->getPaths());
$browse_table->setUser($request->getUser());
$browse_panel = new PHUIObjectBoxView();
$browse_panel->setHeaderText($drequest->getPath(), '/');
$browse_panel->setTable($browse_table);
$content[] = $browse_panel;
}
$content[] = $this->buildOpenRevisions();
$readme_path = $results->getReadmePath();
if ($readme_path) {
$readme_content = $this->callConduitWithDiffusionRequest('diffusion.filecontentquery', array('path' => $readme_path, 'commit' => $drequest->getStableCommit()));
if ($readme_content) {
$content[] = id(new DiffusionReadmeView())->setUser($this->getViewer())->setPath($readme_path)->setContent($readme_content['corpus']);
}
}
$crumbs = $this->buildCrumbs(array('branch' => true, 'path' => true, 'view' => 'browse'));
return $this->buildApplicationPage(array($crumbs, $content), array('title' => array(nonempty(basename($drequest->getPath()), '/'), pht('%s Repository', $drequest->getRepository()->getCallsign()))));
}
示例4: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
$db_values = id(new PhabricatorConfigEntry())->loadAllWhere('namespace = %s', 'default');
$db_values = mpull($db_values, null, 'getConfigKey');
$rows = array();
$options = PhabricatorApplicationConfigOptions::loadAllOptions();
ksort($options);
foreach ($options as $option) {
$key = $option->getKey();
if ($option->getMasked()) {
$value = phutil_tag('em', array(), pht('Masked'));
} else {
if ($option->getHidden()) {
$value = phutil_tag('em', array(), pht('Hidden'));
} else {
$value = PhabricatorEnv::getEnvConfig($key);
$value = PhabricatorConfigJSON::prettyPrintJSON($value);
}
}
$db_value = idx($db_values, $key);
$rows[] = array(phutil_tag('a', array('href' => $this->getApplicationURI('edit/' . $key . '/')), $key), $value, $db_value && !$db_value->getIsDeleted() ? pht('Customized') : '');
}
$table = id(new AphrontTableView($rows))->setColumnClasses(array('', 'wide'))->setHeaders(array(pht('Key'), pht('Value'), pht('Customized')));
$title = pht('Current Settings');
$crumbs = $this->buildApplicationCrumbs()->addTextCrumb($title);
$panel = new PHUIObjectBoxView();
$panel->setHeaderText(pht('Current Settings'));
$panel->appendChild($table);
$versions = $this->loadVersions();
$version_property_list = id(new PHUIPropertyListView());
foreach ($versions as $version) {
list($name, $hash) = $version;
$version_property_list->addProperty($name, $hash);
}
$object_box = id(new PHUIObjectBoxView())->setHeaderText(pht('Current Version'))->addPropertyList($version_property_list);
$phabricator_root = dirname(phutil_get_library_root('phabricator'));
$version_path = $phabricator_root . '/conf/local/VERSION';
if (Filesystem::pathExists($version_path)) {
$version_from_file = Filesystem::readFile($version_path);
$version_property_list->addProperty(pht('Local Version'), $version_from_file);
}
$nav = $this->buildSideNavView();
$nav->selectFilter('all/');
$nav->setCrumbs($crumbs);
$nav->appendChild($object_box);
$nav->appendChild($panel);
return $this->buildApplicationPage($nav, array('title' => $title));
}
示例5: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
$table = new PhabricatorFactRaw();
$conn_r = $table->establishConnection('r');
$table_name = $table->getTableName();
$series = $request->getStr('y1');
$specs = PhabricatorFactSpec::newSpecsForFactTypes(PhabricatorFactEngine::loadAllEngines(), array($series));
$spec = idx($specs, $series);
$data = queryfx_all($conn_r, 'SELECT valueX, epoch FROM %T WHERE factType = %s ORDER BY epoch ASC', $table_name, $series);
$points = array();
$sum = 0;
foreach ($data as $key => $row) {
$sum += (int) $row['valueX'];
$points[(int) $row['epoch']] = $sum;
}
if (!$points) {
// NOTE: Raphael crashes Safari if you hand it series with no points.
throw new Exception(pht('No data to show!'));
}
// Limit amount of data passed to browser.
$count = count($points);
$limit = 2000;
if ($count > $limit) {
$i = 0;
$every = ceil($count / $limit);
foreach ($points as $epoch => $sum) {
$i++;
if ($i % $every && $i != $count) {
unset($points[$epoch]);
}
}
}
$x = array_keys($points);
$y = array_values($points);
$id = celerity_generate_unique_node_id();
$chart = phutil_tag('div', array('id' => $id, 'style' => 'border: 1px solid #6f6f6f; ' . 'margin: 1em 2em; ' . 'background: #ffffff; ' . 'height: 400px; '), '');
require_celerity_resource('raphael-core');
require_celerity_resource('raphael-g');
require_celerity_resource('raphael-g-line');
Javelin::initBehavior('line-chart', array('hardpoint' => $id, 'x' => array($x), 'y' => array($y), 'xformat' => 'epoch', 'colors' => array('#0000ff')));
$panel = new PHUIObjectBoxView();
$panel->setHeaderText(pht('Count of %s', $spec->getName()));
$panel->appendChild($chart);
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Chart'));
return $this->buildApplicationPage(array($crumbs, $panel), array('title' => pht('Chart')));
}
示例6: processRequest
public function processRequest()
{
$request = $this->getRequest();
$event = id(new PhabricatorDaemonLogEvent())->load($this->id);
if (!$event) {
return new Aphront404Response();
}
$event_view = id(new PhabricatorDaemonLogEventsView())->setEvents(array($event))->setUser($request->getUser())->setCombinedLog(true)->setShowFullMessage(true);
$log_panel = new PHUIObjectBoxView();
$log_panel->setHeaderText(pht('Combined Log'));
$log_panel->appendChild($event_view);
$daemon_id = $event->getLogID();
$crumbs = $this->buildApplicationCrumbs()->addTextCrumb(pht('Daemon %s', $daemon_id), $this->getApplicationURI("log/{$daemon_id}/"))->addTextCrumb(pht('Event %s', $event->getID()));
return $this->buildApplicationPage(array($crumbs, $log_panel), array('title' => pht('Combined Daemon Log')));
}
示例7: render
public function render()
{
DarkConsoleXHProfPluginAPI::includeXHProfLib();
$data = $this->profileData;
$GLOBALS['display_calls'] = true;
$totals = array();
$flat = xhprof_compute_flat_info($data, $totals);
unset($GLOBALS['display_calls']);
$symbol = $this->symbol;
$children = array();
$parents = array();
foreach ($this->profileData as $key => $counters) {
if (strpos($key, '==>') !== false) {
list($parent, $child) = explode('==>', $key, 2);
} else {
continue;
}
if ($parent == $symbol) {
$children[$key] = $child;
} else {
if ($child == $symbol) {
$parents[$key] = $parent;
}
}
}
$rows = array();
$rows[] = array(pht('Metrics for this Call'), '', '', '');
$rows[] = $this->formatRow(array($symbol, $flat[$symbol]['ct'], $flat[$symbol]['wt'], 1.0));
$rows[] = array(pht('Parent Calls'), '', '', '');
foreach ($parents as $key => $name) {
$rows[] = $this->formatRow(array($name, $data[$key]['ct'], $data[$key]['wt'], ''));
}
$rows[] = array(pht('Child Calls'), '', '', '');
$child_rows = array();
foreach ($children as $key => $name) {
$child_rows[] = array($name, $data[$key]['ct'], $data[$key]['wt'], $data[$key]['wt'] / $flat[$symbol]['wt']);
}
$child_rows = isort($child_rows, 2);
$child_rows = array_reverse($child_rows);
$rows = array_merge($rows, array_map(array($this, 'formatRow'), $child_rows));
$table = new AphrontTableView($rows);
$table->setHeaders(array(pht('Symbol'), pht('Count'), pht('Wall Time'), '%'));
$table->setColumnClasses(array('wide pri', 'n', 'n', 'n'));
$panel = new PHUIObjectBoxView();
$panel->setHeaderText(pht('XHProf Profile'));
$panel->appendChild($table);
return $panel->render();
}
示例8: render
public function render()
{
$project_phid = $this->request->getStr('project');
$project_handle = null;
if ($project_phid) {
$phids = array($project_phid);
$project_handle = $this->getProjectHandle($phids, $project_phid, $this->request);
$tasks = $this->getOpenTasksforProject($this->user, $phids);
} else {
$tasks = $this->getOpenTasks($this->user);
}
$recently_closed = $this->loadRecentlyClosedTasks();
$date = phabricator_date(time(), $this->user);
$viewer_task_view = new UserOpenTasksView();
$project_task_view = new ProjectOpenTasksView();
if ($this->view == 'user') {
list($leftover, $leftover_closed, $base_link, $leftover_name, $col_header, $header, $result_closed, $result) = $viewer_task_view->execute($tasks, $recently_closed, $date);
} else {
if ($this->view == 'project') {
list($leftover, $base_link, $leftover_name, $col_header, $header, $result_closed, $leftover_closed, $result) = $project_task_view->execute($tasks, $recently_closed, $date);
} else {
$result = array();
$result_closed = array();
$base_link = null;
$leftover = array();
$leftover_closed = array();
$leftover_name = null;
$col_header = '';
$header = '';
}
}
$order = $this->request->getStr('order', 'name');
list($order, $reverse) = AphrontTableView::parseSort($order);
require_celerity_resource('aphront-tooltip-css');
Javelin::initBehavior('phabricator-tooltips', array());
$rows = $this->buildRowsfromResult($project_handle, $result, $result_closed, $base_link, $leftover, $leftover_name, $leftover_closed, $order, $reverse);
list($cname, $cclass) = $this->buildTableColumns($col_header);
$table = $this->buildOpenTasksTable($rows, $cname, $cclass, $order, $reverse);
$panel = new PHUIObjectBoxView();
$panel->setHeaderText($header);
$panel->setTable($table);
$tokens = array();
if ($project_handle) {
$tokens = array($project_handle);
}
$filter = $this->renderReportFilters($tokens, $has_window = false, $this->request, $this->user);
return array($filter, $panel);
}
示例9: renderExample
public function renderExample()
{
$rows = array();
$examples = array(array(pht('Reactive button only generates a stream of events'), 'ReactorButtonExample', 'phabricator-uiexample-reactor-button', array()), array(pht('Reactive checkbox generates a boolean dynamic value'), 'ReactorCheckboxExample', 'phabricator-uiexample-reactor-checkbox', array('checked' => true)), array(pht('Reactive focus detector generates a boolean dynamic value'), 'ReactorFocusExample', 'phabricator-uiexample-reactor-focus', array()), array(pht('Reactive input box, with normal and calmed output'), 'ReactorInputExample', 'phabricator-uiexample-reactor-input', array('init' => 'Initial value')), array(pht('Reactive mouseover detector generates a boolean dynamic value'), 'ReactorMouseoverExample', 'phabricator-uiexample-reactor-mouseover', array()), array(pht('Reactive radio buttons generate a string dynamic value'), 'ReactorRadioExample', 'phabricator-uiexample-reactor-radio', array()), array(pht('Reactive select box generates a string dynamic value'), 'ReactorSelectExample', 'phabricator-uiexample-reactor-select', array()), array(pht('%s makes the class of an element a string dynamic value', 'sendclass'), 'ReactorSendClassExample', 'phabricator-uiexample-reactor-sendclass', array()), array(pht('%s makes some properties of an object into dynamic values', 'sendproperties'), 'ReactorSendPropertiesExample', 'phabricator-uiexample-reactor-sendproperties', array()));
foreach ($examples as $example) {
list($desc, $name, $resource, $params) = $example;
$template = new AphrontJavelinView();
$template->setName($name)->setParameters($params)->setCelerityResource($resource);
$rows[] = array($desc, $template->render());
}
$table = new AphrontTableView($rows);
$panel = new PHUIObjectBoxView();
$panel->setHeaderText(pht('Example'));
$panel->appendChild($table);
return $panel;
}
示例10: processDiffusionRequest
protected function processDiffusionRequest(AphrontRequest $request)
{
$drequest = $this->diffusionRequest;
$viewer = $request->getUser();
$repository = $drequest->getRepository();
$page_size = $request->getInt('pagesize', 100);
$offset = $request->getInt('offset', 0);
$params = array('commit' => $drequest->getCommit(), 'path' => $drequest->getPath(), 'offset' => $offset, 'limit' => $page_size + 1);
if (!$request->getBool('copies')) {
$params['needDirectChanges'] = true;
$params['needChildChanges'] = true;
}
$history_results = $this->callConduitWithDiffusionRequest('diffusion.historyquery', $params);
$history = DiffusionPathChange::newFromConduit($history_results['pathChanges']);
$pager = new AphrontPagerView();
$pager->setPageSize($page_size);
$pager->setOffset($offset);
$history = $pager->sliceResults($history);
$pager->setURI($request->getRequestURI(), 'offset');
$show_graph = !strlen($drequest->getPath());
$content = array();
$history_table = new DiffusionHistoryTableView();
$history_table->setUser($request->getUser());
$history_table->setDiffusionRequest($drequest);
$history_table->setHistory($history);
$history_table->loadRevisions();
$phids = $history_table->getRequiredHandlePHIDs();
$handles = $this->loadViewerHandles($phids);
$history_table->setHandles($handles);
if ($show_graph) {
$history_table->setParents($history_results['parents']);
$history_table->setIsHead($offset == 0);
}
$history_panel = new PHUIObjectBoxView();
$history_panel->setHeaderText(pht('History'));
$history_panel->appendChild($history_table);
$content[] = $history_panel;
$header = id(new PHUIHeaderView())->setUser($viewer)->setPolicyObject($repository)->setHeader($this->renderPathLinks($drequest, $mode = 'history'));
$actions = $this->buildActionView($drequest);
$properties = $this->buildPropertyView($drequest, $actions);
$object_box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties);
$crumbs = $this->buildCrumbs(array('branch' => true, 'path' => true, 'view' => 'history'));
return $this->buildApplicationPage(array($crumbs, $object_box, $content, $pager), array('title' => array(pht('History'), pht('%s Repository', $drequest->getRepository()->getCallsign()))));
}
示例11: renderExample
public function renderExample()
{
$request = $this->getRequest();
$init = $request->getStr('init');
$parent_server_template = new JavelinViewExampleServerView();
$parent_client_template = new AphrontJavelinView();
$parent_client_template->setName('JavelinViewExample')->setCelerityResource('phabricator-uiexample-javelin-view');
$child_server_template = new JavelinViewExampleServerView();
$child_client_template = new AphrontJavelinView();
$child_client_template->setName('JavelinViewExample')->setCelerityResource('phabricator-uiexample-javelin-view');
$parent_server_template->appendChild($parent_client_template);
$parent_client_template->appendChild($child_server_template);
$child_server_template->appendChild($child_client_template);
$child_client_template->appendChild(pht('Hey, it worked.'));
$panel = new PHUIObjectBoxView();
$panel->setHeaderText(pht('Example'));
$panel->appendChild(phutil_tag_div('ml', $parent_server_template));
return $panel;
}
示例12: handleRequest
public function handleRequest(AphrontRequest $request)
{
$response = $this->loadDiffusionContext();
if ($response) {
return $response;
}
$viewer = $this->getViewer();
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
$pager = id(new PHUIPagerView())->readFromRequest($request);
$params = array('commit' => $drequest->getCommit(), 'path' => $drequest->getPath(), 'offset' => $pager->getOffset(), 'limit' => $pager->getPageSize() + 1);
if (!$request->getBool('copies')) {
$params['needDirectChanges'] = true;
$params['needChildChanges'] = true;
}
$history_results = $this->callConduitWithDiffusionRequest('diffusion.historyquery', $params);
$history = DiffusionPathChange::newFromConduit($history_results['pathChanges']);
$history = $pager->sliceResults($history);
$show_graph = !strlen($drequest->getPath());
$content = array();
$history_table = id(new DiffusionHistoryTableView())->setUser($request->getUser())->setDiffusionRequest($drequest)->setHistory($history);
$history_table->loadRevisions();
if ($show_graph) {
$history_table->setParents($history_results['parents']);
$history_table->setIsHead(!$pager->getOffset());
$history_table->setIsTail(!$pager->getHasMorePages());
}
$history_panel = new PHUIObjectBoxView();
$history_panel->setHeaderText(pht('History'));
$history_panel->setTable($history_table);
$content[] = $history_panel;
$header = id(new PHUIHeaderView())->setUser($viewer)->setPolicyObject($repository)->setHeader($this->renderPathLinks($drequest, $mode = 'history'));
$actions = $this->buildActionView($drequest);
$properties = $this->buildPropertyView($drequest, $actions);
$object_box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties);
$crumbs = $this->buildCrumbs(array('branch' => true, 'path' => true, 'view' => 'history'));
$pager_box = $this->renderTablePagerBox($pager);
return $this->newPage()->setTitle(array(pht('History'), $repository->getDisplayName()))->setCrumbs($crumbs)->appendChild(array($object_box, $content, $pager_box));
}
示例13: renderExample
public function renderExample()
{
$request = $this->getRequest();
$offset = (int) $request->getInt('offset');
$page_size = 20;
$item_count = 173;
$rows = array();
for ($ii = $offset; $ii < min($item_count, $offset + $page_size); $ii++) {
$rows[] = array(pht('Item #%d', $ii + 1));
}
$table = new AphrontTableView($rows);
$table->setHeaders(array('Item'));
$panel = new PHUIObjectBoxView();
$panel->setHeaderText(pht('Example'));
$panel->appendChild($table);
$panel->appendChild(hsprintf('<p class="phabricator-ui-example-note">%s</p>', pht('Use %s to render a pager element.', phutil_tag('tt', array(), 'PHUIPagerView'))));
$pager = new PHUIPagerView();
$pager->setPageSize($page_size);
$pager->setOffset($offset);
$pager->setCount($item_count);
$pager->setURI($request->getRequestURI(), 'offset');
$panel->appendChild($pager);
$panel->appendChild(hsprintf('<p class="phabricator-ui-example-note">%s</p>', pht('You can show more or fewer pages of surrounding context.')));
$many_pages_pager = new PHUIPagerView();
$many_pages_pager->setPageSize($page_size);
$many_pages_pager->setOffset($offset);
$many_pages_pager->setCount($item_count);
$many_pages_pager->setURI($request->getRequestURI(), 'offset');
$many_pages_pager->setSurroundingPages(7);
$panel->appendChild($many_pages_pager);
$panel->appendChild(hsprintf('<p class="phabricator-ui-example-note">%s</p>', pht('When it is prohibitively expensive or complex to attain a complete ' . 'count of the items, you can select one extra item and set ' . '%s if it exists, creating an inexact pager.', phutil_tag('tt', array(), 'hasMorePages(true)'))));
$inexact_pager = new PHUIPagerView();
$inexact_pager->setPageSize($page_size);
$inexact_pager->setOffset($offset);
$inexact_pager->setHasMorePages($offset < $item_count - $page_size);
$inexact_pager->setURI($request->getRequestURI(), 'offset');
$panel->appendChild($inexact_pager);
return $panel;
}
示例14: renderExample
public function renderExample()
{
$rows = array(array('make' => 'Honda', 'model' => 'Civic', 'year' => 2004, 'price' => 3199, 'color' => pht('Blue')), array('make' => 'Ford', 'model' => 'Focus', 'year' => 2001, 'price' => 2549, 'color' => pht('Red')), array('make' => 'Toyota', 'model' => 'Camry', 'year' => 2009, 'price' => 4299, 'color' => pht('Black')), array('make' => 'NASA', 'model' => 'Shuttle', 'year' => 1998, 'price' => 1000000000, 'color' => pht('White')));
$request = $this->getRequest();
$orders = array('make', 'model', 'year', 'price');
$sort = $request->getStr('sort');
list($sort, $reverse) = AphrontTableView::parseSort($sort);
if (!in_array($sort, $orders)) {
$sort = 'make';
}
$rows = isort($rows, $sort);
if ($reverse) {
$rows = array_reverse($rows);
}
$table = new AphrontTableView($rows);
$table->setHeaders(array(pht('Make'), pht('Model'), pht('Year'), pht('Price'), pht('Color')));
$table->setColumnClasses(array('', 'wide', 'n', 'n', ''));
$table->makeSortable($request->getRequestURI(), 'sort', $sort, $reverse, $orders);
$panel = new PHUIObjectBoxView();
$panel->setHeaderText(pht('Sortable Table of Vehicles'));
$panel->appendChild($table);
return $panel;
}
示例15: buildChartForm
private function buildChartForm()
{
$request = $this->getRequest();
$viewer = $request->getUser();
$table = new PhabricatorFactRaw();
$conn_r = $table->establishConnection('r');
$table_name = $table->getTableName();
$facts = queryfx_all($conn_r, 'SELECT DISTINCT factType from %T', $table_name);
$specs = PhabricatorFactSpec::newSpecsForFactTypes(PhabricatorFactEngine::loadAllEngines(), ipull($facts, 'factType'));
$options = array();
foreach ($specs as $spec) {
if ($spec->getUnit() == PhabricatorFactSpec::UNIT_COUNT) {
$options[$spec->getType()] = $spec->getName();
}
}
if (!$options) {
return id(new PHUIInfoView())->setSeverity(PHUIInfoView::SEVERITY_NODATA)->setTitle(pht('No Chartable Facts'))->appendChild(phutil_tag('p', array(), pht('There are no facts that can be plotted yet.')));
}
$form = id(new AphrontFormView())->setUser($viewer)->appendChild(id(new AphrontFormSelectControl())->setLabel(pht('Y-Axis'))->setName('y1')->setOptions($options))->appendChild(id(new AphrontFormSubmitControl())->setValue(pht('Plot Chart')));
$panel = new PHUIObjectBoxView();
$panel->setForm($form);
$panel->setHeaderText(pht('Plot Chart'));
return $panel;
}