HCE Project DC service web UI  0.2
Hierarchical Cluster Engine DC service web UI
 All Classes Namespaces Files Functions Variables Pages
TbJsonDataColumn.php
Go to the documentation of this file.
1 <?php
10 Yii::import('booster.widgets.TbJsonGridColumn');
11 
22 {
30  public function renderDataCell($row)
31  {
32  if ($this->grid->json) {
33  $data = $this->grid->dataProvider->data[$row];
34  $options = $this->htmlOptions;
35  if ($this->cssClassExpression !== null) {
36  $class = $this->evaluateExpression($this->cssClassExpression, array('row' => $row, 'data' => $data));
37  if (isset($options['class'])) {
38  $options['class'] .= ' ' . $class;
39  } else {
40  $options['class'] = $class;
41  }
42  }
43  $col = array();
44  $col['attrs'] = CHtml::renderAttributes($options);
45  $col['content'] = $this->renderDataCellContent($row, $data);
46  return $col;
47  }
49  }
50 
60  public function renderDataCellContent($row, $data)
61  {
62  if ($this->grid->json) {
63  if ($this->value !== null) {
64  $value = $this->evaluateExpression($this->value, array('data' => $data, 'row' => $row));
65  } elseif ($this->name !== null) {
66  $value = CHtml::value($data, $this->name);
67  }
68  $value = !isset($value)
69  ? $this->grid->nullDisplay
70  : $this->grid->getFormatter()->format(
71  $value,
72  $this->type
73  );
74 
75  return $value;
76  }
78  }
79 }