/** * 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); }
/** * 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); }
/** * 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); }
/** * 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; }
/** * 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); }
/** * 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); }
/** * 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; }
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); }
/** * 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); }
/** * 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); }
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); }
/** * 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; }
/** * 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; }
/** * 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); }
/** * 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')); }
/** * 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()); }
/** * 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')); }
/** * 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()); }
/** * 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')); }
public static function getJusbibSearchOptionsForHelperOptions(ServiceManager $sm) { return new \VuFind\View\Helper\Root\SearchOptions($sm->getServiceLocator()->get('Jusbib\\SearchOptionsPluginManager')); }
/** * 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')); }
/** * Construct the UpgradeController. * * @param ServiceManager $sm Service manager. * * @return UpgradeController */ public static function getUpgradeController(ServiceManager $sm) { return new UpgradeController($sm->getServiceLocator()->get('VuFind\\CookieManager')); }
/** * 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')); }
/** * 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')); }
/** * 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); }
/** * 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); }
/** * 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')); }
/** * 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); }
/** * 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); }
/** * 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')); }