本文整理汇总了PHP中AphrontTableView::setRowClasses方法的典型用法代码示例。如果您正苦于以下问题:PHP AphrontTableView::setRowClasses方法的具体用法?PHP AphrontTableView::setRowClasses怎么用?PHP AphrontTableView::setRowClasses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AphrontTableView
的用法示例。
在下文中一共展示了AphrontTableView::setRowClasses方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
public function render()
{
$rows = array();
$rowc = array();
// TODO: Experiment with path stack rendering.
// TODO: Copy Away and Move Away are rendered junkily still.
foreach ($this->pathChanges as $id => $change) {
$path = $change->getPath();
$hash = substr(md5($path), 0, 8);
if ($change->getFileType() == DifferentialChangeType::FILE_DIRECTORY) {
$path .= '/';
}
if (isset($this->renderingReferences[$id])) {
$path_column = javelin_render_tag('a', array('href' => '#' . $hash, 'meta' => array('id' => 'diff-' . $hash, 'ref' => $this->renderingReferences[$id]), 'sigil' => 'differential-load'), phutil_escape_html($path));
} else {
$path_column = phutil_escape_html($path);
}
$rows[] = array($this->linkHistory($change->getPath()), $this->linkBrowse($change->getPath()), $this->linkChange($change->getChangeType(), $change->getFileType(), $change->getPath()), $path_column);
$row_class = null;
foreach ($this->ownersPaths as $owners_path) {
$owners_path = $owners_path->getPath();
if (strncmp('/' . $path, $owners_path, strlen($owners_path)) == 0) {
$row_class = 'highlighted';
break;
}
}
$rowc[] = $row_class;
}
$view = new AphrontTableView($rows);
$view->setHeaders(array('History', 'Browse', 'Change', 'Path'));
$view->setColumnClasses(array('', '', '', 'wide'));
$view->setRowClasses($rowc);
$view->setNoDataString('This change has not been fully parsed yet.');
return $view->render();
}
示例2: 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);
}
示例3: render
public function render()
{
$drequest = $this->getDiffusionRequest();
$current_branch = $drequest->getBranch();
$rows = array();
$rowc = array();
foreach ($this->branches as $branch) {
$commit = idx($this->commits, $branch->getHeadCommitIdentifier());
if ($commit) {
$details = $commit->getCommitData()->getCommitMessage();
$details = idx(explode("\n", $details), 0);
$details = substr($details, 0, 80);
$datetime = phabricator_datetime($commit->getEpoch(), $this->user);
} else {
$datetime = null;
$details = null;
}
$rows[] = array(phutil_render_tag('a', array('href' => $drequest->generateURI(array('action' => 'history', 'branch' => $branch->getName()))), 'History'), phutil_render_tag('a', array('href' => $drequest->generateURI(array('action' => 'browse', 'branch' => $branch->getName()))), phutil_escape_html($branch->getName())), self::linkCommit($drequest->getRepository(), $branch->getHeadCommitIdentifier()), $datetime, AphrontTableView::renderSingleDisplayLine(phutil_escape_html($details)));
if ($branch->getName() == $current_branch) {
$rowc[] = 'highlighted';
} else {
$rowc[] = null;
}
}
$view = new AphrontTableView($rows);
$view->setHeaders(array('History', 'Branch', 'Head', 'Modified', 'Details'));
$view->setColumnClasses(array('', 'pri', '', '', 'wide'));
$view->setRowClasses($rowc);
return $view->render();
}
示例4: render
public function render()
{
$drequest = $this->getDiffusionRequest();
$current_branch = $drequest->getBranch();
$repository = $drequest->getRepository();
Javelin::initBehavior('phabricator-tooltips');
$doc_href = PhabricatorEnv::getDoclink('Diffusion User Guide: Autoclose');
$rows = array();
$rowc = array();
foreach ($this->branches as $branch) {
$commit = idx($this->commits, $branch->getCommitIdentifier());
if ($commit) {
$details = $commit->getSummary();
$datetime = phabricator_datetime($commit->getEpoch(), $this->user);
} else {
$datetime = null;
$details = null;
}
switch ($repository->shouldSkipAutocloseBranch($branch->getShortName())) {
case PhabricatorRepository::BECAUSE_REPOSITORY_IMPORTING:
$icon = 'fa-times bluegrey';
$tip = pht('Repository Importing');
break;
case PhabricatorRepository::BECAUSE_AUTOCLOSE_DISABLED:
$icon = 'fa-times bluegrey';
$tip = pht('Repository Autoclose Disabled');
break;
case PhabricatorRepository::BECAUSE_BRANCH_UNTRACKED:
$icon = 'fa-times bluegrey';
$tip = pht('Branch Untracked');
break;
case PhabricatorRepository::BECAUSE_BRANCH_NOT_AUTOCLOSE:
$icon = 'fa-times bluegrey';
$tip = pht('Branch Autoclose Disabled');
break;
case null:
$icon = 'fa-check bluegrey';
$tip = pht('Autoclose Enabled');
break;
default:
$icon = 'fa-question';
$tip = pht('Status Unknown');
break;
}
$status_icon = id(new PHUIIconView())->setIconFont($icon)->addSigil('has-tooltip')->setHref($doc_href)->setMetadata(array('tip' => $tip, 'size' => 200));
$rows[] = array(phutil_tag('a', array('href' => $drequest->generateURI(array('action' => 'history', 'branch' => $branch->getShortName()))), pht('History')), phutil_tag('a', array('href' => $drequest->generateURI(array('action' => 'browse', 'branch' => $branch->getShortName()))), $branch->getShortName()), self::linkCommit($drequest->getRepository(), $branch->getCommitIdentifier()), $status_icon, $datetime, AphrontTableView::renderSingleDisplayLine($details));
if ($branch->getShortName() == $current_branch) {
$rowc[] = 'highlighted';
} else {
$rowc[] = null;
}
}
$view = new AphrontTableView($rows);
$view->setHeaders(array(pht('History'), pht('Branch'), pht('Head'), pht(''), pht('Modified'), pht('Details')));
$view->setColumnClasses(array('', 'pri', '', '', '', 'wide'));
$view->setRowClasses($rowc);
return $view->render();
}
示例5: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
$upload_panel = $this->renderUploadPanel();
$author = null;
$author_username = $request->getStr('author');
if ($author_username) {
$author = id(new PhabricatorUser())->loadOneWhere('userName = %s', $author_username);
if (!$author) {
return id(new Aphront404Response());
}
$title = 'Files Uploaded by ' . phutil_escape_html($author->getUsername());
} else {
$title = 'Files';
}
$pager = new AphrontPagerView();
$pager->setOffset($request->getInt('page'));
if ($author) {
$files = id(new PhabricatorFile())->loadAllWhere('authorPHID = %s ORDER BY id DESC LIMIT %d, %d', $author->getPHID(), $pager->getOffset(), $pager->getPageSize() + 1);
} else {
$files = id(new PhabricatorFile())->loadAllWhere('1 = 1 ORDER BY id DESC LIMIT %d, %d', $pager->getOffset(), $pager->getPageSize() + 1);
}
$files = $pager->sliceResults($files);
$pager->setURI($request->getRequestURI(), 'page');
$phids = mpull($files, 'getAuthorPHID');
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
$highlighted = $request->getStr('h');
$highlighted = explode('-', $highlighted);
$highlighted = array_fill_keys($highlighted, true);
$rows = array();
$rowc = array();
foreach ($files as $file) {
if ($file->isViewableInBrowser()) {
$view_button = phutil_render_tag('a', array('class' => 'small button grey', 'href' => '/file/view/' . $file->getPHID() . '/'), 'View');
} else {
$view_button = null;
}
if (isset($highlighted[$file->getID()])) {
$rowc[] = 'highlighted';
} else {
$rowc[] = '';
}
$rows[] = array(phutil_escape_html('F' . $file->getID()), $file->getAuthorPHID() ? $handles[$file->getAuthorPHID()]->renderLink() : null, phutil_render_tag('a', array('href' => $file->getViewURI()), phutil_escape_html($file->getName())), phutil_escape_html(number_format($file->getByteSize()) . ' bytes'), phutil_render_tag('a', array('class' => 'small button grey', 'href' => '/file/info/' . $file->getPHID() . '/'), 'Info'), $view_button, phutil_render_tag('a', array('class' => 'small button grey', 'href' => '/file/download/' . $file->getPHID() . '/'), 'Download'), phabricator_date($file->getDateCreated(), $user), phabricator_time($file->getDateCreated(), $user));
}
$table = new AphrontTableView($rows);
$table->setRowClasses($rowc);
$table->setHeaders(array('File ID', 'Author', 'Name', 'Size', '', '', '', 'Created', ''));
$table->setColumnClasses(array(null, '', 'wide pri', 'right', 'action', 'action', 'action', '', 'right'));
$panel = new AphrontPanelView();
$panel->appendChild($table);
$panel->setHeader($title);
$panel->appendChild($pager);
return $this->buildStandardPageResponse(array($upload_panel, $panel), array('title' => 'Files', 'tab' => 'files'));
}
示例6: 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->setTable($table);
return $panel;
}
示例7: buildClientList
private function buildClientList($rows, $rowc, $title)
{
$table = new AphrontTableView($rows);
$table->setRowClasses($rowc);
$table->setHeaders(array('Client', 'ID', 'Secret', 'Redirect URI', ''));
$table->setColumnClasses(array('', '', '', '', 'action'));
if (empty($rows)) {
$table->setNoDataString('You have not created any clients for this OAuthServer.');
}
$panel = new AphrontPanelView();
$panel->appendChild($table);
$panel->setHeader($title);
return $panel;
}
示例8: buildClientAuthorizationList
private function buildClientAuthorizationList($rows, $rowc, $title)
{
$table = new AphrontTableView($rows);
$table->setRowClasses($rowc);
$table->setHeaders(array('Client', 'Scope', 'Created', 'Updated', ''));
$table->setColumnClasses(array('wide pri', '', '', '', 'action'));
if (empty($rows)) {
$table->setNoDataString('You have not authorized any clients for this OAuthServer.');
}
$panel = new AphrontPanelView();
$panel->appendChild($table);
$panel->setHeader($title);
return $panel;
}
示例9: processRequest
public function processRequest(AphrontRequest $request)
{
$viewer = $request->getUser();
// TODO: It would be nice to simply disable this panel, but we can't do
// viewer-based checks for enabled panels right now.
$app_class = 'PhabricatorOAuthServerApplication';
$installed = PhabricatorApplication::isClassInstalledForViewer($app_class, $viewer);
if (!$installed) {
$dialog = id(new AphrontDialogView())->setUser($viewer)->setTitle(pht('OAuth Not Available'))->appendParagraph(pht('You do not have access to OAuth authorizations.'))->addCancelButton('/settings/');
return id(new AphrontDialogResponse())->setDialog($dialog);
}
$authorizations = id(new PhabricatorOAuthClientAuthorizationQuery())->setViewer($viewer)->withUserPHIDs(array($viewer->getPHID()))->execute();
$authorizations = mpull($authorizations, null, 'getID');
$panel_uri = $this->getPanelURI();
$revoke = $request->getInt('revoke');
if ($revoke) {
if (empty($authorizations[$revoke])) {
return new Aphront404Response();
}
if ($request->isFormPost()) {
$authorizations[$revoke]->delete();
return id(new AphrontRedirectResponse())->setURI($panel_uri);
}
$dialog = id(new AphrontDialogView())->setUser($viewer)->setTitle(pht('Revoke Authorization?'))->appendParagraph(pht('This application will no longer be able to access Phabricator ' . 'on your behalf.'))->addSubmitButton(pht('Revoke Authorization'))->addCancelButton($panel_uri);
return id(new AphrontDialogResponse())->setDialog($dialog);
}
$highlight = $request->getInt('id');
$rows = array();
$rowc = array();
foreach ($authorizations as $authorization) {
if ($highlight == $authorization->getID()) {
$rowc[] = 'highlighted';
} else {
$rowc[] = null;
}
$button = javelin_tag('a', array('href' => $this->getPanelURI('?revoke=' . $authorization->getID()), 'class' => 'small grey button', 'sigil' => 'workflow'), pht('Revoke'));
$rows[] = array(phutil_tag('a', array('href' => $authorization->getClient()->getViewURI()), $authorization->getClient()->getName()), $authorization->getScopeString(), phabricator_datetime($authorization->getDateCreated(), $viewer), phabricator_datetime($authorization->getDateModified(), $viewer), $button);
}
$table = new AphrontTableView($rows);
$table->setNoDataString(pht("You haven't authorized any OAuth applications."));
$table->setRowClasses($rowc);
$table->setHeaders(array(pht('Application'), pht('Scope'), pht('Created'), pht('Updated'), null));
$table->setColumnClasses(array('pri', 'wide', 'right', 'right', 'action'));
$header = id(new PHUIHeaderView())->setHeader(pht('OAuth Application Authorizations'));
$panel = id(new PHUIObjectBoxView())->setHeader($header)->appendChild($table);
return $panel;
}
示例10: render
public function render()
{
$drequest = $this->getDiffusionRequest();
$current_branch = $drequest->getBranch();
$rows = array();
$rowc = array();
foreach ($this->branches as $branch) {
$rows[] = array(phutil_render_tag('a', array('href' => $drequest->generateURI(array('action' => 'branch', 'branch' => $branch->getName()))), phutil_escape_html($branch->getName())), self::linkCommit($drequest->getRepository(), $branch->getHeadCommitIdentifier()));
if ($branch->getName() == $current_branch) {
$rowc[] = 'highlighted';
} else {
$rowc[] = null;
}
}
$view = new AphrontTableView($rows);
$view->setHeaders(array('Branch', 'Head'));
$view->setColumnClasses(array('wide'));
$view->setRowClasses($rowc);
return $view->render();
}
示例11: processRequest
public function processRequest(AphrontRequest $request)
{
$viewer = $request->getUser();
$accounts = id(new PhabricatorExternalAccountQuery())->setViewer($viewer)->withUserPHIDs(array($viewer->getPHID()))->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->execute();
$identity_phids = mpull($accounts, 'getPHID');
$identity_phids[] = $viewer->getPHID();
$sessions = id(new PhabricatorAuthSessionQuery())->setViewer($viewer)->withIdentityPHIDs($identity_phids)->execute();
$handles = id(new PhabricatorHandleQuery())->setViewer($viewer)->withPHIDs($identity_phids)->execute();
$current_key = PhabricatorHash::digest($request->getCookie(PhabricatorCookies::COOKIE_SESSION));
$rows = array();
$rowc = array();
foreach ($sessions as $session) {
$is_current = phutil_hashes_are_identical($session->getSessionKey(), $current_key);
if ($is_current) {
$rowc[] = 'highlighted';
$button = phutil_tag('a', array('class' => 'small grey button disabled'), pht('Current'));
} else {
$rowc[] = null;
$button = javelin_tag('a', array('href' => '/auth/session/terminate/' . $session->getID() . '/', 'class' => 'small grey button', 'sigil' => 'workflow'), pht('Terminate'));
}
$hisec = $session->getHighSecurityUntil() - time();
$rows[] = array($handles[$session->getUserPHID()]->renderLink(), substr($session->getSessionKey(), 0, 6), $session->getType(), $hisec > 0 ? phutil_format_relative_time($hisec) : null, phabricator_datetime($session->getSessionStart(), $viewer), phabricator_date($session->getSessionExpires(), $viewer), $button);
}
$table = new AphrontTableView($rows);
$table->setNoDataString(pht("You don't have any active sessions."));
$table->setRowClasses($rowc);
$table->setHeaders(array(pht('Identity'), pht('Session'), pht('Type'), pht('HiSec'), pht('Created'), pht('Expires'), pht('')));
$table->setColumnClasses(array('wide', 'n', '', 'right', 'right', 'right', 'action'));
$terminate_icon = id(new PHUIIconView())->setIconFont('fa-exclamation-triangle');
$terminate_button = id(new PHUIButtonView())->setText(pht('Terminate All Sessions'))->setHref('/auth/session/terminate/all/')->setTag('a')->setWorkflow(true)->setIcon($terminate_icon);
$header = id(new PHUIHeaderView())->setHeader(pht('Active Login Sessions'))->addActionLink($terminate_button);
$hisec = $viewer->getSession()->getHighSecurityUntil() - time();
if ($hisec > 0) {
$hisec_icon = id(new PHUIIconView())->setIconFont('fa-lock');
$hisec_button = id(new PHUIButtonView())->setText(pht('Leave High Security'))->setHref('/auth/session/downgrade/')->setTag('a')->setWorkflow(true)->setIcon($hisec_icon);
$header->addActionLink($hisec_button);
}
$panel = id(new PHUIObjectBoxView())->setHeader($header)->setTable($table);
return $panel;
}
示例12: renderList
private function renderList()
{
$table = new AphrontTableView($this->getListRows());
$table->setRowClasses($this->getListRowClasses());
$table->setHeaders(array('File ID', 'Author', 'Name', 'Size', '', '', 'Created', ''));
$table->setColumnClasses(array(null, '', 'wide pri', 'right', 'action', 'action', '', 'right'));
$panel = new AphrontPanelView();
$panel->appendChild($table);
$panel->setHeader($this->getListHeader());
if ($this->showListPager()) {
$panel->appendChild($this->getListPager());
}
return $panel;
}
示例13: processRequest
public function processRequest(AphrontRequest $request)
{
$user = $this->getUser();
$editable = PhabricatorEnv::getEnvConfig('account.editable');
$uri = $request->getRequestURI();
$uri->setQueryParams(array());
if ($editable) {
$new = $request->getStr('new');
if ($new) {
return $this->returnNewAddressResponse($request, $uri, $new);
}
$delete = $request->getInt('delete');
if ($delete) {
return $this->returnDeleteAddressResponse($request, $uri, $delete);
}
}
$verify = $request->getInt('verify');
if ($verify) {
return $this->returnVerifyAddressResponse($request, $uri, $verify);
}
$primary = $request->getInt('primary');
if ($primary) {
return $this->returnPrimaryAddressResponse($request, $uri, $primary);
}
$emails = id(new PhabricatorUserEmail())->loadAllWhere('userPHID = %s ORDER BY address', $user->getPHID());
$rowc = array();
$rows = array();
foreach ($emails as $email) {
$button_verify = javelin_tag('a', array('class' => 'button small grey', 'href' => $uri->alter('verify', $email->getID()), 'sigil' => 'workflow'), pht('Verify'));
$button_make_primary = javelin_tag('a', array('class' => 'button small grey', 'href' => $uri->alter('primary', $email->getID()), 'sigil' => 'workflow'), pht('Make Primary'));
$button_remove = javelin_tag('a', array('class' => 'button small grey', 'href' => $uri->alter('delete', $email->getID()), 'sigil' => 'workflow'), pht('Remove'));
$button_primary = phutil_tag('a', array('class' => 'button small disabled'), pht('Primary'));
if (!$email->getIsVerified()) {
$action = $button_verify;
} else {
if ($email->getIsPrimary()) {
$action = $button_primary;
} else {
$action = $button_make_primary;
}
}
if ($email->getIsPrimary()) {
$remove = $button_primary;
$rowc[] = 'highlighted';
} else {
$remove = $button_remove;
$rowc[] = null;
}
$rows[] = array($email->getAddress(), $action, $remove);
}
$table = new AphrontTableView($rows);
$table->setHeaders(array(pht('Email'), pht('Status'), pht('Remove')));
$table->setColumnClasses(array('wide', 'action', 'action'));
$table->setRowClasses($rowc);
$table->setColumnVisibility(array(true, true, $editable));
$view = new PHUIObjectBoxView();
$header = new PHUIHeaderView();
$header->setHeader(pht('Email Addresses'));
if ($editable) {
$button = new PHUIButtonView();
$button->setText(pht('Add New Address'));
$button->setTag('a');
$button->setHref($uri->alter('new', 'true'));
$button->setIcon('fa-plus');
$button->addSigil('workflow');
$header->addActionLink($button);
}
$view->setHeader($header);
$view->setTable($table);
return $view;
}
示例14: render
public function render()
{
$user = $this->user;
$authority = array_fill_keys($this->authorityPHIDs, true);
$rowc = array();
$last = null;
$rows = array();
foreach ($this->audits as $audit) {
$commit_phid = $audit->getCommitPHID();
if ($last == $commit_phid) {
$commit_name = null;
$commit_desc = null;
} else {
$commit_name = $this->getHandle($commit_phid)->renderLink();
$commit_desc = $this->getCommitDescription($commit_phid);
$last = $commit_phid;
}
$reasons = $audit->getAuditReasons();
foreach ($reasons as $key => $reason) {
$reasons[$key] = phutil_escape_html($reason);
}
$reasons = implode('<br />', $reasons);
$status_code = $audit->getAuditStatus();
$status = PhabricatorAuditStatusConstants::getStatusName($status_code);
$auditor_handle = $this->getHandle($audit->getAuditorPHID());
$rows[] = array($commit_name, phutil_escape_html($commit_desc), $auditor_handle->renderLink(), phutil_escape_html($status), $reasons);
$row_class = null;
$has_authority = !empty($authority[$audit->getAuditorPHID()]);
if ($has_authority) {
$commit_author = $this->commits[$commit_phid]->getAuthorPHID();
// You don't have authority over package and project audits on your own
// commits.
$auditor_is_user = $audit->getAuditorPHID() == $user->getPHID();
$user_is_author = $commit_author == $user->getPHID();
if ($auditor_is_user || !$user_is_author) {
$row_class = 'highlighted';
}
}
$rowc[] = $row_class;
}
$table = new AphrontTableView($rows);
$table->setHeaders(array('Commit', 'Description', 'Auditor', 'Status', 'Details'));
$table->setColumnClasses(array('pri', $this->showDescriptions ? 'wide' : '', '', '', $this->showDescriptions ? '' : 'wide'));
$table->setRowClasses($rowc);
$table->setColumnVisibility(array($this->showDescriptions, $this->showDescriptions, true, true, true));
if ($this->noDataString) {
$table->setNoDataString($this->noDataString);
}
return $table->render();
}
示例15: statsTableView
/**
* @param string[] $rowc
*/
private function statsTableView($rows, $rowc)
{
$table = new AphrontTableView($rows);
$table->setRowClasses($rowc);
$table->setHeaders(array(pht('Period'), pht('Opened'), pht('Closed'), pht('Change')));
$table->setColumnClasses(array('left narrow', 'center narrow', 'center narrow', 'center narrow'));
return $table;
}