ILIAS  release_8 Revision v8.25-1-g13de6a5eca6
IliasDBEmployeeTalkSeriesRepository.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
22
25use ilObjUser;
28
34{
37
44 {
45 $this->currentUser = $currentUser;
46 $this->database = $database;
47 }
48
52 public function findByOwnerAndEmployee(): array
53 {
54 $userId = $this->currentUser->getId();
55
56 //TODO: Alter table talks and store series id, which makes the
57 $result = $this->database->query("
58 SELECT DISTINCT od.obj_id AS objId, oRef.ref_id AS refId
59 FROM (
60 SELECT tree.parent AS parent, talk.employee AS employee
61 FROM etal_data AS talk
62 INNER JOIN object_reference AS oRef ON oRef.obj_id = talk.object_id
63 INNER JOIN tree ON tree.child = oRef.ref_id
64 WHERE oRef.deleted IS NULL
65 ) AS talk
66 INNER JOIN object_reference AS oRef ON oRef.ref_id = talk.parent
67 INNER JOIN object_data AS od ON od.obj_id = oRef.obj_id
68 WHERE od.type = 'tals' AND (talk.employee = " . $this->database->quote($userId, 'integer') .
69 " OR od.owner = " . $this->database->quote($userId, 'integer') .
70 ") AND oRef.deleted is null");
71
72 $talkSeries = [];
73 while ($row = $result->fetchObject()) {
74 $talkSeries[] = new ilObjEmployeeTalkSeries((int) $row->refId, true);
75 }
76
77 return $talkSeries;
78 }
79
81 {
82 $activeRecord = new EmployeeTalkSerieSettings();
83
84 $activeRecord->setId($settingsDto->getObjectId());
85 $activeRecord->setEditingLocked((int) $settingsDto->isLockedEditing());
86 $activeRecord->store();
87 }
88
89 public function readEmployeeTalkSerieSettings(int $obj_id): EmployeeTalkSerieSettingsDto
90 {
92 $activeRecord = EmployeeTalkSerieSettings::findOrGetInstance($obj_id);
93 $activeRecord->setId($obj_id);
94
95 return new EmployeeTalkSerieSettingsDto($obj_id, (bool) $activeRecord->getEditingLocked());
96 }
97
98 public function deleteEmployeeTalkSerieSettings(int $obj_id): void
99 {
101 $activeRecord = EmployeeTalkSerieSettings::findOrGetInstance($obj_id);
102 $activeRecord->delete();
103 }
104}
static findOrGetInstance($primary_key, array $add_constructor_args=array())
__construct(ilObjUser $currentUser, ilDBInterface $database)
IliasDBEmployeeTalkSeriesRepository constructor.
User class.
Interface ilDBInterface.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...