Beispiel #1
0
 protected function renderHttpException(HttpException $e)
 {
     $status = $e->getStatusCode();
     if (view_exists("errors.{$status}")) {
         $viewData = ['app_env' => env('APP_ENV'), 'app_version' => config('app.version'), 'app_title' => config('app.title'), 'site_name' => config('app.site_name'), 'scripts' => ['jquery.js', 'jquery-ui.min.js', 'foundation.min.js', 'tag-it.min.js', 'app.js'], 'modules' => \Module::slugs(), 'exception' => $e];
         return response()->view("errors.{$status}", $viewData, $status);
     } else {
         return $this->convertExceptionToResponse($e);
     }
 }
Beispiel #2
0
function tpl_edit($sub)
{
    $load = CL_Loader::get_instance();
    $editViewsPath = 'tpl/edit/';
    $subViewPath = $editViewsPath . $sub;
    if (view_exists($subViewPath)) {
        return view_get_html($subViewPath);
    } else {
        $load->model('POITypeModel');
        $type = POITypeModel::catFromSub($sub);
        $catViewPath = $editViewsPath . $type->id;
        if (file_exists($catViewPath)) {
            return view_get_html($catViewPath);
        }
    }
    return view_get_html($editViewsPath . 'default');
}
Beispiel #3
0
 protected function instantiateView()
 {
     $route = \Illuminate\Support\Facades\Request::route()->getAction()['controller'];
     $parts = explode('@', $route);
     $controllerParts = explode('\\', $parts[0]);
     $controllerName = array_pop($controllerParts);
     $controller = str_slug(snake_case(substr($controllerName, 0, -strlen('Controller'))));
     $action = str_slug(snake_case($parts[1]));
     // Set up the view based on the module, controller, and action names.
     $viewFile = "{$controller}.{$action}";
     foreach (\Module::slugs() as $mod) {
         if (view_exists("{$mod}::{$viewFile}")) {
             $this->view = view("{$mod}::{$viewFile}");
         }
     }
     if (!$this->view && view_exists($viewFile)) {
         $this->view = view($viewFile);
     } elseif (!$this->view) {
         $this->view = view('base');
     }
     // Set up some more view variables.
     $this->view->controller = $controller;
     $this->view->action = $action;
     $this->view->app_env = env('APP_ENV');
     $this->view->app_version = config('app.version');
     $this->view->app_title = config('app.title');
     $this->view->site_name = config('app.site_name');
     $this->view->scripts = [];
     $this->view->return_to = substr(\Request::url(), strlen(url('')));
     $this->user = Auth::user();
     $this->view->user = $this->user;
     $this->view->tab = 'schedule';
     $this->view->alerts = \Session::get('alerts', array());
     $this->view->modules = \Module::slugs();
     $this->view->bing_key = env('BING_KEY');
 }