PHP Classes

File: controller/controller.php

Recommend this page to a friend!
  Classes of stefan   PHP XML Converter   controller/controller.php   Download  
File: controller/controller.php
Role: Class source
Content type: text/plain
Description: Class source
Class: PHP XML Converter
Transform Indesign to eBundesanzeiger XML format
Author: By
Last change:
Date: 1 year ago
Size: 1,747 bytes
 

Contents

Class file image Download
<?php
class Controller{

    private
$request = null;
    private
$template = '';
    private
$view = null;

   
/**
     * Konstruktor, erstellet den Controller.
     *
     * @param Array $request Array aus $_GET & $_POST.
     */
   
public function __construct($request){
           
               
//Fetch Request and Determine View
       
$this->view = new View();
       
$this->request = $request;
       
$this->template = !empty($request['view']) ? $request['view'] : 'overview';
    }

   
/**
     * Methode zum anzeigen des Contents.
     *
     * @return String Content der Applikation.
     */
   
public function display(){
       
$view = new View();
        switch(
$this->template){
            case
'file_view':
               
$filename = $this->request['filename'];
               
$xmlview = XMLFileModel::readxml($filename);
               
//Generate View
               
$view->setTemplate('file_view');
               
$view->assign('title', $filename);
                               
$view->assign('file', $filename);
                               
$view->assign('xmlview', $xmlview);
                break;
           
            case
'overview':
            default:
                           
$entries = XMLFileModel::getXMLfiles();

                           
//Generate View
                           
$view->setTemplate('overview');
                           
$view->assign('entries', $entries);
                            break;
        }
               
               
               
//Standard Output
               
$this->view->setTemplate('basic_template');
               
$this->view->assign('blog_title', 'Startseite');
               
$this->view->assign('blog_content', $view->loadTemplate());
               
$this->view->assign('blog_footer', 'XML-Generator');
                return
$this->view->loadTemplate();
    }
}
?>