HCE Project DC service web UI  0.2
Hierarchical Cluster Engine DC service web UI
 All Classes Namespaces Files Functions Variables Pages
TbTotalSumColumn.php
Go to the documentation of this file.
1 <?php
10 Yii::import('booster.widgets.TbDataColumn');
11 
18 {
20 
21  public $totalValue;
22 
23  protected $total = 0;
24 
25  public function init()
26  {
27  parent::init();
28 
29  if (!is_null($this->totalExpression)) {
30  $this->total = is_numeric($this->totalExpression)
31  ? $this->totalExpression
32  : $this->evaluateExpression(
33  $this->totalExpression
34  );
35  }
36  $this->footer = true;
37  }
38 
39  protected function renderDataCellContent($row, $data)
40  {
41  ob_start();
43  $value = ob_get_clean();
44 
45  if (is_numeric($value)) {
46  $this->total += $value;
47  }
48  echo $value;
49  }
50 
51  protected function renderFooterCellContent()
52  {
53  if (is_null($this->total)) {
55  }
56 
57  echo $this->totalValue ? $this->evaluateExpression($this->totalValue, array('total' => $this->total))
58  : $this->grid->getFormatter()->format($this->total, $this->type);
59  }
60 }