コード例 #1
0
 /**
  * Create service
  *
  * @param ServiceLocatorInterface $serviceManager
  * @return mixed
  */
 public function createService(ServiceLocatorInterface $serviceManager)
 {
     $locator = $serviceManager->getServiceLocator();
     $viewHelper = new View\Helper\ZfcUserIdentity();
     $viewHelper->setAuthService($locator->get('zfcuser_auth_service'));
     return $viewHelper;
 }
コード例 #2
0
 /**
  * @param string $setting
  * @param UserInterface $user
  * @return
  */
 public function getSetting($setting, UserInterface $user = null)
 {
     if (!$user) {
         $user = $this->zfcUserIdentity->__invoke();
     }
     return $this->userSettingsService->getvalue($setting, $user);
 }
コード例 #3
0
 protected function _before()
 {
     $helper = new ZfcUserIdentity();
     $this->helper = $helper;
     $authService = $this->getMock('Zend\\Authentication\\AuthenticationService');
     $this->authService = $authService;
     $helper->setAuthService($authService);
 }
コード例 #4
0
 public function setUp()
 {
     $helper = new ViewHelper();
     $this->helper = $helper;
     $authService = $this->getMock('Zend\\Authentication\\AuthenticationService');
     $this->authService = $authService;
     $helper->setAuthService($authService);
 }
コード例 #5
0
 /**
  * {@inheritDoc}
  */
 public function createService(ServiceLocatorInterface $pluginManager)
 {
     /* @var $pluginManager HelperPluginManager */
     $serviceManager = $pluginManager->getServiceLocator();
     /* @var $authService AuthenticationService */
     $authService = $serviceManager->get('zfcuser_auth_service');
     $viewHelper = new ZfcUserIdentity();
     $viewHelper->setAuthService($authService);
     return $viewHelper;
 }
コード例 #6
0
ファイル: Module.php プロジェクト: roelvanduijnhoven/ZfcUser
 public function getViewHelperConfig()
 {
     return array('factories' => array('zfcUserDisplayName' => function ($sm) {
         $locator = $sm->getServiceLocator();
         $viewHelper = new View\Helper\ZfcUserDisplayName();
         $viewHelper->setAuthService($locator->get('zfcuser_auth_service'));
         return $viewHelper;
     }, 'zfcUserIdentity' => function ($sm) {
         $locator = $sm->getServiceLocator();
         $viewHelper = new View\Helper\ZfcUserIdentity();
         $viewHelper->setAuthService($locator->get('zfcuser_auth_service'));
         return $viewHelper;
     }, 'zfcUserLoginWidget' => function ($sm) {
         $locator = $sm->getServiceLocator();
         $viewHelper = new View\Helper\ZfcUserLoginWidget();
         $viewHelper->setLoginForm($locator->get('zfcuser_login_form'));
         return $viewHelper;
     }));
 }