当前位置: 首页>>代码示例>>PHP>>正文


PHP AphrontPanelView::setCaption方法代码示例

本文整理汇总了PHP中AphrontPanelView::setCaption方法的典型用法代码示例。如果您正苦于以下问题:PHP AphrontPanelView::setCaption方法的具体用法?PHP AphrontPanelView::setCaption怎么用?PHP AphrontPanelView::setCaption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AphrontPanelView的用法示例。


在下文中一共展示了AphrontPanelView::setCaption方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: buildTagListTable

 private function buildTagListTable(DiffusionRequest $drequest)
 {
     $tag_limit = 15;
     $query = DiffusionTagListQuery::newFromDiffusionRequest($drequest);
     $query->setLimit($tag_limit + 1);
     $tags = $query->loadTags();
     if (!$tags) {
         return null;
     }
     $more_tags = count($tags) > $tag_limit;
     $tags = array_slice($tags, 0, $tag_limit);
     $commits = id(new PhabricatorAuditCommitQuery())->withIdentifiers($drequest->getRepository()->getID(), mpull($tags, 'getCommitIdentifier'))->needCommitData(true)->execute();
     $view = new DiffusionTagListView();
     $view->setDiffusionRequest($drequest);
     $view->setTags($tags);
     $view->setUser($this->getRequest()->getUser());
     $view->setCommits($commits);
     $phids = $view->getRequiredHandlePHIDs();
     $handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
     $view->setHandles($handles);
     $panel = new AphrontPanelView();
     $panel->setHeader('Tags');
     if ($more_tags) {
         $panel->setCaption('Showing the ' . $tag_limit . ' most recent tags.');
     }
     $panel->addButton(phutil_render_tag('a', array('href' => $drequest->generateURI(array('action' => 'tags')), 'class' => 'grey button'), "Show All Tags »"));
     $panel->appendChild($view);
     return $panel;
 }
开发者ID:relrod,项目名称:phabricator,代码行数:29,代码来源:DiffusionRepositoryController.php

示例2: renderBurn


//.........这里部分代码省略.........
         $new_is_open = $newv === (string) ManiphestTaskStatus::STATUS_OPEN;
         $is_open = $new_is_open && !$old_is_open;
         $is_close = $old_is_open && !$new_is_open;
         $data[$key]['_is_open'] = $is_open;
         $data[$key]['_is_close'] = $is_close;
         if (!$is_open && !$is_close) {
             // This is either some kind of bogus event, or a resolution change
             // (e.g., resolved -> invalid). Just skip it.
             continue;
         }
         $day_bucket = phabricator_format_local_time($row['dateCreated'], $user, 'Yz');
         $day_buckets[$day_bucket] = $row['dateCreated'];
         if (empty($stats[$day_bucket])) {
             $stats[$day_bucket] = array('open' => 0, 'close' => 0);
         }
         $stats[$day_bucket][$is_close ? 'close' : 'open']++;
     }
     $template = array('open' => 0, 'close' => 0);
     $rows = array();
     $rowc = array();
     $last_month = null;
     $last_month_epoch = null;
     $last_week = null;
     $last_week_epoch = null;
     $week = null;
     $month = null;
     $last = last_key($stats) - 1;
     $period = $template;
     foreach ($stats as $bucket => $info) {
         $epoch = $day_buckets[$bucket];
         $week_bucket = phabricator_format_local_time($epoch, $user, 'YW');
         if ($week_bucket != $last_week) {
             if ($week) {
                 $rows[] = $this->formatBurnRow('Week of ' . phabricator_date($last_week_epoch, $user), $week);
                 $rowc[] = 'week';
             }
             $week = $template;
             $last_week = $week_bucket;
             $last_week_epoch = $epoch;
         }
         $month_bucket = phabricator_format_local_time($epoch, $user, 'Ym');
         if ($month_bucket != $last_month) {
             if ($month) {
                 $rows[] = $this->formatBurnRow(phabricator_format_local_time($last_month_epoch, $user, 'F, Y'), $month);
                 $rowc[] = 'month';
             }
             $month = $template;
             $last_month = $month_bucket;
             $last_month_epoch = $epoch;
         }
         $rows[] = $this->formatBurnRow(phabricator_date($epoch, $user), $info);
         $rowc[] = null;
         $week['open'] += $info['open'];
         $week['close'] += $info['close'];
         $month['open'] += $info['open'];
         $month['close'] += $info['close'];
         $period['open'] += $info['open'];
         $period['close'] += $info['close'];
     }
     if ($week) {
         $rows[] = $this->formatBurnRow('Week To Date', $week);
         $rowc[] = 'week';
     }
     if ($month) {
         $rows[] = $this->formatBurnRow('Month To Date', $month);
         $rowc[] = 'month';
     }
     $rows[] = $this->formatBurnRow('All Time', $period);
     $rowc[] = 'aggregate';
     $rows = array_reverse($rows);
     $rowc = array_reverse($rowc);
     $table = new AphrontTableView($rows);
     $table->setRowClasses($rowc);
     $table->setHeaders(array('Period', 'Opened', 'Closed', 'Change'));
     $table->setColumnClasses(array('right wide', 'n', 'n', 'n'));
     if ($handle) {
         $header = "Task Burn Rate for Project " . $handle->renderLink();
         $caption = "<p>NOTE: This table reflects tasks <em>currently</em> in " . "the project. If a task was opened in the past but added to " . "the project recently, it is counted on the day it was " . "opened, not the day it was categorized. If a task was part " . "of this project in the past but no longer is, it is not " . "counted at all.</p>";
     } else {
         $header = "Task Burn Rate for All Tasks";
         $caption = null;
     }
     $panel = new AphrontPanelView();
     $panel->setHeader($header);
     $panel->setCaption($caption);
     $panel->appendChild($table);
     $tokens = array();
     if ($handle) {
         $tokens = array($handle->getPHID() => $handle->getFullName());
     }
     $filter = $this->renderReportFilters($tokens, $has_window = false);
     $id = celerity_generate_unique_node_id();
     $chart = phutil_render_tag('div', array('id' => $id, 'style' => 'border: 1px solid #6f6f6f; ' . 'margin: 1em 2em; ' . 'height: 400px; '), '');
     list($burn_x, $burn_y) = $this->buildSeries($data);
     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($burn_x), 'y' => array($burn_y), 'xformat' => 'epoch'));
     return array($filter, $chart, $panel);
 }
