本文整理汇总了PHP中PHUIObjectBoxView::appendChild方法的典型用法代码示例。如果您正苦于以下问题:PHP PHUIObjectBoxView::appendChild方法的具体用法?PHP PHUIObjectBoxView::appendChild怎么用?PHP PHUIObjectBoxView::appendChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHUIObjectBoxView
的用法示例。
在下文中一共展示了PHUIObjectBoxView::appendChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
if ($request->isFormPost()) {
$uri = new PhutilURI('/fact/chart/');
$uri->setQueryParam('y1', $request->getStr('y1'));
return id(new AphrontRedirectResponse())->setURI($uri);
}
$types = array('+N:*', '+N:DREV', 'updated');
$engines = PhabricatorFactEngine::loadAllEngines();
$specs = PhabricatorFactSpec::newSpecsForFactTypes($engines, $types);
$facts = id(new PhabricatorFactAggregate())->loadAllWhere('factType IN (%Ls)', $types);
$rows = array();
foreach ($facts as $fact) {
$spec = $specs[$fact->getFactType()];
$name = $spec->getName();
$value = $spec->formatValueForDisplay($user, $fact->getValueX());
$rows[] = array($name, $value);
}
$table = new AphrontTableView($rows);
$table->setHeaders(array(pht('Fact'), pht('Value')));
$table->setColumnClasses(array('wide', 'n'));
$panel = new PHUIObjectBoxView();
$panel->setHeaderText(pht('Facts'));
$panel->appendChild($table);
$chart_form = $this->buildChartForm();
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Home'));
return $this->buildApplicationPage(array($crumbs, $chart_form, $panel), array('title' => pht('Facts')));
}
示例2: processRequest
public function processRequest(AphrontRequest $request)
{
$user = $this->getUser();
$viewer = $request->getUser();
$keys = id(new PhabricatorAuthSSHKeyQuery())->setViewer($viewer)->withObjectPHIDs(array($user->getPHID()))->execute();
$table = id(new PhabricatorAuthSSHKeyTableView())->setUser($viewer)->setKeys($keys)->setCanEdit(true)->setNoDataString(pht("You haven't added any SSH Public Keys."));
$panel = new PHUIObjectBoxView();
$header = new PHUIHeaderView();
$upload_icon = id(new PHUIIconView())->setIconFont('fa-upload');
$upload_button = id(new PHUIButtonView())->setText(pht('Upload Public Key'))->setHref('/auth/sshkey/upload/?objectPHID=' . $user->getPHID())->setWorkflow(true)->setTag('a')->setIcon($upload_icon);
try {
PhabricatorSSHKeyGenerator::assertCanGenerateKeypair();
$can_generate = true;
} catch (Exception $ex) {
$can_generate = false;
}
$generate_icon = id(new PHUIIconView())->setIconFont('fa-lock');
$generate_button = id(new PHUIButtonView())->setText(pht('Generate Keypair'))->setHref('/auth/sshkey/generate/?objectPHID=' . $user->getPHID())->setTag('a')->setWorkflow(true)->setDisabled(!$can_generate)->setIcon($generate_icon);
$header->setHeader(pht('SSH Public Keys'));
$header->addActionLink($generate_button);
$header->addActionLink($upload_button);
$panel->setHeader($header);
$panel->appendChild($table);
return $panel;
}
示例3: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $this->getViewer();
$package = id(new PhabricatorOwnersPackageQuery())->setViewer($viewer)->withIDs(array($request->getURIData('id')))->needPaths(true)->executeOne();
if (!$package) {
return new Aphront404Response();
}
$paths = $package->getPaths();
$repository_phids = array();
foreach ($paths as $path) {
$repository_phids[$path->getRepositoryPHID()] = true;
}
if ($repository_phids) {
$repositories = id(new PhabricatorRepositoryQuery())->setViewer($viewer)->withPHIDs(array_keys($repository_phids))->execute();
$repositories = mpull($repositories, null, 'getPHID');
} else {
$repositories = array();
}
$actions = $this->buildPackageActionView($package);
$properties = $this->buildPackagePropertyView($package);
$properties->setActionList($actions);
$header = id(new PHUIHeaderView())->setUser($viewer)->setHeader($package->getName())->setPolicyObject($package);
$panel = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties);
$commit_views = array();
$commit_uri = id(new PhutilURI('/audit/'))->setQueryParams(array('auditorPHIDs' => $package->getPHID()));
$attention_commits = id(new DiffusionCommitQuery())->setViewer($request->getUser())->withAuditorPHIDs(array($package->getPHID()))->withAuditStatus(DiffusionCommitQuery::AUDIT_STATUS_CONCERN)->needCommitData(true)->setLimit(10)->execute();
if ($attention_commits) {
$view = id(new PhabricatorAuditListView())->setUser($viewer)->setCommits($attention_commits);
$commit_views[] = array('view' => $view, 'header' => pht('Commits in this Package that Need Attention'), 'button' => id(new PHUIButtonView())->setTag('a')->setHref($commit_uri->alter('status', 'open'))->setText(pht('View All Problem Commits')));
}
$all_commits = id(new DiffusionCommitQuery())->setViewer($request->getUser())->withAuditorPHIDs(array($package->getPHID()))->needCommitData(true)->setLimit(100)->execute();
$view = id(new PhabricatorAuditListView())->setUser($viewer)->setCommits($all_commits)->setNoDataString(pht('No commits in this package.'));
$commit_views[] = array('view' => $view, 'header' => pht('Recent Commits in Package'), 'button' => id(new PHUIButtonView())->setTag('a')->setHref($commit_uri)->setText(pht('View All Package Commits')));
$phids = array();
foreach ($commit_views as $commit_view) {
$phids[] = $commit_view['view']->getRequiredHandlePHIDs();
}
$phids = array_mergev($phids);
$handles = $this->loadViewerHandles($phids);
$commit_panels = array();
foreach ($commit_views as $commit_view) {
$commit_panel = new PHUIObjectBoxView();
$header = new PHUIHeaderView();
$header->setHeader($commit_view['header']);
if (isset($commit_view['button'])) {
$header->addActionLink($commit_view['button']);
}
$commit_view['view']->setHandles($handles);
$commit_panel->setHeader($header);
$commit_panel->appendChild($commit_view['view']);
$commit_panels[] = $commit_panel;
}
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb($package->getName());
$timeline = $this->buildTransactionTimeline($package, new PhabricatorOwnersPackageTransactionQuery());
$timeline->setShouldTerminate(true);
return $this->buildApplicationPage(array($crumbs, $panel, $this->renderPathsTable($paths, $repositories), $commit_panels, $timeline), array('title' => $package->getName()));
}
示例4: 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')));
}
示例5: processRequest
public function processRequest(AphrontRequest $request)
{
if ($request->getExists('new')) {
return $this->processNew($request);
}
if ($request->getExists('edit')) {
return $this->processEdit($request);
}
if ($request->getExists('delete')) {
return $this->processDelete($request);
}
$user = $this->getUser();
$viewer = $request->getUser();
$factors = id(new PhabricatorAuthFactorConfig())->loadAllWhere('userPHID = %s', $user->getPHID());
$rows = array();
$rowc = array();
$highlight_id = $request->getInt('id');
foreach ($factors as $factor) {
$impl = $factor->getImplementation();
if ($impl) {
$type = $impl->getFactorName();
} else {
$type = $factor->getFactorKey();
}
if ($factor->getID() == $highlight_id) {
$rowc[] = 'highlighted';
} else {
$rowc[] = null;
}
$rows[] = array(javelin_tag('a', array('href' => $this->getPanelURI('?edit=' . $factor->getID()), 'sigil' => 'workflow'), $factor->getFactorName()), $type, phabricator_datetime($factor->getDateCreated(), $viewer), javelin_tag('a', array('href' => $this->getPanelURI('?delete=' . $factor->getID()), 'sigil' => 'workflow', 'class' => 'small grey button'), pht('Remove')));
}
$table = new AphrontTableView($rows);
$table->setNoDataString(pht("You haven't added any authentication factors to your account yet."));
$table->setHeaders(array(pht('Name'), pht('Type'), pht('Created'), ''));
$table->setColumnClasses(array('wide pri', '', 'right', 'action'));
$table->setRowClasses($rowc);
$table->setDeviceVisibility(array(true, false, false, true));
$panel = new PHUIObjectBoxView();
$header = new PHUIHeaderView();
$help_uri = PhabricatorEnv::getDoclink('User Guide: Multi-Factor Authentication');
$help_icon = id(new PHUIIconView())->setIconFont('fa-info-circle');
$help_button = id(new PHUIButtonView())->setText(pht('Help'))->setHref($help_uri)->setTag('a')->setIcon($help_icon);
$create_icon = id(new PHUIIconView())->setIconFont('fa-plus');
$create_button = id(new PHUIButtonView())->setText(pht('Add Authentication Factor'))->setHref($this->getPanelURI('?new=true'))->setTag('a')->setWorkflow(true)->setIcon($create_icon);
$header->setHeader(pht('Authentication Factors'));
$header->addActionLink($help_button);
$header->addActionLink($create_button);
$panel->setHeader($header);
$panel->appendChild($table);
return $panel;
}
示例6: 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->appendChild($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()))));
}
示例7: 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));
}
示例8: 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')));
}
示例9: 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')));
}
示例10: 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();
}
示例11: 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;
}
示例12: render
public function render()
{
DarkConsoleXHProfPluginAPI::includeXHProfLib();
$GLOBALS['display_calls'] = true;
$totals = array();
$flat = xhprof_compute_flat_info($this->profileData, $totals);
unset($GLOBALS['display_calls']);
$aggregated = array();
foreach ($flat as $call => $counters) {
$parts = explode('@', $call, 2);
$agg_call = reset($parts);
if (empty($aggregated[$agg_call])) {
$aggregated[$agg_call] = $counters;
} else {
foreach ($aggregated[$agg_call] as $key => $val) {
if ($key != 'wt') {
$aggregated[$agg_call][$key] += $counters[$key];
}
}
}
}
$flat = $aggregated;
$flat = isort($flat, 'wt');
$flat = array_reverse($flat);
$rows = array();
$rows[] = array(pht('Total'), number_format($totals['ct']), number_format($totals['wt']) . ' us', '100.0%', number_format($totals['wt']) . ' us', '100.0%');
if ($this->limit) {
$flat = array_slice($flat, 0, $this->limit);
}
foreach ($flat as $call => $counters) {
$rows[] = array($this->renderSymbolLink($call), number_format($counters['ct']), number_format($counters['wt']) . ' us', sprintf('%.1f%%', 100 * $counters['wt'] / $totals['wt']), number_format($counters['excl_wt']) . ' us', sprintf('%.1f%%', 100 * $counters['excl_wt'] / $totals['wt']));
}
Javelin::initBehavior('phabricator-tooltips');
$table = new AphrontTableView($rows);
$table->setHeaders(array(pht('Symbol'), pht('Count'), javelin_tag('span', array('sigil' => 'has-tooltip', 'meta' => array('tip' => pht('Total wall time spent in this function and all of ' . 'its children (children are other functions it called ' . 'while executing).'), 'size' => 200)), pht('Wall Time (Inclusive)')), '%', javelin_tag('span', array('sigil' => 'has-tooltip', 'meta' => array('tip' => pht('Wall time spent in this function, excluding time ' . 'spent in children (children are other functions it ' . 'called while executing).'), 'size' => 200)), pht('Wall Time (Exclusive)')), '%'));
$table->setColumnClasses(array('wide pri', 'n', 'n', 'n', 'n', 'n'));
$panel = new PHUIObjectBoxView();
$header = id(new PHUIHeaderView())->setHeader(pht('XHProf Profile'));
if ($this->file) {
$button = id(new PHUIButtonView())->setHref($this->file->getBestURI())->setText(pht('Download %s Profile', '.xhprof'))->setTag('a');
$header->addActionLink($button);
}
$panel->setHeader($header);
$panel->appendChild($table);
return $panel->render();
}
示例13: 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()))));
}
示例14: 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;
}
示例15: 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;
}