ILIAS  Release_4_4_x_branch Revision 61816
 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 165 of file class.ilRegistrationEmailRoleAssignments.php.

References $query, $res, $row, and DB_FETCHMODE_OBJECT.

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

{
global $ilias, $ilDB;
$query = "SELECT * FROM reg_er_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 107 of file class.ilRegistrationEmailRoleAssignments.php.

References $query, $res, and __read().

{
global $ilDB;
$next_id = $ilDB->nextId('reg_er_assignments');
$query = "INSERT INTO reg_er_assignments (assignment_id,domain,role) ".
"VALUES( ".
$ilDB->quote($next_id,'integer').', '.
$ilDB->quote('','text').", ".
$ilDB->quote(0,'integer').
")";
$res = $ilDB->manipulate($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 $query, $res, and __read().

{
global $ilDB;
$query = "DELETE FROM reg_er_assignments ".
"WHERE assignment_id = ".$ilDB->quote($a_id ,'integer');
$res = $ilDB->manipulate($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 123 of file class.ilRegistrationEmailRoleAssignments.php.

References $query, $res, and getDefaultRole().

{
global $ilias, $ilDB;
// Save default role
$ilias->setSetting('reg_default_role',$this->getDefaultRole());
foreach($this->assignments as $assignment)
{
$query = "UPDATE reg_er_assignments ".
"SET domain = ".$ilDB->quote($assignment['domain'] ,'text').", ".
"role = ".$ilDB->quote($assignment['role'] ,'integer')." ".
"WHERE assignment_id = ".$ilDB->quote($assignment['id'] ,'integer');
$res = $ilDB->manipulate($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 141 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: