38 $this->obj_id = (int)$a_obj_id;
63 $this->licenses = (int)$a_licenses;
79 $this->remarks = $a_remarks;
103 return max(0, $this->licenses - $this->accesses);
121 $query =
'SELECT DISTINCT pa.rol_id' .
' FROM rbac_pa pa' .
' INNER JOIN object_reference ob ON ob.ref_id = pa.ref_id' .
' WHERE ' 122 . $ilDB->like(
'pa.ops_id',
'text',
'%%i:' . $ops_ids[0] .
';%%') .
' AND ob.obj_id = ' . $ilDB->quote($this->
getObjId(),
'integer');
126 $role_ids[] =
$row->rol_id;
129 if (!count($role_ids)) {
134 $query =
'SELECT COUNT(DISTINCT(usr_id)) accesses ' .
' FROM rbac_ua' .
' WHERE ' . $ilDB->in(
'rol_id', $role_ids,
false,
'integer')
135 .
' AND usr_id NOT IN' .
' (SELECT usr_id FROM read_event' .
' WHERE obj_id = ' . $ilDB->quote($this->
getObjId(),
'integer') .
')';
140 return $row->accesses;
155 $query =
'SELECT * FROM license_data WHERE obj_id = %s';
159 $this->licenses =
$row->licenses;
160 $this->accesses =
$row->used;
161 $this->remarks =
$row->remarks;
178 $query =
'SELECT * FROM license_data WHERE obj_id = %s';
182 $ilDB->update(
'license_data',
array(
183 'licenses' =>
array(
'integer', $this->licenses ),
184 'used' =>
array(
'integer', $this->accesses ),
185 'remarks' =>
array(
'clob', $this->remarks ),
187 'obj_id' =>
array(
'integer', $this->obj_id ),
190 $ilDB->insert(
'license_data',
array(
191 'obj_id' =>
array(
'integer', $this->obj_id ),
192 'licenses' =>
array(
'integer', $this->licenses ),
193 'used' =>
array(
'integer', $this->accesses ),
194 'remarks' =>
array(
'clob', $this->remarks ),
205 public function delete() {
208 $query =
'DELETE FROM license_data WHERE obj_id = %s';
231 require_once(
"Services/License/classes/class.ilLicenseAccess.php");
250 require_once(
"Services/License/classes/class.ilLicenseAccess.php");
256 $query =
'SELECT read_count FROM read_event ' .
'WHERE usr_id = %s AND obj_id = %s';
264 require_once(
'Services/Tracking/classes/class.ilChangeEvent.php');
267 if (self::_isLicensed($a_obj_id)) {
269 $query =
"UPDATE license_data SET used = used + 1 " .
"WHERE obj_id = %s";
288 $query =
'SELECT od.obj_id, od.type, od.title, od.description, re.ref_id ' .
'FROM license_data ld ' 289 .
'INNER JOIN object_data od ON od.obj_id = ld.obj_id ' .
'INNER JOIN object_reference re ON re.obj_id = od.obj_id ' 290 .
'WHERE ld.licenses > 0 ' .
'ORDER BY od.title, od.obj_id';
315 $childs = $tree->getChilds($a_ref_id,
'title');
316 foreach ($childs as
$data) {
317 if (in_array($data[
'type'],
array(
'sahs',
'htlm' ))
and self::_isLicensed($data[
'obj_id'])) {
335 $query =
"SELECT licenses FROM license_data " .
"WHERE obj_id = %s " .
"AND licenses > 0";
static _getOperationIdsByName($operations)
get ops_id's by name.
setRemarks($a_remarks='')
setLicenses($a_licenses=0)
static _isEnabled()
Check, if licencing is enabled This check is called from the ilAccessHandler class.
static _isLicensed($a_obj_id)
Check if an object has licensing activated.
__construct($a_obj_id)
Constructor.
static _recordReadEvent($a_type, $a_ref_id, $obj_id, $usr_id, $isCatchupWriteEvents=true, $a_ext_rc=false, $a_ext_time=false)
Records a read event and catches up with write events.
Create styles array
The data for the language used.
update()
Update the license data in the database.
read()
Read the license data from the database.
static _checkAccess($a_usr_id, $a_obj_id)
Check, if a user can access an object by license.
static _getLicensedObjects()
Get a list of all objects with activated licensing.
static _checkAccess($a_usr_id, $a_obj_id)
Check, if a user can access an object by license.
getPotentialAccesses()
Get the number of users who may access the object but don't have yet a license.
static _getLicensedChildObjects($a_ref_id)
Get a list of all sub objects with activated licensing.
static _noteAccess($a_obj_id, $a_type, $a_ref_id)
Note the access of the current usr to an object.