/**
  * Retorna o usuário logado no nível informado
  * @param string $Nivel
  * @return null|UserVO
  */
 function getLogedUser($Nivel = null)
 {
     $key = "UsersModelLoged_{$Nivel}";
     if (!APP::getGlobal($key)) {
         $session = new Session($key);
         if ($user = $this->getById($session->get('id', null)) and $user->getStatus() == 1) {
             $_SESSION['access-ckeditor'] = true;
             return APP::setGlobal($key, $user);
         } else {
             $_SESSION['access-ckeditor'] = null;
             return null;
         }
     } else {
         $_SESSION['access-ckeditor'] = true;
         return APP::getGlobal($key);
     }
 }
 /**
  * 
  * @param string $Path Completa o direitorio a partir de public
  * @return string
  */
 public static function getPublicPath($Path = null)
 {
     return APP::getGlobal('public_path') . ($Path ? "/{$Path}" : null);
 }
Exemple #3
0
/**
 * Retorna todas as pasta para o include
 * @return array
 */
function get_all_paths()
{
    # Pega o valor já gravado
    if (APP::getGlobal('get_all_paths')) {
        return APP::getGlobal('get_all_paths');
    }
    # Pastas do sistema
    $Paths = ['', 'system', 'system/core', 'system/crud', 'system/helpers', 'system/helpers/Bootstrap', 'system/models', 'system/libraries', 'system/models', 'system/valueobject'];
    # Não possuí cache listando pastas
    if (!APP::getCurrentModule()) {
        return $Paths;
    } else {
        $Paths = array_merge([APP::getCurrentModule(true)], list_paths(APP::getCurrentModule(true)), $Paths);
        $module = APP::getModules()[APP::getCurrentModule()];
        $general = is_array(get_config('library')) ? get_config('library') : [];
        if (is_array($module)) {
            foreach (['library'] as $key => $value) {
                if (is_array($value)) {
                    $general = array_merge($general, $value);
                } else {
                    $general[] = $value;
                }
            }
        }
        foreach ($general as $key => $path) {
            $Paths = array_merge([$path], list_paths($path), $Paths);
        }
        APP::setGlobal('get_all_paths', $Paths);
        return $Paths;
    }
}