예제 #1
0
 /**
  * @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);
 }
예제 #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();
 }
예제 #3
0
 /**
  * @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;
 }
예제 #4
0
 public function __construct(EntityDao $dao)
 {
     parent::__construct($dao);
 }
예제 #5
0
 public function __construct(EntityDao $dao, EntityManager $em, MenuCache $menuCache)
 {
     parent::__construct($dao);
     $this->em = $em;
     $this->menuCache = $menuCache;
 }
예제 #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;
 }
예제 #7
0
파일: MenuCache.php 프로젝트: CSHH/website
 /**
  * @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;
 }
예제 #8
0
 public function __construct(EntityDao $dao, ITranslator $translator, EntityManager $em)
 {
     parent::__construct($dao);
     $this->translator = $translator;
     $this->em = $em;
 }