コード例 #1
0
ファイル: Factory.php プロジェクト: bbeckman/NDL-VuFind2
 /**
  * Factory for UserComments tab plugin.
  *
  * @param ServiceManager $sm Service manager.
  *
  * @return UserComments
  */
 public static function getUserComments(ServiceManager $sm)
 {
     $capabilities = $sm->getServiceLocator()->get('VuFind\\AccountCapabilities');
     $config = $sm->getServiceLocator()->get('VuFind\\Config')->get('config');
     $useRecaptcha = isset($config->Captcha) && isset($config->Captcha->forms) && (trim($config->Captcha->forms) === '*' || strpos($config->Captcha->forms, 'userComments'));
     return new UserComments('enabled' === $capabilities->getCommentSetting(), $useRecaptcha);
 }
コード例 #2
0
ファイル: Factory.php プロジェクト: tillk/vufind
 /**
  * Create Reviews loader
  *
  * @param ServiceManager $sm Service manager
  *
  * @return mixed
  */
 public static function getReviews(ServiceManager $sm)
 {
     $loader = $sm->getServiceLocator()->get('VuFind\\ContentReviewsPluginManager');
     $config = $sm->getServiceLocator()->get('VuFind\\Config')->get('config');
     $providers = isset($config->Content->reviews) ? $config->Content->reviews : '';
     return new Loader($loader, $providers);
 }
コード例 #3
0
ファイル: Factory.php プロジェクト: tillk/vufind
 /**
  * Factory for Solr driver.
  *
  * @param ServiceManager $sm Service manager.
  *
  * @return Solr
  */
 public static function getSolr(ServiceManager $sm)
 {
     $cacheDir = $sm->getServiceLocator()->get('VuFind\\CacheManager')->getCacheDir(false);
     $hierarchyFilters = $sm->getServiceLocator()->get('VuFind\\Config')->get('HierarchyDefault');
     $filters = isset($hierarchyFilters->HierarchyTree->filterQueries) ? $hierarchyFilters->HierarchyTree->filterQueries->toArray() : [];
     return new Solr($sm->getServiceLocator()->get('VuFind\\Search'), rtrim($cacheDir, '/') . '/hierarchy', $filters);
 }
コード例 #4
0
ファイル: Factory.php プロジェクト: paulusova/VuFind-2.x
 /**
  * Factory for Solr params object.
  *
  * @param ServiceManager $sm Service manager.
  *
  * @return Solr
  */
 public static function getSolrParams(ServiceManager $sm)
 {
     $options = $sm->getServiceLocator()->get('VuFind\\SearchOptionsPluginManager')->get('Solr');
     $config = $sm->getServiceLocator()->get('VuFind\\Config');
     $translator = $sm->getServiceLocator()->get('VuFind\\Translator');
     $solr = new \MZKPortal\Search\Solr\Params(clone $options, $config, $translator);
     return $solr;
 }
コード例 #5
0
ファイル: Factory.php プロジェクト: grharry/vufind
 /**
  * Factory for Solr driver.
  *
  * @param ServiceManager $sm Service manager.
  *
  * @return Solr
  */
 public static function getSolr(ServiceManager $sm)
 {
     $cacheDir = $sm->getServiceLocator()->get('VuFind\\CacheManager')->getCacheDir(false);
     $hierarchyFilters = $sm->getServiceLocator()->get('VuFind\\Config')->get('HierarchyDefault');
     $filters = isset($hierarchyFilters->HierarchyTree->filterQueries) ? $hierarchyFilters->HierarchyTree->filterQueries->toArray() : [];
     $solr = $sm->getServiceLocator()->get('VuFind\\Search\\BackendManager')->get('Solr')->getConnector();
     $formatterManager = $sm->getServiceLocator()->get('VuFind\\HierarchyTreeDataFormatterPluginManager');
     return new Solr($solr, $formatterManager, rtrim($cacheDir, '/') . '/hierarchy', $filters);
 }
コード例 #6
0
ファイル: Factory.php プロジェクト: hopeful/vufind
 /**
  * Construct the LayoutClass helper.
  *
  * @param ServiceManager $sm Service manager.
  *
  * @return LayoutClass
  */
 public static function getLayoutClass(ServiceManager $sm)
 {
     $config = $sm->getServiceLocator()->get('VuFind\\Config')->get('config');
     $left = !isset($config->Site->sidebarOnLeft) ? false : $config->Site->sidebarOnLeft;
     $offcanvas = !isset($config->Site->offcanvas) ? false : $config->Site->offcanvas;
     // The right-to-left setting is injected into the layout by the Bootstrapper;
     // pull it back out here to avoid duplicate effort.
     $layout = $sm->getServiceLocator()->get('viewmanager')->getViewModel();
     return new LayoutClass($left, $offcanvas, $layout->rtl);
 }
