Bootstrap.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. /**
  3. *
  4. * PHP Pro Bid $Id$ ywBq0GD/Wfo6NkXOTpHP+JXJC2leduaTfdJqu899Nds=
  5. *
  6. * @link https://www.phpprobid.com
  7. * @copyright Copyright (c) 2017 Online Ventures Software & CodeCube SRL
  8. * @license https://www.phpprobid.com/license Commercial License
  9. *
  10. * @version 7.9 [rev.7.9.01]
  11. */
  12. namespace Admin;
  13. use App\Bootstrap as AppBootstrap,
  14. Ppb\Service;
  15. class Bootstrap extends AppBootstrap
  16. {
  17. protected function _initLayout()
  18. {
  19. $this->getResource('view')->setLayoutsPath(\Ppb\Utility::getPath('themes') . '/admin');
  20. }
  21. protected function _initUser()
  22. {
  23. $this->bootstrap('settings');
  24. $this->bootstrap('authentication');
  25. if (isset($this->_storage['id'])) {
  26. $usersService = new Service\Users();
  27. $user = $usersService->findBy('id', $this->_storage['id']);
  28. if (count($user) > 0) {
  29. $this->_role = $user['role'];
  30. return $user;
  31. }
  32. }
  33. return null;
  34. }
  35. protected function _initAcl()
  36. {
  37. $this->bootstrap('authentication');
  38. $front = $this->getResource('FrontController');
  39. $this->_acl = new Model\Acl();
  40. $front->registerPlugin(
  41. new Controller\Plugin\Acl($this->_acl, $this->_role));
  42. $view = $this->getResource('view');
  43. $view->navigation()->setAcl($this->_acl)
  44. ->setRole($this->_role);
  45. }
  46. protected function _initPlugins()
  47. {
  48. $this->_registerModuleControllerPlugins('Admin');
  49. }
  50. protected function _initAdminViewHelpers()
  51. {
  52. $this->_registerModuleViewHelpers('Admin');
  53. }
  54. }