Exemplo n.º 1
0
 /**
  * Creates a response with the output as error view from the app
  * along with the status code
  *
  * @param int
  * @return object
  */
 public static function error($status, $vars = array())
 {
     return static::create(View::create('error/' . $status, $vars)->render(), $status);
 }
Exemplo n.º 2
0
 /**
  * Menampilkan view
  * @param string $view Lokasi view
  */
 public static function view($view)
 {
     return \View::load($view, self::$viewData);
 }
Exemplo n.º 3
0
 /**
  * @param $url_pattern /url/{page} - {page} заменится на номер страницы
  * @param bool|false $indicator
  * @return string
  * @throws \Exception
  */
 public function getPagination($url_pattern, $indicator = false)
 {
     $view = new View();
     return $view->template("pagination", ['total_pages' => ceil($this->total / $this->per_page), 'current_page' => $this->current_page, 'indicator' => $indicator, 'url_pattern' => $url_pattern, 'max_display_pages' => $this->max_display_pages]);
 }
Exemplo n.º 4
0
                header('Location: /' . \System\Helper::getLang());
            }
            break;
        case 'profile':
            if (\System\Models\Auth::isLogin()) {
                $profile = \System\Models\User::get();
                if ($profile) {
                    View::render('profile', ['profile' => $profile]);
                } else {
                    \System\Models\Auth::logOut();
                    header('Location: /' . \System\Helper::getLang());
                }
            } else {
                header('Location: /' . \System\Helper::getLang());
            }
            break;
        case 'logout':
            \System\Models\Auth::logOut();
            header('Location: /' . \System\Helper::getLang());
            break;
        default:
            View::render('404' . \System\Helper::getLang());
    }
    ?>
    <?php 
}
?>
</div>
<footer></footer>
</body>
</html>
Exemplo n.º 5
0
 /**
  * Get the detailed error report for the exception.
  *
  * @return Response
  */
 private function detailed_response()
 {
     $data = array('severity' => $this->exception->severity(), 'message' => $this->exception->message(), 'line' => $this->exception->getLine(), 'trace' => $this->exception->getTraceAsString(), 'contexts' => $this->exception->context());
     return Response::make(View::make('error.exception', $data), 500);
 }