ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ ilDoc Overview
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
public
$db
;
37
38
public
$course_id
;
39
public
$user_id
;
40
46
public
function
__construct
($crs_id,
$user_id
)
47
{
48
global
$DIC
;
49
50
$ilDB
= $DIC[
'ilDB'
];
51
52
$this->db = &
$ilDB
;
53
54
$this->course_id = $crs_id;
55
$this->user_id =
$user_id
;
56
}
57
58
public
function
getUserId
()
59
{
60
return
$this->user_id
;
61
}
62
public
function
getCourseRefId
()
63
{
64
return
$this->course_id
;
65
}
66
67
public
static
function
_updateLastAccess
($a_user_id, $a_lm_ref_id, $a_page_id)
68
{
69
global
$DIC
;
70
71
$tree
= $DIC[
'tree'
];
72
$ilDB
= $DIC[
'ilDB'
];
73
74
if
(!$crs_ref_id =
$tree
->checkForParentType($a_lm_ref_id,
'crs'
)) {
75
return
true
;
76
}
77
78
$ilDB
->replace(
"crs_lm_history"
, [
79
"crs_ref_id"
=> [
"integer"
, $crs_ref_id],
80
"lm_ref_id"
=> [
"integer"
, $a_lm_ref_id],
81
"usr_id"
=> [
"integer"
, $a_user_id]
82
], [
83
"lm_page_id"
=> [
"integer"
, $a_page_id],
84
"last_access"
=> [
"integer"
, time()]
85
]
86
);
87
88
return
true
;
89
}
90
91
public
function
getLastLM
()
92
{
93
global
$DIC
;
94
95
$ilDB
= $DIC[
'ilDB'
];
96
97
$query
=
"SELECT * FROM crs_lm_history "
.
98
"WHERE usr_id = "
.
$ilDB
->quote($this->
getUserId
(),
'integer'
) .
" "
.
99
"AND crs_ref_id = "
.
$ilDB
->quote($this->
getCourseRefId
(),
'integer'
) .
" "
.
100
"ORDER BY last_access "
;
101
102
$res
= $this->db->query(
$query
);
103
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
104
return
$row
->lm_ref_id;
105
}
106
return
false
;
107
}
108
109
public
function
getLMHistory
()
110
{
111
global
$DIC
;
112
113
$ilDB
= $DIC[
'ilDB'
];
114
115
$query
=
"SELECT * FROM crs_lm_history "
.
116
"WHERE usr_id = "
.
$ilDB
->quote($this->
getUserId
(),
'integer'
) .
" "
.
117
"AND crs_ref_id = "
.
$ilDB
->quote($this->
getCourseRefId
(),
'integer'
) .
""
;
118
119
$res
= $this->db->query(
$query
);
120
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
121
$lm[
$row
->lm_ref_id][
'lm_ref_id'
] =
$row
->lm_ref_id;
122
$lm[
$row
->lm_ref_id][
'lm_page_id'
] =
$row
->lm_page_id;
123
$lm[
$row
->lm_ref_id][
'last_access'
] =
$row
->last_access;
124
}
125
return
$lm ? $lm : array();
126
}
127
134
public
static
function
_deleteUser
($a_usr_id)
135
{
136
global
$DIC
;
137
138
$ilDB
= $DIC[
'ilDB'
];
139
140
$query
=
"DELETE FROM crs_lm_history WHERE usr_id = "
.
$ilDB
->quote($a_usr_id,
'integer'
) .
" "
;
141
$res
=
$ilDB
->manipulate(
$query
);
142
143
return
true
;
144
}
145
}
ilCourseLMHistory\_updateLastAccess
static _updateLastAccess($a_user_id, $a_lm_ref_id, $a_page_id)
Definition:
class.ilCourseLMHistory.php:67
ilCourseLMHistory\_deleteUser
static _deleteUser($a_usr_id)
Delete user type $ilDB.
Definition:
class.ilCourseLMHistory.php:134
$DIC
global $DIC
Definition:
saml.php:7
ilCourseLMHistory\$user_id
$user_id
Definition:
class.ilCourseLMHistory.php:39
ilCourseLMHistory\$course_id
$course_id
Definition:
class.ilCourseLMHistory.php:38
ilCourseLMHistory\getCourseRefId
getCourseRefId()
Definition:
class.ilCourseLMHistory.php:62
$res
foreach($_POST as $key=> $value) $res
Definition:
save_question_post_data.php:15
$tree
$tree
Definition:
calendarserver.php:37
$query
$query
Definition:
proxy_ylocal.php:13
ilCourseLMHistory\$db
$db
Definition:
class.ilCourseLMHistory.php:36
$row
$row
Definition:
migrateto20.php:360
ilCourseLMHistory\getLMHistory
getLMHistory()
Definition:
class.ilCourseLMHistory.php:109
$ilDB
global $ilDB
Definition:
storeScorm2004.php:16
ilCourseLMHistory\__construct
__construct($crs_id, $user_id)
Constructor.
Definition:
class.ilCourseLMHistory.php:46
php
ilDBConstants\FETCHMODE_OBJECT
const FETCHMODE_OBJECT
Definition:
class.ilDBConstants.php:13
ilCourseLMHistory\getLastLM
getLastLM()
Definition:
class.ilCourseLMHistory.php:91
ilCourseLMHistory\getUserId
getUserId()
Definition:
class.ilCourseLMHistory.php:58
ilCourseLMHistory
class ilCourseLMHistory
Definition:
class.ilCourseLMHistory.php:34
Modules
Course
classes
class.ilCourseLMHistory.php
Generated on Thu Jan 16 2025 19:02:00 for ILIAS by
1.8.13 (using
Doxyfile
)