コード例 #7
0
ファイル: Factory.php プロジェクト: tillk/vufind
 /**
  * Factory for Solr results object.
  *
  * @param ServiceManager $sm Service manager.
  *
  * @return Solr
  */
 public static function getEDS(ServiceManager $sm)
 {
     $config = $sm->getServiceLocator()->get('VuFind\\Config');
     $container = new \Zend\Session\Container('EBSCO');
     // No API info in session? Re-establish connection:
     if (!isset($container->info)) {
         $backend = $sm->getServiceLocator()->get('VuFind\\Search\\BackendManager')->get('EDS');
         $backend->getSessionToken();
     }
     $eds = new \VuFind\Search\EDS\Options($config, $container->info);
     return $eds;
 }
コード例 #8
0
ファイル: Factory.php プロジェクト: paulusova/VuFind-2.x
 public static function getHoldingsILS(ServiceManager $sm)
 {
     // If VuFind is configured to suppress the holdings tab when the
     // ILS driver specifies no holdings, we need to pass in a connection
     // object:
     $config = $sm->getServiceLocator()->get('VuFind\\Config')->get('config');
     if (isset($config->Site->hideHoldingsTabWhenEmpty) && $config->Site->hideHoldingsTabWhenEmpty) {
         $catalog = $sm->getServiceLocator()->get('VuFind\\ILSConnection');
     } else {
         $catalog = false;
     }
     return new HoldingsILS($catalog);
 }
コード例 #9
0
ファイル: Factory.php プロジェクト: steenlibrary/vufind
 /**
  * Construct the LayoutClass helper.
  *
  * @param ServiceManager $sm Service manager.
  *
  * @return LayoutClass
  */
 public static function getLayoutClass(ServiceManager $sm)
 {
     $config = $sm->getServiceLocator()->get('VuFind\\Config')->get('config');
     $left = !isset($config->Site->sidebarOnLeft) ? false : $config->Site->sidebarOnLeft;
     $mirror = !isset($config->Site->mirrorSidebarInRTL) ? true : $config->Site->mirrorSidebarInRTL;
     $offcanvas = !isset($config->Site->offcanvas) ? false : $config->Site->offcanvas;
     // The right-to-left setting is injected into the layout by the Bootstrapper;
     // pull it back out here to avoid duplicate effort, then use it to apply
     // the mirror setting appropriately.
     $layout = $sm->getServiceLocator()->get('viewmanager')->getViewModel();
     if ($layout->rtl && !$mirror) {
         $left = !$left;
     }
     return new LayoutClass($left, $offcanvas);
 }
コード例 #10
0
ファイル: Factory.php プロジェクト: tillk/vufind
 /**
  * Construct the LayoutClass helper.
  *
  * @param ServiceManager $sm Service manager.
  *
  * @return LayoutClass
  */
 public static function getLayoutClass(ServiceManager $sm)
 {
     $config = $sm->getServiceLocator()->get('VuFind\\Config')->get('config');
     $left = !isset($config->Site->sidebarOnLeft) ? false : $config->Site->sidebarOnLeft;
     $offcanvas = !isset($config->Site->offcanvas) ? false : $config->Site->offcanvas;
     return new LayoutClass($left, $offcanvas);
 }
コード例 #11
0
ファイル: ObjectExistsFactory.php プロジェクト: Fulbis/api
 public function __invoke(ServiceManager $container)
 {
     $entityManager = $container->getServiceLocator()->get('doctrine.entitymanager.orm_default');
     $options = $this->options;
     $options['object_repository'] = $entityManager->getRepository($options['entity']);
     return new ObjectExists($options);
 }
コード例 #12
0
ファイル: Factory.php プロジェクト: samuli/vufind-ere
 /**
  * Internal utility function for initializing
  * UrlQueryHelper for a Results-object with search ids for all tabs.
  *
  * @param ResultsManager $results Search results.
  * @param ServiceManager $sm      Service manager.
  *
  * @return Results Search results with initialized UrlQueryHelper
  */
 public static function initUrlQueryHelper(\VuFind\Search\Base\Results $results, $sm)
 {
     $helper = new UrlQueryHelper($results->getParams());
     $savedSearches = $sm->getServiceLocator()->get('Request')->getQuery('search');
     if ($savedSearches) {
         $helper->setDefaultParameter('search', $savedSearches);
     }
     $results->setHelper('urlQuery', $helper);
     return $results;
 }
