%PDF- %PDF-
Direktori : /home/devcapijob/public_html/liberary/ |
Current File : /home/devcapijob/public_html/liberary/controller.php |
<?php /** * @version 1 * @package yassir * @copyright Copyright (C) 2011 Open Source Matters. All rights reserved. * @license sharware */ class Controller { public $_params_array=array(); protected $_site; protected $_contenu; protected $_window; protected $_h1; protected $_keys; protected $_descr; protected $_javascript; protected $_css; protected $_fac_url; protected $_fac_type; protected $_fac_title; protected $_fac_description; protected $_fac_image; protected $_view_file; protected $_model; protected $_vars; protected $_msg; function execute($_instance){ $this->_site=$_instance; if($this->load_MV()){ $data=$this->display(); $this->collecte_info(); return $this->_msg; } else { header('Location:'.URL_BASE.'erreur_404.html'); //return 'impossible de charger le composant';} } } function load_MV(){ if(file_exists(CMP.Request::type().DS.'model.php') && file_exists(CMP.Request::type().DS.'views'.DS.'default.php')){ require_once ( CMP.Request::type().DS.'model.php' ); // chargement de model $modelname=Request::type().'Modele';// nom de la class du Modele $this->_model=new $modelname;// instanciation de la class Modele return true;} else{ return false;} } function collecte_info(){ $this->_params_array['verrou_formulaire']=LANG::_('verrou_formulaire'); $this->_params_array['formulaire_deveroulle']=LANG::_('formulaire_deveroulle'); // génération de titre de la Fenêtre $this->_params_array['TITLE_WINDOW']=utf8_encode($this->_window); // génération de CONTENU $this->_params_array['CONTENT']=utf8_encode($this->_contenu); // génération de H1 $this->_params_array['H1']=utf8_encode($this->_h1); // génération de DESCRIPTION $this->_params_array['DESCRIPTION']=html_entity_decode($this->_descr); // génération de KEYWORDS $this->_params_array['KEYWORDS']=utf8_encode($this->_keys); $this->_params_array['FAC_URL']=utf8_encode($this->_fac_url); $this->_params_array['FAC_TYPE']=utf8_encode($this->_fac_type); $this->_params_array['FAC_TITLE']=utf8_encode($this->_fac_title); $this->_params_array['FAC_DESC']=utf8_encode($this->_fac_description); $this->_params_array['FAC_IMG']=utf8_encode($this->_fac_image); $this->_params_array['JAVASCRIPT']=$this->_javascript; $this->_params_array['CSS']=$this->_css; } function build_output(){ if(Request::get('target')=='ajax' && $this->_view_file==''){ $data=$this->_contenu; } else{ $file= $file=($this->_view_file=='')? CMP.Request::type().DS.'views'.DS.'default.php' : CMP.Request::type().DS.'views'.DS.$this->_view_file; $output=$this->_vars; ob_start(); include($file); $data = (!is_null($direct_data))? $direct_data : ob_get_contents(); ob_end_clean(); } return $data; } } ?>