ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 12 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
int$a_usr_id
int$a_obj_id(not reference)
Returns
boolean access is possible (true/false)

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

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

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

55  {
56  global $ilDB;
57 
58  // check the object license
59  $query = 'SELECT licenses, used FROM license_data WHERE obj_id = %s';
60  $result = $ilDB->queryF($query, array( 'integer' ), array( $a_obj_id ));
61 
62  if ($row = $ilDB->fetchObject($result)) {
63  // no licenses set or at least one free => grant access
64  if ($row->licenses == 0 or $row->used < $row->licenses) {
65  return true;
66  }
67  } else {
68  // no license data available => access granted
69  return true;
70  }
71 
72  // check if user has already accessed
73  $query = 'SELECT read_count FROM read_event ' . 'WHERE usr_id = %s AND obj_id = %s';
74 
75  $result = $ilDB->queryF($query, array( 'integer', 'integer' ), array( $a_usr_id, $a_obj_id ));
76 
77  if ($row = $ilDB->fetchObject($result)) {
78  return true;
79  }
80 
81  // all failed
82  return false;
83  }
$result
$query
Create styles array
The data for the language used.
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 21 of file class.ilLicenseAccess.php.

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

22  {
23  static $enabled;
24 
25  if (isset($enabled)) {
26  return $enabled;
27  }
28 
29  $lic_set = new ilSetting("license");
30  if ($lic_set->get("license_counter")) {
31  $enabled = true;
32 
33  return true;
34  } else {
35  $enabled = false;
36 
37  return false;
38  }
39  }
+ Here is the caller graph for this function:

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