diff --git a/Controleurs/ControleurHelloworld.php b/Controleurs/ControleurHelloworld.php deleted file mode 100644 index 68019a1..0000000 --- a/Controleurs/ControleurHelloworld.php +++ /dev/null @@ -1,19 +0,0 @@ - $O_helloworld->donneMessage())); - - } - - public function testformAction(Array $A_parametres = null, Array $A_postParams = null) - { - - Vue::montrer('helloworld/testform', array('formData' => $A_postParams)); - - } - -} \ No newline at end of file diff --git a/Controllers/HelloworldController.php b/Controllers/HelloworldController.php new file mode 100644 index 0000000..448a2c8 --- /dev/null +++ b/Controllers/HelloworldController.php @@ -0,0 +1,19 @@ + $O_helloworld->donneMessage())); + + } + + public function testformAction(Array $A_urlParams = null, Array $A_postParams = null) + { + + View::show('helloworld/testform', array('formData' => $A_postParams)); + + } + +} \ No newline at end of file diff --git a/Kernel/AutoLoad.php b/Kernel/AutoLoad.php new file mode 100644 index 0000000..230177e --- /dev/null +++ b/Kernel/AutoLoad.php @@ -0,0 +1,54 @@ +_A_urlParts['controller'] = array_shift($_A_urlParts); + $this->_A_urlParts['action'] = array_shift($_A_urlParts); + + $this->_A_urlParametres = $_A_urlParts; + + $this->_A_postParams = $A_postParams; + + + } + + // Execute the controller and action deduced + + public function execute() + { + if (!class_exists($this->_A_urlParts['controller'])) { + throw new ControllerException("Controller " . $this->_A_urlParts['controller'] . " is not valid."); + } + + if (!method_exists($this->_A_urlParts['controller'], $this->_A_urlParts['action'])) { + throw new ControllerException("Action " . $this->_A_urlParts['action'] . " of controller " . + $this->_A_urlParts['controller'] . " is not valid."); + } + + + $B_called = call_user_func_array(array(new $this->_A_urlParts['controller'], + $this->_A_urlParts['action']), array($this->_A_urlParams, $this->_A_postParams )); + + if (false === $B_called) { + throw new ControllerException("Action " . $this->_A_urlParts['action'] . + " of controller " . $this->_A_urlParts['controller'] . " failed."); + } + } +} \ No newline at end of file diff --git a/Kernel/Exceptions/ControllerException.php b/Kernel/Exceptions/ControllerException.php new file mode 100644 index 0000000..b529795 --- /dev/null +++ b/Kernel/Exceptions/ControllerException.php @@ -0,0 +1,3 @@ +_A_urlDecortique['controleur'] = array_shift($A_urlDecortique); // on recupere le contrôleur - $this->_A_urlDecortique['action'] = array_shift($A_urlDecortique); // puis l'action - - // ...on stocke ces éventuels parametres dans la variable d'instance qui leur est réservée - $this->_A_urlParametres = $A_urlDecortique; - - // On s'occupe du tableau $A_postParams - $this->_A_postParams = $A_postParams; - - - } - - // On exécute notre triplet - - public function executer() - { - if (!class_exists($this->_A_urlDecortique['controleur'])) { - throw new ControleurException($this->_A_urlDecortique['controleur'] . " n'est pas un controleur valide."); - } - - if (!method_exists($this->_A_urlDecortique['controleur'], $this->_A_urlDecortique['action'])) { - throw new ControleurException($this->_A_urlDecortique['action'] . " du contrôleur " . - $this->_A_urlDecortique['controleur'] . " n'est pas une action valide."); - } - - $B_called = call_user_func_array(array(new $this->_A_urlDecortique['controleur'], - $this->_A_urlDecortique['action']), array($this->_A_urlParametres, $this->_A_postParams )); - - if (false === $B_called) { - throw new ControleurException("L'action " . $this->_A_urlDecortique['action'] . - " du contrôleur " . $this->_A_urlDecortique['controleur'] . " a rencontré une erreur."); - } - } -} \ No newline at end of file diff --git a/Noyau/Exceptions/ControleurException.php b/Noyau/Exceptions/ControleurException.php deleted file mode 100644 index 045e712..0000000 --- a/Noyau/Exceptions/ControleurException.php +++ /dev/null @@ -1,3 +0,0 @@ -