-function plc_table_start ($table_id, $headers, $column_sort, $options=NULL) {
- if ( ! $options ) $options = array();
- global $plc_table_hash;
- $plc_table_hash[$table_id]=array($headers,$options);
- $search_area = array_key_exists('search_area',$options) ? $options['search_area'] : true;
- $pagesize_area = array_key_exists('pagesize_area',$options) ? $options['pagesize_area'] : true;
- $max_pages = array_key_exists('max_pages',$options) ? $options['max_pages'] : 10;
- $pagesize = array_key_exists('pagesize',$options) ? $options['pagesize'] : 25;
- $pagesize_def = array_key_exists('pagesize_def',$options) ? $options['pagesize_def'] : 999;
- $search_width = array_key_exists('search_width',$options) ? $options['search_width'] : 40;
-
- $paginator=$table_id."_paginator";
- $classname="paginationcallback-".$paginator;
- $classname.=" max-pages-" . $max_pages;
- $classname.=" paginate-" . $pagesize;
+
+class PlcTable {
+ // mandatory
+ var $table_id;
+ var $headers;
+ var $column_sort;
+ // options
+ var $search_area; // boolean (default true)
+ var $pagesize_area; // boolean (default true)
+ var $notes_area; // boolean (default true)
+ var $search_width; // size in chars of the search text dialog
+ var $pagesize; // the initial pagination size
+ var $pagesize_def; // the page size when one clicks the pagesize reset button
+ var $max_pages; // the max number of pages to display in the paginator
+ var $notes; // an array of additional notes
+ var $footers; // an array of table rows (<tr> will be added) for building the table's tfoot area
+
+ function PlcTable ($table_id,$headers,$column_sort,$options=NULL) {
+ $this->table_id = $table_id;
+ $this->headers = $headers;
+ $this->column_sort = $column_sort;
+
+ $this->search_area = true;
+ $this->pagesize_area = true;
+ $this->notes_area = true;
+ $this->search_width = 40;
+ $this->pagesize = 25;
+ $this->pagesize_def = 999;
+ $this->max_pages = 10;
+ $this->notes = array();
+ $this->footers = array();
+
+ $this->set_options ($options);
+ }
+
+ function set_options ($options) {
+ if ( ! $options)
+ return;
+ if (array_key_exists('search_area',$options)) $this->search_area=$options['search_area'];
+ if (array_key_exists('pagesize_area',$options)) $this->pagesize_area=$options['pagesize_area'];
+ if (array_key_exists('notes_area',$options)) $this->notes_area=$options['notes_area'];
+ if (array_key_exists('search_width',$options)) $this->search_width=$options['search_width'];
+ if (array_key_exists('pagesize',$options)) $this->pagesize=$options['pagesize'];
+ if (array_key_exists('pagesize_def',$options)) $this->pagesize_def=$options['pagesize_def'];
+ if (array_key_exists('max_pages',$options)) $this->max_pages=$options['max_pages'];
+
+ if (array_key_exists('notes',$options)) $this->notes=array_merge($this->notes,$options['notes']);
+ if (array_key_exists('footers',$options)) $this->footers=array_merge($this->footers,$options['footers']);
+ }
+
+ ////////////////////
+ public function start () {
+ $paginator=$this->table_id."_paginator";
+ $classname="paginationcallback-".$paginator;
+ $classname.=" max-pages-" . $max_pages;
+ $classname.=" paginate-" . $pagesize;