/*
* cmsdAm HTML presentation logic
* Author: Dino Ciuffetti - dam2000@gmail.com
*/
/* HTML PRESENTATION CLASS */
/**
* HTML presentation logic is defined here. You can use it to generate HTML code like tables, form fields, ecc
* Class instance: $cms->presentation->html
* @author dAm2K (Dino Ciuffetti) <dam2k@users.sourceforge.net>
*/
class html
{
/**
* You should not use this variable from your section.
*/
var $conf;
var $collection;
var $htmldata;
var $attributes;
/**
* This is the class constructor. Here are automatically setted things.
* @return null
* @author dAm2K (Dino Ciuffetti) <dam2k@users.sourceforge.net>
*/
function html () {
// Add this attribute to the list
$this->attributes[] = "table";
//TODO Add attributes here
//$this->attributes[] = "tr";
//$this->attributes[] = "td";
return true;
}
function add_collection ($collname) { // Add a new html collection
if ($collname == "") {
return false;
}
if (@array_search($collname, $this->collection) === false) { // Do the entity already exist? No.
// Add the collection
$this->collection[] = $collname;
return true;
} else { // Collection already exist
return false;
}
return false;
}
function open_table ($collname, $tablename, $parameters = "") { // Add a table into the collection
if ($collname == "") {
return false;
}
if ($tablename == "") {
return false;
}
if (@array_search($collname, $this->collection) === false) { // Do the entity already exist? No.
return false;
}
for ($j=0; $jhtmldata[$collname]); $j++) { // Search the array. $j is the number of the operation executed
if (@array_search($tablename, $this->htmldata[$collname][$j]["table"]["name"]) !== false) { // Entity already exist
return false;
}
}
// Queue the entity to the collection
$this->htmldata[$collname][$j]["table"]["name"] = $tablename;
$this->htmldata[$collname][$j]["table"]["value"] = "\n";
return true;
}
function flush_collection ($collname) {
if ($collname == "") {
return false;
}
for ($i=0; $i < count($this->htmldata[$collname]); $i++) { // For each operation in collection
for ($j=0; $jattributes); $j++) { // For each attribute in the list
$t = $this->attributes[$j];
if ($this->htmldata[$collname][$i][$t]["name"] != "") { // Name associated
// Print the value
echo $this->htmldata[$collname][$i][$t]["value"];
unset ($this->htmldata[$collname][$i][$j]["value"]);
}
unset ($t);
}
}
// Flush out data
unset ($this->htmldata[$collname]);
return true;
}
}