[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/differential/render/ -> DifferentialChangesetOneUpRenderer.php (source)

   1  <?php
   2  
   3  final class DifferentialChangesetOneUpRenderer
   4    extends DifferentialChangesetHTMLRenderer {
   5  
   6    public function isOneUpRenderer() {
   7      return true;
   8    }
   9  
  10    protected function renderColgroup() {
  11      return phutil_tag('colgroup', array(), array(
  12        phutil_tag('col', array('class' => 'num')),
  13        phutil_tag('col', array('class' => 'num')),
  14        phutil_tag('col', array('class' => 'unified')),
  15      ));
  16    }
  17  
  18    public function renderTextChange(
  19      $range_start,
  20      $range_len,
  21      $rows) {
  22  
  23      $primitives = $this->buildPrimitives($range_start, $range_len);
  24  
  25      $out = array();
  26      foreach ($primitives as $p) {
  27        $type = $p['type'];
  28        switch ($type) {
  29          case 'old':
  30          case 'new':
  31            $out[] = hsprintf('<tr>');
  32            if ($type == 'old') {
  33              if ($p['htype']) {
  34                $class = 'left old';
  35              } else {
  36                $class = 'left';
  37              }
  38              $out[] = phutil_tag('th', array(), $p['line']);
  39              $out[] = phutil_tag('th', array());
  40              $out[] = phutil_tag('td', array('class' => $class), $p['render']);
  41            } else if ($type == 'new') {
  42              if ($p['htype']) {
  43                $class = 'right new';
  44                $out[] = phutil_tag('th', array());
  45              } else {
  46                $class = 'right';
  47                $out[] = phutil_tag('th', array(), $p['oline']);
  48              }
  49              $out[] = phutil_tag('th', array(), $p['line']);
  50              $out[] = phutil_tag('td', array('class' => $class), $p['render']);
  51            }
  52            $out[] = hsprintf('</tr>');
  53            break;
  54          case 'inline':
  55            $out[] = hsprintf('<tr><th /><th />');
  56            $out[] = hsprintf('<td>');
  57  
  58            $inline = $this->buildInlineComment(
  59              $p['comment'],
  60              $p['right']);
  61            $inline->setBuildScaffolding(false);
  62            $out[] = $inline->render();
  63  
  64            $out[] = hsprintf('</td></tr>');
  65            break;
  66          default:
  67            $out[] = hsprintf('<tr><th /><th /><td>%s</td></tr>', $type);
  68            break;
  69        }
  70      }
  71  
  72      if ($out) {
  73        return $this->wrapChangeInTable(phutil_implode_html('', $out));
  74      }
  75      return null;
  76    }
  77  
  78    public function renderFileChange(
  79      $old_file = null,
  80      $new_file = null,
  81      $id = 0,
  82      $vs = 0) {
  83  
  84      throw new PhutilMethodNotImplementedException();
  85    }
  86  
  87  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1