/**
  * @param  Repositories\BaseRepository $repository
  * @param  int                         $limit
  * @param  Entities\UserEntity         $user
  */
 protected function runActionDefault(Repositories\BaseRepository $repository, $limit, Entities\UserEntity $user)
 {
     $this->checkIfDisplayInactiveOnly();
     $this->canAccess = $this->canAccess();
     if ($this->canAccess && $this->displayInactiveOnly) {
         $this->items = $repository->getAllInactiveForPage($this->paginatorFactory, $this->vp->page, $limit);
     } else {
         $this->items = $repository->getAllByUserForPage($this->paginatorFactory, $this->vp->page, $limit, $user);
     }
     $this->preparePaginator($this->items->count(), $limit);
 }
Example #2
0
 public function __construct(EntityDao $dao, ITranslator $translator, EntityManager $em)
 {
     parent::__construct($dao);
     $this->translator = $translator;
     $this->em = $em;
     $this->htmlPurifier = (new HtmlPurifierFactory())->createHtmlPurifier();
 }
 /**
  * @param  Repositories\BaseRepository $repository
  * @param  string                      $tagSlug
  * @param  int                         $limit
  * @return Paginator
  */
 protected function runActionDefault(Repositories\BaseRepository $repository, $tagSlug, $limit)
 {
     $this->checkIfDisplayInactiveOnly();
     $tag = $this->getTag($tagSlug);
     $this->canAccess = $this->canAccess();
     if ($this->canAccess && $this->displayInactiveOnly) {
         $items = $tag ? $repository->getAllInactiveByTagForPage($this->paginatorFactory, $this->vp->page, $limit, $tag) : $repository->getAllInactiveForPage($this->paginatorFactory, $this->vp->page, $limit);
     } else {
         $state = !$this->canAccess;
         $items = $tag ? $repository->getAllByTagForPage($this->paginatorFactory, $this->vp->page, $limit, $tag, $state) : $repository->getAllForPage($this->paginatorFactory, $this->vp->page, $limit, $state);
     }
     $this->preparePaginator($items->count(), $limit);
     $this->throw404IfNoItemsOnPage($items, $tag);
     $this->tag = $tag;
     return $items;
 }
Example #4
0
 public function __construct(EntityDao $dao)
 {
     parent::__construct($dao);
 }
 public function __construct(EntityDao $dao, EntityManager $em, MenuCache $menuCache)
 {
     parent::__construct($dao);
     $this->em = $em;
     $this->menuCache = $menuCache;
 }
Example #6
0
 /**
  * @param  int                         $itemId
  * @param  Repositories\BaseRepository $repository
  * @return Entities\BaseEntity|null
  */
 protected function getItem($itemId, Repositories\BaseRepository $repository)
 {
     return $itemId ? $repository->getById($itemId) : null;
 }
Example #7
0
 /**
  * @param  int                         $section
  * @param  Entities\TagRepository[]    $tags
  * @param  Repositories\BaseRepository $repository
  * @param  string                      $wikiType
  * @return array
  */
 private function getItemsForSection($section, array $tags, Repositories\BaseRepository $repository, $wikiType = null)
 {
     $items = $this->cache->load($section);
     if ($items === null) {
         $items = array();
         foreach ($tags as $tag) {
             if ($wikiType ? $repository->getAllByTag($tag, $wikiType) : $repository->getAllByTag($tag)) {
                 $items[$tag->id] = $tag;
             }
         }
         $this->cache->save($section, $items);
     }
     return $items;
 }
Example #8
0
 public function __construct(EntityDao $dao, ITranslator $translator, EntityManager $em)
 {
     parent::__construct($dao);
     $this->translator = $translator;
     $this->em = $em;
 }