ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilOrgUnitAssignmentList Class Reference

Organisation Unit Assignment List. More...

+ Inheritance diagram for ilOrgUnitAssignmentList:
+ Collaboration diagram for ilOrgUnitAssignmentList:

Public Member Functions

 __construct ($org_unit_id)
 sortCallback ($a_assignment_a, $a_assignment_b)
 addAssignment ($a_user_id, $a_reporting_access, $a_cc_compl_invit, $a_cc_compl_not1, $a_cc_compl_not2)
 removeAssignment ($a_user_id)
 doesAssignmentExist ($a_user_id)
 hasUserReportingAccess ($a_user_id)
 current ()
 next ()
 key ()
 valid ()
 rewind ()

Private Member Functions

 read ()

Private Attributes

 $org_unit_id = 0
 $assignments = array()

Detailed Description

Organisation Unit Assignment List.

Author
Bjoern Heyser bheys.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

Definition at line 14 of file class.ilOrgUnitAssignmentList.php.

Constructor & Destructor Documentation

ilOrgUnitAssignmentList::__construct (   $org_unit_id)

Definition at line 20 of file class.ilOrgUnitAssignmentList.php.

References $org_unit_id, and read().

{
$this->org_unit_id = (int)$org_unit_id;
$this->read();
}

+ Here is the call graph for this function:

Member Function Documentation

ilOrgUnitAssignmentList::addAssignment (   $a_user_id,
  $a_reporting_access,
  $a_cc_compl_invit,
  $a_cc_compl_not1,
  $a_cc_compl_not2 
)

Definition at line 63 of file class.ilOrgUnitAssignmentList.php.

{
if( isset($this->assignments[$user_id]) )
throw new ilOrgUnitException('Error: User with id "'.$user_id.'" is allready assigned!');
$assignment = new ilOrgUnitAssignment($this->org_unit_id, $a_user_id);
$assignment ->setReportingAccess($a_reporting_access)
->setCcComplianceInvitation($a_cc_compl_invit)
->setCcComplianceNotify1($a_cc_compl_not1)
->setCcComplianceNotify2($a_cc_compl_not2)
->create();
$this->assignments[$user_id] = $assignment;
}
ilOrgUnitAssignmentList::current ( )

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

{
return current($this->assignments);
}
ilOrgUnitAssignmentList::doesAssignmentExist (   $a_user_id)

Definition at line 90 of file class.ilOrgUnitAssignmentList.php.

{
return isset($this->assignments[$a_user_id]);
}
ilOrgUnitAssignmentList::hasUserReportingAccess (   $a_user_id)

Definition at line 95 of file class.ilOrgUnitAssignmentList.php.

{
return $this->assignments[$a_user_id]->hasReportingAccess();
}
ilOrgUnitAssignmentList::key ( )

Definition at line 110 of file class.ilOrgUnitAssignmentList.php.

Referenced by valid().

{
return key($this->assignments);
}

+ Here is the caller graph for this function:

ilOrgUnitAssignmentList::next ( )

Definition at line 105 of file class.ilOrgUnitAssignmentList.php.

{
return next($this->assignments);
}
ilOrgUnitAssignmentList::read ( )
private

Definition at line 27 of file class.ilOrgUnitAssignmentList.php.

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

Referenced by __construct().

{
global $ilDB;
$query = "SELECT * FROM org_unit_assignments WHERE oa_ou_id = %s";
$res = $ilDB->queryF($query, array('integer'), array($this->org_unit_id));
$this->assignments = array();
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$assignment = new ilOrgUnitAssignment($row->oa_ou_id, $row->oa_usr_id);
$assignment->setReportingAccess($row->oa_reporting_access);
$assignment->setCcComplianceInvitation($row->oa_cc_compl_invit);
$assignment->setCcComplianceNotify1($row->oa_cc_compl_not1);
$assignment->setCcComplianceNotify2($row->oa_cc_compl_not2);
$this->assignments[$row->oa_usr_id] = $assignment;
}
#usort($this->assignments, array($this, 'sortCallback'));
}

+ Here is the caller graph for this function:

ilOrgUnitAssignmentList::removeAssignment (   $a_user_id)

Definition at line 80 of file class.ilOrgUnitAssignmentList.php.

{
if( !isset($this->assignments[$user_id]) )
throw new ilOrgUnitException('Error: User with id "'.$user_id.'" is not assigned!');
$this->assignments[$user_id]->delete();
unset( $this->assignments[$user_id] );
}
ilOrgUnitAssignmentList::rewind ( )

Definition at line 120 of file class.ilOrgUnitAssignmentList.php.

{
return reset($this->assignments);
}
ilOrgUnitAssignmentList::sortCallback (   $a_assignment_a,
  $a_assignment_b 
)

Definition at line 52 of file class.ilOrgUnitAssignmentList.php.

References ilObjectFactory\getInstanceByObjId().

{
$user_a = ilObjectFactory::getInstanceByObjId($a_assignment_a->getUserId());
$user_b = ilObjectFactory::getInstanceByObjId($a_assignment_b->getUserId());
$user_name_a = $user_a->getLastName().', '.$user_a->getFirstName();
$user_name_b = $user_b->getLastName().', '.$user_b->getFirstName();
return strcmp($user_name_a, $user_name_b);
}

+ Here is the call graph for this function:

ilOrgUnitAssignmentList::valid ( )

Definition at line 115 of file class.ilOrgUnitAssignmentList.php.

References key().

{
return key($this->assignments) !== null;
}

+ Here is the call graph for this function:

Field Documentation

ilOrgUnitAssignmentList::$assignments = array()
private

Definition at line 18 of file class.ilOrgUnitAssignmentList.php.

ilOrgUnitAssignmentList::$org_unit_id = 0
private

Definition at line 16 of file class.ilOrgUnitAssignmentList.php.

Referenced by __construct().


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