33 define(
'IL_REG_MISSING_DOMAIN',1);
34 define(
'IL_REG_MISSING_ROLE',2);
51 global $ilObjDataCache;
53 foreach($this->assignments as $assignment)
55 if(!$assignment[
'domain'] or !$assignment[
'role'])
59 if(stristr($a_email,$assignment[
'domain']))
62 if(!$ilObjDataCache->lookupType($assignment[
'role']))
66 return $assignment[
'role'];
75 return $this->assignments ? $this->assignments : array();
80 $this->assignments[$a_id][
'domain'] = $a_domain;
84 $this->assignments[$a_id][
'role'] = $a_role;
93 $this->default_role = $a_role_id;
96 function delete($a_id)
100 $query =
"DELETE FROM reg_email_role_assignments ".
101 "WHERE assignment_id = ".$ilDB->quote($a_id);
103 $this->db->query($query);
111 $query =
"INSERT INTO reg_email_role_assignments ".
115 $this->db->query($query);
123 global $ilias, $ilDB;
128 foreach($this->assignments as $assignment)
130 $query =
"UPDATE reg_email_role_assignments ".
131 "SET domain = ".$ilDB->quote($assignment[
'domain']).
", ".
132 "role = ".$ilDB->quote($assignment[
'role']).
" ".
133 "WHERE assignment_id = ".$ilDB->quote($assignment[
'id']);
135 $this->db->query($query);
142 foreach($this->assignments as $assignment)
144 if(!strlen($assignment[
'domain']))
148 if(!$assignment[
'role'])
166 global $ilias, $ilDB;
168 $query =
"SELECT * FROM reg_email_role_assignments ";
169 $res = $this->db->query($query);
171 $this->assignments = array();
174 $this->assignments[$row->assignment_id][
'id'] = $row->assignment_id;
175 $this->assignments[$row->assignment_id][
'role'] = $row->role;
176 $this->assignments[$row->assignment_id][
'domain'] = $row->domain;
179 $this->default_role = $ilias->getSetting(
'reg_default_role');