Bootstrap.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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 Members;
  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. /**
  34. *
  35. * method that initializes the _members.phtml sub-layout
  36. */
  37. protected function _initSubLayout()
  38. {
  39. $view = $this->getResource('view');
  40. $view->set('isMembersModule', true);
  41. }
  42. protected function _initAcl()
  43. {
  44. $this->bootstrap('authentication');
  45. $front = $this->getResource('FrontController');
  46. $this->_acl = new Model\Acl();
  47. $front->registerPlugin(
  48. new Controller\Plugin\Acl($this->_acl, $this->_role));
  49. $view = $this->getResource('view');
  50. $view->navigation()->setAcl($this->_acl)
  51. ->setRole($this->_role);
  52. }
  53. protected function _initPlugins()
  54. {
  55. $this->_registerModuleControllerPlugins('Listings');
  56. }
  57. protected function _initMembersViewHelpers()
  58. {
  59. $view = $this->getResource('view');
  60. $view->setHelper('offerRanges', new \Listings\View\Helper\OfferRanges());
  61. $this->_registerModuleViewHelpers('Members');
  62. }
  63. }