ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilLicenseAccess Class Reference
+ Collaboration diagram for ilLicenseAccess:

Static Public Member Functions

static _isEnabled ()
 Check, if licencing is enabled This check is called from the ilAccessHandler class. More...
 
static _checkAccess ($a_usr_id, $a_obj_id)
 Check, if a user can access an object by license. More...
 

Detailed Description

Definition at line 14 of file class.ilLicenseAccess.php.

Member Function Documentation

◆ _checkAccess()

static ilLicenseAccess::_checkAccess (   $a_usr_id,
  $a_obj_id 
)
static

Check, if a user can access an object by license.

The user can access, if he/she already accessed the object or if a license is available for the object. This check is called from the ilAccessHandler class.

@access static

Parameters
intuser id
intobject id (not reference)
Returns
boolean access is possible (true/false)

Definition at line 57 of file class.ilLicenseAccess.php.

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 }
$result
global $ilDB
global $ilUser
Definition: imgupload.php:15

References $ilDB, $ilUser, $query, $result, and $row.

Referenced by ilLicense\_checkAccess(), and ilAccessHandler\doLicenseCheck().

+ Here is the caller graph for this function:

◆ _isEnabled()

static ilLicenseAccess::_isEnabled ( )
static

Check, if licencing is enabled This check is called from the ilAccessHandler class.

Returns
boolean licensing enabled (true/false)

Definition at line 22 of file class.ilLicenseAccess.php.

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 }
ILIAS Setting Class.

Referenced by ilLicense\_noteAccess(), ilObjCourseGUI\checkLicenses(), ilAccessHandler\doLicenseCheck(), ilObjLearningResourcesSettingsGUI\getAdminTabs(), ilObjCourseGUI\getTabs(), ilObjSAHSLearningModuleGUI\getTabs(), ilObjFileBasedLMGUI\getTabs(), and ilObjFileBasedLMGUI\initSettingsForm().

+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: