|
|
@ -10,6 +10,7 @@ use Chamilo\CoreBundle\Entity\User; |
|
|
|
use Chamilo\CoreBundle\Entity\Usergroup; |
|
|
|
use Chamilo\CoreBundle\Entity\Usergroup; |
|
|
|
use Chamilo\CoreBundle\Entity\UsergroupRelUser; |
|
|
|
use Chamilo\CoreBundle\Entity\UsergroupRelUser; |
|
|
|
use Chamilo\CoreBundle\Repository\ResourceRepository; |
|
|
|
use Chamilo\CoreBundle\Repository\ResourceRepository; |
|
|
|
|
|
|
|
use Chamilo\CoreBundle\ServiceHelper\AccessUrlHelper; |
|
|
|
use Doctrine\Persistence\ManagerRegistry; |
|
|
|
use Doctrine\Persistence\ManagerRegistry; |
|
|
|
use Exception; |
|
|
|
use Exception; |
|
|
|
|
|
|
|
|
|
|
@ -17,7 +18,8 @@ class UsergroupRepository extends ResourceRepository |
|
|
|
{ |
|
|
|
{ |
|
|
|
public function __construct( |
|
|
|
public function __construct( |
|
|
|
ManagerRegistry $registry, |
|
|
|
ManagerRegistry $registry, |
|
|
|
private readonly IllustrationRepository $illustrationRepository |
|
|
|
private readonly IllustrationRepository $illustrationRepository, |
|
|
|
|
|
|
|
private readonly AccessUrlHelper $accessUrlHelper, |
|
|
|
) { |
|
|
|
) { |
|
|
|
parent::__construct($registry, Usergroup::class); |
|
|
|
parent::__construct($registry, Usergroup::class); |
|
|
|
} |
|
|
|
} |
|
|
@ -47,11 +49,12 @@ class UsergroupRepository extends ResourceRepository |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($this->getUseMultipleUrl()) { |
|
|
|
if ($this->accessUrlHelper->isMultipleEnabled()) { |
|
|
|
$urlId = $this->getCurrentAccessUrlId(); |
|
|
|
$accessUrl = $this->accessUrlHelper->getCurrent(); |
|
|
|
|
|
|
|
|
|
|
|
$qb->innerJoin('g.urls', 'u') |
|
|
|
$qb->innerJoin('g.urls', 'u') |
|
|
|
->andWhere('u.accessUrl = :urlId') |
|
|
|
->andWhere('u.accessUrl = :urlId') |
|
|
|
->setParameter('urlId', $urlId) |
|
|
|
->setParameter('urlId', $accessUrl->getId()) |
|
|
|
; |
|
|
|
; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -85,11 +88,12 @@ class UsergroupRepository extends ResourceRepository |
|
|
|
->setMaxResults($limit) |
|
|
|
->setMaxResults($limit) |
|
|
|
; |
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
if ($this->getUseMultipleUrl()) { |
|
|
|
if ($this->accessUrlHelper->isMultipleEnabled()) { |
|
|
|
$urlId = $this->getCurrentAccessUrlId(); |
|
|
|
$accessUrl = $this->accessUrlHelper->getCurrent(); |
|
|
|
|
|
|
|
|
|
|
|
$qb->innerJoin('g.urls', 'u') |
|
|
|
$qb->innerJoin('g.urls', 'u') |
|
|
|
->andWhere('u.accessUrl = :urlId') |
|
|
|
->andWhere('u.accessUrl = :urlId') |
|
|
|
->setParameter('urlId', $urlId) |
|
|
|
->setParameter('urlId', $accessUrl->getId()) |
|
|
|
; |
|
|
|
; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -120,11 +124,12 @@ class UsergroupRepository extends ResourceRepository |
|
|
|
->setMaxResults($limit) |
|
|
|
->setMaxResults($limit) |
|
|
|
; |
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
if ($this->getUseMultipleUrl()) { |
|
|
|
if ($this->accessUrlHelper->isMultipleEnabled()) { |
|
|
|
$urlId = $this->getCurrentAccessUrlId(); |
|
|
|
$accessUrl = $this->accessUrlHelper->getCurrent(); |
|
|
|
|
|
|
|
|
|
|
|
$qb->innerJoin('g.urls', 'u') |
|
|
|
$qb->innerJoin('g.urls', 'u') |
|
|
|
->andWhere('u.accessUrl = :urlId') |
|
|
|
->andWhere('u.accessUrl = :urlId') |
|
|
|
->setParameter('urlId', $urlId) |
|
|
|
->setParameter('urlId', $accessUrl->getId()) |
|
|
|
; |
|
|
|
; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -306,11 +311,12 @@ class UsergroupRepository extends ResourceRepository |
|
|
|
$qb->select('g.id, g.title, g.description, g.url, g.picture'); |
|
|
|
$qb->select('g.id, g.title, g.description, g.url, g.picture'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($this->getUseMultipleUrl()) { |
|
|
|
if ($this->accessUrlHelper->isMultipleEnabled()) { |
|
|
|
$urlId = $this->getCurrentAccessUrlId(); |
|
|
|
$accessUrl = $this->accessUrlHelper->getCurrent(); |
|
|
|
|
|
|
|
|
|
|
|
$qb->innerJoin('g.accessUrls', 'a', 'WITH', 'g.id = a.usergroup') |
|
|
|
$qb->innerJoin('g.accessUrls', 'a', 'WITH', 'g.id = a.usergroup') |
|
|
|
->andWhere('a.accessUrl = :urlId') |
|
|
|
->andWhere('a.accessUrl = :urlId') |
|
|
|
->setParameter('urlId', $urlId) |
|
|
|
->setParameter('urlId', $accessUrl->getId()) |
|
|
|
; |
|
|
|
; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|