ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilRegistrationRoleAccessLimitations Class Reference
+ Collaboration diagram for ilRegistrationRoleAccessLimitations:

Public Member Functions

 __construct ()
 
 __read ()
 
 save ()
 
 validate ()
 
 getMode ($a_role_id)
 
 setMode ($a_mode, $a_role_id)
 
 getAbsolute ($a_role_id)
 
 setAbsolute ($a_arr, $a_role_id)
 
 getRelative ($a_role_id, $a_type)
 
 setRelative ($a_arr, $a_role_id)
 
 resetAccessLimitations ()
 reset access limitations More...
 

Data Fields

 $access_limits = array()
 

Private Attributes

 $access_limitations = array()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilRegistrationRoleAccessLimitations::__construct ( )

Definition at line 42 of file class.ilRegistrationRoleAccessLimitations.php.

References $DIC, $ilDB, and __read().

43  {
44  global $DIC;
45 
46  $ilDB = $DIC['ilDB'];
47 
48  $this->db = $ilDB;
49  $this->__read();
50  }
global $DIC
Definition: saml.php:7
global $ilDB
+ Here is the call graph for this function:

Member Function Documentation

◆ __read()

ilRegistrationRoleAccessLimitations::__read ( )

Definition at line 53 of file class.ilRegistrationRoleAccessLimitations.php.

References $DIC, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by __construct().

54  {
55  global $DIC;
56 
57  $ilias = $DIC['ilias'];
58 
59  $query = "SELECT * FROM reg_access_limit ";
60  $res = $this->db->query($query);
61 
62  $this->access_limitations = array();
63  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
64  $this->access_limitations[$row->role_id]['id'] = $row->role_id;
65  $this->access_limitations[$row->role_id]['absolute'] = $row->limit_absolute;
66  $this->access_limitations[$row->role_id]['relative_d'] = $row->limit_relative_d;
67  $this->access_limitations[$row->role_id]['relative_m'] = $row->limit_relative_m;
68  $this->access_limitations[$row->role_id]['relative_y'] = $row->limit_relative_y;
69  $this->access_limitations[$row->role_id]['mode'] = $row->limit_mode;
70  }
71 
72  return true;
73  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
+ Here is the caller graph for this function:

◆ getAbsolute()

ilRegistrationRoleAccessLimitations::getAbsolute (   $a_role_id)

Definition at line 136 of file class.ilRegistrationRoleAccessLimitations.php.

137  {
138  return $this->access_limitations[$a_role_id] ? $this->access_limitations[$a_role_id]['absolute'] : time();
139  }

◆ getMode()

ilRegistrationRoleAccessLimitations::getMode (   $a_role_id)

Definition at line 126 of file class.ilRegistrationRoleAccessLimitations.php.

127  {
128  return $this->access_limitations[$a_role_id] ? $this->access_limitations[$a_role_id]['mode'] : 'null';
129  }

◆ getRelative()

ilRegistrationRoleAccessLimitations::getRelative (   $a_role_id,
  $a_type 
)

Definition at line 146 of file class.ilRegistrationRoleAccessLimitations.php.

References $a_type.

147  {
148  return $this->access_limitations[$a_role_id] ? $this->access_limitations[$a_role_id]['relative_' . $a_type] : 0;
149  }
$a_type
Definition: workflow.php:92

◆ resetAccessLimitations()

ilRegistrationRoleAccessLimitations::resetAccessLimitations ( )

reset access limitations

Definition at line 161 of file class.ilRegistrationRoleAccessLimitations.php.

162  {
163  $this->access_limitations = array();
164  }

◆ save()

ilRegistrationRoleAccessLimitations::save ( )

Definition at line 75 of file class.ilRegistrationRoleAccessLimitations.php.

References $data, $DIC, $ilDB, $key, $query, and $res.

76  {
77  global $DIC;
78 
79  $ilias = $DIC['ilias'];
80  $ilDB = $DIC['ilDB'];
81 
82  foreach ($this->access_limitations as $key => $data) {
83  $limit_value = "";
84 
85  // Delete old entry
86  $query = "DELETE FROM reg_access_limit " .
87  "WHERE role_id = " . $ilDB->quote($key, 'integer');
88  $res = $ilDB->manipulate($query);
89 
90 
91  $query = "INSERT INTO reg_access_limit (role_id,limit_mode,limit_absolute," .
92  "limit_relative_d,limit_relative_m,limit_relative_y) " .
93  "VALUES( " .
94  $ilDB->quote($key, 'integer') . ", " .
95  $ilDB->quote($data['mode'], 'text') . ", " .
96  $ilDB->quote($data['absolute']) . ", " .
97  $ilDB->quote($data['relative_d']) . ", " .
98  $ilDB->quote($data['relative_m']) . ", " .
99  $ilDB->quote($data['relative_y']) . " " .
100  ")";
101  $res = $ilDB->manipulate($query);
102  }
103 
104  return true;
105  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
global $ilDB
$key
Definition: croninfo.php:18
$data
Definition: bench.php:6

◆ setAbsolute()

ilRegistrationRoleAccessLimitations::setAbsolute (   $a_arr,
  $a_role_id 
)

Definition at line 141 of file class.ilRegistrationRoleAccessLimitations.php.

142  {
143  $this->access_limitations[$a_role_id]['absolute'] = mktime(23, 59, 59, $a_arr['m'], $a_arr['d'], $a_arr['y']);
144  }

◆ setMode()

ilRegistrationRoleAccessLimitations::setMode (   $a_mode,
  $a_role_id 
)

Definition at line 131 of file class.ilRegistrationRoleAccessLimitations.php.

132  {
133  $this->access_limitations[$a_role_id]['mode'] = $a_mode;
134  }

◆ setRelative()

ilRegistrationRoleAccessLimitations::setRelative (   $a_arr,
  $a_role_id 
)

Definition at line 151 of file class.ilRegistrationRoleAccessLimitations.php.

152  {
153  $this->access_limitations[$a_role_id]['relative_d'] = $a_arr['d'];
154  $this->access_limitations[$a_role_id]['relative_m'] = $a_arr['m'];
155  $this->access_limitations[$a_role_id]['relative_y'] = $a_arr['y'];
156  }

◆ validate()

ilRegistrationRoleAccessLimitations::validate ( )

Definition at line 107 of file class.ilRegistrationRoleAccessLimitations.php.

References $data, IL_REG_ACCESS_LIMITATION_MISSING_MODE, and IL_REG_ACCESS_LIMITATION_OUT_OF_DATE.

108  {
109  foreach ($this->access_limitations as $data) {
110  if ($data['mode'] == "null") {
112  }
113 
114  if ($data['mode'] == 'absolute' and $data['absolute'] < time()) {
116  }
117 
118  if ($data['mode'] == 'relative' and ($data['relative_d'] < 1 and $data['relative_m'] < 1 and $data['relative_y'] < 1)) {
120  }
121  }
122 
123  return 0;
124  }
const IL_REG_ACCESS_LIMITATION_MISSING_MODE
Class class.ilRegistrationAccessLimitation.
$data
Definition: bench.php:6

Field Documentation

◆ $access_limitations

ilRegistrationRoleAccessLimitations::$access_limitations = array()
private

◆ $access_limits

ilRegistrationRoleAccessLimitations::$access_limits = array()

The documentation for this class was generated from the following file: