2005-03-08 11:14:15 +00:00
|
|
|
<?php // $Id$
|
|
|
|
|
|
|
|
class flexible_table {
|
|
|
|
|
|
|
|
var $uniqueid = NULL;
|
|
|
|
var $attributes = array();
|
|
|
|
var $headers = array();
|
|
|
|
var $columns = array();
|
|
|
|
var $column_style = array();
|
2005-03-08 14:57:16 +00:00
|
|
|
var $column_class = array();
|
2005-03-08 11:14:15 +00:00
|
|
|
var $column_suppress = array();
|
|
|
|
var $setup = false;
|
|
|
|
var $sess = NULL;
|
|
|
|
var $baseurl = NULL;
|
|
|
|
|
|
|
|
var $is_collapsible = false;
|
|
|
|
var $is_sortable = false;
|
|
|
|
var $use_pages = false;
|
|
|
|
var $use_initials = false;
|
|
|
|
|
2005-03-10 16:38:01 +00:00
|
|
|
var $maxsortkeys = 2;
|
|
|
|
var $pagesize = 30;
|
|
|
|
var $currpage = 0;
|
|
|
|
var $totalrows = 0;
|
2005-03-08 11:14:15 +00:00
|
|
|
|
|
|
|
function flexible_table($uniqueid) {
|
|
|
|
$this->uniqueid = $uniqueid;
|
|
|
|
}
|
|
|
|
|
|
|
|
function sortable($bool) {
|
|
|
|
$this->is_sortable = $bool;
|
|
|
|
}
|
|
|
|
|
|
|
|
function collapsible($bool) {
|
|
|
|
$this->is_collapsible = $bool;
|
|
|
|
}
|
|
|
|
|
|
|
|
function pageable($bool) {
|
|
|
|
$this->use_pages = $bool;
|
|
|
|
}
|
|
|
|
|
|
|
|
function initialbars($bool) {
|
|
|
|
$this->use_initials = $bool;
|
|
|
|
}
|
|
|
|
|
|
|
|
function pagesize($perpage, $total) {
|
|
|
|
$this->pagesize = $perpage;
|
|
|
|
$this->totalrows = $total;
|
|
|
|
$this->use_pages = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
function set_attribute($attribute, $value) {
|
|
|
|
$this->attributes[$attribute] = $value;
|
|
|
|
}
|
|
|
|
|
|
|
|
function column_suppress($column) {
|
|
|
|
if(isset($this->column_suppress[$column])) {
|
|
|
|
$this->column_suppress[$column] = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-03-08 14:57:16 +00:00
|
|
|
function column_class($column, $classname) {
|
|
|
|
if(isset($this->column_class[$column])) {
|
|
|
|
$this->column_class[$column] = ' '.$classname; // This space needed so that classnames don't run together in the HTML
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-03-08 11:14:15 +00:00
|
|
|
function column_style($column, $property, $value) {
|
|
|
|
if(isset($this->column_style[$column])) {
|
|
|
|
$this->column_style[$column][$property] = $value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function column_style_all($property, $value) {
|
|
|
|
foreach(array_keys($this->columns) as $column) {
|
|
|
|
$this->column_style[$column][$property] = $value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function define_baseurl($url) {
|
|
|
|
$this->reseturl = $url;
|
|
|
|
if(!strpos($url, '?')) {
|
|
|
|
$this->baseurl = $url.'?';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$this->baseurl = $url.'&';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function define_columns($columns) {
|
|
|
|
$this->columns = array();
|
|
|
|
$this->column_style = array();
|
2005-03-08 14:57:16 +00:00
|
|
|
$this->column_class = array();
|
2005-03-08 11:14:15 +00:00
|
|
|
$colnum = 0;
|
|
|
|
|
|
|
|
foreach($columns as $column) {
|
|
|
|
$this->columns[$column] = $colnum++;
|
|
|
|
$this->column_style[$column] = array();
|
2005-03-08 14:57:16 +00:00
|
|
|
$this->column_class[$column] = '';
|
2005-03-08 11:14:15 +00:00
|
|
|
$this->column_suppress[$column] = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function define_headers($headers) {
|
|
|
|
$this->headers = $headers;
|
|
|
|
}
|
|
|
|
|
|
|
|
function make_styles_string(&$styles) {
|
|
|
|
if(empty($styles)) {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
|
|
|
$string = ' style="';
|
|
|
|
foreach($styles as $property => $value) {
|
|
|
|
$string .= $property.':'.$value.';';
|
|
|
|
}
|
|
|
|
$string .= '"';
|
|
|
|
return $string;
|
|
|
|
}
|
|
|
|
|
|
|
|
function make_attributes_string(&$attributes) {
|
|
|
|
if(empty($attributes)) {
|
|
|
|
return '';
|
|
|
|
}
|
2005-04-13 09:57:10 +00:00
|
|
|
|
2005-03-08 11:14:15 +00:00
|
|
|
$string = ' ';
|
|
|
|
foreach($attributes as $attr => $value) {
|
|
|
|
$string .= ($attr.'="'.$value.'" ');
|
|
|
|
}
|
2005-04-13 09:57:10 +00:00
|
|
|
|
2005-03-08 11:14:15 +00:00
|
|
|
return $string;
|
|
|
|
}
|
|
|
|
|
|
|
|
function setup() {
|
|
|
|
global $SESSION, $CFG;
|
|
|
|
|
|
|
|
if(empty($this->columns) || empty($this->uniqueid)) {
|
|
|
|
return false;
|
|
|
|
}
|
2005-04-13 09:57:10 +00:00
|
|
|
|
2005-04-14 17:43:18 +00:00
|
|
|
if (!isset($SESSION->flextable)) {
|
|
|
|
$SESSION->flextable = array();
|
2005-03-08 11:14:15 +00:00
|
|
|
}
|
2005-04-13 09:57:10 +00:00
|
|
|
|
2005-04-14 17:43:18 +00:00
|
|
|
if(!isset($SESSION->flextable[$this->uniqueid])) {
|
|
|
|
$SESSION->flextable[$this->uniqueid] = new stdClass;
|
|
|
|
$SESSION->flextable[$this->uniqueid]->uniqueid = $this->uniqueid;
|
|
|
|
$SESSION->flextable[$this->uniqueid]->collapse = array();
|
|
|
|
$SESSION->flextable[$this->uniqueid]->sortby = array();
|
|
|
|
$SESSION->flextable[$this->uniqueid]->i_first = '';
|
|
|
|
$SESSION->flextable[$this->uniqueid]->i_last = '';
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->sess = &$SESSION->flextable[$this->uniqueid];
|
2005-03-08 11:14:15 +00:00
|
|
|
|
|
|
|
if(!empty($_GET['tshow']) && isset($this->columns[$_GET['tshow']])) {
|
|
|
|
// Show this column
|
|
|
|
$this->sess->collapse[$_GET['tshow']] = false;
|
|
|
|
}
|
|
|
|
else if(!empty($_GET['thide']) && isset($this->columns[$_GET['thide']])) {
|
|
|
|
// Hide this column
|
|
|
|
$this->sess->collapse[$_GET['thide']] = true;
|
2005-03-10 16:38:01 +00:00
|
|
|
if(array_key_exists($_GET['thide'], $this->sess->sortby)) {
|
|
|
|
unset($this->sess->sortby[$_GET['thide']]);
|
2005-03-08 11:14:15 +00:00
|
|
|
}
|
|
|
|
}
|
2005-04-13 09:57:10 +00:00
|
|
|
|
2005-03-08 11:14:15 +00:00
|
|
|
// Now, update the column attributes for collapsed columns
|
|
|
|
foreach(array_keys($this->columns) as $column) {
|
|
|
|
if(!empty($this->sess->collapse[$column])) {
|
|
|
|
$this->column_style[$column]['width'] = '10px';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(
|
2005-04-13 09:57:10 +00:00
|
|
|
!empty($_GET['tsort']) &&
|
|
|
|
(isset($this->columns[$_GET['tsort']]) ||
|
2005-03-08 11:14:15 +00:00
|
|
|
(($_GET['tsort'] == 'firstname' || $_GET['tsort'] == 'lastname') && isset($this->columns['fullname']))
|
|
|
|
))
|
|
|
|
{
|
|
|
|
if(empty($this->sess->collapse[$_GET['tsort']])) {
|
2005-03-10 16:38:01 +00:00
|
|
|
if(array_key_exists($_GET['tsort'], $this->sess->sortby)) {
|
|
|
|
// This key already exists somewhere. Change its sortorder and bring it to the top.
|
|
|
|
$sortorder = $this->sess->sortby[$_GET['tsort']] == SORT_ASC ? SORT_DESC : SORT_ASC;
|
|
|
|
unset($this->sess->sortby[$_GET['tsort']]);
|
|
|
|
$this->sess->sortby = array_merge(array($_GET['tsort'] => $sortorder), $this->sess->sortby);
|
2005-03-08 11:14:15 +00:00
|
|
|
}
|
|
|
|
else {
|
2005-03-10 16:38:01 +00:00
|
|
|
// Key doesn't exist, so just add it to the beginning of the array, ascending order
|
|
|
|
$this->sess->sortby = array_merge(array($_GET['tsort'] => SORT_ASC), $this->sess->sortby);
|
|
|
|
}
|
|
|
|
// Finally, make sure that no more than $this->maxsortkeys are present into the array
|
|
|
|
if(!empty($this->maxsortkeys) && ($sortkeys = count($this->sess->sortby)) > $this->maxsortkeys) {
|
|
|
|
while($sortkeys-- > $this->maxsortkeys) {
|
|
|
|
array_pop($this->sess->sortby);
|
|
|
|
}
|
2005-03-08 11:14:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(isset($_GET['tilast'])) {
|
|
|
|
if(empty($_GET['tilast']) || is_numeric(strpos(get_string('alphabet'), $_GET['tilast']))) {
|
|
|
|
$this->sess->i_last = $_GET['tilast'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(isset($_GET['tifirst'])) {
|
|
|
|
if(empty($_GET['tifirst']) || is_numeric(strpos(get_string('alphabet'), $_GET['tifirst']))) {
|
|
|
|
$this->sess->i_first = $_GET['tifirst'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(empty($this->baseurl)) {
|
|
|
|
$getcopy = $_GET;
|
|
|
|
unset($getcopy['tshow']);
|
|
|
|
unset($getcopy['thide']);
|
|
|
|
unset($getcopy['tsort']);
|
|
|
|
unset($getcopy['tifirst']);
|
|
|
|
unset($getcopy['tilast']);
|
|
|
|
unset($getcopy['page']);
|
|
|
|
|
|
|
|
$strippedurl = strip_querystring(qualified_me());
|
|
|
|
|
|
|
|
if(!empty($getcopy)) {
|
|
|
|
$first = false;
|
|
|
|
$querystring = '';
|
|
|
|
foreach($getcopy as $var => $val) {
|
|
|
|
if(!$first) {
|
|
|
|
$first = true;
|
|
|
|
$querystring .= '?'.$var.'='.$val;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$querystring .= '&'.$var.'='.$val;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->reseturl = $strippedurl.$querystring;
|
|
|
|
$querystring .= '&';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$this->reseturl = $strippedurl.$querystring;
|
|
|
|
$querystring = '?';
|
|
|
|
}
|
2005-04-13 09:57:10 +00:00
|
|
|
|
2005-03-08 11:14:15 +00:00
|
|
|
$this->baseurl = strip_querystring(qualified_me()) . $querystring;
|
|
|
|
}
|
|
|
|
|
|
|
|
// If it's "the first time" we 've been here, forget the previous initials filters
|
|
|
|
if(qualified_me() == $this->reseturl) {
|
|
|
|
$this->sess->i_first = '';
|
|
|
|
$this->sess->i_last = '';
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->currpage = optional_param('page', 0);
|
|
|
|
$this->setup = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
function get_sql_sort() {
|
|
|
|
if(!$this->setup) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if(!empty($this->sess->sortby)) {
|
2005-03-10 16:38:01 +00:00
|
|
|
$sortstring = '';
|
|
|
|
foreach($this->sess->sortby as $column => $order) {
|
|
|
|
if(!empty($sortstring)) {
|
|
|
|
$sortstring .= ', ';
|
|
|
|
}
|
|
|
|
$sortstring .= $column.($order == SORT_ASC ? ' ASC' : ' DESC');
|
|
|
|
}
|
|
|
|
return $sortstring;
|
2005-03-08 11:14:15 +00:00
|
|
|
}
|
2005-03-10 16:38:01 +00:00
|
|
|
return '';
|
2005-03-08 11:14:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function get_page_start() {
|
|
|
|
if(!$this->use_pages) {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
return $this->currpage * $this->pagesize;
|
|
|
|
}
|
|
|
|
|
|
|
|
function get_page_size() {
|
|
|
|
if(!$this->use_pages) {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
return $this->pagesize;
|
|
|
|
}
|
|
|
|
|
|
|
|
function get_sql_where() {
|
|
|
|
if(!isset($this->columns['fullname'])) {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
|
|
|
$LIKE = sql_ilike();
|
2005-04-13 09:57:10 +00:00
|
|
|
if(!empty($this->sess->i_first) && !empty($this->sess->i_last)) {
|
2005-03-08 11:14:15 +00:00
|
|
|
return 'firstname '.$LIKE.' \''.$this->sess->i_first.'%\' AND lastname '.$LIKE.' \''.$this->sess->i_last.'%\'';
|
|
|
|
}
|
|
|
|
else if(!empty($this->sess->i_first)) {
|
|
|
|
return 'firstname '.$LIKE.' \''.$this->sess->i_first.'%\'';
|
|
|
|
}
|
|
|
|
else if(!empty($this->sess->i_last)) {
|
|
|
|
return 'lastname '.$LIKE.' \''.$this->sess->i_last.'%\'';
|
|
|
|
}
|
|
|
|
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
|
|
|
function print_html() {
|
|
|
|
global $CFG;
|
|
|
|
|
|
|
|
if(!$this->setup) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
$colcount = count($this->columns);
|
|
|
|
|
|
|
|
// Do we need to print initial bars?
|
|
|
|
|
|
|
|
if($this->use_initials && isset($this->columns['fullname'])) {
|
|
|
|
|
|
|
|
$strall = get_string('all');
|
|
|
|
$alpha = explode(',', get_string('alphabet'));
|
|
|
|
|
|
|
|
// Bar of first initials
|
|
|
|
|
|
|
|
echo '<div class="initialbar">'.get_string('firstname').' : ';
|
|
|
|
if(!empty($this->sess->i_first)) {
|
|
|
|
echo '<a href="'.$this->baseurl.'tifirst=">'.$strall.'</a>';
|
|
|
|
} else {
|
|
|
|
echo '<strong>'.$strall.'</strong>';
|
|
|
|
}
|
|
|
|
foreach ($alpha as $letter) {
|
|
|
|
if ($letter == $this->sess->i_first) {
|
|
|
|
echo ' <strong>'.$letter.'</strong>';
|
|
|
|
} else {
|
|
|
|
echo ' <a href="'.$this->baseurl.'tifirst='.$letter.'">'.$letter.'</a>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
echo '</div>';
|
2005-04-13 09:57:10 +00:00
|
|
|
|
2005-03-08 11:14:15 +00:00
|
|
|
// Bar of last initials
|
|
|
|
|
|
|
|
echo '<div class="initialbar">'.get_string('lastname').' : ';
|
|
|
|
if(!empty($this->sess->i_last)) {
|
|
|
|
echo '<a href="'.$this->baseurl.'tilast=">'.$strall.'</a>';
|
|
|
|
} else {
|
|
|
|
echo '<strong>'.$strall.'</strong>';
|
|
|
|
}
|
|
|
|
foreach ($alpha as $letter) {
|
|
|
|
if ($letter == $this->sess->i_last) {
|
|
|
|
echo ' <strong>'.$letter.'</strong>';
|
|
|
|
} else {
|
|
|
|
echo ' <a href="'.$this->baseurl.'tilast='.$letter.'">'.$letter.'</a>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
echo '</div>';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// End of initial bars code
|
|
|
|
|
|
|
|
// Paging bar
|
|
|
|
if($this->use_pages) {
|
|
|
|
print_paging_bar($this->totalrows, $this->currpage, $this->pagesize, $this->baseurl);
|
|
|
|
}
|
|
|
|
|
2005-04-14 15:35:27 +00:00
|
|
|
if (empty($this->data)) {
|
|
|
|
print_heading(get_string('nothingtodisplay'));
|
|
|
|
return true;
|
2005-03-08 11:14:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$suppress_enabled = array_sum($this->column_suppress);
|
|
|
|
$suppress_lastrow = NULL;
|
|
|
|
// Start of main data table
|
|
|
|
|
|
|
|
echo '<table'.$this->make_attributes_string($this->attributes).'>';
|
|
|
|
|
|
|
|
echo '<tr>';
|
|
|
|
foreach($this->columns as $column => $index) {
|
|
|
|
$icon_hide = '';
|
|
|
|
$icon_sort = '';
|
|
|
|
|
|
|
|
if($this->is_collapsible) {
|
|
|
|
if(!empty($this->sess->collapse[$column])) {
|
|
|
|
$icon_hide = ' <a href="'.$this->baseurl.'tshow='.$column.'"><img src="'.$CFG->pixpath.'/t/switch_plus.gif" title="'.get_string('show').' '.$this->headers[$index].'" /></a>';
|
|
|
|
}
|
|
|
|
else if($this->headers[$index] !== NULL) {
|
|
|
|
$icon_hide = ' <a href="'.$this->baseurl.'thide='.$column.'"><img src="'.$CFG->pixpath.'/t/switch_minus.gif" title="'.get_string('hide').' '.$this->headers[$index].'" /></a>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-03-10 16:38:01 +00:00
|
|
|
$primary_sort_column = '';
|
|
|
|
$primary_sort_order = '';
|
|
|
|
if(reset($this->sess->sortby)) {
|
|
|
|
$primary_sort_column = key($this->sess->sortby);
|
|
|
|
$primary_sort_order = current($this->sess->sortby);
|
|
|
|
}
|
|
|
|
|
2005-03-08 11:14:15 +00:00
|
|
|
switch($column) {
|
|
|
|
|
|
|
|
case 'fullname':
|
|
|
|
if($this->is_sortable) {
|
|
|
|
$icon_sort_first = $icon_sort_last = '';
|
2005-03-10 16:38:01 +00:00
|
|
|
if($primary_sort_column == 'firstname') {
|
|
|
|
if($primary_sort_order == SORT_ASC) {
|
2005-03-08 11:14:15 +00:00
|
|
|
$icon_sort_first = ' <img src="'.$CFG->pixpath.'/t/down.gif" />';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$icon_sort_first = ' <img src="'.$CFG->pixpath.'/t/up.gif" />';
|
|
|
|
}
|
|
|
|
}
|
2005-03-10 16:38:01 +00:00
|
|
|
else if($primary_sort_column == 'lastname') {
|
|
|
|
if($primary_sort_order == SORT_ASC) {
|
2005-03-08 11:14:15 +00:00
|
|
|
$icon_sort_last = ' <img src="'.$CFG->pixpath.'/t/down.gif" />';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$icon_sort_last = ' <img src="'.$CFG->pixpath.'/t/up.gif" />';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->headers[$index] = '<a href="'.$this->baseurl.'tsort=firstname">'.get_string('firstname').'</a> '.$icon_sort_first.' / '.
|
|
|
|
'<a href="'.$this->baseurl.'tsort=lastname">'.get_string('lastname').'</a> '.$icon_sort_last;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
if($this->is_sortable) {
|
2005-03-10 16:38:01 +00:00
|
|
|
if($primary_sort_column == $column) {
|
|
|
|
if($primary_sort_order == SORT_ASC) {
|
2005-03-08 11:14:15 +00:00
|
|
|
$icon_sort = ' <img src="'.$CFG->pixpath.'/t/down.gif" />';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$icon_sort = ' <img src="'.$CFG->pixpath.'/t/up.gif" />';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->headers[$index] = '<a href="'.$this->baseurl.'tsort='.$column.'">'.$this->headers[$index].'</a>';
|
|
|
|
}
|
|
|
|
}
|
2005-04-13 09:57:10 +00:00
|
|
|
|
2005-03-08 11:14:15 +00:00
|
|
|
if($this->headers[$index] === NULL) {
|
2005-03-08 14:57:16 +00:00
|
|
|
echo '<th class="header c'.$index.$this->column_class[$column].'"> </th>';
|
2005-03-08 11:14:15 +00:00
|
|
|
}
|
|
|
|
else if(!empty($this->sess->collapse[$column])) {
|
2005-03-08 14:57:16 +00:00
|
|
|
echo '<th class="header c'.$index.$this->column_class[$column].'">'.$icon_hide.'</th>';
|
2005-03-08 11:14:15 +00:00
|
|
|
}
|
|
|
|
else {
|
2005-03-08 14:57:16 +00:00
|
|
|
echo '<th class="header c'.$index.$this->column_class[$column].'" nowrap="nowrap"'.$this->make_styles_string($this->column_style[$column]).'>'.$this->headers[$index].$icon_sort.'<div class="commands">'.$icon_hide.'</div></th>';
|
2005-03-08 11:14:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
echo '</tr>';
|
|
|
|
|
|
|
|
if(!empty($this->data)) {
|
|
|
|
$oddeven = 1;
|
|
|
|
$colbyindex = array_flip($this->columns);
|
|
|
|
foreach($this->data as $row) {
|
|
|
|
$oddeven = $oddeven ? 0 : 1;
|
|
|
|
echo '<tr class="r'.$oddeven.'">';
|
|
|
|
|
|
|
|
// If we have a separator, print it
|
|
|
|
if($row === NULL && $colcount) {
|
|
|
|
echo '<td colspan="'.$colcount.'"><div class="tabledivider"></div></td>';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
foreach($row as $index => $data) {
|
|
|
|
if($index >= $colcount) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
$column = $colbyindex[$index];
|
2005-03-08 14:57:16 +00:00
|
|
|
echo '<td class="cell c'.$index.$this->column_class[$column].'"'.$this->make_styles_string($this->column_style[$column]).'>';
|
2005-03-08 11:14:15 +00:00
|
|
|
if(empty($this->sess->collapse[$column])) {
|
|
|
|
if($this->column_suppress[$column] && $suppress_lastrow !== NULL && $suppress_lastrow[$index] === $data) {
|
|
|
|
echo ' ';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
echo $data;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
echo ' ';
|
|
|
|
}
|
|
|
|
echo '</td>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
echo '</tr>';
|
|
|
|
if($suppress_enabled) {
|
|
|
|
$suppress_lastrow = $row;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
echo '</table>';
|
|
|
|
|
2005-04-13 09:57:10 +00:00
|
|
|
// Paging bar
|
|
|
|
if($this->use_pages) {
|
|
|
|
print_paging_bar($this->totalrows, $this->currpage, $this->pagesize, $this->baseurl);
|
|
|
|
}
|
2005-03-08 11:14:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function add_data($row) {
|
|
|
|
if(!$this->setup) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
$this->data[] = $row;
|
|
|
|
}
|
|
|
|
|
|
|
|
function add_separator() {
|
|
|
|
if(!$this->setup) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
$this->data[] = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|