File: D:/HostingSpaces/SBogers59/ferrumbv.nl/wwwroot/lib/general/template_factory.class.php
<?php
/**
* Created by PhpStorm.
* User: mike
* Date: 08/10/14
* Time: 13:46
*/
class Template_Factory
{
private $_pageName;
public function __construct($pageName)
{
$this->_pageName = $pageName;
}
public function create($objects)
{
$data = array();
// Read XML to array
$Parser = new XML_Parser($this->_pageName);
$all = $Parser->getAll();
$current = $Parser->getCurrent();
foreach($objects as $name => $param)
{
// Create object
$obj_name = 'UI_' . ucfirst($name);
if( ! class_exists($obj_name)) require_once DOCUMENT_ROOT . 'lib/ui/' . $name . '.class.php';
$Obj = new $obj_name($this->_pageName);
if($param != 'both')
{
// Create with requested parameter
$data[$name] = $Obj->create(${$param});
}
else
{
// Create with both parameters
$data[$name] = $Obj->create($all,$current);
}
}
return $data;
}
}