You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Malio/app/Controllers/BaseController.php

56 lines
919 B
PHTML

9 years ago
<?php
namespace App\Controllers;
8 years ago
use App\Models\User;
9 years ago
use App\Services\View;
use App\Services\Auth;
8 years ago
use Smarty;
use App\Services\Internationalization;
9 years ago
/**
* BaseController
*/
class BaseController
{
/**
8 years ago
* @var Smarty
*/
protected $view;
9 years ago
/**
8 years ago
* @var User
*/
protected $user;
9 years ago
/**
* Construct page renderer
*/
public function __construct()
9 years ago
{
$this->view = View::getSmarty();
$this->user = Auth::getUser();
$this->i18n = new Internationalization();
$this->i18n->lang = $this->user->lang;
9 years ago
}
/**
* Get smarty
*
8 years ago
* @return Smarty
*/
public function view()
{
return $this->view;
}
9 years ago
/**
* @param $response
* @param $res
* @return mixed
*/
public function echoJson($response, $res)
{
return $response->getBody()->write(json_encode($res));
}
}