Go to most recent revision | Blame | Last modification | View Log | RSS feed
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title>File Source for Controleur.php</title>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/>
<link rel="stylesheet" href="../media/stylesheet.css" />
</head>
<body>
<h1>Source for file Controleur.php</h1>
<p>Documentation is available at <a href="../Framework/_Controleur.php.html">Controleur.php</a></p>
<div class="src-code">
<div class="src-code"><ol><li><div class="src-line"><a name="a1"></a><span class="src-php"><?php</span></div></li>
<li><div class="src-line"><a name="a2"></a><span class="src-comm">// declare(encoding='UTF-8');</span></div></li>
<li><div class="src-line"><a name="a3"></a><span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a4"></a><span class="src-doc"> * Classe Controleur, coeur d'une application, c'est normalement la seule classe d'une application</span></div></li>
<li><div class="src-line"><a name="a5"></a><span class="src-doc"> * qui devrait être appelée de l'extérieur.</span></div></li>
<li><div class="src-line"><a name="a6"></a><span class="src-doc"> * Elle est abstraite donc doit obligatoirement être étendue.</span></div></li>
<li><div class="src-line"><a name="a7"></a><span class="src-doc"> *</span></div></li>
<li><div class="src-line"><a name="a8"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@category</span><span class="src-doc"> php5</span></div></li>
<li><div class="src-line"><a name="a9"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@package</span><span class="src-doc"> Framework</span></div></li>
<li><div class="src-line"><a name="a10"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@author</span><span class="src-doc"> Aurélien PERONNET <aurelien@tela-botanica.org></span></div></li>
<li><div class="src-line"><a name="a11"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@author</span><span class="src-doc"> Jean-Pascal MILCENT <jpm@tela-botanica.org></span></div></li>
<li><div class="src-line"><a name="a12"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@copyright</span><span class="src-doc"> 2009 Tela-Botanica</span></div></li>
<li><div class="src-line"><a name="a13"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@license</span><span class="src-doc"> http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL</span></div></li>
<li><div class="src-line"><a name="a14"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@license</span><span class="src-doc"> http://www.gnu.org/licenses/gpl.html Licence GNU-GPL</span></div></li>
<li><div class="src-line"><a name="a15"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@version</span><span class="src-doc"> SVN: $$Id: Controleur.php 158 2010-03-04 17:14:36Z jpm $$</span></div></li>
<li><div class="src-line"><a name="a16"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@link</span><span class="src-doc"> /doc/framework/</span></div></li>
<li><div class="src-line"><a name="a17"></a><span class="src-doc"> *</span></div></li>
<li><div class="src-line"><a name="a18"></a><span class="src-doc"> */</span></div></li>
<li><div class="src-line"><a name="a19"></a><span class="src-key">abstract </span><span class="src-key">class </span><a href="../Framework/Controleur.html">Controleur</a> <span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a20"></a> <span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a21"></a><span class="src-doc"> * Registre global, normalement accessible partout</span></div></li>
<li><div class="src-line"><a name="a22"></a><span class="src-doc"> */</span></div></li>
<li><div class="src-line"><a name="a23"></a> <span class="src-key">private </span><span class="src-var">$registre</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a24"></a> </div></li>
<li><div class="src-line"><a name="a25"></a> <span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a26"></a><span class="src-doc"> * Constructeur par défaut</span></div></li>
<li><div class="src-line"><a name="a27"></a><span class="src-doc"> */</span></div></li>
<li><div class="src-line"><a name="a28"></a> <span class="src-key">public </span><span class="src-key">function </span><a href="../Framework/Controleur.html#method__construct">__construct</a><span class="src-sym">(</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a29"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-id"><a href="../Framework/Config.html">Config</a></span><span class="src-sym">::</span><a href="../Framework/Config.html#methodexiste">existe</a><span class="src-sym">(</span><span class="src-str">'fw_html_errors'</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a30"></a> <a href="http://www.php.net/ini_set">ini_set</a><span class="src-sym">(</span><span class="src-str">'html_errors'</span><span class="src-sym">, </span><span class="src-id"><a href="../Framework/Config.html">Config</a></span><span class="src-sym">::</span><a href="../Framework/Config.html#methodget">get</a><span class="src-sym">(</span><span class="src-str">'fw_html_errors'</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a31"></a> <span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a32"></a> </div></li>
<li><div class="src-line"><a name="a33"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">registre </span>= <span class="src-id"><a href="../Framework/Registre.html">Registre</a></span><span class="src-sym">::</span><a href="../Framework/Registre.html#methodgetInstance">getInstance</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a34"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">registre</span><span class="src-sym">-></span><span class="src-id">set</span><span class="src-sym">(</span><span class="src-str">'base_chemin_modele'</span><span class="src-sym">, </span><span class="src-id"><a href="../Framework/Config.html">Config</a></span><span class="src-sym">::</span><a href="../Framework/Config.html#methodget">get</a><span class="src-sym">(</span><span class="src-str">'chemin_modeles'</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a35"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">registre</span><span class="src-sym">-></span><span class="src-id">set</span><span class="src-sym">(</span><span class="src-str">'base_chemin_squelette'</span><span class="src-sym">, </span><span class="src-id"><a href="../Framework/Config.html">Config</a></span><span class="src-sym">::</span><a href="../Framework/Config.html#methodget">get</a><span class="src-sym">(</span><span class="src-str">'chemin_squelettes'</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a36"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">registre</span><span class="src-sym">-></span><span class="src-id">set</span><span class="src-sym">(</span><span class="src-str">'base_chemin_controleur'</span><span class="src-sym">, </span><span class="src-id"><a href="../Framework/Config.html">Config</a></span><span class="src-sym">::</span><a href="../Framework/Config.html#methodget">get</a><span class="src-sym">(</span><span class="src-str">'chemin_controleurs'</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a37"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">registre</span><span class="src-sym">-></span><span class="src-id">set</span><span class="src-sym">(</span><span class="src-str">'base_url_application'</span><span class="src-sym">, </span><span class="src-key">new </span><span class="src-id"><a href="../Framework/Url.html">Url</a></span><span class="src-sym">(</span><span class="src-id"><a href="../Framework/Config.html">Config</a></span><span class="src-sym">::</span><a href="../Framework/Config.html#methodget">get</a><span class="src-sym">(</span><span class="src-str">'url_base'</span><span class="src-sym">)))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a38"></a> <span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a39"></a> </div></li>
<li><div class="src-line"><a name="a40"></a> <span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a41"></a><span class="src-doc"> * Charge un modele donné et le rend disponible sous la forme $this->nom_modele</span></div></li>
<li><div class="src-line"><a name="a42"></a><span class="src-doc"> *</span></div></li>
<li><div class="src-line"><a name="a43"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$nom_modele </span><span class="src-doc">le nom du modèle à charger</span></div></li>
<li><div class="src-line"><a name="a44"></a><span class="src-doc"> *</span></div></li>
<li><div class="src-line"><a name="a45"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">boolean </span><span class="src-doc">false si le chargement a échoué, sinon true.</span></div></li>
<li><div class="src-line"><a name="a46"></a><span class="src-doc"> */</span></div></li>
<li><div class="src-line"><a name="a47"></a> <span class="src-key">final </span><span class="src-key">protected </span><span class="src-key">function </span><a href="../Framework/Controleur.html#methodchargerModele">chargerModele</a><span class="src-sym">(</span><span class="src-var">$nom_modele</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a48"></a> <span class="src-var">$sortie </span>= <span class="src-id">true</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a49"></a> <span class="src-var">$modele </span>= <span class="src-var">$this</span><span class="src-sym">-></span><a href="../Framework/Controleur.html#methodgetModele">getModele</a><span class="src-sym">(</span><span class="src-var">$nom_modele</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a50"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$modele </span>!== <span class="src-id">false</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a51"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">$nom_modele </span>= <span class="src-key">new </span><span class="src-var">$nom_modele</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a52"></a> <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a53"></a> <span class="src-var">$sortie </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a54"></a> <span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a55"></a> <span class="src-key">return </span><span class="src-var">$sortie</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a56"></a> <span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a57"></a> </div></li>
<li><div class="src-line"><a name="a58"></a> <span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a59"></a><span class="src-doc"> * Retourne un modele donné</span></div></li>
<li><div class="src-line"><a name="a60"></a><span class="src-doc"> *</span></div></li>
<li><div class="src-line"><a name="a61"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$nom_modele </span><span class="src-doc">le nom du modèle à charger</span></div></li>
<li><div class="src-line"><a name="a62"></a><span class="src-doc"> *</span></div></li>
<li><div class="src-line"><a name="a63"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">mixed </span><span class="src-doc">false si le chargement a échoué, sinon l'objet du modèle demandé.</span></div></li>
<li><div class="src-line"><a name="a64"></a><span class="src-doc"> */</span></div></li>
<li><div class="src-line"><a name="a65"></a> <span class="src-key">final </span><span class="src-key">protected </span><span class="src-key">function </span><a href="../Framework/Controleur.html#methodgetModele">getModele</a><span class="src-sym">(</span><span class="src-var">$nom_modele</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a66"></a> <span class="src-var">$sortie </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a67"></a> <span class="src-var">$chemin_modele </span>= <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">registre</span><span class="src-sym">-></span><span class="src-id">get</span><span class="src-sym">(</span><span class="src-str">'base_chemin_modele'</span><span class="src-sym">)</span>.<span class="src-var">$nom_modele</span>.<span class="src-str">'.php'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a68"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/file_exists">file_exists</a><span class="src-sym">(</span><span class="src-var">$chemin_modele</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a69"></a> <span class="src-inc">include_once </span><span class="src-var">$chemin_modele</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a70"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/class_exists">class_exists</a><span class="src-sym">(</span><span class="src-var">$nom_modele</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a71"></a> <span class="src-var">$sortie </span>= <span class="src-key">new </span><span class="src-var">$nom_modele</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a72"></a> <span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a73"></a> <span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a74"></a> <span class="src-key">return </span><span class="src-var">$sortie</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a75"></a> <span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a76"></a> </div></li>
<li><div class="src-line"><a name="a77"></a> <span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a78"></a><span class="src-doc"> * Fonction prenant en paramètre le nom d'un squelette et un tableau associatif de données,</span></div></li>
<li><div class="src-line"><a name="a79"></a><span class="src-doc"> * en extrait les variables, charge le squelette et retourne le résultat des deux combinés.</span></div></li>
<li><div class="src-line"><a name="a80"></a><span class="src-doc"> *</span></div></li>
<li><div class="src-line"><a name="a81"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">String </span><span class="src-doc-var">$nom_squelette </span><span class="src-doc">le nom du squelette</span></div></li>
<li><div class="src-line"><a name="a82"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">Array </span><span class="src-doc"> </span><span class="src-doc-var">$donnees </span><span class="src-doc"> un tableau associatif contenant les variables a injecter dans la vue</span></div></li>
<li><div class="src-line"><a name="a83"></a><span class="src-doc"> *</span></div></li>
<li><div class="src-line"><a name="a84"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">boolean </span><span class="src-doc">false si la vue n'existe pas, sinon la chaine résultat.</span></div></li>
<li><div class="src-line"><a name="a85"></a><span class="src-doc"> */</span></div></li>
<li><div class="src-line"><a name="a86"></a> <span class="src-key">final </span><span class="src-key">protected </span><span class="src-key">function </span><a href="../Framework/Controleur.html#methodgetVue">getVue</a><span class="src-sym">(</span><span class="src-var">$nom_squelette</span><span class="src-sym">, </span><span class="src-var">$donnees </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a87"></a> <span class="src-var">$chemin_squelette </span>= <span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">registre</span><span class="src-sym">-></span><span class="src-id">get</span><span class="src-sym">(</span><span class="src-str">'base_chemin_squelette'</span><span class="src-sym">))</span>.<span class="src-var">$nom_squelette</span>.<span class="src-str">'.tpl.html'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a88"></a> <span class="src-var">$sortie </span>= <span class="src-id"><a href="../Framework/SquelettePhp.html">SquelettePhp</a></span><span class="src-sym">::</span><a href="../Framework/SquelettePhp.html#methodanalyser">analyser</a><span class="src-sym">(</span><span class="src-var">$chemin_squelette</span><span class="src-sym">, </span><span class="src-var">$donnees</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a89"></a> <span class="src-key">return </span><span class="src-var">$sortie</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a90"></a> <span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a91"></a> </div></li>
<li><div class="src-line"><a name="a92"></a> <span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a93"></a><span class="src-doc"> * Fonction prenant en paramètre le nom d'un squelette et un tableau associatif de données,</span></div></li>
<li><div class="src-line"><a name="a94"></a><span class="src-doc"> * en extrait les variables, charge le squelette et crée une variable de classe portant le nom du squelette</span></div></li>
<li><div class="src-line"><a name="a95"></a><span class="src-doc"> * contenant les deux combinés.</span></div></li>
<li><div class="src-line"><a name="a96"></a><span class="src-doc"> *</span></div></li>
<li><div class="src-line"><a name="a97"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">String </span><span class="src-doc-var">$nom_squelette </span><span class="src-doc">le nom du squelette</span></div></li>
<li><div class="src-line"><a name="a98"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">Array </span><span class="src-doc"> </span><span class="src-doc-var">$donnees </span><span class="src-doc"> un tableau associatif contenant les variables a injecter dans la vue</span></div></li>
<li><div class="src-line"><a name="a99"></a><span class="src-doc"> *</span></div></li>
<li><div class="src-line"><a name="a100"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">boolean </span><span class="src-doc">false si la vue n'existe pas, sinon true.</span></div></li>
<li><div class="src-line"><a name="a101"></a><span class="src-doc"> */</span></div></li>
<li><div class="src-line"><a name="a102"></a> <span class="src-key">final </span><span class="src-key">protected </span><span class="src-key">function </span><a href="../Framework/Controleur.html#methodchargerVue">chargerVue</a><span class="src-sym">(</span><span class="src-var">$nom_squelette</span><span class="src-sym">, </span><span class="src-var">$donnees </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a103"></a> <span class="src-var">$sortie </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a104"></a> <span class="src-var">$rendu </span>= <span class="src-var">$this</span><span class="src-sym">-></span><a href="../Framework/Controleur.html#methodgetVue">getVue</a><span class="src-sym">(</span><span class="src-var">$nom_squelette</span><span class="src-sym">, </span><span class="src-var">$donnees</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a105"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$rendu </span>!== <span class="src-id">false</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a106"></a> <span class="src-comm">// Création d'une variable de classe contenant le rendu</span></div></li>
<li><div class="src-line"><a name="a107"></a> <span class="src-var">$this</span><span class="src-sym">-></span><span class="src-var">$nom_squelette </span>= <span class="src-var">$rendu</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a108"></a> <span class="src-var">$sortie </span>= <span class="src-id">true</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a109"></a> <span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a110"></a> <span class="src-key">return </span><span class="src-var">$sortie</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a111"></a> <span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a112"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a113"></a><span class="src-php">?></span></div></li>
</ol></div>
</div>
<p class="notes" id="credit">
Documentation generated on Thu, 04 Mar 2010 19:27:20 +0100 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.4.3</a>
</p>
</body>
</html>