示例#1
0
 /**
  * inicia a controller conforme configurado em navigation e retorna o resultado do metodo chamado
  * @return HttpResultVO
  */
 private function getControllerResult()
 {
     $ignore_name = Config::getAliasFolder();
     if (Config::getLocale()) {
         $ignore_name .= "/" . Config::getLocale();
     }
     //url com trata com regras de rota
     $url = explode("/", Config::rewriteUrl(Navigation::getURI($ignore_name, Navigation::URI_RETURN_TYPE_STRING)));
     //inicia a controller
     $retornoDaController = self::searchController($url, Config::FOLDER_REQUEST_CONTROLER);
     //afiliados ( afiliate) reconhecer aqui a poss�vel origem do internauta atrav�s do restFolder afiliate.N
     $arrayVariable = Navigation::getVariableArraySlug($retornoDaController->arrayRestFolder);
     if (!$retornoDaController->success) {
         //pega o nome da classe para instanciar e executa o init
         $tempExplode = explode("/", Config::URL_DEFAULT_CONTROLLER);
         $className = $tempExplode[count($tempExplode) - 1];
         $className = str_replace(array(".class.php", ".php"), "", $className);
         $retornoDaController->className = $className;
         $retornoDaController->methodName = "init";
         $retornoDaController->urlToInclude = Config::URL_DEFAULT_CONTROLLER;
     }
     $className = $retornoDaController->className;
     $methodName = $retornoDaController->methodName;
     //inclui a controller
     include_once $retornoDaController->urlToInclude;
     //instancia
     $instancia = new $className($retornoDaController->arrayRestFolder);
     //executa o metodo e este deve retornar sempre uma HttpResultVO
     if (!ClassHandler::isMethodPublic($instancia, $methodName)) {
         $methodName = "init";
     }
     $HttpResultVO = $instancia->{$methodName}();
     return $HttpResultVO;
 }
示例#2
0
 public function __construct()
 {
     // echo "ta aqui.".UserClient::getTypeId();exit();
     if (!UserClient::isAlive() || UserClient::getTypeId() != Config::ADMIN_USER_TYPE_ID && UserClient::getTypeId() != Config::DEVELOPER_USER_TYPE_ID) {
         $urlTo = Navigation::getURI(Config::$URL_ROOT_APPLICATION);
         Navigation::redirect("backend/login/to/" . implode("/", $urlTo));
     }
 }
示例#3
0
 public function __construct($currentQuery = null)
 {
     $this->currentQuery = $currentQuery;
     //Config::getConection();
     $this->arrayRestFolder = Navigation::getURI(Config::getRootPath(), Navigation::URI_RETURN_TYPE_ARRAY);
     $this->arrayVariable = Navigation::getVariableArraySlug($this->arrayRestFolder);
     if (in_array("promocoes", $this->arrayRestFolder)) {
         $this->arrayVariable["promocoes"] = 1;
     }
 }
示例#4
0
 public static function saveUri()
 {
     Session::start();
     if (!isset($_SESSION[UserClient::SESSION_VAR_HISTORY_URI])) {
         $_SESSION[UserClient::SESSION_VAR_HISTORY_URI] = array();
     }
     if (count($_SESSION[UserClient::SESSION_VAR_HISTORY_URI]) > 3) {
         array_shift($_SESSION[UserClient::SESSION_VAR_HISTORY_URI]);
     }
     $_SESSION[UserClient::SESSION_VAR_HISTORY_URI][] = Navigation::getURI(NULL, Navigation::URI_RETURN_TYPE_STRING);
 }
示例#5
0
<?php

$array_folders = Navigation::getURI(Config::$URL_ROOT_APPLICATION);
?>
<div class="sidebar">
	<div id="accordion">
        <h3 class="open"><?php 
echo $HttpContentResult->vo->title;
?>
</h3>
        <div class="content" style="display: block;">
        	<ul class="leftmenu">
            	<li <?php 
if (count($array_folders) > 2 && $array_folders[2] == 'change') {
    echo ' class="current"';
}
?>
><a href="<?php 
echo Config::getRootPath('backend/client/change/id.' . $HttpContentResult->vo->id);
?>
" class="table">Infos</a></li>
            	<li <?php 
if (count($array_folders) > 2 && $array_folders[3] == 'tagged') {
    echo ' class="current"';
}
?>
><a href="<?php 
echo Config::getRootPath('backend/client/gallery/type.tagged/id.' . $HttpContentResult->vo->id);
?>
" class="form">Destaque</a></li>
                <li <?php 
示例#6
0
文件: nav-in.php 项目: reytuty/facil
<?php

