forked from extern/egroupware
CreateObject can now pass multiple params to the class
This commit is contained in:
parent
6ba82eab04
commit
9571b47278
@ -38,9 +38,9 @@
|
|||||||
Syntax: CreateObject('app.class', 'constructor_params'); <br>
|
Syntax: CreateObject('app.class', 'constructor_params'); <br>
|
||||||
Example1: $phpgw->acl = CreateObject('phpgwapi.acl');
|
Example1: $phpgw->acl = CreateObject('phpgwapi.acl');
|
||||||
@param $classname name of class
|
@param $classname name of class
|
||||||
@param $constructor_param constructor parameter
|
@param $p1-$p16 class parameters (all optional)
|
||||||
*/
|
*/
|
||||||
function CreateObject($classname, $constructor_param = '')
|
function CreateObject($classname, $p1='',$p2='',$p3='',$p4='',$p5='',$p6='',$p7='',$p8='',$p9='',$p10='',$p11='',$p12='',$p13='',$p14='',$p15='',$p16='')
|
||||||
{
|
{
|
||||||
global $phpgw, $phpgw_info, $phpgw_domain;
|
global $phpgw, $phpgw_info, $phpgw_domain;
|
||||||
$classpart = explode (".", $classname);
|
$classpart = explode (".", $classname);
|
||||||
@ -52,13 +52,13 @@
|
|||||||
$phpgw_info['flags']['included_classes'][$classname] = True;
|
$phpgw_info['flags']['included_classes'][$classname] = True;
|
||||||
include(PHPGW_INCLUDE_ROOT.'/'.$appname.'/inc/class.'.$classname.'.inc.php');
|
include(PHPGW_INCLUDE_ROOT.'/'.$appname.'/inc/class.'.$classname.'.inc.php');
|
||||||
}
|
}
|
||||||
if ($constructor_param == '')
|
if ($p1 == '')
|
||||||
{
|
{
|
||||||
$obj = new $classname;
|
$obj = new $classname;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$obj = new $classname($constructor_param);
|
$obj = new $classname($p1,$p2,$p3,$p4,$p5,$p6,$p7,$p8,$p9,$p10,$p11,$p12,$p13,$p14,$p15,$p16);
|
||||||
}
|
}
|
||||||
return $obj;
|
return $obj;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user