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


PHP PhabricatorApplicationTransaction::getTransactionGroup方法代码示例

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


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

示例1: renderTransactionContent

 protected function renderTransactionContent(PhabricatorApplicationTransaction $xaction)
 {
     $out = array();
     $group = $xaction->getTransactionGroup();
     if ($xaction->getTransactionType() == PholioTransaction::TYPE_INLINE) {
         array_unshift($group, $xaction);
     } else {
         $out[] = parent::renderTransactionContent($xaction);
     }
     if (!$group) {
         return $out;
     }
     $inlines = array();
     foreach ($group as $xaction) {
         switch ($xaction->getTransactionType()) {
             case PholioTransaction::TYPE_INLINE:
                 $inlines[] = $xaction;
                 break;
             default:
                 throw new Exception(pht('Unknown grouped transaction type!'));
         }
     }
     if ($inlines) {
         $icon = id(new PHUIIconView())->setIconFont('fa-comment bluegrey msr');
         $header = phutil_tag('div', array('class' => 'phabricator-transaction-subheader'), array($icon, pht('Inline Comments')));
         $out[] = $header;
         foreach ($inlines as $inline) {
             if (!$inline->getComment()) {
                 continue;
             }
             $out[] = $this->renderInlineContent($inline);
         }
     }
     return $out;
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:35,代码来源:PholioTransactionView.php

示例2: renderTransactionContent

 protected function renderTransactionContent(PhabricatorApplicationTransaction $xaction)
 {
     $out = array();
     $type_inline = DifferentialTransaction::TYPE_INLINE;
     $group = $xaction->getTransactionGroup();
     if ($xaction->getTransactionType() == $type_inline) {
         array_unshift($group, $xaction);
     } else {
         $out[] = parent::renderTransactionContent($xaction);
     }
     if (!$group) {
         return $out;
     }
     $inlines = array();
     foreach ($group as $xaction) {
         switch ($xaction->getTransactionType()) {
             case DifferentialTransaction::TYPE_INLINE:
                 $inlines[] = $xaction;
                 break;
             default:
                 throw new Exception('Unknown grouped transaction type!');
         }
     }
     if ($inlines) {
         $inline_view = new PhabricatorInlineSummaryView();
         $changesets = $this->getChangesets();
         $inline_groups = DifferentialTransactionComment::sortAndGroupInlines($inlines, $changesets);
         foreach ($inline_groups as $changeset_id => $group) {
             $changeset = $changesets[$changeset_id];
             $items = array();
             foreach ($group as $inline) {
                 $comment = $inline->getComment();
                 $item = array('id' => $comment->getID(), 'line' => $comment->getLineNumber(), 'length' => $comment->getLineLength(), 'content' => parent::renderTransactionContent($inline));
                 $changeset_diff_id = $changeset->getDiffID();
                 if ($comment->getIsNewFile()) {
                     $visible_diff_id = $this->getRightDiff()->getID();
                 } else {
                     $visible_diff_id = $this->getLeftDiff()->getID();
                 }
                 // TODO: We still get one edge case wrong here, when we have a
                 // versus diff and the file didn't exist in the old version. The
                 // comment is visible because we show the left side of the target
                 // diff when there's no corresponding file in the versus diff, but
                 // we incorrectly link it off-page.
                 $is_visible = $changeset_diff_id == $visible_diff_id;
                 if (!$is_visible) {
                     $item['where'] = pht('(On Diff #%d)', $changeset_diff_id);
                     $revision_id = $this->getRevision()->getID();
                     $comment_id = $comment->getID();
                     $item['href'] = '/D' . $revision_id . '?id=' . $changeset_diff_id . '#inline-' . $comment_id;
                 }
                 $items[] = $item;
             }
             $inline_view->addCommentGroup($changeset->getFilename(), $items);
         }
         $out[] = $inline_view;
     }
     return $out;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:59,代码来源:DifferentialTransactionView.php

示例3: renderTransactionContent

 protected function renderTransactionContent(PhabricatorApplicationTransaction $xaction)
 {
     $out = array();
     $type_inline = PhabricatorAuditActionConstants::INLINE;
     $group = $xaction->getTransactionGroup();
     if ($xaction->getTransactionType() == $type_inline) {
         array_unshift($group, $xaction);
     } else {
         $out[] = parent::renderTransactionContent($xaction);
     }
     if (!$group) {
         return $out;
     }
     $inlines = array();
     foreach ($group as $xaction) {
         switch ($xaction->getTransactionType()) {
             case PhabricatorAuditActionConstants::INLINE:
                 $inlines[] = $xaction;
                 break;
             default:
                 throw new Exception('Unknown grouped transaction type!');
         }
     }
     if ($inlines) {
         // TODO: This should do something similar to sortAndGroupInlines() to get
         // a stable ordering.
         $inlines_by_path = array();
         foreach ($inlines as $key => $inline) {
             $comment = $inline->getComment();
             if (!$comment) {
                 // TODO: Migrate these away? They probably do not exist on normal
                 // non-development installs.
                 unset($inlines[$key]);
                 continue;
             }
             $path_id = $comment->getPathID();
             $inlines_by_path[$path_id][] = $inline;
         }
         $inline_view = new PhabricatorInlineSummaryView();
         foreach ($inlines_by_path as $path_id => $group) {
             $path = idx($this->pathMap, $path_id);
             if ($path === null) {
                 continue;
             }
             $items = array();
             foreach ($group as $inline) {
                 $comment = $inline->getComment();
                 $item = array('id' => $comment->getID(), 'line' => $comment->getLineNumber(), 'length' => $comment->getLineLength(), 'content' => parent::renderTransactionContent($inline));
                 $items[] = $item;
             }
             $inline_view->addCommentGroup($path, $items);
         }
         $out[] = $inline_view;
     }
     return $out;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:56,代码来源:PhabricatorAuditTransactionView.php


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