//$array_folders = Navigation::getURI(Config::$URL_ROOT_APPLICATION);
$array_folders = Navigation::getURI(Config::getAliasFolder(), Navigation::URI_RETURN_TYPE_ARRAY);
//Debug::print_r($array_folders);
?>
<div class="sidebar">
	<div id="accordion">
        <h3 class="open"><!--Seja bem-vindo--></h3>
        <div class="content" style="display: block;">
        	<ul class="leftmenu">
            	<li <?php 
if (count($array_folders) > 2 && $array_folders[2] == 'show') {
    echo ' class="current"';
}
?>
><a href="<?php 
echo Config::getRootPath('backend/equipe/show/');
?>
" class="table">Listagem</a></li>
                <li <?php 
if (count($array_folders) > 2 && $array_folders[2] == 'add') {
    echo ' class="current"';
}
?>
><a href="<?php 
echo Config::getRootPath('backend/equipe/add/');
?>
" class="form">Inserir Membro</a></li>
            </ul>
        </div>
示例#7
0
 /**
  * Retorna apenas 1 resultado dentro do ReturnSearchFileVO, os dados em ReturnSearchFileVO são todos referentes ao mesmo resultado
  * @param $_startFolder 	string
  * @param $searchClass 		string
  * @return ReturnSearchClassVO
  */
 public static function searchFileOrFolder($_urlToIgnore = "", $_startFolder = "", $search_file_mode = Navigation::SEARCH_FILE_MODE_FILE, $searchFileOrFolderName = "", $autoInclude = FALSE)
 {
     //iniciando o objeto de retorno
     $returnReturnSearchClassVO = new ReturnSearchClassVO();
     $searchFileOrFolderName = $searchFileOrFolderName != "" ? "/" . DataHandler::removeSpecialCharacters($searchFileOrFolderName) : "";
     //array completa sem a parte filtrada da url
     $array = Navigation::getURI($_urlToIgnore, Navigation::URI_RETURN_TYPE_ARRAY);
     //Debug::print_r($array);
     $contador = 0;
     //varredura de hierarquia invertida
     for ($i = count($array) - 1; $i >= 0; $i--) {
         //echo Debug::li($i." = valor de i ", FALSE, "FFFF00");
         switch ($search_file_mode) {
             case Navigation::SEARCH_FILE_MODE_CLASS_AND_METHOD:
                 $arrayRestFolder = Navigation::getURI($_urlToIgnore, Navigation::URI_RETURN_TYPE_ARRAY, FALSE, $i + 1);
                 //echo " valor de arrayRestFolder ";
                 //echo Debug::print_r($arrayRestFolder);
                 $stringPath = "";
                 if ($i > 0) {
                     $stringPath = Navigation::getURI($_urlToIgnore, Navigation::URI_RETURN_TYPE_STRING, $i - 1);
                 }
                 //echo Debug::li($stringPath." = valor de stringPath ", FALSE, "FFFF55");
                 $currentFolder = "";
                 if ($i < count($array)) {
                     $currentFolder = DataHandler::removeSpecialCharacters($array[$i]);
                 }
                 //echo Debug::li($currentFolder." = valor de currentFolder ", FALSE, "FFFF55");
                 $currentFolder = str_replace("/", "", $currentFolder);
                 //echo Debug::li($currentFolder." = valor de currentFolder ", FALSE, "FFFF55");
                 //procurando folder
                 $searchFileOrFolderName = DataHandler::urlFolderNameToClassName($currentFolder);
                 //echo " valor de searchFileOrFolderName ";
                 //echo Debug::print_r($searchFileOrFolderName);
                 //echo "<br>";
                 $tempMetodo = "init";
                 if ($i + 1 < count($array)) {
                     $tempMetodo = DataHandler::urlFolderNameToMethodName($array[$i + 1]);
                 }
                 //echo Debug::li("<b>tempMetodo:".$tempMetodo."</b>", false, NULL, NULL, "0000ff");
                 //echo $_startFolder.$stringPath."/".$searchFileOrFolderName.".php";
                 if (file_exists($_startFolder . $stringPath . "/" . $searchFileOrFolderName . ".php")) {
                     //echo Debug::li("<b>A classe:".$_startFolder.$stringPath."/".$searchFileOrFolderName.".php </b>");
                     $returnReturnSearchClassVO->success = TRUE;
                     $returnReturnSearchClassVO->file = $searchFileOrFolderName . ".php";
                     $returnReturnSearchClassVO->folder = DataHandler::removeDobleBars($_startFolder . $stringPath . "/");
                     $returnReturnSearchClassVO->urlToInclude = DataHandler::removeDobleBars($_startFolder . $stringPath . "/" . $searchFileOrFolderName . ".php");
                     $returnReturnSearchClassVO->className = $searchFileOrFolderName;
                     $returnReturnSearchClassVO->methodName = $tempMetodo;
                     $returnReturnSearchClassVO->arrayRestFolder = $arrayRestFolder;
                     $className = $returnReturnSearchClassVO->className;
                     if ($autoInclude) {
                         include_once $_startFolder . $stringPath . "/" . $searchFileOrFolderName . ".php";
                         //echo $className;
                         $classe = new $className();
                         //inicia o metodo como vazio
                         $returnReturnSearchClassVO->methodName = "init";
                         //Se existir uma pasta acima dessa, ve qual é pois pode ser tentativa de acessar metodo
                         if ($i + 1 < count($array)) {
                             //echo Debug::li(" >>>>> ".$array[$i+1]);
                             $tempMetodo = DataHandler::urlFolderNameToMethodName($array[$i + 1]);
                             //verifica se o metodo existe
                             if (ClassHandler::isMethodPublic($classe, $tempMetodo)) {
                                 $returnReturnSearchClassVO->methodName = $tempMetodo;
                             }
                         }
                         $metodo = $returnReturnSearchClassVO->methodName;
                         //echo $metodo;
                         return $classe->{$metodo}();
                     }
                     return $returnReturnSearchClassVO;
                 }
                 break;
             case Navigation::SEARCH_FILE_MODE_FILE:
             default:
                 $stringPath = Navigation::getURI($_urlToIgnore, Navigation::URI_RETURN_TYPE_STRING, $i + 1);
                 //echo Debug::li($stringPath." = valor de stringPath ", FALSE, "FFFF00");
                 $stringPath = DataHandler::removeLastBar($stringPath);
                 //echo Debug::li($stringPath." = valor de stringPath ", FALSE, "FFFF00");
                 $lastFolder = "";
                 if ($i + 1 < count($array)) {
                     $lastFolder = "/" . DataHandler::removeSpecialCharacters($array[$i + 1]);
                 }
                 //echo Debug::li($lastFolder." = valor de lastFolder ", FALSE, "FFFF00");
                 $currentFolder = "";
                 if ($i < count($array)) {
                     $currentFolder = DataHandler::removeSpecialCharacters($array[$i]);
                 }
                 //echo Debug::li($currentFolder." = valor de currentFolder ", FALSE, "FFFF00");
                 //criando a array (além dos limites) - que não foi tratada
                 $contador++;
                 //echo Debug::li($contador." = valor de contador ", FALSE, "FFFF00");
                 $arrayRestFolder = Navigation::getURI($_urlToIgnore, Navigation::URI_RETURN_TYPE_ARRAY, count($array), count($array) - $contador);
                 //echo " valor de arrayRestFolder ";
                 //echo Debug::print_r($arrayRestFolder);
                 $returnReturnSearchClassVO->arrayRestFolder = $arrayRestFolder;
                 $stringPath = "";
                 if ($i + 1 >= 1) {
                     $stringPath = Navigation::getURI($_urlToIgnore, Navigation::URI_RETURN_TYPE_STRING, $i);
                 }
                 //echo Debug::li("<b>{$i}</b>[11] Navigation::SEARCH_FILE_MODE_FILE : ".$_startFolder."----".$stringPath." ");
                 $searchFileOrFolderName = "";
                 if (file_exists($_startFolder . $stringPath . ".php")) {
                     $returnReturnSearchClassVO->success = TRUE;
                     $returnReturnSearchClassVO->className = "";
                     $returnReturnSearchClassVO->folder = "";
                     $returnReturnSearchClassVO->urlToInclude = $_startFolder . $stringPath . ".php";
                     $returnReturnSearchClassVO->file = $lastFolder . ".php";
                     $returnReturnSearchClassVO->arrayRestFolder = $arrayRestFolder;
                     return $returnReturnSearchClassVO;
                 }
                 //echo Debug::li("<b>AAA{$i}</b>[11] Navigation::SEARCH_FILE_MODE_FILE : ".$_startFolder.$stringPath."/index.php"." ");
                 if (file_exists($_startFolder . $stringPath . "/index.php")) {
                     $returnReturnSearchClassVO->success = TRUE;
                     $returnReturnSearchClassVO->className = "";
                     $returnReturnSearchClassVO->folder = "";
                     $returnReturnSearchClassVO->urlToInclude = $_startFolder . $stringPath . "/index.php";
                     $returnReturnSearchClassVO->file = "index.php";
                     $returnReturnSearchClassVO->arrayRestFolder = $arrayRestFolder;
                     //echo Debug::li("<b>{$i}</b>[11] Navigation::SEARCH_FILE_MODE_FILE : ". $_startFolder.$stringPath."/index.php");
                     return $returnReturnSearchClassVO;
                 }
                 break;
         }
         //end switch($search_file_mode){
     }
     // end for($i = count($array)-1; $i >= 0; $i--){
     return $returnReturnSearchClassVO;
 }