app = $app;
}
function DatabaseTable($table)
{
}
function Group($groupid)
{
}
function Search($searchwidget)
{
}
function Table(&$listwidget)
{
}
function SourceItems($sql)
{
$this->sourceitemsdatasets = $this->app->DB->SelectArr($sql);
foreach($this->sourceitemsdatasets[0] as $colkey=>$value)
$this->sourceitemsheadings[]=ucfirst($colkey);
//$this->sourceitemsheadings[count($this->sourceitemsheadings)-1] = 'Aktion';
}
function DynamicTable($sql)
{
//$sql.= " LIMIT 1,10";
$sql.= " order by position";
$this->datasets = $this->app->DB->SelectArr($sql);
foreach($this->datasets[0] as $colkey=>$value)
$this->headings[]=ucfirst($colkey);
$this->headings[count($this->headings)-1] = 'Aktion';
}
function GetTableWithArrows()
{
$htmltable = new HTMLTable(0,"100%","",3,1);
$htmltable->AddRowAsHeading($this->headings);
$htmltable->ChangingRowColors('#FFf1c5','#FFcc99');
foreach($this->datasets as $row){
$htmltable->NewRow();
foreach($row as $field)
$htmltable->AddCol($field);
}
$module = $this->app->Secure->GetGET("module");
$action = $this->app->Secure->GetGET("action");
$id = $this->app->Secure->GetGET("id");
$htmltable->ReplaceCol(count($this->headings),
"del
new
nauf
nunda
");
return $htmltable->Get();
}
function Step($step,$widget,$method,$parsetarget)
{
$mywidget = $this->app->Widget->Get($widget,$parsetarget);
$mywidget->$method();
}
function SaveItem($widget,$method,$formvar)
{
}
function SaveValue($widget,$method,$formvar)
{
}
function Execute($verknuepftabelle,$hauptpunkttabelle,$hauptpunkttabelleid,
$untertabelle,$parsetarget=PAGE)
{
$event = $this->app->Secure->GetGET("event");
$eventid = $this->app->Secure->GetGET("eventid");
$module = $this->app->Secure->GetGET("module");
$action = $this->app->Secure->GetGET("action");
$id = $this->app->Secure->GetGET("id");
switch($event) {
case "new":
//echo "nach $id und item $eventid";
$eventnewitem = $this->app->Secure->GetPOST("eventnewitem");
if(is_numeric($eventnewitem))
{
/* speichern */
//wenn nichts dann als erstes
$this->app->DB->Insert("INSERT INTO $verknuepftabelle (id,$hauptpunkttabelle,
$untertabelle,position) VALUES ('','$hauptpunkttabelleid','$eventnewitem',1)");
//echo $eventnewitem." ".$id;
//sonst alles nachrutschen
/* redirect auf module und action + id */
header("Location: index.php?module=$module&action=$action&id=$id");
} else
{
$htmltable = new HTMLTable(0,"100%","",3,1);
$htmltable->AddRowAsHeading($this->sourceitemsheadings);
$htmltable->ChangingRowColors('#FFf1c5','#FFcc99');
foreach($this->sourceitemsdatasets as $row){
$htmltable->NewRow();
foreach($row as $field)
$htmltable->AddCol($field);
}
$htmltable->ReplaceCol(1,
"");
/* anzeige */
$this->app->Tpl->Set($parsetarget,$htmltable->Get());
}
break;
case "del":
echo "hau ab!";
$this->app->Tpl->Set($parsetarget,$this->GetTableWithArrows());
break;
case "up":
echo "nauf";
$this->app->Tpl->Set($parsetarget,$this->GetTableWithArrows());
break;
case "down":
echo "nunda";
$this->app->Tpl->Set($parsetarget,$this->GetTableWithArrows());
break;
default:
// entweder fertige tabelle mit pfeilen
if(count($this->datasets[0])>0)
$this->app->Tpl->Set($parsetarget,$this->GetTableWithArrows());
else
$this->app->Tpl->Set($parsetarget,
"Keine Datensätze vorhanden -> Datensatz
einfügen.");
//$this->app->Tpl->Parse($parsetarget,"dialog.tpl");
}
// oder suche + tabelle mit radiobuttons
}
}
?>