示例#1
0
 /**
  * add column to footers array if the $name property is set in the column
  * and if not just add a null value to footer to account for column count
  *
  * @param \GridView\Columns\Column $column
  */
 protected function setTableFooter($column)
 {
     if ($column->isVisible()) {
         $this->footers[$column->name] = $column->getFooter();
     }
 }
示例#2
0
 /**
  * add column to table. If a string is passed as column, that name will be
  * used for the $name property of the column, and a GridView\Columns\Column
  * instance will be created.
  * @param mixed $column
  * @return \GridView\Table
  */
 public function addColumn($column)
 {
     if (is_array($column)) {
         $column = new Columns\Column($column);
     }
     if (is_scalar($column)) {
         $column = new Columns\Column(array('name' => $column));
     }
     $column->setTable($this);
     $this->javascript .= $column->getJavaScript();
     // if column is not meant to be visible, like for admin reasons, take it out of the visible columns
     if (!$column->isVisible() && is_array($this->visibleColumns)) {
         $flip = array_flip($this->visibleColumns);
         unset($flip[$column->name]);
         $this->visibleColumns = $flip;
     }
     if (!$this->noFilters && $this->visibleColumns != false && !in_array($column->name, $this->visibleColumns)) {
         $column->visible = false;
     }
     if ($column->isVisible()) {
         $this->headers[] = 1;
     }
     $this->columns[] = $column;
     $this->setTableFooter($column);
     return $this;
 }