<?php
/***************************************************************************
*
* ControlFactory.php
* -------------------
*
* begin : Friday, Sep 27, 2003
* copyright : (C) 2002 The Kabramps Team
* email : hide@address.com,
* hide@address.com
*
*
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* See the GNU General Public License for more details.
* (http://www.gnu.org/licenses/gpl.html)
*
***************************************************************************/
class ControlFactory
{
function factory ( $type )
{
include_once('includes/controls/Control.php');
switch ($type)
{
case "text":
include_once ('includes/controls/Text.php');
return new Text ();
break;
case "customlist":
include_once ('includes/controls/Liste.php');
include_once ('includes/controls/CustomList.php');
return new CustomList ($attribute, $value, $xmlDoc, $tmpl, $lang);
break;
case "urilist":
include_once ('includes/controls/Liste.php');
include_once ('includes/controls/CustomList.php');
include_once ('includes/controls/URIList.php');
return new URIList ($attribute, $value, $xmlDoc, $tmpl, $lang);
break;
case "dnlist":
include_once ('includes/controls/Liste.php');
include_once ('includes/controls/CustomList.php');
include_once ('includes/controls/DNList.php');
return new DNList ($attribute, $value, $xmlDoc, $tmpl, $lang);
break;
case "switchlist":
include_once ('includes/controls/Liste.php');
include_once ('includes/controls/SwitchList.php');
return new SwitchList ($attribute, $value, $xmlDoc, $tmpl, $lang);
break;
case "combobox":
include_once ('includes/controls/Text.php');
include_once ('includes/controls/Combobox.php');
return new Combobox ($attribute, $value, $xmlDoc, $tmpl, $lang);
break;
case "calculate":
include_once ('includes/controls/Text.php');
include_once ('includes/controls/Calculate.php');
return new Calculate($attribute, $value, $xmlDoc, $tmpl, $lang);
break;
case "address":
include_once ('includes/controls/Address.php');
return new Address($attribute, $value, $xmlDoc, $tmpl, $lang);
break;
case "image":
include_once ('includes/controls/Image.php');
return new Image($attribute, $value, $xmlDoc, $tmpl, $lang, $dn);
break;
case "password":
include_once ('includes/controls/Password.php');
return new Password($attribute, $value, $xmlDoc, $tmpl, $lang);
break;
case "description":
include_once ('includes/controls/Description.php');
return new Description($attribute, $value, $xmlDoc, $tmpl, $lang);
break;
case "hidden":
include_once ('includes/controls/Hidden.php');
return new Hidden($attribute, $value, $xmlDoc, $tmpl, $lang);
break;
case "homedirectory":
include_once ('includes/controls/Text.php');
include_once ('includes/controls/Homedirectory.php');
return new Homedirectory($attribute, $value, $xmlDoc, $tmpl, $lang);
break;
case "quota":
include_once ('includes/controls/Liste.php');
include_once ('includes/controls/Quota.php');
return new Quota($attribute, $value, $xmlDoc, $tmpl, $lang);
break;
case "searchlist":
include_once ('includes/controls/Liste.php');
include_once ('includes/controls/SearchList.php');
return new SearchList($attribute, $value, $xmlDoc, $tmpl, $lang);
break;
case "chooselist":
include_once ('includes/controls/ChooseList.php');
return new ChooseList($attribute, $value, $xmlDoc, $tmpl, $lang);
break;
case "date":
include_once ('includes/controls/Date.php');
return new Date($attribute, $value, $xmlDoc, $tmpl, $lang);
break;
default:
print_r( debug_backtrace() );
die("ControlFactory: XML-File indicates a non-existing control.(".$type.")");
break;
}
}
}
?>