ILIAS
release_4-3 Revision
◀ ilDoc Overview
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Groups
Pages
class.ilLicenseAccess.php
Go to the documentation of this file.
1
<?php
2
/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
14
class
ilLicenseAccess
15
{
22
static
function
_isEnabled
()
23
{
24
static
$enabled;
25
26
if
(isset($enabled))
27
{
28
return
$enabled;
29
}
30
31
$lic_set =
new
ilSetting
(
"license"
);
32
if
($lic_set->get(
"license_counter"
))
33
{
34
$enabled =
true
;
35
return
true
;
36
}
37
else
38
{
39
$enabled =
false
;
40
return
false
;
41
}
42
}
43
44
57
static
function
_checkAccess
($a_usr_id, $a_obj_id)
58
{
59
global $ilDB,
$ilUser
;
60
61
// check the object license
62
$query
=
'SELECT licenses, used FROM license_data WHERE obj_id = %s'
;
63
$result
= $ilDB->queryF(
$query
, array(
'integer'
), array($a_obj_id));
64
65
if
(
$row
= $ilDB->fetchObject(
$result
))
66
{
67
// no licenses set or at least one free => grant access
68
if
(
$row
->licenses == 0
69
or
$row
->used <
$row
->licenses)
70
{
71
return
true
;
72
}
73
}
74
else
75
{
76
// no license data available => access granted
77
return
true
;
78
}
79
80
// check if user has already accessed
81
$query
=
'SELECT read_count FROM read_event '
82
.
'WHERE usr_id = %s AND obj_id = %s'
;
83
84
$result
= $ilDB->queryF(
$query
,
85
array(
'integer'
,
'integer'
),
86
array($a_usr_id, $a_obj_id));
87
88
if
(
$row
= $ilDB->fetchObject(
$result
))
89
{
90
return
true
;
91
}
92
93
// all failed
94
return
false
;
95
}
96
}
97
98
?>
Services
License
classes
class.ilLicenseAccess.php
Generated on Sat Apr 30 2016 19:01:02 for ILIAS by
1.8.1.2 (using
Doxyfile
)