ILIAS
release_5-0 Revision 5.0.0-1144-gc4397b1f870
◀ ilDoc Overview
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
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
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
+
Files
File List
+
Globals
+
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
z
+
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
o
p
r
s
t
u
v
w
x
+
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
z
Examples
•
All
Data Structures
Namespaces
Files
Functions
Variables
Modules
Pages
class.ilCourseLMHistory.php
Go to the documentation of this file.
1
<?php
2
/*
3
+-----------------------------------------------------------------------------+
4
| ILIAS open source |
5
+-----------------------------------------------------------------------------+
6
| Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7
| |
8
| This program is free software; you can redistribute it and/or |
9
| modify it under the terms of the GNU General Public License |
10
| as published by the Free Software Foundation; either version 2 |
11
| of the License, or (at your option) any later version. |
12
| |
13
| This program is distributed in the hope that it will be useful, |
14
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
15
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16
| GNU General Public License for more details. |
17
| |
18
| You should have received a copy of the GNU General Public License |
19
| along with this program; if not, write to the Free Software |
20
| Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21
+-----------------------------------------------------------------------------+
22
*/
23
24
34
class
ilCourseLMHistory
35
{
36
var
$db
;
37
38
var
$course_id
;
39
var
$user_id
;
40
41
function
ilCourseLMHistory
($crs_id,$user_id)
42
{
43
global
$ilDB
;
44
45
$this->db =&
$ilDB
;
46
47
$this->course_id = $crs_id;
48
$this->user_id =
$user_id
;
49
}
50
51
function
getUserId
()
52
{
53
return
$this->user_id
;
54
}
55
function
getCourseRefId
()
56
{
57
return
$this->course_id
;
58
}
59
60
function
_updateLastAccess
($a_user_id,$a_lm_ref_id,$a_page_id)
61
{
62
global $tree,
$ilDB
;
63
64
if
(!$crs_ref_id = $tree->checkForParentType($a_lm_ref_id,
'crs'
))
65
{
66
return
true
;
67
}
68
69
// Delete old entries
70
$query
=
"DELETE FROM crs_lm_history "
.
71
"WHERE lm_ref_id = "
.$ilDB->quote($a_lm_ref_id,
'integer'
).
" "
.
72
"AND usr_id = "
.$ilDB->quote($a_user_id,
'integer'
).
""
;
73
$res
= $ilDB->manipulate(
$query
);
74
75
// Add new entry
76
$fields = array(
"usr_id"
=> array(
"integer"
, $a_user_id),
77
"crs_ref_id"
=> array(
"integer"
, $crs_ref_id),
78
"lm_ref_id"
=> array(
"integer"
, $a_lm_ref_id),
79
"lm_page_id"
=> array(
"integer"
, $a_page_id),
80
"last_access"
=> array(
"integer"
, time()));
81
$ilDB->insert(
"crs_lm_history"
, $fields);
82
return
true
;
83
}
84
85
function
getLastLM
()
86
{
87
global
$ilDB
;
88
89
$query
=
"SELECT * FROM crs_lm_history "
.
90
"WHERE usr_id = "
.$ilDB->quote($this->
getUserId
(),
'integer'
).
" "
.
91
"AND crs_ref_id = "
.$ilDB->quote($this->
getCourseRefId
(),
'integer'
).
" "
.
92
"ORDER BY last_access "
;
93
94
$res
= $this->db->query(
$query
);
95
while
(
$row
=
$res
->fetchRow(
DB_FETCHMODE_OBJECT
))
96
{
97
return
$row
->lm_ref_id;
98
}
99
return
false
;
100
}
101
102
function
getLMHistory
()
103
{
104
global
$ilDB
;
105
106
$query
=
"SELECT * FROM crs_lm_history "
.
107
"WHERE usr_id = "
.$ilDB->quote($this->
getUserId
(),
'integer'
).
" "
.
108
"AND crs_ref_id = "
.$ilDB->quote($this->
getCourseRefId
(),
'integer'
).
""
;
109
110
$res
= $this->db->query(
$query
);
111
while
(
$row
=
$res
->fetchRow(
DB_FETCHMODE_OBJECT
))
112
{
113
$lm[
$row
->lm_ref_id][
'lm_ref_id'
] =
$row
->lm_ref_id;
114
$lm[
$row
->lm_ref_id][
'lm_page_id'
] =
$row
->lm_page_id;
115
$lm[
$row
->lm_ref_id][
'last_access'
] =
$row
->last_access;
116
}
117
return
$lm ? $lm : array();
118
}
119
120
function
_deleteUser
($a_usr_id)
121
{
122
global
$ilDB
;
123
124
$query
=
"DELETE FROM crs_lm_history WHERE usr_id = "
.$ilDB->quote($a_usr_id,
'integer'
).
" "
;
125
$res
= $ilDB->manipulate(
$query
);
126
127
return
true
;
128
}
129
130
}
131
?>
$res
$res
Definition:
examplelayouts.sql.php:25
ilCourseLMHistory\$user_id
$user_id
Definition:
class.ilCourseLMHistory.php:39
ilCourseLMHistory\$course_id
$course_id
Definition:
class.ilCourseLMHistory.php:38
$query
$query
Definition:
examplelayouts.sql.php:24
DB_FETCHMODE_OBJECT
const DB_FETCHMODE_OBJECT
Definition:
class.ilDB.php:11
ilCourseLMHistory\getCourseRefId
getCourseRefId()
Definition:
class.ilCourseLMHistory.php:55
ilCourseLMHistory\ilCourseLMHistory
ilCourseLMHistory($crs_id, $user_id)
Definition:
class.ilCourseLMHistory.php:41
ilCourseLMHistory\_deleteUser
_deleteUser($a_usr_id)
Definition:
class.ilCourseLMHistory.php:120
$row
$row
Definition:
examplelayouts.sql.php:26
ilCourseLMHistory\_updateLastAccess
_updateLastAccess($a_user_id, $a_lm_ref_id, $a_page_id)
Definition:
class.ilCourseLMHistory.php:60
ilCourseLMHistory\$db
$db
Definition:
class.ilCourseLMHistory.php:36
ilCourseLMHistory\getLMHistory
getLMHistory()
Definition:
class.ilCourseLMHistory.php:102
$ilDB
global $ilDB
Definition:
storeScorm2004.php:16
ilCourseLMHistory\getLastLM
getLastLM()
Definition:
class.ilCourseLMHistory.php:85
ilCourseLMHistory\getUserId
getUserId()
Definition:
class.ilCourseLMHistory.php:51
ilCourseLMHistory
class ilCourseLMHistory
Definition:
class.ilCourseLMHistory.php:34
Modules
Course
classes
class.ilCourseLMHistory.php
Generated on Mon Apr 7 2025 19:00:38 for ILIAS by
1.8.13 (using
Doxyfile
)