开发者ID:rudimk,项目名称:phabricator,代码行数:101,代码来源:ManiphestReportController.php

示例3: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $uri = $request->getStr('uri');
     $id = $request->getStr('id');
     $repositories = id(new PhabricatorRepository())->loadAll();
     if ($uri) {
         $uri_path = id(new PhutilURI($uri))->getPath();
         $matches = array();
         // Try to figure out which tracked repository this external lives in by
         // comparing repository metadata. We look for an exact match, but accept
         // a partial match.
         foreach ($repositories as $key => $repository) {
             $remote_uri = new PhutilURI($repository->getRemoteURI());
             if ($remote_uri->getPath() == $uri_path) {
                 $matches[$key] = 1;
             }
             if ($repository->getPublicRemoteURI() == $uri) {
                 $matches[$key] = 2;
             }
             if ($repository->getRemoteURI() == $uri) {
                 $matches[$key] = 3;
             }
         }
         arsort($matches);
         $best_match = head_key($matches);
         if ($best_match) {
             $repository = $repositories[$best_match];
             $redirect = DiffusionRequest::generateDiffusionURI(array('action' => 'browse', 'callsign' => $repository->getCallsign(), 'branch' => $repository->getDefaultBranch(), 'commit' => $id));
             return id(new AphrontRedirectResponse())->setURI($redirect);
         }
     }
     // TODO: This is a rare query but does a table scan, add a key?
     $commits = id(new PhabricatorRepositoryCommit())->loadAllWhere('commitIdentifier = %s', $id);
     if (empty($commits)) {
         $desc = null;
         if ($uri) {
             $desc = phutil_escape_html($uri) . ', at ';
         }
         $desc .= phutil_escape_html($id);
         $content = id(new AphrontErrorView())->setTitle('Unknown External')->setSeverity(AphrontErrorView::SEVERITY_WARNING)->appendChild("<p>This external ({$desc}) does not appear in any tracked " . "repository. It may exist in an untracked repository that " . "Diffusion does not know about.</p>");
     } else {
         if (count($commits) == 1) {
             $commit = head($commits);
             $repo = $repositories[$commit->getRepositoryID()];
             $redirect = DiffusionRequest::generateDiffusionURI(array('action' => 'browse', 'callsign' => $repo->getCallsign(), 'branch' => $repo->getDefaultBranch(), 'commit' => $commit->getCommitIdentifier()));
             return id(new AphrontRedirectResponse())->setURI($redirect);
         } else {
             $rows = array();
             foreach ($commits as $commit) {
                 $repo = $repositories[$commit->getRepositoryID()];
                 $href = DiffusionRequest::generateDiffusionURI(array('action' => 'browse', 'callsign' => $repo->getCallsign(), 'branch' => $repo->getDefaultBranch(), 'commit' => $commit->getCommitIdentifier()));
                 $rows[] = array(phutil_render_tag('a', array('href' => $href), phutil_escape_html('r' . $repo->getCallsign() . $commit->getCommitIdentifier())), phutil_escape_html($commit->loadCommitData()->getSummary()));
             }
             $table = new AphrontTableView($rows);
             $table->setHeaders(array('Commit', 'Description'));
             $table->setColumnClasses(array('pri', 'wide'));
             $content = new AphrontPanelView();
             $content->setHeader('Multiple Matching Commits');
             $content->setCaption('This external reference matches multiple known commits.');
             $content->appendChild($table);
         }
     }
     return $this->buildStandardPageResponse($content, array('title' => 'Unresolvable External'));
 }
开发者ID:rudimk,项目名称:phabricator,代码行数:65,代码来源:DiffusionExternalController.php

