ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 52 of file class.ilLicenseAccess.php.

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

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

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

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

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

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