HCE Project DC service web UI  0.2
Hierarchical Cluster Engine DC service web UI
 All Classes Namespaces Files Functions Variables Pages
TbJsonButtonColumn.php
Go to the documentation of this file.
1 <?php
10 Yii::import('booster.widgets.TbButtonColumn');
11 
22 {
26  public function renderHeaderCell()
27  {
28  if ($this->grid->json) {
29  ob_start();
30  $this->renderHeaderCellContent();
31  $content = ob_get_contents();
32  ob_end_clean();
33 
34  return array('id' => $this->id, 'content' => $content);
35  }
37  }
38 
46  public function renderDataCell($row)
47  {
48  if ($this->grid->json) {
49  $data = $this->grid->dataProvider->data[$row];
50  $options = $this->htmlOptions;
51  if ($this->cssClassExpression !== null) {
52  $class = $this->evaluateExpression($this->cssClassExpression, array('row' => $row, 'data' => $data));
53  if (!empty($class)) {
54  if (isset($options['class'])) {
55  $options['class'] .= ' ' . $class;
56  } else {
57  $options['class'] = $class;
58  }
59  }
60  }
61 
62  return array(
63  'attrs' => CHtml::renderAttributes($options),
64  'content' => $this->renderDataCellContent($row, $data),
65  );
66  }
67 
69  }
70 
71  protected function renderDataCellContent($row, $data)
72  {
73  ob_start();
75  $html = ob_get_contents();
76  ob_end_clean();
77 
78  if ($this->grid->json) {
79  return $html;
80  }
81 
82  echo $html;
83  }
84 
88  protected function initDefaultButtons()
89  {
94  $this->buttons['delete']['click'] = strtr(
95  $this->buttons['delete']['click'],
96  array('yiiGridView' => 'yiiJsonGridView')
97  );
98  }
99 }