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;
// Create initial mapping
$this->mapping= array_keys($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 setInstantDelete($flag)
{
$this->instantDelete= $flag;
}
function setEditable($flag)
{
$this->editable= $flag;
}
function setDeleteable($flag)
{
$this->deleteable= $flag;
}
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";
$action_width= 0;
$edit_image= $this->editable?"":"";
$delete_image= $this->deleteable?"":"";
// Do we need colspecs?
if ($this->colspecs) {
$result.= "
\n";
for ($i= 0; $i<$this->columns; $i++) {
$result.= "
\n";
}
// Extend by another column if we've actions specified
$action_width= ($this->editable?20:0) + ($this->deleteable?20:0);
if ($action_width) {
$result.= "
\n";
}
$result.= "
\n";
}
// Do we need a header?
if ($this->header) {
$result.= " \n
\n";
for ($i= 0; $i<$this->columns; $i++) {
$result.= "