Ejemplo n.º 1
0
 /**
  * Returns the header cell content.
  * This method will render a link that can trigger the sorting if the column is sortable.
  * @return string the header cell content.
  * @since 1.1.16
  */
 public function getHeaderCellContent()
 {
     if ($this->grid->enableSorting && $this->sortable && $this->name !== null) {
         return $this->grid->dataProvider->getSort()->link($this->name, $this->header, array('class' => 'sort-link'));
     } elseif ($this->name !== null && $this->header === null) {
         if ($this->grid->dataProvider instanceof CActiveDataProvider) {
             return CHtml::encode($this->grid->dataProvider->model->getAttributeLabel($this->name));
         } else {
             return CHtml::encode($this->name);
         }
     } else {
         return parent::getHeaderCellContent();
     }
 }
Ejemplo n.º 2
0
 /**
  * Returns the header cell content.
  * This method will render a checkbox in the header when {@link selectableRows} is greater than 1
  * or in case {@link selectableRows} is null when {@link CGridView::selectableRows} is greater than 1.
  * @return string the header cell content.
  * @since 1.1.16
  */
 public function getHeaderCellContent()
 {
     if (trim($this->headerTemplate) === '') {
         return $this->grid->blankDisplay;
     }
     if ($this->selectableRows === null && $this->grid->selectableRows > 1) {
         $item = CHtml::checkBox($this->id . '_all', false, array('class' => 'select-on-check-all'));
     } elseif ($this->selectableRows > 1) {
         $item = CHtml::checkBox($this->id . '_all', false);
     } else {
         $item = parent::getHeaderCellContent();
     }
     return strtr($this->headerTemplate, array('{item}' => $item));
 }