ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ ilDoc Overview
class.ilCalendarRegistration.php
Go to the documentation of this file.
1
<?
php
2
/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
13
class
ilCalendarRegistration
14
{
15
private
$appointment_id
= 0;
16
17
private
$registered
= array();
18
23
public
function
__construct
($a_appointment_id)
24
{
25
$this->appointment_id = $a_appointment_id;
26
27
$this->
read
();
28
}
29
35
public
static
function
deleteByUser
($a_usr_id)
36
{
37
global
$DIC
;
38
39
$ilDB
= $DIC[
'ilDB'
];
40
41
$query
=
"DELETE FROM cal_registrations "
.
42
"WHERE usr_id = "
.
$ilDB
->quote($a_usr_id,
'integer'
);
43
$ilDB
->manipulate(
$query
);
44
}
45
46
public
static
function
deleteByAppointment
($a_cal_id)
47
{
48
global
$DIC
;
49
50
$ilDB
= $DIC[
'ilDB'
];
51
52
$query
=
"DELETE FROM cal_registrations "
.
53
"WHERE cal_id = "
.
$ilDB
->quote($a_cal_id,
'integer'
);
54
$ilDB
->manipulate(
$query
);
55
}
56
61
public
function
getAppointmentId
()
62
{
63
return
$this->appointment_id
;
64
}
65
70
public
function
getRegisteredUsers
(\
ilDateTime
$start
, \
ilDateTime
$end
)
71
{
72
$users
= [];
73
foreach
($this->registered as $reg_data) {
74
if
(
75
$reg_data[
'dstart'
] == $start->
get
(
IL_CAL_UNIX
) &&
76
$reg_data[
'dend'
] == $end->
get
(
IL_CAL_UNIX
)
77
) {
78
$users
[] = $reg_data[
'usr_id'
];
79
}
80
}
81
return
$users
;
82
}
83
89
public
function
isRegistered
($a_usr_id,
ilDateTime
$start
,
ilDateTime
$end
)
90
{
91
foreach
($this->registered as $reg_data) {
92
if
($reg_data[
'usr_id'
] == $a_usr_id) {
93
if
($reg_data[
'dstart'
] == $start->
get
(
IL_CAL_UNIX
)
and
$reg_data[
'dend'
] == $end->
get
(
IL_CAL_UNIX
)) {
94
return
true
;
95
}
96
}
97
}
98
}
99
105
public
function
register
($a_usr_id,
ilDateTime
$start
,
ilDateTime
$end
)
106
{
107
global
$DIC
;
108
109
$ilDB
= $DIC[
'ilDB'
];
110
111
$this->
unregister
($a_usr_id, $start,
$end
);
112
113
$query
=
"INSERT INTO cal_registrations (cal_id,usr_id,dstart,dend) "
.
114
"VALUES ( "
.
115
$ilDB
->quote($this->
getAppointmentId
(),
'integer'
) .
", "
.
116
$ilDB
->quote($a_usr_id,
'integer'
) .
", "
.
117
$ilDB
->quote($start->get(
IL_CAL_UNIX
),
'integer'
) .
", "
.
118
$ilDB
->quote(
$end
->get(
IL_CAL_UNIX
),
'integer'
) .
119
")"
;
120
$ilDB
->manipulate(
$query
);
121
122
$this->registered[] = $a_usr_id;
123
return
true
;
124
}
125
131
public
function
unregister
($a_usr_id,
ilDateTime
$start,
ilDateTime
$end
)
132
{
133
global
$DIC
;
134
135
$ilDB
= $DIC[
'ilDB'
];
136
137
$query
=
"DELETE FROM cal_registrations "
.
138
"WHERE cal_id = "
.
$ilDB
->quote($this->
getAppointmentId
(),
'integer'
) .
' '
.
139
"AND usr_id = "
.
$ilDB
->quote($a_usr_id,
'integer'
) .
' '
.
140
"AND dstart = "
.
$ilDB
->quote($start->
get
(
IL_CAL_UNIX
),
'integer'
) .
' '
.
141
"AND dend = "
.
$ilDB
->quote($end->
get
(
IL_CAL_UNIX
),
'integer'
);
142
$res
=
$ilDB
->manipulate(
$query
);
143
}
144
145
150
protected
function
read
()
151
{
152
global
$DIC
;
153
154
$ilDB
= $DIC[
'ilDB'
];
155
156
if
(!$this->
getAppointmentId
()) {
157
return
false
;
158
}
159
160
$query
=
"SELECT * FROM cal_registrations WHERE cal_id = "
.
$ilDB
->quote($this->
getAppointmentId
(),
'integer'
);
161
$res
=
$ilDB
->query(
$query
);
162
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
163
$this->registered[] = array(
164
'usr_id'
=>
$row
->usr_id,
165
'dstart'
=>
$row
->dstart,
166
'dend'
=>
$row
->dend
167
);
168
}
169
}
170
}
$DIC
global $DIC
Definition:
saml.php:7
ilCalendarRegistration\read
read()
Read registration.
Definition:
class.ilCalendarRegistration.php:150
ilCalendarRegistration\$registered
$registered
Definition:
class.ilCalendarRegistration.php:17
ilCalendarRegistration\$appointment_id
$appointment_id
Definition:
class.ilCalendarRegistration.php:15
$end
$end
Definition:
bench_freebusygenerator.php:28
IL_CAL_UNIX
const IL_CAL_UNIX
Definition:
class.ilDateTime.php:11
$start
$start
Definition:
bench.php:8
ilCalendarRegistration\getAppointmentId
getAppointmentId()
Get appoinmtent id.
Definition:
class.ilCalendarRegistration.php:61
$res
foreach($_POST as $key=> $value) $res
Definition:
save_question_post_data.php:15
ilCalendarRegistration
registration for calendar appointments
Definition:
class.ilCalendarRegistration.php:13
ilDateTime
Date and time handling
Definition:
class.ilDateTime.php:33
$query
$query
Definition:
proxy_ylocal.php:13
ilDateTime\get
get($a_format, $a_format_str='', $a_tz='')
get formatted date
Definition:
class.ilDateTime.php:506
$users
$users
Definition:
authpage.php:44
$row
$row
Definition:
migrateto20.php:360
ilCalendarRegistration\isRegistered
isRegistered($a_usr_id, ilDateTime $start, ilDateTime $end)
Check if one user is registered.
Definition:
class.ilCalendarRegistration.php:89
ilCalendarRegistration\unregister
unregister($a_usr_id, ilDateTime $start, ilDateTime $end)
unregister one user
Definition:
class.ilCalendarRegistration.php:131
$ilDB
global $ilDB
Definition:
storeScorm2004.php:16
ilCalendarRegistration\__construct
__construct($a_appointment_id)
Constructor.
Definition:
class.ilCalendarRegistration.php:23
php
and
ilDBConstants\FETCHMODE_OBJECT
const FETCHMODE_OBJECT
Definition:
class.ilDBConstants.php:13
ilCalendarRegistration\deleteByAppointment
static deleteByAppointment($a_cal_id)
Definition:
class.ilCalendarRegistration.php:46
ilCalendarRegistration\getRegisteredUsers
getRegisteredUsers(\ilDateTime $start, \ilDateTime $end)
Get all registered users.
Definition:
class.ilCalendarRegistration.php:70
ilCalendarRegistration\deleteByUser
static deleteByUser($a_usr_id)
Delete all user registrations.
Definition:
class.ilCalendarRegistration.php:35
Services
Calendar
classes
class.ilCalendarRegistration.php
Generated on Thu Feb 27 2025 19:01:53 for ILIAS by
1.8.13 (using
Doxyfile
)