コード例 #13
0
ファイル: Auth.php プロジェクト: Ellipizle/dotscms
 /**
  * Set the ZeAuth Service for the plugin/helper class.
  * @param \Zend\ServiceManager\ServiceManager $serviceManager
  * @return \ZeAuth\Service\Auth
  */
 public function setServiceManager(ServiceManager $serviceManager)
 {
     if (!$this->service) {
         if ($serviceManager instanceof \Zend\View\HelperPluginManager) {
             $this->service = $serviceManager->getServiceLocator()->get('ZeAuth');
         } else {
             $this->service = $serviceManager->get('ZeAuth');
         }
     }
     return $this->service;
 }
コード例 #14
0
ファイル: Factory.php プロジェクト: bbeckman/NDL-VuFind2
 /**
  * Construct the UserList table.
  *
  * @param ServiceManager $sm Service manager.
  *
  * @return UserList
  */
 public static function getUserList(ServiceManager $sm)
 {
     // For user anonymization console utility
     if (Console::isConsole()) {
         $session = new \Zend\Session\Container('List');
     } else {
         $sessionManager = $sm->getServiceLocator()->get('VuFind\\SessionManager');
         $session = new \Zend\Session\Container('List', $sessionManager);
     }
     return new UserList($session);
 }
コード例 #15
0
ファイル: Factory.php プロジェクト: grharry/vufind
 /**
  * Factory for WorldCatSimilar module.
  *
  * @param ServiceManager $sm Service manager.
  *
  * @return WorldCatSimilar
  */
 public static function getWorldCatSimilar(ServiceManager $sm)
 {
     return new WorldCatSimilar($sm->getServiceLocator()->get('VuFind\\Search'));
 }
コード例 #16
0
ファイル: Factory.php プロジェクト: steenlibrary/vufind
 /**
  * Factory for UserComments tab plugin.
  *
  * @param ServiceManager $sm Service manager.
  *
  * @return UserComments
  */
 public static function getUserComments(ServiceManager $sm)
 {
     $capabilities = $sm->getServiceLocator()->get('VuFind\\AccountCapabilities');
     return new UserComments('enabled' === $capabilities->getCommentSetting());
 }
コード例 #17
0
ファイル: Factory.php プロジェクト: tillk/vufind
 /**
  * Construct the SolrReserves plugin.
  *
  * @param ServiceManager $sm Service manager.
  *
  * @return SolrReserves
  */
 public static function getSolrReserves(ServiceManager $sm)
 {
     return new SolrReserves($sm->getServiceLocator()->get('VuFind\\SearchResultsPluginManager'));
 }
コード例 #18
0
ファイル: Factory.php プロジェクト: paulusova/VuFind-2.x
 /**
  * Factory for VoyagerRestful driver.
  *
  * @param ServiceManager $sm Service manager.
  *
  * @return VoyagerRestful
  */
 public static function getVoyagerRestful(ServiceManager $sm)
 {
     $ils = $sm->getServiceLocator()->get('VuFind\\ILSHoldSettings');
     return new VoyagerRestful($sm->getServiceLocator()->get('VuFind\\DateConverter'), $ils->getHoldsMode(), $ils->getTitleHoldsMode());
 }
コード例 #19
0
ファイル: Factory.php プロジェクト: datavoyager/vufind
 /**
  * Factory for JSTree renderer.
  *
  * @param ServiceManager $sm Service manager.
  *
  * @return JSTree
  */
 public static function getJSTree(ServiceManager $sm)
 {
     return new JSTree($sm->getServiceLocator()->get('ControllerPluginManager')->get('Url'));
 }
コード例 #20
0
ファイル: Factory.php プロジェクト: htw-pk15/vufind
 public static function getJusbibSearchOptionsForHelperOptions(ServiceManager $sm)
 {
     return new \VuFind\View\Helper\Root\SearchOptions($sm->getServiceLocator()->get('Jusbib\\SearchOptionsPluginManager'));
 }
コード例 #21
0
ファイル: Factory.php プロジェクト: bbeckman/NDL-VuFind2
 /**
  * Factory for Solr driver.
  *
  * @param ServiceManager $sm Service manager.
  *
  * @return Solr
  */
 public static function getSolr(ServiceManager $sm)
 {
     return new Solr($sm->getServiceLocator()->get('VuFind\\Solr\\Writer'), $sm->getServiceLocator()->get('VuFind\\Search\\BackendManager')->get('SolrStats'));
 }
