/**
  * Initialize the ModifyController class and their parents
  */
 public function init()
 {
     try {
         parent::init();
     } catch (Exception $e) {
         throw new Exception('Une erreur est survenue durant le chargement du module: ' . $e->getMessage());
     }
     if (file_exists(_CONTROLLERS_DIR_ . '/Tools.php')) {
         $url = Tools::getInstance()->request_url;
         $controller = Tools::getInstance()->getUrl_controller($url);
         if ($controller == 'ModifyController') {
             if (file_exists(_SECTORS_MODELS_ . '/' . $this->model_name . 'Model.php')) {
                 if (file_exists(_SECTORS_VIEWS_ . '/' . $this->view_name . '.tpl')) {
                     try {
                         require_once _SECTORS_MODELS_ . '/' . $this->model_name . 'Model.php';
                         $id = Tools::getInstance()->getUrl_id($url);
                         $data = \Sector\DisplayModel::getInstance()->display_sector($id);
                         echo $this->twig->render($this->view_name . '.tpl', array('sector' => $data[0], 'bootstrapPath' => _BOOTSTRAP_FILE_));
                     } catch (Exception $e) {
                         throw new Exception('Une erreur est survenue durant la récupération des données: ' . $e->getMessage());
                     }
                 } else {
                     throw new Exception('Le template "' . $this->view_name . '" n\'existe pas dans "' . _SECTORS_VIEWS_ . '"!');
                 }
             } else {
                 throw new Exception('Le modèle "' . $this->model_name . '" n\'existe pas dans "' . _SECTORS_MODELS_ . '"!');
             }
         } else {
             throw new Exception('Une erreur est survenue durant la phase de routage!');
         }
     } else {
         throw new Exception('L\'URL n\'est pas évaluable!');
     }
 }
 /**
  * Initialize the DisplayController class and their parents
  */
 public function init()
 {
     try {
         parent::init();
     } catch (Exception $e) {
         throw new Exception('Une erreur est survenue durant le chargement du module: ' . $e->getMessage());
     }
     if (file_exists(_CONTROLLERS_DIR_ . '/Tools.php')) {
         $url = Tools::getInstance()->request_url;
         $controller = Tools::getInstance()->getUrl_controller($url);
         if ($controller == 'DisplayController') {
             if (file_exists(_SECTORS_MODELS_ . '/' . $this->model_name . 'Model.php') && file_exists(_LOCATIONS_MODELS_ . '/' . $this->model_name . 'Model.php')) {
                 if (file_exists(_SECTORS_VIEWS_ . '/' . $this->view_name . '.tpl')) {
                     try {
                         require_once _SECTORS_MODELS_ . '/' . $this->model_name . 'Model.php';
                         require_once _LOCATIONS_MODELS_ . '/' . $this->model_name . 'Model.php';
                         $id = Tools::getInstance()->getUrl_id($url);
                         switch ($id) {
                             case 'all':
                                 $sectors = \Sector\DisplayModel::getInstance()->display_sectors();
                                 $locations = \Location\DisplayModel::getInstance()->display_locationAll();
                                 break;
                             default:
                                 if (\Sector\DisplayModel::getInstance()->has_sector($id) == 1) {
                                     $data = \Sector\DisplayModel::getInstance()->display_sector($id);
                                     $sectors = \Sector\DisplayModel::getInstance()->display_sector($id);
                                     $locations = \Location\DisplayModel::getInstance()->display_locationAll();
                                 } else {
                                     header('Location: /Cas-M-Ping/errors/404');
                                 }
                                 break;
                         }
                         echo $this->twig->render($this->view_name . '.tpl', array('sectors' => $sectors, 'locations' => $locations, 'bootstrapPath' => _BOOTSTRAP_FILE_));
                     } catch (Exception $e) {
                         throw new Exception('Une erreur est survenue durant la récupération des données: ' . $e->getMessage());
                     }
                 } else {
                     throw new Exception('Le template "' . $this->view_name . '" n\'existe pas dans "' . _SECTORS_VIEWS_ . '"!');
                 }
             } else {
                 throw new Exception('Le modèle "' . $this->model_name . '" n\'existe pas dans "' . _SECTORS_MODELS_ . '"!');
             }
         } else {
             throw new Exception('Une erreur est survenue durant la phase de routage!');
         }
     } else {
         throw new Exception('L\'URL n\'est pas évaluable!');
     }
 }
 /**
  * Initialize the CreateController class and their parents
  */
 public function init()
 {
     try {
         parent::init();
     } catch (Exception $e) {
         throw new Exception('Une erreur est survenue durant le chargement du module: ' . $e->getMessage());
     }
     if (file_exists(_CONTROLLERS_DIR_ . '/Tools.php')) {
         $url = Tools::getInstance()->request_url;
         $url .= '&id=ukn';
         $controller = Tools::getInstance()->getUrl_controller($url);
         if ($controller == 'CreateController') {
             if (file_exists(_LOCATIONS_MODELS_ . '/' . $this->model_name . 'Model.php') && file_exists(_SECTORS_MODELS_ . '/' . $this->model_name . 'Model.php')) {
                 if (file_exists(_LOCATIONS_VIEWS_ . '/' . $this->view_name . '.tpl')) {
                     try {
                         require_once _LOCATIONS_MODELS_ . '/' . $this->model_name . 'Model.php';
                         require_once _SECTORS_MODELS_ . '/' . $this->model_name . 'Model.php';
                         $sectors = \Sector\DisplayModel::getInstance()->display_sectors();
                         $type_location = \Location\DisplayModel::getInstance()->display_TypeLocationModels();
                         echo $this->twig->render($this->view_name . '.tpl', array('sectors' => $sectors, 'typeLocations' => $type_location, 'bootstrapPath' => _BOOTSTRAP_FILE_));
                     } catch (Exception $e) {
                         throw new Exception('Une erreur est survenue durant l\'affichage des données: ' . $e->getMessage());
                     }
                 } else {
                     throw new Exception('Le template "' . $this->view_name . '" n\'existe pas dans "' . _LOCATIONS_VIEWS_ . '"!');
                 }
             } else {
                 throw new Exception('Le modèle "' . $this->model_name . '" n\'existe pas dans "' . _LOCATIONS_MODELS_ . '" ou "' . _SECTORS_MODELS_ . '"!');
             }
         } else {
             throw new Exception('Une erreur est survenue durant la phase de routage!');
         }
     } else {
         throw new Exception('L\'URL n\'est pas évaluable!');
     }
 }