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_limitation ";
54 $res = $this->db->query($query);
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)
78 if (
$data[
'mode'] ==
'absolute')
80 $limit_value =
", limit_absolute = ".$ilDB->quote(
$data[
'absolute']).
" ";
83 if (
$data[
'mode'] ==
'relative')
85 $limit_value =
", limit_relative_d = ".$ilDB->quote(
$data[
'relative_d']).
" ".
86 ", limit_relative_m = ".$ilDB->quote(
$data[
'relative_m']).
" ".
87 ", limit_relative_y = ".$ilDB->quote(
$data[
'relative_y']).
" ";
90 $query =
"REPLACE INTO reg_access_limitation ".
91 "SET role_id = ".$ilDB->quote($key).
", ".
92 "limit_mode = ".$ilDB->quote(
$data[
'mode']).
" ".
95 $this->db->query($query);
103 foreach ($this->access_limitations as
$data)
105 if ($data[
'mode'] ==
"null")
110 if ($data[
'mode'] ==
'absolute' and $data[
'absolute'] < time())
115 if ($data[
'mode'] ==
'relative' and ($data[
'relative_d'] < 1 and $data[
'relative_m'] < 1 and $data[
'relative_y'] < 1))
126 return $this->access_limitations[$a_role_id] ? $this->access_limitations[$a_role_id][
'mode'] :
'null';
131 $this->access_limitations[$a_role_id][
'mode'] = $a_mode;
136 return $this->access_limitations[$a_role_id] ? $this->access_limitations[$a_role_id][
'absolute'] : time();
141 $this->access_limitations[$a_role_id][
'absolute'] = mktime(23,59,59,$a_arr[
'm'],$a_arr[
'd'],$a_arr[
'y']);
146 return $this->access_limitations[$a_role_id] ? $this->access_limitations[$a_role_id][
'relative_'.$a_type] : 0;
151 $this->access_limitations[$a_role_id][
'relative_d'] = $a_arr[
'd'];
152 $this->access_limitations[$a_role_id][
'relative_m'] = $a_arr[
'm'];
153 $this->access_limitations[$a_role_id][
'relative_y'] = $a_arr[
'y'];