1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* For licensing terms, see /license.txt */ |
6
|
|
|
|
7
|
|
|
namespace Chamilo\CourseBundle\Repository; |
8
|
|
|
|
9
|
|
|
use Chamilo\CoreBundle\Entity\Course; |
10
|
|
|
use Chamilo\CoreBundle\Entity\ResourceInterface; |
11
|
|
|
use Chamilo\CoreBundle\Entity\ResourceNode; |
12
|
|
|
use Chamilo\CoreBundle\Entity\Session; |
13
|
|
|
use Chamilo\CoreBundle\Entity\User; |
14
|
|
|
use Chamilo\CoreBundle\Repository\ResourceRepository; |
15
|
|
|
use Chamilo\CoreBundle\Repository\ResourceWithLinkInterface; |
16
|
|
|
use Chamilo\CourseBundle\Entity\CGlossary; |
17
|
|
|
use Chamilo\CourseBundle\Entity\CGroup; |
18
|
|
|
use Doctrine\ORM\QueryBuilder; |
19
|
|
|
use Doctrine\Persistence\ManagerRegistry; |
20
|
|
|
use Symfony\Component\Routing\RouterInterface; |
21
|
|
|
|
22
|
|
|
final class CGlossaryRepository extends ResourceRepository implements ResourceWithLinkInterface |
23
|
|
|
{ |
24
|
|
|
public function __construct(ManagerRegistry $registry) |
25
|
|
|
{ |
26
|
|
|
parent::__construct($registry, CGlossary::class); |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
/*public function getResources(User $user, ResourceNode $parentNode, Course $course = null, Session $session = null, CGroup $group = null): QueryBuilder |
30
|
|
|
{ |
31
|
|
|
return $this->getResourcesByCourse($course, $session, $group, $parentNode); |
32
|
|
|
}*/ |
33
|
|
|
|
34
|
|
|
public function getLink(ResourceInterface $resource, RouterInterface $router, array $extraParams = []): string |
35
|
|
|
{ |
36
|
|
|
$params = [ |
37
|
|
|
'name' => 'glossary/index.php', |
38
|
|
|
'glossary_id' => $resource->getResourceIdentifier(), |
39
|
|
|
]; |
40
|
|
|
if (!empty($extraParams)) { |
41
|
|
|
$params = array_merge($params, $extraParams); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
return $router->generate('legacy_main', $params); |
45
|
|
|
} |
46
|
|
|
} |
47
|
|
|
|