ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilPDSelectedItemsBlockMembershipsObjectDatabaseRepository Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilPDSelectedItemsBlockMembershipsObjectDatabaseRepository:
+ Collaboration diagram for ilPDSelectedItemsBlockMembershipsObjectDatabaseRepository:

Public Member Functions

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

Private Attributes

const VALID_OBJECT_TYPES
 
 $db
 
 $recoveryFolderId
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

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

Constructor & Destructor Documentation

◆ __construct()

ilPDSelectedItemsBlockMembershipsObjectDatabaseRepository::__construct ( ilDBInterface  $db,
int  $recoveryFolderId 
)

Member Function Documentation

◆ getForUser()

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

Implements ilPDSelectedItemsBlockMembershipsObjectRepository.

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

References $res, and ilObject\getId().

49  : Generator
50  {
51  $objTypes = array_intersect($objTypes, self::VALID_OBJECT_TYPES);
52  if ($objTypes === []) {
53  return;
54  }
55 
56  $odObjTypes = ' AND ' . $this->db->in(
57  'od.type',
58  $objTypes,
59  false,
60  'text'
61  );
62 
63  $res = $this->db->queryF(
64  "
65  SELECT DISTINCT
66  od.obj_id,
67  objr.ref_id,
68  (
69  CASE
70  WHEN (trans.title IS NOT NULL AND trans.title != '')
71  THEN trans.title
72  ELSE od.title
73  END
74  ) title,
75  (
76  CASE
77  WHEN (trans.description IS NOT NULL AND trans.description != '')
78  THEN trans.description
79  ELSE od.description
80  END
81  ) description,
82  od.type,
83  t.parent,
84  tp.lft parent_lft,
85  (
86  CASE
87  WHEN od.type = 'crs' THEN crs_settings.period_start
88  ELSE grp_settings.period_start
89  END
90  ) period_start,
91  (
92  CASE
93  WHEN od.type = 'crs' THEN crs_settings.period_end
94  ELSE grp_settings.period_end
95  END
96  ) period_end,
97  (
98  CASE
99  WHEN od.type = 'crs' THEN crs_settings.period_time_indication
100  ELSE grp_settings.period_time_indication
101  END
102  ) period_has_time
103  FROM rbac_ua ua
104  INNER JOIN rbac_fa fa ON fa.rol_id = ua.rol_id AND fa.assign = %s
105  INNER JOIN object_reference objr ON objr.ref_id = fa.parent
106  INNER JOIN object_data od ON od.obj_id = objr.obj_id $odObjTypes
107  INNER JOIN tree t ON t.child = objr.ref_id AND t.tree = %s AND t.parent != %s
108  INNER JOIN tree tp ON tp.child = t.parent
109  LEFT JOIN grp_settings ON grp_settings.obj_id = od.obj_id
110  LEFT JOIN crs_settings ON crs_settings.obj_id = od.obj_id
111  LEFT JOIN object_translation trans ON trans.obj_id = od.obj_id AND trans.lang_code = %s
112  WHERE ua.usr_id = %s
113  ",
114  ['text', 'integer', 'integer', 'text', 'integer'],
115  ['y', 1, $this->recoveryFolderId, $actorLanguageCode, $user->getId()]
116  );
117 
118  while ($row = $this->db->fetchAssoc($res)) {
119  $periodStart = null;
120  if (!is_null($row['period_start'])) {
121  $periodStart = new DateTimeImmutable($row['period_start'], new DateTimeZone('UTC'));
122  }
123  $periodEnd = null;
124  if (!is_null($row['period_end'])) {
125  $periodEnd = new DateTimeImmutable($row['period_end'], new DateTimeZone('UTC'));
126  }
127 
129  (int) $row['ref_id'],
130  (int) $row['obj_id'],
131  (string) $row['type'],
132  (string) $row['title'],
133  (string) $row['description'],
134  (int) $row['parent'],
135  (int) $row['parent_lft'],
136  (bool) $row['period_has_time'],
137  $periodStart,
138  $periodEnd
139  );
140  }
141  }
foreach($_POST as $key=> $value) $res
getId()
get object id public
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ getValidObjectTypes()

ilPDSelectedItemsBlockMembershipsObjectDatabaseRepository::getValidObjectTypes ( )
Returns
string[]

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

41  : array
42  {
43  return self::VALID_OBJECT_TYPES;
44  }

Field Documentation

◆ $db

ilPDSelectedItemsBlockMembershipsObjectDatabaseRepository::$db
private

◆ $recoveryFolderId

ilPDSelectedItemsBlockMembershipsObjectDatabaseRepository::$recoveryFolderId
private

◆ VALID_OBJECT_TYPES

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

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


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