<?php
class Rapport
{
	protected $data = array();
	protected $vue = null;
	
	public function __construct()
	{
		/*
		Définir les requetes avec leur options
			Paramètres d'entrées, Vue, etc

		Définir les requetes standard

		En paramètres 
			Liste des requetes qui doivent être générer 	 

		 */		
	}
	
	public function execRequete(){
		$this->data['Identite']['raisonSociale'] = 'PEUGEOT';		
	}
		
	public function assignVars()
	{
		$this->view = new VueHtml(realpath(dirname(__FILE__)).'/Templates/fiche.phtml');
		foreach($this->data['Identite'] as $var => $value){
			$this->view->{$var} = $value;			
		}		
	}

	public function getContent(){
		$this->execRequete();
		$this->assignVars();
		return $this->view->getHtml();		
	}
	
}

class VueHtml 
{
	protected $includeVue = array();
	
	public function __construct($filename)
	{
		if (is_array($filename)){
			$this->includeVue = $filename;
		} else {
			$this->includeVue = array($filename);			
		}
	}
	
	public function getHtml()
	{	
		$content = '';
		
		foreach( $this->includeVue as $f ) {
			if ( is_file( $f ) ) {
				ob_start();
				include $f;
				$content.= ob_get_contents();
				ob_end_clean();
			}
		}
		return $content;		
	}
	
}

$rapport = new Rapport();
echo $rapport->getContent();