HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
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;
    }
}