ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ ilDoc Overview
class.ilTimingUser.php
Go to the documentation of this file.
1
<?
php
2
/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
12
class
ilTimingUser
13
{
14
private
$ref_id
= 0;
15
private
$usr_id
= 0;
16
private
$start
= null;
17
private
$end
= null;
18
19
private
$is_scheduled
=
false
;
20
26
public
function
__construct
($a_ref_id, $a_usr_id)
27
{
28
$this->ref_id = $a_ref_id;
29
$this->usr_id = $a_usr_id;
30
31
$this->start =
new
ilDateTime
(0,
IL_CAL_UNIX
);
32
$this->end =
new
ilDateTime
(0,
IL_CAL_UNIX
);
33
34
$this->
read
();
35
}
36
41
public
function
getUserId
()
42
{
43
return
$this->usr_id
;
44
}
45
50
public
function
getRefId
()
51
{
52
return
$this->ref_id
;
53
}
54
58
public
function
isScheduled
()
59
{
60
return
$this->is_scheduled
;
61
}
62
67
public
function
getStart
()
68
{
69
return
$this->start
;
70
}
71
76
public
function
getEnd
()
77
{
78
return
$this->end
;
79
}
80
84
public
function
create
()
85
{
86
global
$DIC
;
87
88
$ilDB
= $DIC->database();
89
90
if
($this->
isScheduled
()) {
91
return
$this->
update
();
92
}
93
94
$query
=
'INSERT INTO crs_timings_user (ref_id, usr_id, sstart, ssend ) VALUES ( '
.
95
$ilDB
->quote($this->
getRefId
(),
'integer'
) .
', '
.
96
$ilDB
->quote($this->
getUserId
(),
'integer'
) .
', '
.
97
$ilDB
->quote($this->
getStart
()->
get
(
IL_CAL_UNIX
,
'integer'
)) .
', '
.
98
$ilDB
->quote($this->
getEnd
()->
get
(
IL_CAL_UNIX
,
'integer'
)) .
' '
.
99
')'
;
100
$ilDB
->manipulate(
$query
);
101
102
$this->is_scheduled =
true
;
103
}
104
109
public
function
update
()
110
{
111
global
$DIC
;
112
113
$ilDB
= $DIC->database();
114
115
if
(!$this->
isScheduled
()) {
116
return
$this->
create
();
117
}
118
119
$query
=
'UPDATE crs_timings_user '
.
120
'SET sstart = '
.
$ilDB
->quote($this->
getStart
()->
get
(
IL_CAL_UNIX
,
'integer'
)) .
', '
.
121
'ssend = '
.
$ilDB
->quote($this->
getEnd
()->
get
(
IL_CAL_UNIX
,
'integer'
)) .
' '
.
122
'WHERE ref_id = '
.
$ilDB
->quote($this->
getRefId
(),
'integer'
) .
' '
.
123
'AND usr_id = '
.
$ilDB
->quote($this->
getUserId
(),
'integer'
);
124
$ilDB
->manipulate(
$query
);
125
}
126
131
public
function
delete
()
132
{
133
global
$DIC
;
134
135
$ilDB
= $DIC->database();
136
137
$query
=
'DELETE FROM crs_timings_user '
.
' '
.
138
'WHERE ref_id = '
.
$ilDB
->quote($this->
getRefId
(),
'integer'
) .
' '
.
139
'AND usr_id = '
.
$ilDB
->quote($this->
getUserId
(),
'integer'
);
140
$ilDB
->manipulate(
$query
);
141
142
$this->is_scheduled =
false
;
143
}
144
145
146
150
public
function
read
()
151
{
152
global
$DIC
;
153
154
$ilDB
= $DIC->database();
155
156
$query
=
'SELECT * FROM crs_timings_user '
.
157
'WHERE ref_id = '
.
$ilDB
->quote($this->
getRefId
(),
'integer'
) .
' '
.
158
'AND usr_id = '
.
$ilDB
->quote($this->
getUserId
(),
'integer'
);
159
$res
=
$ilDB
->query(
$query
);
160
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
161
$this->is_scheduled =
true
;
162
$this->start =
new
ilDateTime
(
$row
->sstart,
IL_CAL_UNIX
);
163
$this->end =
new
ilDateTime
(
$row
->ssend,
IL_CAL_UNIX
);
164
}
165
return
$this->
isScheduled
();
166
}
167
}
ilTimingUser\isScheduled
isScheduled()
Check if an entry exists for user.
Definition:
class.ilTimingUser.php:58
ilTimingUser\getStart
getStart()
Use to set start date.
Definition:
class.ilTimingUser.php:67
$DIC
global $DIC
Definition:
saml.php:7
ilTimingUser
TableGUI class for timings administration.
Definition:
class.ilTimingUser.php:12
IL_CAL_UNIX
const IL_CAL_UNIX
Definition:
class.ilDateTime.php:11
ilTimingUser\getUserId
getUserId()
get user id
Definition:
class.ilTimingUser.php:41
ilTimingUser\read
read()
Read from db.
Definition:
class.ilTimingUser.php:150
ilTimingUser\__construct
__construct($a_ref_id, $a_usr_id)
Constructor.
Definition:
class.ilTimingUser.php:26
$res
foreach($_POST as $key=> $value) $res
Definition:
save_question_post_data.php:15
ilTimingUser\$usr_id
$usr_id
Definition:
class.ilTimingUser.php:15
ilTimingUser\create
create()
Create new entry.
Definition:
class.ilTimingUser.php:84
ilTimingUser\$end
$end
Definition:
class.ilTimingUser.php:17
ilDateTime
Date and time handling
Definition:
class.ilDateTime.php:33
$query
$query
Definition:
proxy_ylocal.php:13
$row
$row
Definition:
migrateto20.php:360
ilTimingUser\getEnd
getEnd()
Use to set date.
Definition:
class.ilTimingUser.php:76
ilTimingUser\$start
$start
Definition:
class.ilTimingUser.php:16
ilTimingUser\$ref_id
$ref_id
Definition:
class.ilTimingUser.php:14
$ilDB
global $ilDB
Definition:
storeScorm2004.php:16
ilTimingUser\update
update()
Update type $ilDB.
Definition:
class.ilTimingUser.php:109
ilTimingUser\$is_scheduled
$is_scheduled
Definition:
class.ilTimingUser.php:19
php
ilDBConstants\FETCHMODE_OBJECT
const FETCHMODE_OBJECT
Definition:
class.ilDBConstants.php:13
ilTimingUser\getRefId
getRefId()
Get ref_id.
Definition:
class.ilTimingUser.php:50
Modules
Course
classes
Timings
class.ilTimingUser.php
Generated on Thu Jan 30 2025 19:01:38 for ILIAS by
1.8.13 (using
Doxyfile
)