You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Templates.php 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. namespace SCF\Core;
  3. use Smarty;
  4. use AltoRouter;
  5. class Templates extends Smarty
  6. {
  7. private $_auth;
  8. private $_acl;
  9. private $_lang;
  10. private $_router;
  11. private $_user;
  12. private $_settings;
  13. /**
  14. * Templates constructor.
  15. * @param System $settings
  16. * @param Authentication $auth
  17. * @param AclManager $acl
  18. * @param AltoRouter $router
  19. * @param Languages $lang
  20. * @param UserManager $user
  21. */
  22. public function __construct(System $settings, Authentication $auth, AclManager $acl, AltoRouter $router, Languages $lang, UserManager $user)
  23. {
  24. parent::__construct();
  25. $this->_settings = $settings;
  26. $this->_auth = $auth;
  27. if($this->_auth->isLogin()) {
  28. $this->_user = $user;
  29. $this->_acl = $acl;
  30. }
  31. $this->_router = $router;
  32. $this->_lang = $lang;
  33. $this->setTemplateDir(ROOTDIR . DS . APP . '/templates/SmartAdmin/');
  34. $this->setCompileDir(ROOTDIR . DS . APP . '/Caches/templates_c/');
  35. $this->setConfigDir(ROOTDIR . DS . APP . '/Caches/configs/');
  36. $this->setCacheDir(ROOTDIR . DS . APP . '/Caches/cache/');
  37. $this->assign('path', ROOTDIR . DS . APP);
  38. $this->assign('auth', $this->_auth);
  39. $this->assign('lang', $this->_lang);
  40. $this->assign('settings', $this->_settings);
  41. if($this->_auth->isLogin()) {
  42. $this->assign('user', $this->_user);
  43. $this->assign('acl', $this->_acl);
  44. }
  45. }
  46. }