21 $this->obj_id = (int) $a_obj_id;
30 $this->licenses = (int) $a_licenses;
34 return $this->licenses;
38 $this->remarks = $a_remarks;
42 return $this->remarks;
46 return $this->accesses;
50 return max(0, $this->licenses - $this->accesses);
68 $query =
'SELECT DISTINCT pa.rol_id'
70 .
' INNER JOIN object_reference ob ON ob.ref_id = pa.ref_id '
71 .
' WHERE '.$ilDB->like(
'pa.ops_id',
'text',
'%%i:'.$ops_ids[0].
';%%')
72 .
' AND ob.obj_id = ' . $ilDB->quote($this->obj_id,
'integer');
77 $role_ids[] =
$row->rol_id;
80 if (!count($role_ids))
86 $query =
'SELECT COUNT(DISTINCT(usr_id)) accesses '
88 .
' WHERE '. $ilDB->in(
'rol_id', $role_ids,
false,
'integer')
89 .
' AND usr_id NOT IN'
90 .
' (SELECT usr_id FROM read_event'
91 .
' WHERE obj_id = ' . $ilDB->quote($this->obj_id,
'integer') .
')';
95 return $row->accesses;
111 $query =
'SELECT * FROM license_data WHERE obj_id = %s';
112 $result = $ilDB->queryF(
$query, array(
'integer'), array($this->obj_id));
116 $this->licenses =
$row->licenses;
117 $this->accesses =
$row->used;
118 $this->remarks =
$row->remarks;
137 $query =
'SELECT * FROM license_data WHERE obj_id = %s';
138 $result = $ilDB->queryF(
$query, array(
'integer'), array($this->obj_id));
142 $ilDB->update(
'license_data',
144 'licenses' => array(
'integer', $this->licenses),
145 'used' => array(
'integer', $this->accesses),
146 'remarks' => array(
'clob', $this->remarks)
149 'obj_id' => array(
'integer', $this->obj_id),
155 $ilDB->insert(
'license_data', array(
156 'obj_id' => array(
'integer', $this->obj_id),
157 'licenses' => array(
'integer', $this->licenses),
158 'used' => array(
'integer', $this->accesses),
159 'remarks' => array(
'clob', $this->remarks)
173 $query =
'DELETE FROM license_data WHERE obj_id = %s';
174 $ilDB->manipulateF(
$query, array(
'integer'), array($this->obj_id));
196 require_once(
"Services/License/classes/class.ilLicenseAccess.php");
215 require_once(
"Services/License/classes/class.ilLicenseAccess.php");
222 $query =
'SELECT read_count FROM read_event '
223 .
'WHERE usr_id = %s AND obj_id = %s';
225 array(
'integer',
'integer'),
226 array($ilUser->getId(), $a_obj_id));
236 require_once(
'Services/Tracking/classes/class.ilChangeEvent.php');
239 if (self::_isLicensed($a_obj_id))
242 $query =
"UPDATE license_data SET used = used + 1 "
243 .
"WHERE obj_id = %s";
244 $ilDB->manipulateF(
$query, array(
'integer'), array($a_obj_id));
264 $query =
'SELECT od.obj_id, od.type, od.title, od.description, re.ref_id '
265 .
'FROM license_data ld '
266 .
'INNER JOIN object_data od ON od.obj_id = ld.obj_id '
267 .
'INNER JOIN object_reference re ON re.obj_id = od.obj_id '
268 .
'WHERE ld.licenses > 0 '
269 .
'ORDER BY od.title, od.obj_id';
275 if (
$row[
'obj_id'] != $obj_id)
278 $obj_id =
$row[
'obj_id'];
296 $childs = $tree->getChilds($a_ref_id,
'title');
297 foreach ($childs as
$data)
299 if (in_array($data[
'type'], array(
'sahs',
'htlm'))
300 and self::_isLicensed($data[
'obj_id']))
319 $query =
"SELECT licenses FROM license_data ".
320 "WHERE obj_id = %s ".
322 $result = $ilDB->queryF(
$query, array(
'integer'), array($a_obj_id));