Overview

Packages

  • Auth
  • Config
  • Controller
  • Date
  • Db
  • Feed
    • Abstract
    • Writers
  • File
    • Decorator
  • Form
    • Element
  • Image
  • Log
    • Writer
  • Net
    • Exception
  • None
  • PHP
  • PHPMailer
  • Session
  • Util
  • Validate
    • Validator
  • Zend
    • Registry

Classes

  • Controller_BaseController
  • Controller_Router
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: 
 3: /**
 4:  * Pry Framework
 5:  *
 6:  * LICENSE
 7:  *
 8:  * This source file is subject to the new BSD license that is bundled
 9:  * with this package in the file LICENSE.txt.
10:  * 
11:  * @version $Revision: 276 $
12:  */
13: 
14: /**
15:  * Controller de base fournissant les info essentielles aux autres controlleurs
16:  * @category Pry
17:  * @package Controller
18:  * @version 1.1.1
19:  * @author Olivier ROGER <oroger.fr>
20:  */
21: abstract class Controller_BaseController
22: {
23: 
24:     /**
25:      * Tableau de données pour la vue
26:      * @var array
27:      */
28:     protected $view;
29: 
30:     /**
31:      * Objet de template
32:      * @var Twig_Environment
33:      */
34:     protected $template;
35: 
36:     /**
37:      * Paramètre passé dans l'url
38:      * @var array
39:      */
40:     protected $params;
41: 
42:     /**
43:      * Objet base de données
44:      * @var Zend_Db_Adapter_Abstract 
45:      */
46:     protected $db;
47:     
48:     /**
49:      * Langue détectée dans l'URL. Code sur deux lettre
50:      * @var string 
51:      */
52:     protected $codeLangue;
53:     
54:     /**
55:      * Instanciation du controller
56:      * @param type $paramsFromRouter Paramètres contenu dans l'url
57:      * @param type $codeLangue Code langue. par défaut défini à fr
58:      */
59:     public function __construct($paramsFromRouter,$codeLangue = 'fr')
60:     {
61:         if (Util_Registry::isRegistered('twig')) {
62:             $this->view         = Util_Registry::get('view');
63:             $this->template     = Util_Registry::get('twig');
64:         } else {
65:             $this->view     = null;
66:             $this->template = null;
67:         }
68: 
69:         if (Util_Registry::isRegistered('Db'))
70:             $this->db = Util_Registry::get('Db');
71:         
72:         $this->params       = $paramsFromRouter;
73:         $this->codeLangue   = $codeLangue;
74:     }
75:     
76:     /**
77:      * Redirection
78:      * @param string $url 
79:      */
80:     public function redirect($url)
81:     {
82:         header('Location: '.$this->view['url'].$url);
83:         exit;
84:     }
85: 
86:     abstract public function index();
87: }
88: 
Pry Framework API documentation generated by ApiGen 2.6.1