Наследование: extends Zend\Mvc\Controller\Plugin\AbstractPlugin
 /**
  * @param ModuleEntity $module
  * @return Entry
  */
 public function addModule(ModuleEntity $module)
 {
     $moduleDescription = $module->getDescription();
     if (empty($moduleDescription)) {
         $moduleDescription = 'No description available';
     }
     $moduleName = $module->getName();
     $urlParams = ['vendor' => $module->getOwner(), 'module' => $moduleName];
     $entry = $this->feed->createEntry();
     $entry->setId($module->getIdentifier());
     $entry->setTitle($moduleName);
     $entry->setDescription($moduleDescription);
     $entry->setLink($this->urlPlugin->fromRoute('view-module', $urlParams, ['force_canonical' => true]));
     $entry->addAuthor(['name' => $module->getOwner()]);
     $entry->setDateCreated($module->getCreatedAtDateTime());
     $this->feed->addEntry($entry);
     return $entry;
 }
Пример #2
0
 /**
  * Add URLs to the outline.
  *
  * @return void
  */
 protected function injectUrls()
 {
     foreach ($this->outline['lists'] as $key => $list) {
         foreach ($list as $id => $item) {
             foreach ($item['datastreams'] as $ds) {
                 $routeParams = ['id' => $item['id'], 'type' => $ds];
                 $this->outline['lists'][$key][$id][strtolower($ds)] = $this->url->fromRoute('files', $routeParams);
             }
         }
     }
 }
Пример #3
0
 /**
  * Transforms Collection XML to Desired Format
  *
  * @param string $context     The Context in which the tree is being displayed
  * @param string $mode        The Mode in which the tree is being displayed
  * @param string $hierarchyID The hierarchy to get the tree for
  * @param string $recordID    The currently selected Record (false for none)
  *
  * @return string A HTML List
  */
 protected function transformCollectionXML($context, $mode, $hierarchyID, $recordID)
 {
     $record = $this->getRecordDriver();
     $inHierarchies = $record->getHierarchyTopID();
     $inHierarchiesTitle = $record->getHierarchyTopTitle();
     $hierarchyTitle = $this->getHierarchyName($hierarchyID, $inHierarchies, $inHierarchiesTitle);
     // Set up parameters for XSL transformation
     $params = ['titleText' => $this->translate('collection_view_record'), 'collectionID' => $hierarchyID, 'collectionTitle' => $hierarchyTitle, 'baseURL' => rtrim($this->router->fromRoute('home'), '/'), 'context' => $context, 'recordID' => $recordID];
     // Transform the XML
     $xmlFile = $this->getDataSource()->getXML($hierarchyID);
     $transformation = ucfirst($context) . ucfirst($mode);
     $xslFile = "Hierarchy/{$transformation}.xsl";
     return \VuFind\XSLT\Processor::process($xslFile, $xmlFile, $params);
 }
Пример #4
0
 public function fromRoute($route = null, $params = array(), $options = array(), $reuseMatchedParams = false, $useAlias = true)
 {
     $url = parent::fromRoute($route, $params, $options, $reuseMatchedParams);
     if (!$useAlias) {
         return $url;
     }
     $aliasManager = $this->aliasManager;
     $instance = $this->instanceManager->getInstanceFromRequest();
     try {
         $url = $aliasManager->findAliasBySource($url, $instance);
     } catch (AliasNotFoundException $e) {
         // Nothing to do..
     }
     return $url;
 }
Пример #5
0
 public function testPluginWithoutControllerRaisesDomainException()
 {
     $plugin = new UrlPlugin();
     $this->setExpectedException('Zend\\Mvc\\Exception\\DomainException', 'requires a controller');
     $plugin->fromRoute('home');
 }
Пример #6
0
 /**
  * @todo remove unused $mailer parameter an fix tests
  *
  * @param InputFilterInterface $filter
  * @param Plugin\Mailer $mailer
  * @param Url $url
  * @throws \LogicException
  * @throws UserDoesNotHaveAnEmailException
  * @throws UserNotFoundException
  */
 public function proceed(InputFilterInterface $filter, Plugin\Mailer $mailer, Url $url)
 {
     if (!$filter->isValid()) {
         throw new \LogicException('Form is not valid');
     }
     $identity = $filter->getValue('identity');
     $suffix = $this->loginFilter->filter();
     if (!($user = $this->userRepository->findByLoginOrEmail($identity, $suffix))) {
         throw new UserNotFoundException('User is not found');
     }
     if (!($email = $user->getInfo()->getEmail())) {
         throw new UserDoesNotHaveAnEmailException('User does not have an email');
     }
     $tokenHash = $this->tokenGenerator->generate($user);
     $resetLink = $url->fromRoute('lang/goto-reset-password', array('token' => $tokenHash, 'userId' => $user->getId()), array('force_canonical' => true));
     $e = new AuthEvent();
     $e->setResetLink($resetLink);
     $e->setUser($user);
     $this->eventManager->trigger(AuthEvent::EVENT_AUTH_NEWPASSWORD, $e);
 }
Пример #7
0
 /**
  * @param string $path
  * @param array $parameters
  *
  * @return string
  */
 protected function generateUrl($path, array $parameters = array())
 {
     return $this->urlPlugin->fromRoute($path, $parameters, array('force_canonical' => true));
 }