Ejemplo n.º 1
0
 /**
  * Renders the data cell content.
  * This method renders the view, update and toggle buttons in the data cell.
  * @param integer $row the row number (zero-based)
  * @param mixed $data the data associated with the row
  */
 protected function renderDataCellContent($row, $data)
 {
     $checked = CHtml::value($data, $this->name);
     $toggleOptions = $this->toggleOptions;
     $toggleOptions['icon'] = $checked === null ? $this->emptyIcon : ($checked ? $this->checkedIcon : $this->uncheckedIcon);
     $toggleOptions['url'] = isset($toggleOptions['url']) ? $this->evaluateExpression($toggleOptions['url'], array('data' => $data, 'row' => $row)) : '#';
     if (!$this->displayText) {
         $htmlOptions = WhHtml::popOption('htmlOptions', $this->toggleOptions, array());
         $htmlOptions['title'] = $this->getButtonLabel($checked);
         $htmlOptions['rel'] = 'tooltip';
         echo CHtml::link(WhHtml::icon($toggleOptions['icon']), $toggleOptions['url'], $htmlOptions);
     } else {
         echo WhHtml::button($this->getButtonLabel($checked), $toggleOptions);
     }
 }