40 $this->obj_id = (int) $a_obj_id;
68 $this->licenses = (int) $a_licenses;
86 $this->remarks = $a_remarks;
113 return max(0, $this->licenses - $this->accesses);
132 $query =
'SELECT DISTINCT pa.rol_id' .
' FROM rbac_pa pa' .
' INNER JOIN object_reference ob ON ob.ref_id = pa.ref_id' .
' WHERE ' 133 . $ilDB->like(
'pa.ops_id',
'text',
'%%i:' . $ops_ids[0] .
';%%') .
' AND ob.obj_id = ' . $ilDB->quote($this->
getObjId(),
'integer');
137 $role_ids[] =
$row->rol_id;
140 if (!count($role_ids)) {
145 $query =
'SELECT COUNT(DISTINCT(usr_id)) accesses ' .
' FROM rbac_ua' .
' WHERE ' . $ilDB->in(
'rol_id', $role_ids,
false,
'integer')
146 .
' AND usr_id NOT IN' .
' (SELECT usr_id FROM read_event' .
' WHERE obj_id = ' . $ilDB->quote($this->
getObjId(),
'integer') .
')';
151 return $row->accesses;
167 $query =
'SELECT * FROM license_data WHERE obj_id = %s';
171 $this->licenses =
$row->licenses;
172 $this->accesses =
$row->used;
173 $this->remarks =
$row->remarks;
191 $query =
'SELECT * FROM license_data WHERE obj_id = %s';
195 $ilDB->update(
'license_data',
array(
196 'licenses' =>
array(
'integer', $this->licenses ),
197 'used' =>
array(
'integer', $this->accesses ),
198 'remarks' =>
array(
'clob', $this->remarks ),
200 'obj_id' =>
array(
'integer', $this->obj_id ),
203 $ilDB->insert(
'license_data',
array(
204 'obj_id' =>
array(
'integer', $this->obj_id ),
205 'licenses' =>
array(
'integer', $this->licenses ),
206 'used' =>
array(
'integer', $this->accesses ),
207 'remarks' =>
array(
'clob', $this->remarks ),
218 public function delete()
222 $query =
'DELETE FROM license_data WHERE obj_id = %s';
246 require_once(
"Services/License/classes/class.ilLicenseAccess.php");
266 require_once(
"Services/License/classes/class.ilLicenseAccess.php");
272 $query =
'SELECT read_count FROM read_event ' .
'WHERE usr_id = %s AND obj_id = %s';
280 require_once(
'Services/Tracking/classes/class.ilChangeEvent.php');
283 if (self::_isLicensed($a_obj_id)) {
285 $query =
"UPDATE license_data SET used = used + 1 " .
"WHERE obj_id = %s";
305 $query =
'SELECT od.obj_id, od.type, od.title, od.description, re.ref_id ' .
'FROM license_data ld ' 306 .
'INNER JOIN object_data od ON od.obj_id = ld.obj_id ' .
'INNER JOIN object_reference re ON re.obj_id = od.obj_id ' 307 .
'WHERE ld.licenses > 0 ' .
'ORDER BY od.title, od.obj_id';
333 $childs = $tree->getChilds($a_ref_id,
'title');
334 foreach ($childs as
$data) {
335 if (in_array($data[
'type'],
array(
'sahs',
'htlm' )) and self::_isLicensed($data[
'obj_id'])) {
354 $query =
"SELECT licenses FROM license_data " .
"WHERE obj_id = %s " .
"AND licenses > 0";
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.
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.
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.