Bootstrap.php 1.8 KB

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