ILIAS
release_8 Revision v8.19
◀ ilDoc Overview
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
$
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
x
+
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
+
Variables
$
a
b
c
d
e
f
g
h
j
l
m
p
s
t
u
+
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
+
Data Fields
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Ö
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Variables
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Ö
+
Files
File List
+
Globals
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
+
Functions
_
a
b
c
d
e
g
h
i
m
n
p
r
s
t
u
v
x
+
Variables
$
a
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
z
Examples
•
All
Data Structures
Namespaces
Files
Functions
Variables
Modules
Pages
class.ilConsultationHourAppointments.php
Go to the documentation of this file.
1
<?php
2
3
declare(strict_types=1);
4
26
class
ilConsultationHourAppointments
27
{
31
public
static
function
getAppointmentIds
(
32
int
$a_user_id,
33
int
$a_context_id = null,
34
?
ilDateTime
$a_start = null,
35
?
int
$a_type = null,
36
bool
$a_check_owner =
true
37
): array {
38
global
$DIC
;
39
40
$ilDB
= $DIC->database();
41
42
if
(!$a_type) {
43
$a_type =
ilCalendarCategory::TYPE_CH
;
44
}
45
$owner =
' '
;
46
if
($a_check_owner) {
47
$owner =
" AND be.obj_id = "
.
$ilDB
->quote($a_user_id,
'integer'
);
48
}
49
50
$query
=
"SELECT ce.cal_id FROM cal_entries ce"
.
51
" JOIN cal_cat_assignments cca ON ce.cal_id = cca.cal_id"
.
52
" JOIN cal_categories cc ON cca.cat_id = cc.cat_id"
.
53
" JOIN booking_entry be ON ce.context_id = be.booking_id"
.
54
" WHERE cc.obj_id = "
.
$ilDB
->quote($a_user_id,
'integer'
) .
55
$owner .
56
" AND cc.type = "
.
$ilDB
->quote($a_type,
'integer'
);
57
58
if
($a_context_id) {
59
$query
.=
" AND ce.context_id = "
.
$ilDB
->quote($a_context_id,
'integer'
);
60
}
61
if
($a_start) {
62
$query
.=
" AND ce.starta = "
.
$ilDB
->quote($a_start->get(
IL_CAL_DATETIME
,
''
,
'UTC'
),
'text'
);
63
}
64
$query
.= (
' ORDER BY ce.starta ASC'
);
65
$res
=
$ilDB
->query(
$query
);
66
$entries = array();
67
while
($row =
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
68
$entries[] = (
int
) $row->cal_id;
69
}
70
return
$entries;
71
}
72
78
public
static
function
getAppointmentIdsByGroup
(
79
int
$a_user_id,
80
int
$a_ch_group_id,
81
?
ilDateTime
$start = null
82
): array {
83
global
$DIC
;
84
85
$ilDB
= $DIC->database();
86
$type
=
ilCalendarCategory::TYPE_CH
;
87
$start_limit =
''
;
88
if
($start instanceof
ilDateTime
) {
89
$start_limit =
'AND ce.starta >= '
.
$ilDB
->quote($start->get(
IL_CAL_DATETIME
,
''
,
'UTC'
),
'timestamp'
);
90
}
91
$query
=
'SELECT ce.cal_id FROM cal_entries ce '
.
92
'JOIN cal_cat_assignments ca ON ce.cal_id = ca.cal_id '
.
93
'JOIN cal_categories cc ON ca.cat_id = cc.cat_id '
.
94
'JOIN booking_entry be ON ce.context_id = be.booking_id '
.
95
'WHERE cc.obj_id = '
.
$ilDB
->quote($a_user_id,
'integer'
) .
' '
.
96
'AND cc.type = '
.
$ilDB
->quote(
$type
,
'integer'
) .
' '
.
97
'AND be.booking_group = '
.
$ilDB
->quote($a_ch_group_id,
'integer'
) .
' '
.
98
$start_limit .
' '
.
99
'ORDER BY ce.starta '
;
100
$res
=
$ilDB
->query(
$query
);
101
$app_ids = [];
102
while
($row =
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
103
$app_ids[] = (
int
) $row->cal_id;
104
}
105
return
$app_ids;
106
}
107
112
public
static
function
getAppointments
(
int
$a_user_id): array
113
{
114
$entries = [];
115
foreach
(self::getAppointmentIds($a_user_id) as $app_id) {
116
$entries[] =
new
ilCalendarEntry
($app_id);
117
}
118
return
$entries;
119
}
120
125
public
static
function
getManager
(
bool
$a_as_name =
false
,
bool
$a_full_name =
false
,
int
$a_user_id = null)
126
{
127
global
$DIC
;
128
129
$ilDB
= $DIC->database();
130
$ilUser
= $DIC->user();
131
132
if
(!$a_user_id) {
133
$user_id =
$ilUser
->getId();
134
}
else
{
135
$user_id = $a_user_id;
136
}
137
138
$set =
$ilDB
->query(
'SELECT admin_id FROM cal_ch_settings'
.
139
' WHERE user_id = '
.
$ilDB
->quote($user_id,
'integer'
));
140
$row =
$ilDB
->fetchAssoc($set);
141
if
($row && $row[
'admin_id'
]) {
142
if
($a_as_name && $a_full_name) {
143
return
ilObjUser::_lookupFullname
((
int
) $row[
'admin_id'
]);
144
} elseif ($a_as_name) {
145
return
ilObjUser::_lookupLogin
((
int
) $row[
'admin_id'
]);
146
}
147
return
(
int
) $row[
'admin_id'
];
148
}
149
return
0;
150
}
151
157
public
static
function
setManager
(
string
$a_user_name): bool
158
{
159
global
$DIC
;
160
161
$ilDB
= $DIC->database();
162
$ilUser
= $DIC->user();
163
164
$user_id =
false
;
165
if
($a_user_name) {
166
$user_id =
ilObjUser::_loginExists
($a_user_name);
167
if
(!$user_id) {
168
return
false
;
169
}
170
}
171
172
$ilDB
->manipulate(
'DELETE FROM cal_ch_settings'
.
173
' WHERE user_id = '
.
$ilDB
->quote(
$ilUser
->getId(),
'integer'
));
174
175
if
($user_id && $user_id !=
$ilUser
->getId()) {
176
$ilDB
->manipulate(
'INSERT INTO cal_ch_settings (user_id, admin_id)'
.
177
' VALUES ('
.
$ilDB
->quote(
$ilUser
->getId(),
'integer'
) .
','
.
178
$ilDB
->quote($user_id,
'integer'
) .
')'
);
179
}
180
return
true
;
181
}
182
187
public
static
function
getManagedUsers
(): array
188
{
189
global
$DIC
;
190
191
$ilDB
= $DIC->database();
192
$ilUser
= $DIC->user();
193
194
$all = array();
195
$set =
$ilDB
->query(
'SELECT user_id FROM cal_ch_settings'
.
196
' WHERE admin_id = '
.
$ilDB
->quote(
$ilUser
->getId(),
'integer'
));
197
while
($row =
$ilDB
->fetchAssoc($set)) {
198
$all[(
int
) $row[
'user_id'
]] =
ilObjUser::_lookupLogin
((
int
) $row[
'user_id'
]);
199
}
200
return
$all;
201
}
202
}
ilConsultationHourAppointments\getManager
static getManager(bool $a_as_name=false, bool $a_full_name=false, int $a_user_id=null)
Get consultation hour manager for current user or specific user.
Definition:
class.ilConsultationHourAppointments.php:125
$res
$res
Definition:
ltiservices.php:69
ilCalendarEntry
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition:
class.ilCalendarEntry.php:27
ilDateTime
IL_CAL_DATETIME
const IL_CAL_DATETIME
Definition:
class.ilDateTime.php:7
$type
$type
Definition:
proxy_ylocal.php:10
ilObjUser\_lookupFullname
static _lookupFullname(int $a_user_id)
Definition:
class.ilObjUser.php:568
ilConsultationHourAppointments
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition:
class.ilConsultationHourAppointments.php:26
$DIC
global $DIC
Definition:
feed.php:28
ilCalendarCategory\TYPE_CH
const TYPE_CH
Definition:
class.ilCalendarCategory.php:44
ilConsultationHourAppointments\getAppointmentIds
static getAppointmentIds(int $a_user_id, int $a_context_id=null, ?ilDateTime $a_start=null, ?int $a_type=null, bool $a_check_owner=true)
Definition:
class.ilConsultationHourAppointments.php:31
$ilDB
$ilDB
Definition:
storeScorm2004.php:26
ilConsultationHourAppointments\getManagedUsers
static getManagedUsers()
Get all managed consultation hours users for current users.
Definition:
class.ilConsultationHourAppointments.php:187
ilConsultationHourAppointments\getAppointmentIdsByGroup
static getAppointmentIdsByGroup(int $a_user_id, int $a_ch_group_id, ?ilDateTime $start=null)
Get appointment ids by consultation hour group.
Definition:
class.ilConsultationHourAppointments.php:78
ilObjUser\_loginExists
static _loginExists(string $a_login, int $a_user_id=0)
check if a login name already exists You may exclude a user from the check by giving his user id as 2...
Definition:
class.ilObjUser.php:3204
$query
$query
Definition:
proxy_ylocal.php:13
ilConsultationHourAppointments\getAppointments
static getAppointments(int $a_user_id)
Get all appointments.
Definition:
class.ilConsultationHourAppointments.php:112
$ilUser
$ilUser
Definition:
imgupload.php:34
ilDBConstants\FETCHMODE_OBJECT
const FETCHMODE_OBJECT
Definition:
class.ilDBConstants.php:29
ILIAS\Repository\int
int(string $key)
Definition:
trait.BaseGUIRequest.php:61
ilConsultationHourAppointments\setManager
static setManager(string $a_user_name)
Set consultation hour manager for current user.
Definition:
class.ilConsultationHourAppointments.php:157
ilObjUser\_lookupLogin
static _lookupLogin(int $a_user_id)
Definition:
class.ilObjUser.php:660
Services
Calendar
classes
ConsultationHours
class.ilConsultationHourAppointments.php
Generated on Sun Apr 6 2025 22:01:59 for ILIAS by
1.8.13 (using
Doxyfile
)