ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilRegistrationRoleAssignments Class Reference
+ Collaboration diagram for ilRegistrationRoleAssignments:

Public Member Functions

 ilRegistrationRoleAssignments ()
 getRoleByEmail ($a_email)
 getAssignments ()
 setDomain ($a_id, $a_domain)
 setRole ($a_id, $a_role)
 getDefaultRole ()
 setDefaultRole ($a_role_id)
 delete ($a_id)
 add ()
 save ()
 validate ()
 __read ()

Data Fields

 $assignments = array()
 $default_role = 0

Detailed Description

Definition at line 36 of file class.ilRegistrationEmailRoleAssignments.php.

Member Function Documentation

ilRegistrationRoleAssignments::__read ( )

Definition at line 164 of file class.ilRegistrationEmailRoleAssignments.php.

References $res, and DB_FETCHMODE_OBJECT.

Referenced by add(), delete(), and ilRegistrationRoleAssignments().

{
global $ilias, $ilDB;
$query = "SELECT * FROM reg_email_role_assignments ";
$res = $this->db->query($query);
$this->assignments = array();
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->assignments[$row->assignment_id]['id'] = $row->assignment_id;
$this->assignments[$row->assignment_id]['role'] = $row->role;
$this->assignments[$row->assignment_id]['domain'] = $row->domain;
}
$this->default_role = $ilias->getSetting('reg_default_role');
return true;
}

+ Here is the caller graph for this function:

ilRegistrationRoleAssignments::add ( )

Definition at line 109 of file class.ilRegistrationEmailRoleAssignments.php.

References __read().

{
$query = "INSERT INTO reg_email_role_assignments ".
"SET domain = '', ".
"role = ''";
$this->db->query($query);
$this->__read();
return true;
}

+ Here is the call graph for this function:

ilRegistrationRoleAssignments::delete (   $a_id)

Definition at line 96 of file class.ilRegistrationEmailRoleAssignments.php.

References __read().

{
global $ilDB;
$query = "DELETE FROM reg_email_role_assignments ".
"WHERE assignment_id = ".$ilDB->quote($a_id);
$this->db->query($query);
$this->__read();
return true;
}

+ Here is the call graph for this function:

ilRegistrationRoleAssignments::getAssignments ( )

Definition at line 73 of file class.ilRegistrationEmailRoleAssignments.php.

{
return $this->assignments ? $this->assignments : array();
}
ilRegistrationRoleAssignments::getDefaultRole ( )

Definition at line 87 of file class.ilRegistrationEmailRoleAssignments.php.

References $default_role.

Referenced by getRoleByEmail(), save(), and validate().

{
}

+ Here is the caller graph for this function:

ilRegistrationRoleAssignments::getRoleByEmail (   $a_email)

Definition at line 49 of file class.ilRegistrationEmailRoleAssignments.php.

References getDefaultRole().

{
global $ilObjDataCache;
foreach($this->assignments as $assignment)
{
if(!$assignment['domain'] or !$assignment['role'])
{
continue;
}
if(stristr($a_email,$assignment['domain']))
{
// check if role exists
if(!$ilObjDataCache->lookupType($assignment['role']))
{
continue;
}
return $assignment['role'];
}
}
// return default
return $this->getDefaultRole();
}

+ Here is the call graph for this function:

ilRegistrationRoleAssignments::ilRegistrationRoleAssignments ( )

Definition at line 41 of file class.ilRegistrationEmailRoleAssignments.php.

References __read().

{
global $ilDB;
$this->db =& $ilDB;
$this->__read();
}

+ Here is the call graph for this function:

ilRegistrationRoleAssignments::save ( )

Definition at line 121 of file class.ilRegistrationEmailRoleAssignments.php.

References getDefaultRole().

{
global $ilias, $ilDB;
// Save default role
$ilias->setSetting('reg_default_role',$this->getDefaultRole());
foreach($this->assignments as $assignment)
{
$query = "UPDATE reg_email_role_assignments ".
"SET domain = ".$ilDB->quote($assignment['domain']).", ".
"role = ".$ilDB->quote($assignment['role'])." ".
"WHERE assignment_id = ".$ilDB->quote($assignment['id']);
$this->db->query($query);
}
return true;
}

+ Here is the call graph for this function:

ilRegistrationRoleAssignments::setDefaultRole (   $a_role_id)

Definition at line 91 of file class.ilRegistrationEmailRoleAssignments.php.

{
$this->default_role = $a_role_id;
}
ilRegistrationRoleAssignments::setDomain (   $a_id,
  $a_domain 
)

Definition at line 78 of file class.ilRegistrationEmailRoleAssignments.php.

{
$this->assignments[$a_id]['domain'] = $a_domain;
}
ilRegistrationRoleAssignments::setRole (   $a_id,
  $a_role 
)

Definition at line 82 of file class.ilRegistrationEmailRoleAssignments.php.

{
$this->assignments[$a_id]['role'] = $a_role;
}
ilRegistrationRoleAssignments::validate ( )

Definition at line 140 of file class.ilRegistrationEmailRoleAssignments.php.

References getDefaultRole(), IL_REG_MISSING_DOMAIN, and IL_REG_MISSING_ROLE.

{
foreach($this->assignments as $assignment)
{
if(!strlen($assignment['domain']))
{
}
if(!$assignment['role'])
{
}
}
if(!$this->getDefaultRole())
{
}
return 0;
}

+ Here is the call graph for this function:

Field Documentation

ilRegistrationRoleAssignments::$assignments = array()

Definition at line 38 of file class.ilRegistrationEmailRoleAssignments.php.

ilRegistrationRoleAssignments::$default_role = 0

Definition at line 39 of file class.ilRegistrationEmailRoleAssignments.php.

Referenced by getDefaultRole().


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