ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 $ilDB, and __read().

43  {
44  global $ilDB;
45 
46  $this->db = $ilDB;
47  $this->__read();
48  }
global $ilDB
+ Here is the call graph for this function:

Member Function Documentation

◆ __read()

ilRegistrationRoleAccessLimitations::__read ( )

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

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

Referenced by __construct().

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

◆ getAbsolute()

ilRegistrationRoleAccessLimitations::getAbsolute (   $a_role_id)

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

References time.

130  {
131  return $this->access_limitations[$a_role_id] ? $this->access_limitations[$a_role_id]['absolute'] : time();
132  }
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.

◆ getMode()

ilRegistrationRoleAccessLimitations::getMode (   $a_role_id)

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

120  {
121  return $this->access_limitations[$a_role_id] ? $this->access_limitations[$a_role_id]['mode'] : 'null';
122  }

◆ getRelative()

ilRegistrationRoleAccessLimitations::getRelative (   $a_role_id,
  $a_type 
)

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

References $a_type.

140  {
141  return $this->access_limitations[$a_role_id] ? $this->access_limitations[$a_role_id]['relative_' . $a_type] : 0;
142  }
$a_type
Definition: workflow.php:92

◆ resetAccessLimitations()

ilRegistrationRoleAccessLimitations::resetAccessLimitations ( )

reset access limitations

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

References array.

155  {
156  $this->access_limitations = array();
157  }
Create styles array
The data for the language used.

◆ save()

ilRegistrationRoleAccessLimitations::save ( )

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

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

72  {
73  global $ilias, $ilDB;
74 
75  foreach ($this->access_limitations as $key => $data) {
76  $limit_value = "";
77 
78  // Delete old entry
79  $query = "DELETE FROM reg_access_limit " .
80  "WHERE role_id = " . $ilDB->quote($key, 'integer');
81  $res = $ilDB->manipulate($query);
82 
83 
84  $query = "INSERT INTO reg_access_limit (role_id,limit_mode,limit_absolute," .
85  "limit_relative_d,limit_relative_m,limit_relative_y) " .
86  "VALUES( " .
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']) . " " .
93  ")";
94  $res = $ilDB->manipulate($query);
95  }
96 
97  return true;
98  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
$key
Definition: croninfo.php:18

◆ setAbsolute()

ilRegistrationRoleAccessLimitations::setAbsolute (   $a_arr,
  $a_role_id 
)

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

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

◆ setMode()

ilRegistrationRoleAccessLimitations::setMode (   $a_mode,
  $a_role_id 
)

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

125  {
126  $this->access_limitations[$a_role_id]['mode'] = $a_mode;
127  }

◆ setRelative()

ilRegistrationRoleAccessLimitations::setRelative (   $a_arr,
  $a_role_id 
)

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

145  {
146  $this->access_limitations[$a_role_id]['relative_d'] = $a_arr['d'];
147  $this->access_limitations[$a_role_id]['relative_m'] = $a_arr['m'];
148  $this->access_limitations[$a_role_id]['relative_y'] = $a_arr['y'];
149  }

◆ validate()

ilRegistrationRoleAccessLimitations::validate ( )

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

References $data, IL_REG_ACCESS_LIMITATION_MISSING_MODE, IL_REG_ACCESS_LIMITATION_OUT_OF_DATE, and time.

101  {
102  foreach ($this->access_limitations as $data) {
103  if ($data['mode'] == "null") {
105  }
106 
107  if ($data['mode'] == 'absolute' and $data['absolute'] < time()) {
109  }
110 
111  if ($data['mode'] == 'relative' and ($data['relative_d'] < 1 and $data['relative_m'] < 1 and $data['relative_y'] < 1)) {
113  }
114  }
115 
116  return 0;
117  }
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
const IL_REG_ACCESS_LIMITATION_MISSING_MODE
Class class.ilRegistrationAccessLimitation.

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: