33 define(
'IL_REG_ACCESS_LIMITATION_MISSING_MODE',1);
34 define(
'IL_REG_ACCESS_LIMITATION_OUT_OF_DATE',2);
53 $query =
"SELECT * FROM reg_access_limit ";
56 $this->access_limitations = array();
59 $this->access_limitations[
$row->role_id][
'id'] =
$row->role_id;
60 $this->access_limitations[
$row->role_id][
'absolute'] =
$row->limit_absolute;
61 $this->access_limitations[
$row->role_id][
'relative_d'] =
$row->limit_relative_d;
62 $this->access_limitations[
$row->role_id][
'relative_m'] =
$row->limit_relative_m;
63 $this->access_limitations[
$row->role_id][
'relative_y'] =
$row->limit_relative_y;
64 $this->access_limitations[
$row->role_id][
'mode'] =
$row->limit_mode;
74 foreach($this->access_limitations as $key =>
$data)
79 $query =
"DELETE FROM reg_access_limit ".
80 "WHERE role_id = ".$ilDB->quote($key,
'integer');
84 $query =
"INSERT INTO reg_access_limit (role_id,limit_mode,limit_absolute,".
85 "limit_relative_d,limit_relative_m,limit_relative_y) ".
87 $ilDB->quote($key,
'integer').
", ".
88 $ilDB->quote(
$data[
'mode'] ,
'text').
", ".
89 $ilDB->quote(
$data[
'absolute']).
", ".
90 $ilDB->quote(
$data[
'relative_d']).
", ".
91 $ilDB->quote(
$data[
'relative_m']).
", ".
92 $ilDB->quote(
$data[
'relative_y']).
" ".
102 foreach ($this->access_limitations as
$data)
104 if ($data[
'mode'] ==
"null")
109 if ($data[
'mode'] ==
'absolute' and $data[
'absolute'] < time())
114 if ($data[
'mode'] ==
'relative' and ($data[
'relative_d'] < 1 and $data[
'relative_m'] < 1 and $data[
'relative_y'] < 1))
125 return $this->access_limitations[$a_role_id] ? $this->access_limitations[$a_role_id][
'mode'] :
'null';
130 $this->access_limitations[$a_role_id][
'mode'] = $a_mode;
135 return $this->access_limitations[$a_role_id] ? $this->access_limitations[$a_role_id][
'absolute'] : time();
140 $this->access_limitations[$a_role_id][
'absolute'] = mktime(23,59,59,$a_arr[
'm'],$a_arr[
'd'],$a_arr[
'y']);
145 return $this->access_limitations[$a_role_id] ? $this->access_limitations[$a_role_id][
'relative_'.$a_type] : 0;
150 $this->access_limitations[$a_role_id][
'relative_d'] = $a_arr[
'd'];
151 $this->access_limitations[$a_role_id][
'relative_m'] = $a_arr[
'm'];
152 $this->access_limitations[$a_role_id][
'relative_y'] = $a_arr[
'y'];