本文整理汇总了PHP中phutil_render_tag函数的典型用法代码示例。如果您正苦于以下问题:PHP phutil_render_tag函数的具体用法?PHP phutil_render_tag怎么用?PHP phutil_render_tag使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了phutil_render_tag函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: processRequest
public function processRequest()
{
$items = id(new PhabricatorDirectoryItem())->loadAll();
$items = msort($items, 'getSortKey');
$categories = id(new PhabricatorDirectoryCategory())->loadAll();
$categories = msort($categories, 'getSequence');
$category_map = mpull($categories, 'getName', 'getID');
$category_map[0] = 'Free Radicals';
$items = mgroup($items, 'getCategoryID');
require_celerity_resource('phabricator-directory-css');
$content = array();
foreach ($category_map as $id => $category_name) {
$category_items = idx($items, $id);
if (!$category_items) {
continue;
}
$item_markup = array();
foreach ($category_items as $item) {
$item_markup[] = '<div>' . '<h2>' . phutil_render_tag('a', array('href' => $item->getHref()), phutil_escape_html($item->getName())) . '</h2>' . '<p>' . phutil_escape_html($item->getDescription()) . '</p>' . '</div>';
}
$content[] = '<div class="aphront-directory-category">' . '<h1>' . phutil_escape_html($category_name) . '</h1>' . '<div class="aphront-directory-group">' . implode("\n", $item_markup) . '</div>' . '</div>';
}
$content = '<div class="aphront-directory-list">' . implode("\n", $content) . '</div>';
return $this->buildStandardPageResponse($content, array('title' => 'Directory', 'tab' => 'directory'));
}
开发者ID:nguyennamtien,项目名称:phabricator,代码行数:25,代码来源:PhabricatorDirectoryMainController.php
示例2: 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();
}
开发者ID:nexeck,项目名称:phabricator,代码行数:30,代码来源:DiffusionBranchTableView.php
示例3: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
$timer = id(new PhabricatorTimer())->load($this->id);
if (!$timer) {
return new Aphront404Response();
}
require_celerity_resource('phabricator-countdown-css');
$chrome_visible = $request->getBool('chrome', true);
$chrome_new = $chrome_visible ? false : null;
$chrome_link = phutil_render_tag('a', array('href' => $request->getRequestURI()->alter('chrome', $chrome_new), 'class' => 'phabricator-timer-chrome-link'), $chrome_visible ? 'Disable Chrome' : 'Enable Chrome');
$content = '<div class="phabricator-timer">
<h1 class="phabricator-timer-header">' . phutil_escape_html($timer->getTitle()) . ' · ' . phabricator_datetime($timer->getDatePoint(), $user) . '</h1>
<div class="phabricator-timer-pane">
<table class="phabricator-timer-table">
<tr>
<th>Days</th>
<th>Hours</th>
<th>Minutes</th>
<th>Seconds</th>
</tr>
<tr>
<td id="phabricator-timer-days"></td>
<td id="phabricator-timer-hours"></td>
<td id="phabricator-timer-minutes"></td>
<td id="phabricator-timer-seconds"></td>
</table>
</div>' . $chrome_link . '</div>';
Javelin::initBehavior('countdown-timer', array('timestamp' => $timer->getDatepoint()));
$panel = $content;
return $this->buildStandardPageResponse($panel, array('title' => 'Countdown: ' . $timer->getTitle(), 'chrome' => $chrome_visible));
}
开发者ID:nexeck,项目名称:phabricator,代码行数:33,代码来源:PhabricatorCountdownViewController.php
示例4: render
public final function render()
{
require_celerity_resource('aphront-error-view-css');
$errors = $this->errors;
if ($errors) {
$list = array();
foreach ($errors as $error) {
$list[] = phutil_render_tag('li', array(), phutil_escape_html($error));
}
$list = '<ul>' . implode("\n", $list) . '</ul>';
} else {
$list = null;
}
$title = $this->title;
if (strlen($title)) {
$title = '<h1>' . phutil_escape_html($title) . '</h1>';
} else {
$title = null;
}
$this->severity = nonempty($this->severity, self::SEVERITY_ERROR);
$this->width = nonempty($this->width, self::WIDTH_DEFAULT);
$more_classes = array();
$more_classes[] = 'aphront-error-severity-' . $this->severity;
$more_classes[] = 'aphront-error-width-' . $this->width;
$more_classes = implode(' ', $more_classes);
return phutil_render_tag('div', array('id' => $this->id, 'class' => 'aphront-error-view ' . $more_classes), $title . $this->renderChildren() . $list);
}
开发者ID:nguyennamtien,项目名称:phabricator,代码行数:27,代码来源:AphrontErrorView.php
示例5: processRequest
public function processRequest()
{
$request = $this->getRequest();
$phids = $request->getStrList('phids');
if ($phids) {
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
$rows = array();
foreach ($handles as $handle) {
if ($handle->getURI()) {
$link = phutil_render_tag('a', array('href' => $handle->getURI()), phutil_escape_html($handle->getURI()));
} else {
$link = null;
}
$rows[] = array(phutil_escape_html($handle->getPHID()), phutil_escape_html($handle->getType()), phutil_escape_html($handle->getName()), $link);
}
$table = new AphrontTableView($rows);
$table->setHeaders(array('PHID', 'Type', 'Name', 'URI'));
$table->setColumnClasses(array(null, null, null, 'wide'));
$panel = new AphrontPanelView();
$panel->setHeader('PHID Handles');
$panel->appendChild($table);
return $this->buildStandardPageResponse($panel, array('title' => 'PHID Lookup Results'));
}
$lookup_form = new AphrontFormView();
$lookup_form->setUser($request->getUser());
$lookup_form->setAction('/phid/')->appendChild(id(new AphrontFormTextAreaControl())->setName('phids')->setCaption('Enter PHIDs separated by spaces or commas.'))->appendChild(id(new AphrontFormSubmitControl())->setValue('Lookup PHIDs'));
$lookup_panel = new AphrontPanelView();
$lookup_panel->setHeader('Lookup PHIDs');
$lookup_panel->appendChild($lookup_form);
$lookup_panel->setWidth(AphrontPanelView::WIDTH_WIDE);
return $this->buildStandardPageResponse(array($lookup_panel), array('title' => 'PHID Lookup'));
}
开发者ID:nexeck,项目名称:phabricator,代码行数:32,代码来源:PhabricatorPHIDLookupController.php
示例6: processRequest
public function processRequest()
{
$title = 'OAuth Clients';
$request = $this->getRequest();
$current_user = $request->getUser();
$offset = $request->getInt('offset', 0);
$page_size = 100;
$pager = new AphrontPagerView();
$request_uri = $request->getRequestURI();
$pager->setURI($request_uri, 'offset');
$pager->setPageSize($page_size);
$pager->setOffset($offset);
$query = new PhabricatorOAuthServerClientQuery();
$query->withCreatorPHIDs(array($current_user->getPHID()));
$clients = $query->executeWithPager($pager);
$rows = array();
$rowc = array();
$highlight = $this->getHighlightPHIDs();
foreach ($clients as $client) {
$row = array(phutil_render_tag('a', array('href' => $client->getViewURI()), phutil_escape_html($client->getName())), $client->getPHID(), $client->getSecret(), phutil_render_tag('a', array('href' => $client->getRedirectURI()), phutil_escape_html($client->getRedirectURI())), phutil_render_tag('a', array('class' => 'small button grey', 'href' => $client->getEditURI()), 'Edit'));
$rows[] = $row;
if (isset($highlight[$client->getPHID()])) {
$rowc[] = 'highlighted';
} else {
$rowc[] = '';
}
}
$panel = $this->buildClientList($rows, $rowc, $title);
return $this->buildStandardPageResponse(array($this->getNoticeView(), $panel->appendChild($pager)), array('title' => $title));
}
开发者ID:nexeck,项目名称:phabricator,代码行数:30,代码来源:PhabricatorOAuthClientListController.php
示例7: renderValueForRevisionView
public function renderValueForRevisionView()
{
$diff = $this->getDiff();
$path_changesets = mpull($diff->loadChangesets(), 'getId', 'getFilename');
$lstar = DifferentialRevisionUpdateHistoryView::renderDiffLintStar($diff);
$lmsg = DifferentialRevisionUpdateHistoryView::getDiffLintMessage($diff);
$ldata = $this->getDiffProperty('arc:lint');
$ltail = null;
if ($ldata) {
$ldata = igroup($ldata, 'path');
$lint_messages = array();
foreach ($ldata as $path => $messages) {
$message_markup = array();
foreach ($messages as $message) {
$path = idx($message, 'path');
$line = idx($message, 'line');
$code = idx($message, 'code');
$severity = idx($message, 'severity');
$name = idx($message, 'name');
$description = idx($message, 'description');
$line_link = phutil_escape_html($line);
if (isset($path_changesets[$path])) {
// TODO: Create standalone links for large diffs. Logic is in
// DifferentialDiffTableOfContentsView::renderChangesetLink().
$line_link = phutil_render_tag('a', array('href' => '#C' . $path_changesets[$path] . 'NL' . $line), $line_link);
}
$message_markup[] = hsprintf('<li>' . '<span class="lint-severity-%s">%s</span> (%s) %s ' . 'at line ' . $line_link . '<p>%s</p>' . '</li>', $severity, ucwords($severity), $code, $name, $description);
}
$lint_messages[] = '<li class="lint-file-block">' . 'Lint for <strong>' . phutil_escape_html($path) . '</strong>' . '<ul>' . implode("\n", $message_markup) . '</ul>' . '</li>';
}
$lexcuse = $this->getLintExcuse();
$ltail = '<div class="differential-lint-block">' . $lexcuse . '<ul>' . implode("\n", $lint_messages) . '</ul>' . '</div>';
}
return $lstar . ' ' . $lmsg . $ltail;
}
开发者ID:ramons03,项目名称:phabricator,代码行数:35,代码来源:DifferentialLintFieldSpecification.php
示例8: markupDocumentLink
public function markupDocumentLink($matches)
{
$slug = trim($matches[1]);
$name = trim(idx($matches, 2, $slug));
// If whatever is being linked to begins with "/" or has "://", treat it
// as a URI instead of a wiki page.
$is_uri = preg_match('@(^/)|(://)@', $slug);
if ($is_uri) {
$protocols = $this->getEngine()->getConfig('uri.allowed-protocols', array());
$protocol = id(new PhutilURI($slug))->getProtocol();
if (!idx($protocols, $protocol)) {
// Don't treat this as a URI if it's not an allowed protocol.
$is_uri = false;
}
}
if ($is_uri) {
$uri = $slug;
// Leave the name unchanged, i.e. link the whole URI if there's no
// explicit name.
} else {
$name = explode('/', trim($name, '/'));
$name = end($name);
$slug = PhrictionDocument::normalizeSlug($slug);
$uri = PhrictionDocument::getSlugURI($slug);
}
return $this->getEngine()->storeText(phutil_render_tag('a', array('href' => $uri, 'class' => $is_uri ? null : 'phriction-link'), phutil_escape_html($name)));
}
开发者ID:netcomtec,项目名称:phabricator,代码行数:27,代码来源:PhabricatorRemarkupRulePhriction.php
示例9: processRequest
public function processRequest()
{
$drequest = $this->diffusionRequest;
$request = $this->getRequest();
$page_size = $request->getInt('pagesize', 100);
$offset = $request->getInt('page', 0);
$history_query = DiffusionHistoryQuery::newFromDiffusionRequest($drequest);
$history_query->setOffset($offset);
$history_query->setLimit($page_size + 1);
if (!$request->getBool('copies')) {
$history_query->needDirectChanges(true);
$history_query->needChildChanges(true);
}
$history = $history_query->loadHistory();
$phids = array();
foreach ($history as $item) {
$data = $item->getCommitData();
if ($data) {
if ($data->getCommitDetail('authorPHID')) {
$phids[$data->getCommitDetail('authorPHID')] = true;
}
}
}
$phids = array_keys($phids);
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
$pager = new AphrontPagerView();
$pager->setPageSize($page_size);
$pager->setOffset($offset);
if (count($history) == $page_size + 1) {
array_pop($history);
$pager->setHasMorePages(true);
} else {
$pager->setHasMorePages(false);
}
$pager->setURI($request->getRequestURI(), 'page');
$content = array();
$content[] = $this->buildCrumbs(array('branch' => true, 'path' => true, 'view' => 'history'));
if ($request->getBool('copies')) {
$button_title = 'Hide Copies/Branches';
} else {
$button_title = 'Show Copies/Branches';
}
$button_uri = $request->getRequestURI()->alter('copies', !$request->getBool('copies'));
$button = phutil_render_tag('a', array('class' => 'button small grey', 'href' => $button_uri), phutil_escape_html($button_title));
$history_table = new DiffusionHistoryTableView();
$history_table->setDiffusionRequest($drequest);
$history_table->setHandles($handles);
$history_table->setHistory($history);
$history_panel = new AphrontPanelView();
$history_panel->setHeader('History');
$history_panel->addButton($button);
$history_panel->appendChild($history_table);
$history_panel->appendChild($pager);
$content[] = $history_panel;
// TODO: Sometimes we do have a change view, we need to look at the most
// recent history entry to figure it out.
$nav = $this->buildSideNav('history', false);
$nav->appendChild($content);
return $this->buildStandardPageResponse($nav, array('title' => 'history'));
}
开发者ID:nguyennamtien,项目名称:phabricator,代码行数:60,代码来源:DiffusionHistoryController.php
示例10: 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 $change) {
$path = $change->getPath();
$hash = substr(md5($path), 0, 8);
if ($change->getFileType() == DifferentialChangeType::FILE_DIRECTORY) {
$path .= '/';
}
$path_column = phutil_render_tag('a', array('href' => '#' . $hash), 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();
}
开发者ID:nexeck,项目名称:phabricator,代码行数:31,代码来源:DiffusionCommitChangeTableView.php
示例11: render
public function render()
{
$application = $this->application;
require_celerity_resource('phabricator-application-launch-view-css');
$content = array();
$content[] = phutil_render_tag('span', array('class' => 'phabricator-application-launch-name'), phutil_escape_html($application->getName()));
$content[] = phutil_render_tag('span', array('class' => 'phabricator-application-launch-description'), phutil_escape_html($application->getShortDescription()));
$count = 0;
if ($this->status) {
$content[] = '<span class="phabricator-application-status-block">';
foreach ($this->status as $status) {
$count += $status->getCount();
$content[] = $status;
}
$content[] = '</span>';
}
if ($count) {
$content[] = phutil_render_tag('span', array('class' => 'phabricator-application-launch-attention'), phutil_escape_html($count));
}
$classes = array();
$classes[] = 'phabricator-application-launch-icon';
$styles = array();
if ($application->getIconURI()) {
$styles[] = 'background-image: url(' . $application->getIconURI() . ')';
} else {
$autosprite = $application->getAutospriteName();
$classes[] = 'autosprite';
$classes[] = 'app-' . $autosprite . '-full';
}
$icon = phutil_render_tag('span', array('class' => implode(' ', $classes), 'style' => nonempty(implode('; ', $styles), null)), '');
return phutil_render_tag('a', array('class' => 'phabricator-application-launch-container', 'href' => $application->getBaseURI()), $icon . $this->renderSingleView($content));
}
开发者ID:neoxen,项目名称:phabricator,代码行数:32,代码来源:PhabricatorApplicationLaunchView.php
示例12: 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'));
}
开发者ID:nguyennamtien,项目名称:phabricator,代码行数:29,代码来源:PhabricatorPasteListController.php
示例13: buildView
public function buildView()
{
if (!$this->user) {
throw new Exception('Call setUser() before buildView()!');
}
$user = $this->user;
$stories = $this->stories;
$handles = array();
if ($stories) {
$handle_phids = array_mergev(mpull($stories, 'getRequiredHandlePHIDs'));
$object_phids = array_mergev(mpull($stories, 'getRequiredObjectPHIDs'));
$handles = id(new PhabricatorObjectHandleData($handle_phids))->loadHandles();
}
$null_view = new AphrontNullView();
require_celerity_resource('phabricator-feed-css');
$last_date = null;
foreach ($stories as $story) {
$story->setHandles($handles);
$story->setFramed($this->framed);
$date = ucfirst(phabricator_relative_date($story->getEpoch(), $user));
if ($date !== $last_date) {
if ($last_date !== null) {
$null_view->appendChild('<div class="phabricator-feed-story-date-separator"></div>');
}
$last_date = $date;
$null_view->appendChild(phutil_render_tag('div', array('class' => 'phabricator-feed-story-date'), phutil_escape_html($date)));
}
$view = $story->renderView();
$view->setViewer($user);
$null_view->appendChild($view);
}
return id(new AphrontNullView())->appendChild('<div class="phabricator-feed-frame">' . $null_view->render() . '</div>');
}
开发者ID:nexeck,项目名称:phabricator,代码行数:33,代码来源:PhabricatorFeedBuilder.php
示例14: processRequest
public function processRequest()
{
$request = $this->getRequest();
$nav = new AphrontSideNavView();
$links = array('calls' => 'All Calls');
if (empty($links[$this->view])) {
$this->view = key($links);
}
foreach ($links as $slug => $name) {
$nav->addNavItem(phutil_render_tag('a', array('href' => '/conduit/log/view/' . $slug . '/', 'class' => $slug == $this->view ? 'aphront-side-nav-selected' : null), phutil_escape_html($name)));
}
$conn_table = new PhabricatorConduitConnectionLog();
$call_table = new PhabricatorConduitMethodCallLog();
$conn_r = $call_table->establishConnection('r');
$pager = new AphrontPagerView();
$pager->setOffset($request->getInt('page'));
$calls = $call_table->loadAllWhere('1 = 1 ORDER BY id DESC LIMIT %d, %d', $pager->getOffset(), $pager->getPageSize() + 1);
$calls = $pager->sliceResults($calls);
$pager->setURI(new PhutilURI('/conduit/log/view/' . $this->view . '/'), 'page');
$pager->setEnableKeyboardShortcuts(true);
$min = $pager->getOffset() + 1;
$max = $min + count($calls) - 1;
$conn_ids = array_filter(mpull($calls, 'getConnectionID'));
$conns = array();
if ($conn_ids) {
$conns = $conn_table->loadAllWhere('id IN (%Ld)', $conn_ids);
}
$table = $this->renderCallTable($calls, $conns);
$panel = new AphrontPanelView();
$panel->setHeader('Conduit Method Calls (' . $min . '-' . $max . ')');
$panel->appendChild($table);
$panel->appendChild($pager);
$nav->appendChild($panel);
return $this->buildStandardPageResponse($nav, array('title' => 'Conduit Logs', 'tab' => 'logs'));
}
开发者ID:netcomtec,项目名称:phabricator,代码行数:35,代码来源:PhabricatorConduitLogController.php
示例15: render
public final function render()
{
require_celerity_resource('aphront-error-view-css');
$errors = $this->errors;
if ($errors) {
$list = array();
foreach ($errors as $error) {
$list[] = phutil_render_tag('li', array(), phutil_escape_html($error));
}
$list = phutil_render_tag('ul', array('class' => 'aphront-error-view-list'), implode("\n", $list));
} else {
$list = null;
}
$title = $this->title;
if (strlen($title)) {
$title = phutil_render_tag('h1', array('class' => 'aphront-error-view-head'), phutil_escape_html($title));
} else {
$title = null;
}
$this->severity = nonempty($this->severity, self::SEVERITY_ERROR);
$more_classes = array();
$more_classes[] = 'aphront-error-severity-' . $this->severity;
$more_classes = implode(' ', $more_classes);
return phutil_render_tag('div', array('id' => $this->id, 'class' => 'aphront-error-view ' . $more_classes), $title . phutil_render_tag('div', array('class' => 'aphront-error-view-body'), $this->renderChildren() . $list));
}
开发者ID:rudimk,项目名称:phabricator,代码行数:25,代码来源:AphrontErrorView.php
示例16: phabricator_render_form
function phabricator_render_form(PhabricatorUser $user, $attributes, $content)
{
if (strcasecmp(idx($attributes, 'method'), 'POST') == 0 && !preg_match('#^(https?:|//)#', idx($attributes, 'action'))) {
$content = phutil_render_tag('input', array('type' => 'hidden', 'name' => AphrontRequest::getCSRFTokenName(), 'value' => $user->getCSRFToken())) . phutil_render_tag('input', array('type' => 'hidden', 'name' => '__form__', 'value' => true)) . $content;
}
return javelin_render_tag('form', $attributes, $content);
}
开发者ID:nexeck,项目名称:phabricator,代码行数:7,代码来源:markup.php
示例17: render
public function render()
{
$handle = $this->handle;
$type_name = nonempty($handle->getTypeName(), 'Document');
require_celerity_resource('phabricator-search-results-css');
$link = phutil_render_tag('a', array('href' => $handle->getURI()), PhabricatorEnv::getProductionURI($handle->getURI()));
$img = $handle->getImageURI();
if ($img) {
$img = phutil_render_tag('div', array('class' => 'result-image', 'style' => "background-image: url('{$img}');"), '');
}
switch ($handle->getType()) {
case PhabricatorPHIDConstants::PHID_TYPE_CMIT:
$object_name = $handle->getName();
if ($this->object) {
$data = $this->object->getCommitData();
$summary = $data->getSummary();
if (strlen($summary)) {
$object_name = $handle->getName() . ': ' . $data->getSummary();
}
}
break;
default:
$object_name = $handle->getFullName();
break;
}
return '<div class="phabricator-search-result">' . $img . '<div class="result-desc">' . phutil_render_tag('a', array('class' => 'result-name', 'href' => $handle->getURI()), $this->emboldenQuery($object_name)) . '<div class="result-type">' . $type_name . ' · ' . $link . '</div>' . '</div>' . '<div style="clear: both;"></div>' . '</div>';
}
开发者ID:ramons03,项目名称:phabricator,代码行数:27,代码来源:PhabricatorSearchResultView.php
示例18: 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'));
}
开发者ID:rudimk,项目名称:phabricator,代码行数:26,代码来源:DrydockResourceListController.php
示例19: processRequest
public function processRequest()
{
$request = $this->getRequest();
if ($request->isFormPost()) {
$parser = new ArcanistDiffParser();
$diff = null;
try {
$diff = PhabricatorFile::readUploadedFileData($_FILES['diff-file']);
} catch (Exception $ex) {
$diff = $request->getStr('diff');
}
$changes = $parser->parseDiff($diff);
$diff = DifferentialDiff::newFromRawChanges($changes);
$diff->setLintStatus(DifferentialLintStatus::LINT_SKIP);
$diff->setUnitStatus(DifferentialLintStatus::LINT_SKIP);
$diff->setAuthorPHID($request->getUser()->getPHID());
$diff->setCreationMethod('web');
$diff->save();
return id(new AphrontRedirectResponse())->setURI('/differential/diff/' . $diff->getID() . '/');
}
$form = new AphrontFormView();
$arcanist_href = PhabricatorEnv::getDoclink('article/Arcanist_User_Guide.html');
$arcanist_link = phutil_render_tag('a', array('href' => $arcanist_href, 'target' => '_blank'), 'Arcanist');
$form->setAction('/differential/diff/create/')->setEncType('multipart/form-data')->setUser($request->getUser())->appendChild('<p class="aphront-form-instructions">The best way to create a ' . "Differential diff is by using {$arcanist_link}, but you " . 'can also just paste a diff (e.g., from <tt>svn diff</tt> or ' . '<tt>git diff</tt>) into this box or upload it as a file if you ' . 'really want.</p>')->appendChild(id(new AphrontFormTextAreaControl())->setLabel('Raw Diff')->setName('diff')->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL))->appendChild(id(new AphrontFormFileControl())->setLabel('Raw Diff from file')->setName('diff-file'))->appendChild(id(new AphrontFormSubmitControl())->setValue("Create Diff »"));
$panel = new AphrontPanelView();
$panel->setHeader('Create New Diff');
$panel->appendChild($form);
$panel->setWidth(AphrontPanelView::WIDTH_FORM);
return $this->buildStandardPageResponse($panel, array('title' => 'Create Diff', 'tab' => 'create'));
}
开发者ID:netcomtec,项目名称:phabricator,代码行数:30,代码来源:DifferentialDiffCreateController.php
示例20: buildNavItems
private function buildNavItems()
{
$classes = $this->getAllMethodImplementationClasses();
$method_names = array();
foreach ($classes as $method_class) {
$method_name = ConduitAPIMethod::getAPIMethodNameFromClassName($method_class);
$parts = explode('.', $method_name);
$method_names[] = array('full_name' => $method_name, 'group_name' => reset($parts));
}
$method_names = igroup($method_names, 'group_name');
ksort($method_names);
$items = array();
foreach ($method_names as $group => $methods) {
$items[] = phutil_render_tag('a', array(), phutil_escape_html($group));
foreach ($methods as $method) {
$method_name = $method['full_name'];
$selected = $method_name == $this->method;
$items[] = phutil_render_tag('a', array('class' => $selected ? 'aphront-side-nav-selected' : null, 'href' => '/conduit/method/' . $method_name), '<span style="padding-left: 1em;">' . phutil_escape_html($method_name) . '</span>');
}
$items[] = '<hr />';
}
// Pop off the last '<hr />'.
array_pop($items);
return $items;
}
开发者ID:hunterbridges,项目名称:phabricator,代码行数:25,代码来源:PhabricatorConduitConsoleController.php
注:本文中的phutil_render_tag函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论