Beispiel #1
0
 /**
  * Fija el modulo y acción solicitados al sistema
  * @author Julian Lasso <*****@*****.**>
  * @version 1.0.0
  */
 protected function setRouting()
 {
     $this->path = $this->config->getPath() . 'controller/';
     if (isset($_SERVER['PATH_INFO']) === true) {
         $data = explode('/', $_SERVER['PATH_INFO']);
         $cnt = count($data);
         switch ($cnt) {
             case 3:
                 $this->module = $data[1];
                 $this->action = $data[2];
                 break;
             default:
                 if ($cnt > 3) {
                     $this->module = $data[$cnt - 2];
                     $this->action = $data[$cnt - 1];
                     unset($data[$cnt - 2], $data[$cnt - 1]);
                     $cnt = count($data);
                     for ($x = 1; $x < $cnt; $x++) {
                         $this->path .= $data[$x] . '/';
                     }
                     $this->alternateController = $this->module;
                 } else {
                     throw new PDOException('La dirección solicitada no existe en el sistema');
                 }
         }
     } else {
         $this->module = $this->config->getDefaultModule();
         $this->action = $this->config->getDefaultAction();
     }
 }
 /**
  * Fija el modulo y acción solicitados al sistema
  * @author Julian Lasso <*****@*****.**>
  * @version 1.0.0
  */
 protected function setRouting()
 {
     if (isset($_SERVER['PATH_INFO']) === true) {
         $data = explode('/', $_SERVER['PATH_INFO']);
         $this->module = isset($data[1]) === true ? $data[1] : null;
         $this->action = isset($data[2]) === true ? $data[2] : null;
         if ($this->module === null) {
             throw new PDOException('Escriba una dirección válida');
         }
         if ($this->action === null) {
             throw new PDOException('Escriba una dirección válida');
         }
     } else {
         $this->module = $this->config->getDefaultModule();
         $this->action = $this->config->getDefaultAction();
     }
 }