HCE Project DC service web UI  0.2
Hierarchical Cluster Engine DC service web UI
 All Classes Namespaces Files Functions Variables Pages
TbJsonCheckBoxColumn.php
Go to the documentation of this file.
1 <?php
20 class TbJsonCheckBoxColumn extends CCheckBoxColumn
21 {
25  public function renderHeaderCell()
26  {
27  if ($this->grid->json) {
28  $this->headerHtmlOptions['id'] = $this->id;
29  if ($this->grid->json) {
30  return CMap::mergeArray(
31  $this->headerHtmlOptions,
32  array('content' => $this->renderHeaderCellContent())
33  );
34  }
35  }
37  }
38 
44  protected function renderHeaderCellContent()
45  {
46  if ($this->grid->json) {
47  if (trim($this->headerTemplate) === '') {
48  return $this->grid->blankDisplay;
49  }
50 
51  if ($this->selectableRows === null && $this->grid->selectableRows > 1) {
52  $item = CHtml::checkBox($this->id . '_all', false, array('class' => 'select-on-check-all'));
53  } else if ($this->selectableRows > 1) {
54  $item = CHtml::checkBox($this->id . '_all', false);
55  } else {
56  ob_start();
58  $item = ob_get_clean();
59  }
60 
61  return strtr(
62  $this->headerTemplate,
63  array(
64  '{item}' => $item,
65  )
66  );
67  }
69  }
70 
78  public function renderDataCell($row)
79  {
80  if ($this->grid->json) {
81  $data = $this->grid->dataProvider->data[$row];
82  $options = $this->htmlOptions;
83  if ($this->cssClassExpression !== null) {
84  $class = $this->evaluateExpression($this->cssClassExpression, array('row' => $row, 'data' => $data));
85  if (!empty($class)) {
86  if (isset($options['class'])) {
87  $options['class'] .= ' ' . $class;
88  } else {
89  $options['class'] = $class;
90  }
91  }
92  }
93 
94  return array(
95  'attrs' => CHtml::renderAttributes($options),
96  'content' => $this->renderDataCellContent($row, $data),
97  );
98  }
99 
101  }
102 
111  protected function renderDataCellContent($row, $data)
112  {
113  ob_start();
115  $html = ob_get_contents();
116  ob_end_clean();
117 
118  if ($this->grid->json) {
119  return $html;
120  }
121 
122  echo $html;
123  }
124 }