From 6bbb3062ed735a5cbb761f80c313c207af5e80dc Mon Sep 17 00:00:00 2001 From: cajus Date: Thu, 7 Jan 2010 15:39:01 +0000 Subject: [PATCH] Saved prelimitary, non working version of a replacement selectable git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15112 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_sortableListing.inc | 157 ++++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 gosa-core/include/class_sortableListing.inc diff --git a/gosa-core/include/class_sortableListing.inc b/gosa-core/include/class_sortableListing.inc new file mode 100644 index 000000000..53c61c34e --- /dev/null +++ b/gosa-core/include/class_sortableListing.inc @@ -0,0 +1,157 @@ +setData($data); + + // Generate instance wide unique ID + $tmp= gettimeofday(); + $this->id= 'l'.md5($t['sec']); + } + + + function setData($data) + { + if (!is_array($data)) { + die ("sortableList needs an array as data!"); + } + + // Transfer information + $this->data= $data; + + // Find the number of coluns + reset($this->data); + $first= current($this->data); + if (is_array($first)) { + $this->columns= count($first); + } else { + $this->columns= 1; + } + + } + + + function setWidth($width) + { + $this->width= $width; + } + + + function setHeight($height) + { + $this->height= $height; + } + + + function setCssClass($css) + { + $this->cssclass= $css; + } + + + function setHeader($header) + { + $this->header= $header; + } + + + function setColspecs($specs) + { + $this->colspecs= $specs; + } + + + function render() + { + $result= "
\n"; + $result.= "cssclass)?" class='".$this->cssclass."'":"").">\n"; + + // Do we need colspecs? + if ($this->colspecs) { + $result.= " \n"; + for ($i= 0; $i<$this->columns; $i++) { + $result.= " \n"; + } + $result.= " \n"; + } + + // Do we need a header? + if ($this->header) { + $result.= " \n \n"; + for ($i= 0; $i<$this->columns; $i++) { + $result.= " \n"; + } + $result.= " \n \n"; + } + + // Render table body + $result.= " \n"; + foreach ($this->data as $nr => $row) { + $result.= " \n"; + foreach ($row as $column) { + $result.= " \n"; + } + $result.= " \n"; + } + + $result.= " \n
".(isset($this->header[$i])?$this->header[$i]:"")."
".htmlentities($column)."
\n
\n"; + $result.= "