ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
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.

static

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

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

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

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

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

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

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.
+ Here is the caller graph for this function:

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