本文整理汇总了PHP中AphrontTableView::setHeaders方法的典型用法代码示例。如果您正苦于以下问题:PHP AphrontTableView::setHeaders方法的具体用法?PHP AphrontTableView::setHeaders怎么用?PHP AphrontTableView::setHeaders使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AphrontTableView
的用法示例。
在下文中一共展示了AphrontTableView::setHeaders方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
$pager = new AphrontPagerView();
$pager->setOffset($request->getInt('page'));
$pager->setURI($request->getRequestURI(), 'page');
$timers = id(new PhabricatorTimer())->loadAllWhere('1 = 1 ORDER BY id DESC LIMIT %d, %d', $pager->getOffset(), $pager->getPageSize() + 1);
$timers = $pager->sliceResults($timers);
$phids = mpull($timers, 'getAuthorPHID');
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
$rows = array();
foreach ($timers as $timer) {
$edit_button = null;
$delete_button = null;
if ($user->getIsAdmin() || $user->getPHID() == $timer->getAuthorPHID()) {
$edit_button = phutil_render_tag('a', array('class' => 'small button grey', 'href' => '/countdown/edit/' . $timer->getID() . '/'), 'Edit');
$delete_button = javelin_render_tag('a', array('class' => 'small button grey', 'href' => '/countdown/delete/' . $timer->getID() . '/', 'sigil' => 'workflow'), 'Delete');
}
$rows[] = array(phutil_escape_html($timer->getID()), $handles[$timer->getAuthorPHID()]->renderLink(), phutil_render_tag('a', array('href' => '/countdown/' . $timer->getID() . '/'), phutil_escape_html($timer->getTitle())), phabricator_datetime($timer->getDatepoint(), $user), $edit_button, $delete_button);
}
$table = new AphrontTableView($rows);
$table->setHeaders(array('ID', 'Author', 'Title', 'End Date', '', ''));
$table->setColumnClasses(array(null, null, 'wide pri', null, 'action', 'action'));
$panel = id(new AphrontPanelView())->appendChild($table)->setHeader('Timers')->setCreateButton('Create Timer', '/countdown/edit/')->appendChild($pager);
return $this->buildStandardPageResponse($panel, array('title' => 'Countdown'));
}
示例2: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
$nav = $this->buildSideNav('resource');
$pager = new AphrontPagerView();
$pager->setURI(new PhutilURI('/drydock/resource/'), 'page');
$data = id(new DrydockResource())->loadAllWhere('1 = 1 ORDER BY id DESC LIMIT %d, %d', $pager->getOffset(), $pager->getPageSize() + 1);
$data = $pager->sliceResults($data);
$phids = mpull($data, 'getOwnerPHID');
$handles = $this->loadViewerHandles($phids);
$rows = array();
foreach ($data as $resource) {
$rows[] = array($resource->getID(), $resource->getOwnerPHID() ? $handles[$resource->getOwnerPHID()]->renderLink() : null, phutil_escape_html($resource->getType()), DrydockResourceStatus::getNameForStatus($resource->getStatus()), phutil_escape_html(nonempty($resource->getName(), 'Unnamed')), phabricator_datetime($resource->getDateCreated(), $user));
}
$table = new AphrontTableView($rows);
$table->setHeaders(array('ID', 'Owner', 'Type', 'Status', 'Resource', 'Created'));
$table->setColumnClasses(array('', '', '', '', 'pri wide', 'right'));
$panel = new AphrontPanelView();
$panel->setHeader('Drydock Resources');
$panel->addButton(phutil_render_tag('a', array('href' => '/drydock/resource/allocate/', 'class' => 'green button'), 'Allocate Resource'));
$panel->appendChild($table);
$panel->appendChild($pager);
$nav->appendChild($panel);
return $this->buildStandardPageResponse($nav, array('title' => 'Resources'));
}
示例3: processRequest
public function processRequest()
{
$request = $this->getRequest();
$pager = new AphrontPagerView();
$pager->setOffset($request->getInt('page'));
$macro_table = new PhabricatorFileImageMacro();
$macros = $macro_table->loadAllWhere('1 = 1 ORDER BY id DESC LIMIT %d, %d', $pager->getOffset(), $pager->getPageSize());
// Get an exact count since the size here is reasonably going to be a few
// thousand at most in any reasonable case.
$count = queryfx_one($macro_table->establishConnection('r'), 'SELECT COUNT(*) N FROM %T', $macro_table->getTableName());
$count = $count['N'];
$pager->setCount($count);
$pager->setURI($request->getRequestURI(), 'page');
$rows = array();
foreach ($macros as $macro) {
$src = PhabricatorFileURI::getViewURIForPHID($macro->getFilePHID());
$rows[] = array(phutil_render_tag('a', array('href' => '/file/macro/edit/' . $macro->getID() . '/'), phutil_escape_html($macro->getName())), phutil_render_tag('a', array('href' => $src, 'target' => '_blank'), phutil_render_tag('img', array('src' => $src))), javelin_render_tag('a', array('href' => '/file/macro/delete/' . $macro->getID() . '/', 'sigil' => 'workflow', 'class' => 'grey small button'), 'Delete'));
}
$table = new AphrontTableView($rows);
$table->setHeaders(array('Name', 'Image', ''));
$table->setColumnClasses(array('pri', 'wide thumb', 'action'));
$panel = new AphrontPanelView();
$panel->appendChild($table);
$panel->setHeader('Image Macros');
$panel->setCreateButton('New Image Macro', '/file/macro/edit/');
$panel->appendChild($pager);
return $this->buildStandardPageResponse($panel, array('title' => 'Image Macros', 'tab' => 'macros'));
}
示例4: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
$nav = $this->buildSideNav('lease');
$pager = new AphrontPagerView();
$pager->setURI(new PhutilURI('/drydock/lease/'), 'page');
$data = id(new DrydockLease())->loadAllWhere('1 = 1 ORDER BY id DESC LIMIT %d, %d', $pager->getOffset(), $pager->getPageSize() + 1);
$data = $pager->sliceResults($data);
$phids = mpull($data, 'getOwnerPHID');
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
$resource_ids = mpull($data, 'getResourceID');
$resources = array();
if ($resource_ids) {
$resources = id(new DrydockResource())->loadAllWhere('id IN (%Ld)', $resource_ids);
}
$rows = array();
foreach ($data as $lease) {
$resource = idx($resources, $lease->getResourceID());
$rows[] = array($lease->getID(), DrydockLeaseStatus::getNameForStatus($lease->getStatus()), $lease->getOwnerPHID() ? $handles[$lease->getOwnerPHID()]->renderLink() : null, $lease->getResourceID(), $resource ? phutil_escape_html($resource->getName()) : null, phabricator_datetime($lease->getDateCreated(), $user));
}
$table = new AphrontTableView($rows);
$table->setHeaders(array('ID', 'Status', 'Owner', 'Resource ID', 'Resource', 'Created'));
$table->setColumnClasses(array('', '', '', '', 'wide pri', 'right'));
$panel = new AphrontPanelView();
$panel->setHeader('Drydock Leases');
$panel->appendChild($table);
$panel->appendChild($pager);
$nav->appendChild($panel);
return $this->buildStandardPageResponse($nav, array('title' => 'Leases'));
}
示例5: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
$nav = $this->buildSideNav('log');
$query = new DrydockLogQuery();
$resource_ids = $request->getStrList('resource');
if ($resource_ids) {
$query->withResourceIDs($resource_ids);
}
$lease_ids = $request->getStrList('lease');
if ($lease_ids) {
$query->withLeaseIDs($lease_ids);
}
$pager = new AphrontPagerView();
$pager->setPageSize(500);
$pager->setOffset($request->getInt('offset'));
$pager->setURI($request->getRequestURI(), 'offset');
$logs = $query->executeWithOffsetPager($pager);
$rows = array();
foreach ($logs as $log) {
$rows[] = array($log->getResourceID(), $log->getLeaseID(), phutil_escape_html($log->getMessage()), phabricator_datetime($log->getEpoch(), $user));
}
$table = new AphrontTableView($rows);
$table->setHeaders(array('Resource', 'Lease', 'Message', 'Date'));
$table->setColumnClasses(array('', '', 'wide', ''));
$panel = new AphrontPanelView();
$panel->setHeader('Drydock Logs');
$panel->appendChild($table);
$panel->appendChild($pager);
$nav->appendChild($panel);
return $this->buildStandardPageResponse($nav, array('title' => 'Logs'));
}
示例6: processRequest
public function processRequest()
{
$request = $this->getRequest();
$pager = new AphrontPagerView();
$pager->setOffset($request->getInt('page'));
$pastes = id(new PhabricatorPaste())->loadAllWhere('1 = 1 ORDER BY id DESC LIMIT %d, %d', $pager->getOffset(), $pager->getPageSize() + 1);
$pastes = $pager->sliceResults($pastes);
$pager->setURI($request->getRequestURI(), 'page');
$phids = mpull($pastes, 'getAuthorPHID');
$handles = array();
if ($phids) {
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
}
$rows = array();
foreach ($pastes as $paste) {
$handle = $handles[$paste->getAuthorPHID()];
$rows[] = array(phutil_escape_html('P' . $paste->getID()), phutil_render_tag('a', array('href' => '/p/' . $handle->getName() . '/'), phutil_escape_html($handle->getName())), phutil_escape_html($paste->getLanguage()), phutil_render_tag('a', array('href' => '/P' . $paste->getID()), phutil_escape_html(nonempty($paste->getTitle(), 'Untitled Masterwork P' . $paste->getID()))), phutil_render_tag('a', array('href' => PhabricatorFileURI::getViewURIForPHID($paste->getFilePHID())), phutil_escape_html($paste->getFilePHID())));
}
$table = new AphrontTableView($rows);
$table->setHeaders(array('Paste ID', 'Author', 'Language', 'Title', 'File'));
$table->setColumnClasses(array(null, null, null, 'wide pri', null));
$panel = new AphrontPanelView();
$panel->setWidth(AphrontPanelView::WIDTH_FULL);
$panel->setHeader("Paste");
$panel->setCreateButton('Paste Something', '/paste/');
$panel->appendChild($table);
$panel->appendChild($pager);
return $this->buildStandardPageResponse($panel, array('title' => 'Paste List', 'tab' => 'list'));
}
示例7: render
public function render()
{
$drequest = $this->getDiffusionRequest();
$handles = $this->handles;
$rows = array();
foreach ($this->history as $history) {
$epoch = $history->getEpoch();
if ($epoch) {
$date = date('M j, Y', $epoch);
$time = date('g:i A', $epoch);
} else {
$date = null;
$time = null;
}
$data = $history->getCommitData();
$author_phid = null;
if ($data) {
$author_phid = $data->getCommitDetail('authorPHID');
}
if ($author_phid && isset($handles[$author_phid])) {
$author = $handles[$author_phid]->renderLink();
} else {
$author = phutil_escape_html($history->getAuthorName());
}
$rows[] = array($this->linkBrowse($drequest->getPath(), array('commit' => $history->getCommitIdentifier())), self::linkCommit($drequest->getRepository(), $history->getCommitIdentifier()), $this->linkChange($history->getChangeType(), $history->getFileType(), null, $history->getCommitIdentifier()), $date, $time, $author, phutil_escape_html($history->getSummary()));
}
$view = new AphrontTableView($rows);
$view->setHeaders(array('Browse', 'Commit', 'Change', 'Date', 'Time', 'Author', 'Details'));
$view->setColumnClasses(array('', 'n', '', '', 'right', '', 'wide wrap'));
return $view->render();
}
示例8: render
public function render()
{
$rows = array();
if (!$this->user) {
throw new Exception("Call setUser() before rendering!");
}
foreach ($this->daemonLogs as $log) {
$epoch = $log->getDateCreated();
if ($log->getHost() == php_uname('n')) {
$pid = $log->getPID();
$is_running = PhabricatorDaemonReference::isProcessRunning($pid);
if ($is_running) {
$running = phutil_render_tag('span', array('style' => 'color: #00cc00', 'title' => 'Running'), '•');
} else {
$running = phutil_render_tag('span', array('style' => 'color: #cc0000', 'title' => 'Not running'), '•');
}
} else {
$running = phutil_render_tag('span', array('style' => 'color: #888888', 'title' => 'Not on this host'), '?');
}
$rows[] = array($running, phutil_escape_html($log->getDaemon()), phutil_escape_html($log->getHost()), $log->getPID(), phabricator_date($epoch, $this->user), phabricator_time($epoch, $this->user), phutil_render_tag('a', array('href' => '/daemon/log/' . $log->getID() . '/', 'class' => 'button small grey'), 'View Log'));
}
$daemon_table = new AphrontTableView($rows);
$daemon_table->setHeaders(array('', 'Daemon', 'Host', 'PID', 'Date', 'Time', 'View'));
$daemon_table->setColumnClasses(array('', 'wide wrap', '', '', '', 'right', 'action'));
return $daemon_table->render();
}
示例9: processRequest
public function processRequest()
{
$method_groups = $this->getMethodFilters();
$rows = array();
foreach ($method_groups as $group => $methods) {
foreach ($methods as $info) {
switch ($info['status']) {
case ConduitAPIMethod::METHOD_STATUS_DEPRECATED:
$status = 'Deprecated';
break;
case ConduitAPIMethod::METHOD_STATUS_UNSTABLE:
$status = 'Unstable';
break;
default:
$status = null;
break;
}
$rows[] = array($group, phutil_render_tag('a', array('href' => '/conduit/method/' . $info['full_name']), phutil_escape_html($info['full_name'])), $info['description'], $status);
$group = null;
}
}
$table = new AphrontTableView($rows);
$table->setHeaders(array('Group', 'Name', 'Description', 'Status'));
$table->setColumnClasses(array('pri', 'pri', 'wide', null));
$panel = new AphrontPanelView();
$panel->setHeader('Conduit Methods');
$panel->appendChild($table);
$panel->setWidth(AphrontPanelView::WIDTH_FULL);
$utils = new AphrontPanelView();
$utils->setHeader('Utilities');
$utils->appendChild('<ul>' . '<li><a href="/conduit/log/">Log</a> - Conduit Method Calls</li>' . '<li><a href="/conduit/token/">Token</a> - Certificate Install</li>' . '</ul>');
$utils->setWidth(AphrontPanelView::WIDTH_FULL);
$this->setShowSideNav(false);
return $this->buildStandardPageResponse(array($panel, $utils), array('title' => 'Conduit Console'));
}
示例10: render
public function render()
{
$user = $this->getUser();
$blogs = $this->getBlogs();
$panel = new AphrontPanelView();
if (empty($blogs)) {
$panel = id(new AphrontPanelView())->setHeader('No blogs... Yet!')->setCaption('Will you answer the call to phame?')->setCreateButton('New Blog', '/phame/blog/new');
return $panel->render();
}
$table_data = array();
foreach ($blogs as $blog) {
$view_link = phutil_render_tag('a', array('href' => $blog->getViewURI()), phutil_escape_html($blog->getName()));
$bloggers = $blog->getBloggers();
if (isset($bloggers[$user->getPHID()])) {
$edit = phutil_render_tag('a', array('class' => 'button small grey', 'href' => $blog->getEditURI()), 'Edit');
} else {
$edit = null;
}
$view = phutil_render_tag('a', array('class' => 'button small grey', 'href' => $blog->getViewURI()), 'View');
$table_data[] = array($view_link, implode(', ', mpull($blog->getBloggers(), 'renderLink')), $view, $edit);
}
$table = new AphrontTableView($table_data);
$table->setHeaders(array('Name', 'Bloggers', '', ''));
$table->setColumnClasses(array(null, null, 'action', 'action'));
$panel->setCreateButton('Create a Blog', '/phame/blog/new/');
$panel->setHeader($this->getHeader());
$panel->appendChild($table);
return $panel->render();
}
示例11: renderConfigurationFooter
public function renderConfigurationFooter()
{
$hashers = PhabricatorPasswordHasher::getAllHashers();
$hashers = msort($hashers, 'getStrength');
$hashers = array_reverse($hashers);
$yes = phutil_tag('strong', array('style' => 'color: #009900'), pht('Yes'));
$no = phutil_tag('strong', array('style' => 'color: #990000'), pht('Not Installed'));
$best_hasher_name = null;
try {
$best_hasher = PhabricatorPasswordHasher::getBestHasher();
$best_hasher_name = $best_hasher->getHashName();
} catch (PhabricatorPasswordHasherUnavailableException $ex) {
// There are no suitable hashers. The user might be able to enable some,
// so we don't want to fatal here. We'll fatal when users try to actually
// use this stuff if it isn't fixed before then. Until then, we just
// don't highlight a row. In practice, at least one hasher should always
// be available.
}
$rows = array();
$rowc = array();
foreach ($hashers as $hasher) {
$is_installed = $hasher->canHashPasswords();
$rows[] = array($hasher->getHumanReadableName(), $hasher->getHashName(), $hasher->getHumanReadableStrength(), $is_installed ? $yes : $no, $is_installed ? null : $hasher->getInstallInstructions());
$rowc[] = $best_hasher_name == $hasher->getHashName() ? 'highlighted' : null;
}
$table = new AphrontTableView($rows);
$table->setRowClasses($rowc);
$table->setHeaders(array(pht('Algorithm'), pht('Name'), pht('Strength'), pht('Installed'), pht('Install Instructions')));
$table->setColumnClasses(array('', '', '', '', 'wide'));
$header = id(new PHUIHeaderView())->setHeader(pht('Password Hash Algorithms'))->setSubheader(pht('Stronger algorithms are listed first. The highlighted algorithm ' . 'will be used when storing new hashes. Older hashes will be ' . 'upgraded to the best algorithm over time.'));
return id(new PHUIObjectBoxView())->setHeader($header)->appendChild($table);
}
示例12: render
public function render()
{
$user = $this->user;
if (!$user) {
throw new Exception("Call setUser() before render()!");
}
foreach ($this->fields as $field) {
$field->setUser($this->user);
$field->setHandles($this->handles);
}
$rows = array();
foreach ($this->revisions as $revision) {
$row = array();
foreach ($this->fields as $field) {
$row[] = $field->renderValueForRevisionList($revision);
}
$rows[] = $row;
}
$headers = array();
$classes = array();
foreach ($this->fields as $field) {
$headers[] = $field->renderHeaderForRevisionList();
$classes[] = $field->getColumnClassForRevisionList();
}
$table = new AphrontTableView($rows);
$table->setHeaders($headers);
$table->setColumnClasses($classes);
$table->setNoDataString(DifferentialRevisionListView::NO_DATA_STRING);
return $table->render();
}
示例13: 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(phutil_escape_html($name), phutil_escape_html($value));
}
$table = new AphrontTableView($rows);
$table->setHeaders(array('Fact', 'Value'));
$table->setColumnClasses(array('wide', 'n'));
$panel = new AphrontPanelView();
$panel->setHeader('Facts!');
$panel->appendChild($table);
$chart_form = $this->buildChartForm();
return $this->buildStandardPageResponse(array($chart_form, $panel), array('title' => 'Facts!'));
}
示例14: render
public function render()
{
$rows = array();
foreach ($this->edits as $edit) {
$name = nonempty($edit->getRuleName(), 'Unknown Rule');
$rule_name = phutil_render_tag('strong', array(), phutil_escape_html($name));
switch ($edit->getAction()) {
case 'create':
$details = "Created rule '{$rule_name}'.";
break;
case 'delete':
$details = "Deleted rule '{$rule_name}'.";
break;
case 'edit':
default:
$details = "Edited rule '{$rule_name}'.";
break;
}
$rows[] = array($edit->getRuleID(), $this->handles[$edit->getEditorPHID()]->renderLink(), $details, phabricator_datetime($edit->getDateCreated(), $this->user));
}
$table = new AphrontTableView($rows);
$table->setNoDataString("No edits for rule.");
$table->setHeaders(array('Rule ID', 'Editor', 'Details', 'Edit Date'));
$table->setColumnClasses(array('', '', 'wide', ''));
return $table->render();
}
示例15: renderPanel
public function renderPanel()
{
$data = $this->getData();
$sections = array('Basics' => array('Machine' => php_uname('n')));
// NOTE: This may not be present for some SAPIs, like php-fpm.
if (!empty($data['Server']['SERVER_ADDR'])) {
$addr = $data['Server']['SERVER_ADDR'];
$sections['Basics']['Host'] = $addr;
$sections['Basics']['Hostname'] = @gethostbyaddr($addr);
}
$sections = array_merge($sections, $data);
$mask = array('HTTP_COOKIE' => true, 'HTTP_X_PHABRICATOR_CSRF' => true);
$out = array();
foreach ($sections as $header => $map) {
$rows = array();
foreach ($map as $key => $value) {
if (isset($mask[$key])) {
$rows[] = array($key, phutil_tag('em', array(), '(Masked)'));
} else {
$rows[] = array($key, is_array($value) ? json_encode($value) : $value);
}
}
$table = new AphrontTableView($rows);
$table->setHeaders(array($header, null));
$table->setColumnClasses(array('header', 'wide wrap'));
$out[] = $table->render();
}
return phutil_implode_html("\n", $out);
}