ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
ilPDSelectedItemsBlockMembershipsObjectDatabaseRepository Class Reference
+ Inheritance diagram for ilPDSelectedItemsBlockMembershipsObjectDatabaseRepository:
+ Collaboration diagram for ilPDSelectedItemsBlockMembershipsObjectDatabaseRepository:

Public Member Functions

 __construct (protected readonly ilDBInterface $db, protected readonly int $recovery_folder_id)
 
 getValidObjectTypes ()
 
 getForUser (ilObjUser $user, array $objTypes, string $actorLanguageCode)
 
 getForUser (ilObjUser $user, array $objTypes, string $actorLanguageCode)
 

Private Attributes

const VALID_OBJECT_TYPES
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilPDSelectedItemsBlockMembershipsObjectDatabaseRepository::__construct ( protected readonly ilDBInterface  $db,
protected readonly int  $recovery_folder_id 
)

Member Function Documentation

◆ getForUser()

ilPDSelectedItemsBlockMembershipsObjectDatabaseRepository::getForUser ( ilObjUser  $user,
array  $objTypes,
string  $actorLanguageCode 
)
Parameters
string[]$objTypes

Implements ilPDSelectedItemsBlockMembershipsObjectRepository.

Definition at line 40 of file class.ilPDSelectedItemsBlockMembershipsObjectDatabaseRepository.php.

40 : Generator
41 {
42 $objTypes = array_intersect($objTypes, self::VALID_OBJECT_TYPES);
43 if ($objTypes === []) {
44 return;
45 }
46
47 $odObjTypes = ' AND ' . $this->db->in(
48 'od.type',
49 $objTypes,
50 false,
52 );
53
54 $res = $this->db->queryF(
55 "
56 SELECT DISTINCT
57 od.obj_id,
58 objr.ref_id,
59 (
60 CASE
61 WHEN (trans.title IS NOT NULL AND trans.title != '')
62 THEN trans.title
63 ELSE od.title
64 END
65 ) title,
66 (
67 CASE
68 WHEN (trans.description IS NOT NULL AND trans.description != '')
69 THEN trans.description
70 ELSE od.description
71 END
72 ) description,
73 od.type,
74 t.parent,
75 tp.lft parent_lft,
76 (
77 CASE
78 WHEN od.type = 'crs' THEN crs_settings.period_start
79 ELSE grp_settings.period_start
80 END
81 ) period_start,
82 (
83 CASE
84 WHEN od.type = 'crs' THEN crs_settings.period_end
85 ELSE grp_settings.period_end
86 END
87 ) period_end,
88 (
89 CASE
90 WHEN od.type = 'crs' THEN crs_settings.period_time_indication
91 ELSE grp_settings.period_time_indication
92 END
93 ) period_has_time
94 FROM rbac_ua ua
95 INNER JOIN rbac_fa fa ON fa.rol_id = ua.rol_id AND fa.assign = %s
96 INNER JOIN object_reference objr ON objr.ref_id = fa.parent
97 INNER JOIN object_data od ON od.obj_id = objr.obj_id $odObjTypes
98 INNER JOIN tree t ON t.child = objr.ref_id AND t.tree = %s AND t.parent != %s
99 INNER JOIN tree tp ON tp.child = t.parent
100 LEFT JOIN grp_settings ON grp_settings.obj_id = od.obj_id
101 LEFT JOIN crs_settings ON crs_settings.obj_id = od.obj_id
102 LEFT JOIN object_translation trans ON trans.obj_id = od.obj_id AND trans.lang_code = %s
103 WHERE ua.usr_id = %s
104 ",
106 ['y', 1, $this->recovery_folder_id, $actorLanguageCode, $user->getId()]
107 );
108
109 while ($row = $this->db->fetchAssoc($res)) {
110 $periodStart = null;
111 if (!is_null($row['period_start'])) {
112 $periodStart = new DateTimeImmutable($row['period_start'], new DateTimeZone('UTC'));
113 }
114 $periodEnd = null;
115 if (!is_null($row['period_end'])) {
116 $periodEnd = new DateTimeImmutable($row['period_end'], new DateTimeZone('UTC'));
117 }
118
120 (int) $row['ref_id'],
121 (int) $row['obj_id'],
122 (string) $row['type'],
123 (string) $row['title'],
124 (string) $row['description'],
125 (int) $row['parent'],
126 (int) $row['parent_lft'],
127 (bool) $row['period_has_time'],
128 $periodStart,
129 $periodEnd
130 );
131 }
132 }
$res
Definition: ltiservices.php:69

References $res, ilObject\getId(), ilDBConstants\T_INTEGER, and ilDBConstants\T_TEXT.

+ Here is the call graph for this function:

◆ getValidObjectTypes()

ilPDSelectedItemsBlockMembershipsObjectDatabaseRepository::getValidObjectTypes ( )

Field Documentation

◆ VALID_OBJECT_TYPES

const ilPDSelectedItemsBlockMembershipsObjectDatabaseRepository::VALID_OBJECT_TYPES
private
Initial value:
= [
'crs',
'grp',
]

Definition at line 23 of file class.ilPDSelectedItemsBlockMembershipsObjectDatabaseRepository.php.

Referenced by getValidObjectTypes().


The documentation for this class was generated from the following file: