controller = $controller; } public function input ($name, $label, $options=array()) { $error = false; $classError = ''; if(isset($this->errors[$name])) { $error = $this->errors[$name]; $classError = ' has-error'; } if (!isset($this->controller->request->data->$name)) { $value =''; } else { $value = $this->controller->request->data->$name; } if ($label=='hidden') { return ''; } if ($options['type'] != 'radio' && $options['type'] != 'checkbox' && $options['type'] != 'file') { // tous les inputs sauf radio et checkbox $html ='
'; } else { // pour radio et checkbox $html ='
'; else $html .= '
'; } else { $html .= '  '.$label.''; } return $html; } } ?>Session = new Session(); $this->Form = new Form($this); if($request) { $this->request=$request; // on stock le request dans l'instance require ROOT.DS.'config'.DS.'hook.php'; } } /** * Permet de rendre une vue * @param $view Fichier à rendre (chemin view ou nom de la vue) **/ public function render($view) { if ($this->rendered) { return false; } extract($this->vars); if(strpos($view,'/')===0) { $view=ROOT.DS.'view'.$view.'.php'; } else { $view=ROOT.DS.'view'.DS.$this->request->controller.DS.$view.'.php'; } ob_start(); require($view); $content_for_layout = ob_get_clean(); require ROOT.DS.'view'.DS.'layout'.DS.$this->layout.'.php'; $this->rendered =true; } /** *Permet de passer une ou plusieurs variable à la vue * @param $key nom de la variable OU tableau de variables * @param $value Valeur de la variable **/ public function set($key, $value=null) { if(is_array($key)) { $this->vars += $key; } else { $this->vars[$key]=$value; } } /** * Permet de charger un model **/ function loadModel($name, $base = null) { $file = ROOT.DS.'model'.DS.$name.'.php'; require_once($file); if(!isset($this->$name)) { $this->$name = new $name(); if(isset($this->Form)) { $this->$name->Form = $this->Form; } } if (isset($base)) { $this->$name->table = $base; } } /** * Permet de gérer les erreurs 404 **/ function e404($message){ header("HTTP/1.0 404 Not Found"); $this->set('message',$message); $this->render('/errors/404'); die(); } /** * Permet d'appeler un controller depuis une vue **/ function request ($controller,$action) { $controller .= 'Controller'; require_once ROOT.DS.'controller'.DS.$controller.'.php'; $c = new $controller(); return $c->$action(); } /** * Redirection vers une autre page **/ function redirect($url, $code = null) { if ($code == 301) { header("HTTP/1.1 301 Moved Permanently"); } header("Location: ".Router::url($url)); } function log ($user, $ip, $error, $content, $type) { $this->loadModel('Post','log'); $errorlog = array( name => $user, ipaddress => $ip, record => date('Y-m-d H:i:s'), error => $error, content => $content, type => $type ); $this->request->errorlog = $errorlog; $this->Post->save($this->request->errorlog); } } ?>
Fatal error: Class 'Controller' not found in /datas/vol4/yulpa165744/var/www/avocats-blumberg-janet.com/htdocs/controller/ActualitesController.php on line 3