コード例 #22
0
ファイル: Factory.php プロジェクト: tillk/vufind
 /**
  * Construct the UpgradeController.
  *
  * @param ServiceManager $sm Service manager.
  *
  * @return UpgradeController
  */
 public static function getUpgradeController(ServiceManager $sm)
 {
     return new UpgradeController($sm->getServiceLocator()->get('VuFind\\CookieManager'));
 }
コード例 #23
0
ファイル: Factory.php プロジェクト: tillk/vufind
 /**
  * Construct the MobileUrl helper.
  *
  * @param ServiceManager $sm Service manager.
  *
  * @return MobileUrl
  */
 public static function getMobileUrl(ServiceManager $sm)
 {
     return new MobileUrl($sm->getServiceLocator()->get('VuFindTheme\\Mobile'));
 }
コード例 #24
0
ファイル: Factory.php プロジェクト: steenlibrary/vufind
 /**
  * Factory for Username
  *
  * @param ServiceManager $sm Service manager.
  *
  * @return Username
  */
 public static function getUsername(ServiceManager $sm)
 {
     return new Username($sm->getServiceLocator()->get('ZfcRbac\\Service\\AuthorizationService'));
 }
コード例 #25
0
ファイル: Factory.php プロジェクト: datavoyager/vufind
 /**
  * Create a Syndetics loader
  *
  * @param ServiceManager $sm Service manager
  *
  * @return mixed
  */
 public static function getSyndetics(ServiceManager $sm)
 {
     $config = $sm->getServiceLocator()->get('VuFind\\Config')->get('config');
     return new Syndetics(isset($config->Syndetics->use_ssl) && $config->Syndetics->use_ssl);
 }
コード例 #26
0
ファイル: Factory.php プロジェクト: tillk/vufind
 /**
  * Factory for UserComments tab plugin.
  *
  * @param ServiceManager $sm Service manager.
  *
  * @return UserComments
  */
 public static function getUserComments(ServiceManager $sm)
 {
     $cfg = $sm->getServiceLocator()->get('VuFind\\Config')->get('config');
     $enabled = !isset($cfg->Social->comments) || $cfg->Social->comments && $cfg->Social->comments !== 'disabled';
     return new UserComments($enabled);
 }
コード例 #27
0
ファイル: Factory.php プロジェクト: steenlibrary/vufind
 /**
  * Factory for WorldCatIdentities module.
  *
  * @param ServiceManager $sm Service manager.
  *
  * @return WorldCatIdentities
  */
 public static function getWorldCatIdentities(ServiceManager $sm)
 {
     return new WorldCatIdentities($sm->getServiceLocator()->get('VuFind\\WorldCatUtils'));
 }
コード例 #28
0
ファイル: Factory.php プロジェクト: datavoyager/vufind
 /**
  * Construct the UserList table.
  *
  * @param ServiceManager $sm Service manager.
  *
  * @return UserList
  */
 public static function getUserList(ServiceManager $sm)
 {
     $sessionManager = $sm->getServiceLocator()->get('VuFind\\SessionManager');
     $session = new \Zend\Session\Container('List', $sessionManager);
     return new UserList($session);
 }
コード例 #29
0
ファイル: Factory.php プロジェクト: jlehmus/NDL-VuFind2
 /**
  * Factory for AxiellWebServices driver.
  *
  * @param ServiceManager $sm Service manager.
  *
  * @return AxiellWebServices
  */
 public static function getAxiellWebServices(ServiceManager $sm)
 {
     $ils = $sm->getServiceLocator()->get('VuFind\\ILSHoldSettings');
     $configReader = $sm->getServiceLocator()->get('Vufind\\Config');
     return new AxiellWebServices($sm->getServiceLocator()->get('VuFind\\DateConverter'), $configReader);
 }
コード例 #30
0
ファイル: Factory.php プロジェクト: grharry/vufind
 /**
  * Construct the MultiILS plugin.
  *
  * @param ServiceManager $sm Service manager.
  *
  * @return MultiILS
  */
 public static function getMultiILS(ServiceManager $sm)
 {
     return new MultiILS($sm->getServiceLocator()->get('VuFind\\ILSConnection'), $sm->getServiceLocator()->get('VuFind\\ILSAuthenticator'));
 }