public function getLogicalRoute()
 {
     // si no hay mapping para la app, o si el que hay no matchea,
     // busca el Mapping de Core.
     $mapping = NULL;
     $mappingPath = "apps/" . $this->requested_route['app'] . "/AppMapping.php";
     if (file_exists($mappingPath)) {
         include_once $mappingPath;
         $mapping = new AppMapping();
         if (preg_match($mapping->mapping, $this->relative_logic_url)) {
             return $mapping->getLogicalRoute($this->field_list);
         } else {
             // Va al mapping por defecto
             // Siempre existe
             $mappingPath = "apps/core/AppMapping.php";
             include_once $mappingPath;
             $mapping = new AppMapping();
             // Siempre matchea, ni pregunto...
             return $mapping->getLogicalRoute($this->field_list);
         }
     } else {
         // Va al mapping por defecto
         // Siempre existe
         $mappingPath = "apps/core/AppMapping.php";
         include_once $mappingPath;
         $mapping = new AppMapping();
         // Siempre matchea, ni pregunto...
         return $mapping->getLogicalRoute($this->field_list);
     }
 }
Exemple #2
0
define("APP_CONTR_DIR", APP_DIR . "controller/");
define("APP_VIEW_DIR", APP_DIR . "view/");
// VIEWS
// specific Views are not autoloaded so fa:
//require(APP_VIEW_DIR."specific/SpecificView.class.php");
// Autoloading
function __autoload($classname)
{
    if (file_exists(MAIN_DIR . "view/" . $classname . ".class.php")) {
        require MAIN_DIR . "view/" . $classname . ".class.php";
    }
    if (file_exists(APP_CONTR_DIR . $classname . ".class.php")) {
        require APP_CONTR_DIR . $classname . ".class.php";
    }
    if (file_exists(APP_CONTR_DIR . "forms/" . $classname . ".class.php")) {
        require APP_CONTR_DIR . "forms/" . $classname . ".class.php";
    }
    if (file_exists(APP_CONTR_DIR . "exceptions/" . $classname . ".class.php")) {
        require APP_CONTR_DIR . "exceptions/" . $classname . ".class.php";
    }
    if (file_exists(APP_VIEW_DIR . $classname . ".class.php")) {
        require APP_VIEW_DIR . $classname . ".class.php";
    }
    if (file_exists(MODEL_DIR . $classname . ".php")) {
        require MODEL_DIR . $classname . ".php";
    }
    DIYFrameworkLoader::__autoload($classname, "lib/diy-framework/classes/diy-framework/");
}
// Runs controller
AppController::getInstance()->process(Request::getInstance(), Response::getInstance(), AppMapping::getInstance());