MDL-6043 - Implement course reset function for quizzes.
[moodle.git] / lib / tablelib.php
CommitLineData
7270d81f 1<?php // $Id$
2
e2ba85e9 3define('TABLE_VAR_SORT', 1);
4define('TABLE_VAR_HIDE', 2);
5define('TABLE_VAR_SHOW', 3);
6define('TABLE_VAR_IFIRST', 4);
7define('TABLE_VAR_ILAST', 5);
8define('TABLE_VAR_PAGE', 6);
9
7270d81f 10class flexible_table {
11
12 var $uniqueid = NULL;
13 var $attributes = array();
14 var $headers = array();
15 var $columns = array();
16 var $column_style = array();
554906f6 17 var $column_class = array();
7270d81f 18 var $column_suppress = array();
19 var $setup = false;
20 var $sess = NULL;
21 var $baseurl = NULL;
e2ba85e9 22 var $request = array();
7270d81f 23
24 var $is_collapsible = false;
25 var $is_sortable = false;
26 var $use_pages = false;
27 var $use_initials = false;
28
73e4f589 29 var $maxsortkeys = 2;
30 var $pagesize = 30;
31 var $currpage = 0;
32 var $totalrows = 0;
a5a3f48a 33 var $sort_default_column = NULL;
34 var $sort_default_order = SORT_ASC;
7270d81f 35
36 function flexible_table($uniqueid) {
37 $this->uniqueid = $uniqueid;
e2ba85e9 38 $this->request = array(
39 TABLE_VAR_SORT => 'tsort',
40 TABLE_VAR_HIDE => 'thide',
41 TABLE_VAR_SHOW => 'tshow',
42 TABLE_VAR_IFIRST => 'tifirst',
43 TABLE_VAR_ILAST => 'tilast',
44 TABLE_VAR_PAGE => 'page'
45 );
7270d81f 46 }
47
a5a3f48a 48 function sortable($bool, $defaultcolumn = NULL, $defaultorder = SORT_ASC) {
7270d81f 49 $this->is_sortable = $bool;
a5a3f48a 50 $this->sort_default_column = $defaultcolumn;
51 $this->sort_default_order = $defaultorder;
7270d81f 52 }
53
54 function collapsible($bool) {
55 $this->is_collapsible = $bool;
56 }
57
58 function pageable($bool) {
59 $this->use_pages = $bool;
60 }
61
62 function initialbars($bool) {
63 $this->use_initials = $bool;
64 }
65
66 function pagesize($perpage, $total) {
67 $this->pagesize = $perpage;
68 $this->totalrows = $total;
69 $this->use_pages = true;
70 }
71
e2ba85e9 72 function set_control_variables($variables) {
73 foreach($variables as $what => $variable) {
74 if(isset($this->request[$what])) {
75 $this->request[$what] = $variable;
76 }
77 }
78 }
79
7270d81f 80 function set_attribute($attribute, $value) {
81 $this->attributes[$attribute] = $value;
82 }
83
84 function column_suppress($column) {
85 if(isset($this->column_suppress[$column])) {
86 $this->column_suppress[$column] = true;
87 }
88 }
89
554906f6 90 function column_class($column, $classname) {
91 if(isset($this->column_class[$column])) {
92 $this->column_class[$column] = ' '.$classname; // This space needed so that classnames don't run together in the HTML
93 }
94 }
95
7270d81f 96 function column_style($column, $property, $value) {
97 if(isset($this->column_style[$column])) {
98 $this->column_style[$column][$property] = $value;
99 }
100 }
101
102 function column_style_all($property, $value) {
103 foreach(array_keys($this->columns) as $column) {
104 $this->column_style[$column][$property] = $value;
105 }
106 }
107
108 function define_baseurl($url) {
109 $this->reseturl = $url;
110 if(!strpos($url, '?')) {
111 $this->baseurl = $url.'?';
112 }
113 else {
114 $this->baseurl = $url.'&amp;';
115 }
116 }
117
118 function define_columns($columns) {
119 $this->columns = array();
120 $this->column_style = array();
554906f6 121 $this->column_class = array();
7270d81f 122 $colnum = 0;
123
124 foreach($columns as $column) {
125 $this->columns[$column] = $colnum++;
126 $this->column_style[$column] = array();
554906f6 127 $this->column_class[$column] = '';
7270d81f 128 $this->column_suppress[$column] = false;
129 }
130 }
131
132 function define_headers($headers) {
133 $this->headers = $headers;
134 }
135
136 function make_styles_string(&$styles) {
137 if(empty($styles)) {
138 return '';
139 }
140
141 $string = ' style="';
142 foreach($styles as $property => $value) {
143 $string .= $property.':'.$value.';';
144 }
145 $string .= '"';
146 return $string;
147 }
148
149 function make_attributes_string(&$attributes) {
150 if(empty($attributes)) {
151 return '';
152 }
1e42af27 153
7270d81f 154 $string = ' ';
155 foreach($attributes as $attr => $value) {
156 $string .= ($attr.'="'.$value.'" ');
157 }
1e42af27 158
7270d81f 159 return $string;
160 }
161
162 function setup() {
163 global $SESSION, $CFG;
164
165 if(empty($this->columns) || empty($this->uniqueid)) {
166 return false;
167 }
1e42af27 168
0ce8ba58 169 if (!isset($SESSION->flextable)) {
170 $SESSION->flextable = array();
7270d81f 171 }
1e42af27 172
0ce8ba58 173 if(!isset($SESSION->flextable[$this->uniqueid])) {
174 $SESSION->flextable[$this->uniqueid] = new stdClass;
175 $SESSION->flextable[$this->uniqueid]->uniqueid = $this->uniqueid;
176 $SESSION->flextable[$this->uniqueid]->collapse = array();
177 $SESSION->flextable[$this->uniqueid]->sortby = array();
178 $SESSION->flextable[$this->uniqueid]->i_first = '';
179 $SESSION->flextable[$this->uniqueid]->i_last = '';
180 }
181
182 $this->sess = &$SESSION->flextable[$this->uniqueid];
7270d81f 183
e2ba85e9 184 if(!empty($_GET[$this->request[TABLE_VAR_SHOW]]) && isset($this->columns[$_GET[$this->request[TABLE_VAR_SHOW]]])) {
7270d81f 185 // Show this column
e2ba85e9 186 $this->sess->collapse[$_GET[$this->request[TABLE_VAR_SHOW]]] = false;
7270d81f 187 }
e2ba85e9 188 else if(!empty($_GET[$this->request[TABLE_VAR_HIDE]]) && isset($this->columns[$_GET[$this->request[TABLE_VAR_HIDE]]])) {
7270d81f 189 // Hide this column
e2ba85e9 190 $this->sess->collapse[$_GET[$this->request[TABLE_VAR_HIDE]]] = true;
191 if(array_key_exists($_GET[$this->request[TABLE_VAR_HIDE]], $this->sess->sortby)) {
192 unset($this->sess->sortby[$_GET[$this->request[TABLE_VAR_HIDE]]]);
7270d81f 193 }
194 }
1e42af27 195
7270d81f 196 // Now, update the column attributes for collapsed columns
197 foreach(array_keys($this->columns) as $column) {
198 if(!empty($this->sess->collapse[$column])) {
199 $this->column_style[$column]['width'] = '10px';
200 }
201 }
202
203 if(
e2ba85e9 204 !empty($_GET[$this->request[TABLE_VAR_SORT]]) &&
205 (isset($this->columns[$_GET[$this->request[TABLE_VAR_SORT]]]) ||
206 (($_GET[$this->request[TABLE_VAR_SORT]] == 'firstname' || $_GET[$this->request[TABLE_VAR_SORT]] == 'lastname') && isset($this->columns['fullname']))
7270d81f 207 ))
208 {
e2ba85e9 209 if(empty($this->sess->collapse[$_GET[$this->request[TABLE_VAR_SORT]]])) {
210 if(array_key_exists($_GET[$this->request[TABLE_VAR_SORT]], $this->sess->sortby)) {
73e4f589 211 // This key already exists somewhere. Change its sortorder and bring it to the top.
e2ba85e9 212 $sortorder = $this->sess->sortby[$_GET[$this->request[TABLE_VAR_SORT]]] == SORT_ASC ? SORT_DESC : SORT_ASC;
213 unset($this->sess->sortby[$_GET[$this->request[TABLE_VAR_SORT]]]);
214 $this->sess->sortby = array_merge(array($_GET[$this->request[TABLE_VAR_SORT]] => $sortorder), $this->sess->sortby);
7270d81f 215 }
216 else {
73e4f589 217 // Key doesn't exist, so just add it to the beginning of the array, ascending order
e2ba85e9 218 $this->sess->sortby = array_merge(array($_GET[$this->request[TABLE_VAR_SORT]] => SORT_ASC), $this->sess->sortby);
73e4f589 219 }
220 // Finally, make sure that no more than $this->maxsortkeys are present into the array
221 if(!empty($this->maxsortkeys) && ($sortkeys = count($this->sess->sortby)) > $this->maxsortkeys) {
222 while($sortkeys-- > $this->maxsortkeys) {
223 array_pop($this->sess->sortby);
224 }
7270d81f 225 }
226 }
227 }
228
a5a3f48a 229 // If we didn't sort just now, then use the default sort order if one is defined and the column exists
f53fba38 230 if(empty($this->sess->sortby) && !empty($this->sort_default_column) && (isset($this->columns[$this->sort_default_column])
231 || (in_array('fullname',$this->columns)
232 && in_array($this->sort_default_column,
233 array('firstname','lastname'))))) {
a5a3f48a 234 $this->sess->sortby = array ($this->sort_default_column => ($this->sort_default_order == SORT_DESC ? SORT_DESC : SORT_ASC));
235 }
236
e2ba85e9 237 if(isset($_GET[$this->request[TABLE_VAR_ILAST]])) {
238 if(empty($_GET[$this->request[TABLE_VAR_ILAST]]) || is_numeric(strpos(get_string('alphabet'), $_GET[$this->request[TABLE_VAR_ILAST]]))) {
239 $this->sess->i_last = $_GET[$this->request[TABLE_VAR_ILAST]];
7270d81f 240 }
241 }
242
e2ba85e9 243 if(isset($_GET[$this->request[TABLE_VAR_IFIRST]])) {
244 if(empty($_GET[$this->request[TABLE_VAR_IFIRST]]) || is_numeric(strpos(get_string('alphabet'), $_GET[$this->request[TABLE_VAR_IFIRST]]))) {
245 $this->sess->i_first = $_GET[$this->request[TABLE_VAR_IFIRST]];
7270d81f 246 }
247 }
248
249 if(empty($this->baseurl)) {
250 $getcopy = $_GET;
e2ba85e9 251 unset($getcopy[$this->request[TABLE_VAR_SHOW]]);
252 unset($getcopy[$this->request[TABLE_VAR_HIDE]]);
253 unset($getcopy[$this->request[TABLE_VAR_SORT]]);
254 unset($getcopy[$this->request[TABLE_VAR_IFIRST]]);
255 unset($getcopy[$this->request[TABLE_VAR_ILAST]]);
256 unset($getcopy[$this->request[TABLE_VAR_PAGE]]);
7270d81f 257
258 $strippedurl = strip_querystring(qualified_me());
259
260 if(!empty($getcopy)) {
261 $first = false;
262 $querystring = '';
263 foreach($getcopy as $var => $val) {
264 if(!$first) {
265 $first = true;
266 $querystring .= '?'.$var.'='.$val;
267 }
268 else {
269 $querystring .= '&amp;'.$var.'='.$val;
270 }
271 }
272 $this->reseturl = $strippedurl.$querystring;
273 $querystring .= '&amp;';
274 }
275 else {
276 $this->reseturl = $strippedurl.$querystring;
277 $querystring = '?';
278 }
1e42af27 279
7270d81f 280 $this->baseurl = strip_querystring(qualified_me()) . $querystring;
281 }
282
283 // If it's "the first time" we 've been here, forget the previous initials filters
284 if(qualified_me() == $this->reseturl) {
285 $this->sess->i_first = '';
286 $this->sess->i_last = '';
287 }
288
e2ba85e9 289 $this->currpage = optional_param($this->request[TABLE_VAR_PAGE], 0);
7270d81f 290 $this->setup = true;
d1b523b7 291
292 /// Always introduce the "flexible" class for the table if not specified
293 /// No attributes, add flexible class
294 if (empty($this->attributes)) {
295 $this->attributes['class'] = 'flexible';
296 /// No classes, add flexible class
297 } else if (!isset($this->attributes['class'])) {
298 $this->attributes['class'] = 'flexible';
299 /// No flexible class in passed classes, add flexible class
300 } else if (!in_array('flexible', explode(' ', $this->attributes['class']))) {
301 $this->attributes['class'] = trim('flexible ' . $this->attributes['class']);
302 }
303
7270d81f 304 }
305
9013e4ad 306 function get_sql_sort($uniqueid = NULL) {
307 if($uniqueid === NULL) {
308 // "Non-static" function call
309 if(!$this->setup) {
310 return false;
311 }
312 $sess = &$this->sess;
313 }
314 else {
315 // "Static" function call
316 global $SESSION;
317 if(empty($SESSION->flextable[$uniqueid])) {
318 return '';
319 }
320 $sess = &$SESSION->flextable[$uniqueid];
7270d81f 321 }
9013e4ad 322
323 if(!empty($sess->sortby)) {
73e4f589 324 $sortstring = '';
9013e4ad 325 foreach($sess->sortby as $column => $order) {
73e4f589 326 if(!empty($sortstring)) {
327 $sortstring .= ', ';
328 }
329 $sortstring .= $column.($order == SORT_ASC ? ' ASC' : ' DESC');
330 }
331 return $sortstring;
7270d81f 332 }
73e4f589 333 return '';
7270d81f 334 }
335
336 function get_page_start() {
337 if(!$this->use_pages) {
338 return '';
339 }
340 return $this->currpage * $this->pagesize;
341 }
342
343 function get_page_size() {
344 if(!$this->use_pages) {
345 return '';
346 }
347 return $this->pagesize;
348 }
349
350 function get_sql_where() {
351 if(!isset($this->columns['fullname'])) {
352 return '';
353 }
354
355 $LIKE = sql_ilike();
1e42af27 356 if(!empty($this->sess->i_first) && !empty($this->sess->i_last)) {
7270d81f 357 return 'firstname '.$LIKE.' \''.$this->sess->i_first.'%\' AND lastname '.$LIKE.' \''.$this->sess->i_last.'%\'';
358 }
359 else if(!empty($this->sess->i_first)) {
360 return 'firstname '.$LIKE.' \''.$this->sess->i_first.'%\'';
361 }
362 else if(!empty($this->sess->i_last)) {
363 return 'lastname '.$LIKE.' \''.$this->sess->i_last.'%\'';
364 }
365
366 return '';
367 }
368
91bb59f4 369 function get_initial_first() {
370 if(!$this->use_initials) {
371 return NULL;
372 }
373
374 return $this->sess->i_first;
375 }
376
377 function get_initial_last() {
378 if(!$this->use_initials) {
379 return NULL;
380 }
381
382 return $this->sess->i_last;
383 }
384
7270d81f 385 function print_html() {
386 global $CFG;
387
388 if(!$this->setup) {
389 return false;
390 }
391
392 $colcount = count($this->columns);
393
394 // Do we need to print initial bars?
395
396 if($this->use_initials && isset($this->columns['fullname'])) {
397
398 $strall = get_string('all');
399 $alpha = explode(',', get_string('alphabet'));
400
401 // Bar of first initials
402
91bb59f4 403 echo '<div class="initialbar firstinitial">'.get_string('firstname').' : ';
7270d81f 404 if(!empty($this->sess->i_first)) {
e2ba85e9 405 echo '<a href="'.$this->baseurl.$this->request[TABLE_VAR_IFIRST].'=">'.$strall.'</a>';
7270d81f 406 } else {
407 echo '<strong>'.$strall.'</strong>';
408 }
409 foreach ($alpha as $letter) {
410 if ($letter == $this->sess->i_first) {
411 echo ' <strong>'.$letter.'</strong>';
412 } else {
e2ba85e9 413 echo ' <a href="'.$this->baseurl.$this->request[TABLE_VAR_IFIRST].'='.$letter.'">'.$letter.'</a>';
7270d81f 414 }
415 }
416 echo '</div>';
1e42af27 417
7270d81f 418 // Bar of last initials
419
91bb59f4 420 echo '<div class="initialbar lastinitial">'.get_string('lastname').' : ';
7270d81f 421 if(!empty($this->sess->i_last)) {
e2ba85e9 422 echo '<a href="'.$this->baseurl.$this->request[TABLE_VAR_ILAST].'=">'.$strall.'</a>';
7270d81f 423 } else {
424 echo '<strong>'.$strall.'</strong>';
425 }
426 foreach ($alpha as $letter) {
427 if ($letter == $this->sess->i_last) {
428 echo ' <strong>'.$letter.'</strong>';
429 } else {
e2ba85e9 430 echo ' <a href="'.$this->baseurl.$this->request[TABLE_VAR_ILAST].'='.$letter.'">'.$letter.'</a>';
7270d81f 431 }
432 }
433 echo '</div>';
434
435 }
436
437 // End of initial bars code
438
439 // Paging bar
440 if($this->use_pages) {
e2ba85e9 441 print_paging_bar($this->totalrows, $this->currpage, $this->pagesize, $this->baseurl, $this->request[TABLE_VAR_PAGE]);
7270d81f 442 }
443
68ffc100 444 if (empty($this->data)) {
445 print_heading(get_string('nothingtodisplay'));
446 return true;
7270d81f 447 }
448
449
450 $suppress_enabled = array_sum($this->column_suppress);
451 $suppress_lastrow = NULL;
452 // Start of main data table
453
454 echo '<table'.$this->make_attributes_string($this->attributes).'>';
455
456 echo '<tr>';
457 foreach($this->columns as $column => $index) {
458 $icon_hide = '';
459 $icon_sort = '';
460
461 if($this->is_collapsible) {
462 if(!empty($this->sess->collapse[$column])) {
b2603953 463 // some headers contain < br/> tags, do not include in title
464 $icon_hide = ' <a href="'.$this->baseurl.$this->request[TABLE_VAR_SHOW].'='.$column.'"><img src="'.$CFG->pixpath.'/t/switch_plus.gif" title="'.get_string('show').' '.strip_tags($this->headers[$index]).'" alt="'.get_string('show').'" /></a>';
7270d81f 465 }
466 else if($this->headers[$index] !== NULL) {
b2603953 467 // some headers contain < br/> tags, do not include in title
468 $icon_hide = ' <a href="'.$this->baseurl.$this->request[TABLE_VAR_HIDE].'='.$column.'"><img src="'.$CFG->pixpath.'/t/switch_minus.gif" title="'.get_string('hide').' '.strip_tags($this->headers[$index]).'" alt="'.get_string('hide').'" /></a>';
7270d81f 469 }
470 }
471
73e4f589 472 $primary_sort_column = '';
473 $primary_sort_order = '';
474 if(reset($this->sess->sortby)) {
475 $primary_sort_column = key($this->sess->sortby);
476 $primary_sort_order = current($this->sess->sortby);
477 }
478
7270d81f 479 switch($column) {
480
481 case 'fullname':
482 if($this->is_sortable) {
483 $icon_sort_first = $icon_sort_last = '';
73e4f589 484 if($primary_sort_column == 'firstname') {
49108746 485 $lsortorder = get_string('asc');
73e4f589 486 if($primary_sort_order == SORT_ASC) {
2bbaf749 487 $icon_sort_first = ' <img src="'.$CFG->pixpath.'/t/down.gif" alt="'.get_string('asc').'" />';
49108746 488 $fsortorder = get_string('asc');
7270d81f 489 }
490 else {
2bbaf749 491 $icon_sort_first = ' <img src="'.$CFG->pixpath.'/t/up.gif" alt="'.get_string('desc').'" />';
49108746 492 $fsortorder = get_string('desc');
7270d81f 493 }
494 }
73e4f589 495 else if($primary_sort_column == 'lastname') {
49108746 496 $fsortorder = get_string('asc');
73e4f589 497 if($primary_sort_order == SORT_ASC) {
2bbaf749 498 $icon_sort_last = ' <img src="'.$CFG->pixpath.'/t/down.gif" alt="'.get_string('asc').'" />';
49108746 499 $lsortorder = get_string('asc');
7270d81f 500 }
501 else {
2bbaf749 502 $icon_sort_last = ' <img src="'.$CFG->pixpath.'/t/up.gif" alt="'.get_string('desc').'" />';
49108746 503 $lsortorder = get_string('desc');
7270d81f 504 }
49108746 505 } else {
506 $fsortorder = get_string('asc');
507 $lsortorder = get_string('asc');
7270d81f 508 }
49108746 509 $this->headers[$index] = '<a href="'.$this->baseurl.$this->request[TABLE_VAR_SORT].'=firstname">'.get_string('firstname').'<span class="accesshide">'.get_string('sortby').' '.get_string('firstname').' '.$fsortorder.'</span></a> '.$icon_sort_first.' / '.
510 '<a href="'.$this->baseurl.$this->request[TABLE_VAR_SORT].'=lastname">'.get_string('lastname').'<span class="accesshide">'.get_string('sortby').' '.get_string('lastname').' '.$lsortorder.'</span></a> '.$icon_sort_last;
7270d81f 511 }
512 break;
513
1d40c70b 514 case 'userpic':
515 // do nothing, do not display sortable links
516 break;
517
7270d81f 518 default:
519 if($this->is_sortable) {
73e4f589 520 if($primary_sort_column == $column) {
521 if($primary_sort_order == SORT_ASC) {
2bbaf749 522 $icon_sort = ' <img src="'.$CFG->pixpath.'/t/down.gif" alt="'.get_string('asc').'" />';
49108746 523 $localsortorder = get_string('asc');
7270d81f 524 }
525 else {
2bbaf749 526 $icon_sort = ' <img src="'.$CFG->pixpath.'/t/up.gif" alt="'.get_string('desc').'" />';
49108746 527 $localsortorder = get_string('desc');
7270d81f 528 }
49108746 529 } else {
530 $localsortorder = get_string('asc');
7270d81f 531 }
49108746 532 $this->headers[$index] = '<a href="'.$this->baseurl.$this->request[TABLE_VAR_SORT].'='.$column.'">'.$this->headers[$index].'<span class="accesshide">'.get_string('sortby').' '.$this->headers[$index].' '.$localsortorder.'</span></a>';
7270d81f 533 }
534 }
1e42af27 535
7270d81f 536 if($this->headers[$index] === NULL) {
8dc9a211 537 echo '<th class="header c'.$index.$this->column_class[$column].'" scope="col">&nbsp;</th>';
7270d81f 538 }
539 else if(!empty($this->sess->collapse[$column])) {
8dc9a211 540 echo '<th class="header c'.$index.$this->column_class[$column].'" scope="col">'.$icon_hide.'</th>';
7270d81f 541 }
542 else {
d9cb14b8 543 // took out nowrap for accessibility, might need replacement
6e291bc6 544 if (!is_array($this->column_style[$column])) {
545 // $usestyles = array('white-space:nowrap');
546 $usestyles = '';
82b9f43e 547 } else {
6e291bc6 548 // $usestyles = $this->column_style[$column]+array('white-space'=>'nowrap');
549 $usestyles = $this->column_style[$column];
550 }
82b9f43e 551 echo '<th class="header c'.$index.$this->column_class[$column].'" '.$this->make_styles_string($usestyles).' scope="col">'.$this->headers[$index].$icon_sort.'<div class="commands">'.$icon_hide.'</div></th>';
7270d81f 552 }
553
554 }
555 echo '</tr>';
556
557 if(!empty($this->data)) {
558 $oddeven = 1;
559 $colbyindex = array_flip($this->columns);
560 foreach($this->data as $row) {
561 $oddeven = $oddeven ? 0 : 1;
562 echo '<tr class="r'.$oddeven.'">';
563
564 // If we have a separator, print it
565 if($row === NULL && $colcount) {
566 echo '<td colspan="'.$colcount.'"><div class="tabledivider"></div></td>';
567 }
568 else {
569 foreach($row as $index => $data) {
570 if($index >= $colcount) {
571 break;
572 }
573 $column = $colbyindex[$index];
554906f6 574 echo '<td class="cell c'.$index.$this->column_class[$column].'"'.$this->make_styles_string($this->column_style[$column]).'>';
7270d81f 575 if(empty($this->sess->collapse[$column])) {
576 if($this->column_suppress[$column] && $suppress_lastrow !== NULL && $suppress_lastrow[$index] === $data) {
577 echo '&nbsp;';
578 }
579 else {
580 echo $data;
581 }
582 }
583 else {
584 echo '&nbsp;';
585 }
586 echo '</td>';
587 }
588 }
589 echo '</tr>';
590 if($suppress_enabled) {
591 $suppress_lastrow = $row;
592 }
593 }
594 }
595
596 echo '</table>';
597
1e42af27 598 // Paging bar
599 if($this->use_pages) {
e2ba85e9 600 print_paging_bar($this->totalrows, $this->currpage, $this->pagesize, $this->baseurl, $this->request[TABLE_VAR_PAGE]);
1e42af27 601 }
7270d81f 602 }
603
604 function add_data($row) {
605 if(!$this->setup) {
606 return false;
607 }
608 $this->data[] = $row;
609 }
610
611 function add_separator() {
612 if(!$this->setup) {
613 return false;
614 }
615 $this->data[] = NULL;
616 }
617
618}
619
620?>