示例4: buildCommitPanel

 public function buildCommitPanel()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $phids = array($user->getPHID());
     $query = new PhabricatorAuditCommitQuery();
     $query->withAuthorPHIDs($phids);
     $query->withStatus(PhabricatorAuditQuery::STATUS_OPEN);
     $query->needCommitData(true);
     $query->setLimit(10);
     $commits = $query->execute();
     if (!$commits) {
         return $this->renderMinipanel('No Problem Commits', 'No one has raised concerns with your commits.');
     }
     $view = new PhabricatorAuditCommitListView();
     $view->setCommits($commits);
     $view->setUser($user);
     $phids = $view->getRequiredHandlePHIDs();
     $handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
     $view->setHandles($handles);
     $panel = new AphrontPanelView();
     $panel->setHeader('Problem Commits');
     $panel->setCaption('Commits which auditors have raised concerns about.');
     $panel->appendChild($view);
     $panel->addButton(phutil_render_tag('a', array('href' => '/audit/', 'class' => 'button grey'), "View Problem Commits »"));
     return $panel;
 }
开发者ID:neoxen,项目名称:phabricator,代码行数:27,代码来源:PhabricatorDirectoryMainController.php

示例5: renderUploadPanel

 private function renderUploadPanel()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $limit_text = PhabricatorFileUploadView::renderUploadLimit();
     if ($this->useBasicUploader()) {
         $upload_panel = new PhabricatorFileUploadView();
         $upload_panel->setUser($user);
     } else {
         require_celerity_resource('files-css');
         $upload_id = celerity_generate_unique_node_id();
         $panel_id = celerity_generate_unique_node_id();
         $upload_panel = new AphrontPanelView();
         $upload_panel->setHeader('Upload Files');
         $upload_panel->setCaption($limit_text);
         $upload_panel->setCreateButton('Basic Uploader', $request->getRequestURI()->setQueryParam('basic_uploader', true));
         $upload_panel->setWidth(AphrontPanelView::WIDTH_FULL);
         $upload_panel->setID($panel_id);
         $upload_panel->appendChild(phutil_render_tag('div', array('id' => $upload_id, 'style' => 'display: none;', 'class' => 'files-drag-and-drop'), ''));
         Javelin::initBehavior('files-drag-and-drop', array('uri' => '/file/dropupload/', 'browseURI' => '/file/filter/my/', 'control' => $upload_id, 'target' => $panel_id, 'activatedClass' => 'aphront-panel-view-drag-and-drop'));
     }
     return $upload_panel;
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:23,代码来源:PhabricatorFileListController.php

示例6: buildMergesTable

 private function buildMergesTable(PhabricatorRepositoryCommit $commit)
 {
     $drequest = $this->getDiffusionRequest();
     $limit = 50;
     $merge_query = DiffusionMergedCommitsQuery::newFromDiffusionRequest($drequest);
     $merge_query->setLimit($limit + 1);
     $merges = $merge_query->loadMergedCommits();
     if (!$merges) {
         return null;
     }
     $caption = null;
     if (count($merges) > $limit) {
         $merges = array_slice($merges, 0, $limit);
         $caption = "This commit merges more than {$limit} changes. Only the first " . "{$limit} are shown.";
     }
     $history_table = new DiffusionHistoryTableView();
     $history_table->setDiffusionRequest($drequest);
     $history_table->setHistory($merges);
     $phids = $history_table->getRequiredHandlePHIDs();
     $handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
     $history_table->setHandles($handles);
     $panel = new AphrontPanelView();
     $panel->setHeader('Merged Changes');
     $panel->setCaption($caption);
     $panel->appendChild($history_table);
     return $panel;
 }
开发者ID:ramons03,项目名称:phabricator,代码行数:27,代码来源:DiffusionCommitController.php

示例7: buildMergesTable

 private function buildMergesTable(PhabricatorRepositoryCommit $commit)
 {
     $drequest = $this->getDiffusionRequest();
     $limit = 50;
     $merges = array();
     try {
         $merges = $this->callConduitWithDiffusionRequest('diffusion.mergedcommitsquery', array('commit' => $drequest->getCommit(), 'limit' => $limit + 1));
     } catch (ConduitException $ex) {
         if ($ex->getMessage() != 'ERR-UNSUPPORTED-VCS') {
             throw $ex;
         }
     }
     if (!$merges) {
         return null;
     }
     $caption = null;
     if (count($merges) > $limit) {
         $merges = array_slice($merges, 0, $limit);
         $caption = "This commit merges more than {$limit} changes. Only the first " . "{$limit} are shown.";
     }
     $history_table = new DiffusionHistoryTableView();
     $history_table->setUser($this->getRequest()->getUser());
     $history_table->setDiffusionRequest($drequest);
     $history_table->setHistory($merges);
     $history_table->loadRevisions();
     $phids = $history_table->getRequiredHandlePHIDs();
     $handles = $this->loadViewerHandles($phids);
     $history_table->setHandles($handles);
     $panel = new AphrontPanelView();
     $panel->setHeader(pht('Merged Changes'));
     $panel->setCaption($caption);
     $panel->appendChild($history_table);
     $panel->setNoBackground();
     return $panel;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:35,代码来源:DiffusionCommitController.php


注:本文中的AphrontPanelView::setCaption方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。