empty_cells;
}
elseif (isset($this->function))
{
$out .= call_user_func($this->function, $cell);
}
else
{
$out .= $cell;
}
$out .= $this->template['cell_'.$name.'end'];
}
$out .= $this->template['row_'.$name.'end'].$this->newline;
}
$out .= $this->template['tbody_close'].$this->newline;
}
$out .= $this->template['table_close'];
// Clear table class properties before generating the table
$this->clear();
return $out;
}
// --------------------------------------------------------------------
/**
* Clears the table arrays. Useful if multiple tables are being generated
*
* @return CI_Table
*/
public function clear()
{
$this->rows = array();
$this->heading = array();
$this->auto_heading = TRUE;
return $this;
}
// --------------------------------------------------------------------
/**
* Set table data from a database result object
*
* @param CI_DB_result $db_result Database result object
* @return void
*/
protected function _set_from_db_result($object)
{
// First generate the headings from the table column names
if ($this->auto_heading === TRUE && empty($this->heading))
{
$this->heading = $this->_prep_args($object->list_fields());
}
foreach ($object->result_array() as $row)
{
$this->rows[] = $this->_prep_args($row);
}
}
// --------------------------------------------------------------------
/**
* Set table data from an array
*
* @param array $data
* @return void
*/
protected function _set_from_array($data)
{
if ($this->auto_heading === TRUE && empty($this->heading))
{
$this->heading = $this->_prep_args(array_shift($data));
}
foreach ($data as &$row)
{
$this->rows[] = $this->_prep_args($row);
}
}
// --------------------------------------------------------------------
/**
* Compile Template
*
* @return void
*/
protected function _compile_template()
{
if ($this->template === NULL)
{
$this->template = $this->_default_template();
return;
}
$this->temp = $this->_default_template();
foreach (array('table_open', 'thead_open', 'thead_close', 'heading_row_start', 'heading_row_end', 'heading_cell_start', 'heading_cell_end', 'tbody_open', 'tbody_close', 'row_start', 'row_end', 'cell_start', 'cell_end', 'row_alt_start', 'row_alt_end', 'cell_alt_start', 'cell_alt_end', 'table_close') as $val)
{
if ( ! isset($this->template[$val]))
{
$this->template[$val] = $this->temp[$val];
}
}
}
// --------------------------------------------------------------------
/**
* Default Template
*
* @return array
*/
protected function _default_template()
{
return array(
'table_open' => '
',
'thead_open' => '
',
'thead_close' => '',
'heading_row_start' => '
',
'heading_row_end' => '
',
'heading_cell_start' => '
',
'heading_cell_end' => ' | ',
'tbody_open' => '
',
'tbody_close' => '',
'row_start' => '
',
'row_end' => '
',
'cell_start' => '
',
'cell_end' => '
',
'row_alt_start' => '
',
'row_alt_end' => '
',
'cell_alt_start' => '
',
'cell_alt_end' => '
',
'table_close' => '
/*
|--------------------------------------------------------------------------
| Cookie Related Variables
|--------------------------------------------------------------------------
|
| 'cookie_prefix' = Set a cookie name prefix if you need to avoid collisions
| 'cookie_domain' = Set to .your-domain.com for site-wide cookies
| 'cookie_path' = Typically will be a forward slash
| 'cookie_secure' = Cookie will only be set if a secure HTTPS connection exists.
| 'cookie_httponly' = Cookie will only be accessible via HTTP(S) (no javascript)
|
| Note: These settings (with the exception of 'cookie_prefix' and
| 'cookie_httponly') will also affect sessions.
|
*/
$config['cookie_prefix'] = '';
$config['cookie_domain'] = '';
$config['cookie_path'] = '/';
$config['cookie_secure'] = FALSE;
$config['cookie_httponly'] = FALSE;
/*
|--------------------------------------------------------------------------
| Standardize newlines
|--------------------------------------------------------------------------
|
| Determines whether to standardize newline characters in input data,
| meaning to replace \r\n, \r, \n occurrences with the PHP_EOL value.
|
| This is particularly use