ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilOrgUnit Class Reference
+ Collaboration diagram for ilOrgUnit:

Public Member Functions

 initAssigns ()
 assignUser ($a_user_id, $a_reporting_access, $a_cc_compl_invit, $a_cc_compl_not1, $a_cc_compl_not2)
 deassignUser ($a_user_id)
 isUserAssigned ($a_user_id)
 getAssignedUsers ()
 read ()
 update ()
 create ()
 delete ()
 hasUserReportingAccess ($a_user_id)
 setId ($ou_id)
 getId ()
 setTitle ($ou_title)
 getTitle ()
 setSubTitle ($ou_subtitle)
 getSubTitle ()
 setImportId ($ou_import_id)
 getImportId ()
 setParent ($a_parent)
 getParent ()
 addChild ($a_child)
 getChilds ()
 hasChilds ()
 sortChilds ()
 sortCallback ($a_a, $a_b)

Static Public Member Functions

static deleteInstance ($ou_id)
static getInstance ($ou_id)
static createInstance ($ou_title, $ou_subtitle, $ou_import_id)
static lookupIdByImportId ($ou_import_id)
static getInstancesByAssignedUser ($a_user_id)

Private Member Functions

 __construct ($ou_id=0)

Private Attributes

 $id = 0
 $title = ''
 $subtitle = ''
 $import_id = 0
 $parent = 0
 $childs = array()
 $assignment_list = null

Static Private Attributes

static $instance_cache = array()
static $import_id_cache = array()

Detailed Description

Definition at line 5 of file class.ilOrgUnit.php.

Constructor & Destructor Documentation

ilOrgUnit::__construct (   $ou_id = 0)
private

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

References read().

{
if( (int)$ou_id > 0 )
{
$this->id = (int)$ou_id;
$this->read();
}
}

+ Here is the call graph for this function:

Member Function Documentation

ilOrgUnit::addChild (   $a_child)

Definition at line 274 of file class.ilOrgUnit.php.

{
$this->childs[] = $a_child;
return $this;
}
ilOrgUnit::assignUser (   $a_user_id,
  $a_reporting_access,
  $a_cc_compl_invit,
  $a_cc_compl_not1,
  $a_cc_compl_not2 
)

Definition at line 35 of file class.ilOrgUnit.php.

{
if($this->assignment_list === null)
throw new ilOrgUnitException('Error: Assignment object not initialised yet!');
$this->assignment_list->addAssignment($a_user_id, $a_reporting_access,
$a_cc_compl_invit, $a_cc_compl_not1, $a_cc_compl_not2);
}
ilOrgUnit::create ( )

Definition at line 118 of file class.ilOrgUnit.php.

{
global $ilDB;
$this->id = $ilDB->nextId('org_unit_data');
$ilDB->insert(
'org_unit_data',
array(
'ou_id' => array('integer', $this->id),
'ou_title' => array('text', $this->title),
'ou_subtitle' => array('text', $this->subtitle),
'ou_import_id' => array('text', $this->import_id)
),
array('ou_id' => array('integer', $this->id))
);
}
static ilOrgUnit::createInstance (   $ou_title,
  $ou_subtitle,
  $ou_import_id 
)
static

Definition at line 165 of file class.ilOrgUnit.php.

{
$unit = new self();
$unit ->setTitle($ou_title)
->setSubTitle($ou_subtitle)
->setImportId($ou_import_id)
->create();
self::$instance_cache[$unit->getId()] = $unit;
return $unit;
}
ilOrgUnit::deassignUser (   $a_user_id)

Definition at line 45 of file class.ilOrgUnit.php.

{
if($this->assignment_list === null)
throw new ilOrgUnitException('Error: Assignment object not initialised yet!');
$this->assignment_list->removeAssignment($a_user_id);
}
ilOrgUnit::delete ( )

Definition at line 136 of file class.ilOrgUnit.php.

References deleteInstance().

{
}

+ Here is the call graph for this function:

static ilOrgUnit::deleteInstance (   $ou_id)
static

Definition at line 141 of file class.ilOrgUnit.php.

References $query.

Referenced by delete().

{
global $ilDB;
$query = "DELETE FROM org_unit_data WHERE ou_id = %s";
$ilDB->queryF($query, array('integer'), array($ou_id));
if( isset(self::$instance_cache[$ou_id]) )
{
unset(self::$instance_cache[$ou_id]);
}
}

+ Here is the caller graph for this function:

ilOrgUnit::getAssignedUsers ( )

Definition at line 61 of file class.ilOrgUnit.php.

{
if($this->assignment_list === null)
throw new ilOrgUnitException('Error: Assignment object not initialised yet!');
$assignments = array();
foreach($this->assignment_list as $assignment)
{
$assignments[$assignment->getUserId()] = array(
'reporting_access' => $assignment->hasReportingAccess(),
'cc_coml_invit' => $assignment->hasCcComplianceInvitation(),
'cc_coml_not1' => $assignment->hasCcComplianceNotify1(),
'cc_coml_not2' => $assignment->hasCcComplianceNotify2()
);
}
return $assignments;
}
ilOrgUnit::getChilds ( )

Definition at line 279 of file class.ilOrgUnit.php.

References $childs.

Referenced by ilOrgUnitTreeExplorerGUI\renderUnit().

{
return $this->childs;
}

+ Here is the caller graph for this function:

ilOrgUnit::getId ( )

Definition at line 233 of file class.ilOrgUnit.php.

References $id.

Referenced by ilOrgUnitTreeExplorerGUI\renderUnit().

{
return $this->id;
}

+ Here is the caller graph for this function:

ilOrgUnit::getImportId ( )

Definition at line 260 of file class.ilOrgUnit.php.

References $import_id.

{
}
static ilOrgUnit::getInstance (   $ou_id)
static

Definition at line 155 of file class.ilOrgUnit.php.

Referenced by getInstancesByAssignedUser(), and ilOrgUnitTree\getRecursiveOrgUnitTree().

{
if( !isset(self::$instance_cache[$ou_id]) )
{
self::$instance_cache[$ou_id] = new self($ou_id);
}
return self::$instance_cache[$ou_id];
}

+ Here is the caller graph for this function:

static ilOrgUnit::getInstancesByAssignedUser (   $a_user_id)
static

Definition at line 201 of file class.ilOrgUnit.php.

References $query, $res, $row, DB_FETCHMODE_OBJECT, and getInstance().

Referenced by ilOrgUnitAssignmentTableGUI\getItems().

{
global $ilDB;
$query = "SELECT ou_id FROM org_unit_data ".
"LEFT JOIN org_unit_assignments ".
"ON ou_id = oa_ou_id ".
"WHERE oa_usr_id = %s";
$res = $ilDB->queryF($query, array('integer'), array($a_user_id));
$units = array();
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$units[$row->ou_id] = self::getInstance($row->ou_id);
}
return $units;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilOrgUnit::getParent ( )

Definition at line 270 of file class.ilOrgUnit.php.

References $parent.

{
return $this->parent;
}
ilOrgUnit::getSubTitle ( )

Definition at line 251 of file class.ilOrgUnit.php.

References $subtitle.

Referenced by ilOrgUnitTreeExplorerGUI\renderUnit().

{
}

+ Here is the caller graph for this function:

ilOrgUnit::getTitle ( )

Definition at line 242 of file class.ilOrgUnit.php.

References $title.

Referenced by ilOrgUnitTreeExplorerGUI\renderUnit().

{
return $this->title;
}

+ Here is the caller graph for this function:

ilOrgUnit::hasChilds ( )

Definition at line 283 of file class.ilOrgUnit.php.

Referenced by ilOrgUnitTreeExplorerGUI\renderUnit().

{
return (bool)count($this->childs);
}

+ Here is the caller graph for this function:

ilOrgUnit::hasUserReportingAccess (   $a_user_id)

Definition at line 221 of file class.ilOrgUnit.php.

References initAssigns().

{
if($this->assignment_list === null) $this->initAssigns();
return $this->assignment_list->hasUserReportingAccess($a_user_id);
}

+ Here is the call graph for this function:

ilOrgUnit::initAssigns ( )

Definition at line 29 of file class.ilOrgUnit.php.

Referenced by hasUserReportingAccess(), and ilOrgUnitTreeExplorerGUI\renderUnit().

{
require_once('Services/OrgUnit/classes/class.ilOrgUnitAssignmentList.php');
$this->assignment_list = new ilOrgUnitAssignmentList($this->id);
}

+ Here is the caller graph for this function:

ilOrgUnit::isUserAssigned (   $a_user_id)

Definition at line 53 of file class.ilOrgUnit.php.

{
if($this->assignment_list === null)
throw new ilOrgUnitException('Error: Assignment object not initialised yet!');
return $this->assignment_list->doesAssignmentExist($a_user_id);
}
static ilOrgUnit::lookupIdByImportId (   $ou_import_id)
static

Definition at line 179 of file class.ilOrgUnit.php.

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

{
if( isset(self::$import_id_cache[$ou_import_id]) )
{
return self::$import_id_cache[$ou_import_id];
}
global $ilDB;
$query = "SELECT ou_id FROM org_unit_data WHERE ou_import_id = %s";
$res = $ilDB->queryF($query, array('integer'), array($ou_import_id));
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
self::$import_id_cache[$ou_import_id] = $row->ou_id;
return $row->ou_id;
}
return null;
}
ilOrgUnit::read ( )

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

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

Referenced by __construct().

{
global $ilDB;
$query = "SELECT * FROM org_unit_data WHERE ou_id = %s";
$res = $ilDB->queryF($query, array('integer'), array($this->id));
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->id = $row->ou_id;
$this->title = $row->ou_title;
$this->subtitle = $row->ou_subtitle;
$this->import_id = $row->ou_import_id;
return true;
}
'organisation unit with id "'.$this->id.'" does not exist!'
);
}

+ Here is the caller graph for this function:

ilOrgUnit::setId (   $ou_id)

Definition at line 228 of file class.ilOrgUnit.php.

{
$this->id = (int)$ou_id;
return $this;
}
ilOrgUnit::setImportId (   $ou_import_id)

Definition at line 255 of file class.ilOrgUnit.php.

{
$this->import_id = (int)$ou_import_id;
return $this;
}
ilOrgUnit::setParent (   $a_parent)

Definition at line 265 of file class.ilOrgUnit.php.

{
$this->parent = (int)$a_parent;
return $this;
}
ilOrgUnit::setSubTitle (   $ou_subtitle)

Definition at line 246 of file class.ilOrgUnit.php.

{
$this->subtitle = $ou_subtitle;
return $this;
}
ilOrgUnit::setTitle (   $ou_title)

Definition at line 237 of file class.ilOrgUnit.php.

{
$this->title = $ou_title;
return $this;
}
ilOrgUnit::sortCallback (   $a_a,
  $a_b 
)

Definition at line 296 of file class.ilOrgUnit.php.

{
return strcmp($a_a->getTitle(), $a_b->getTitle());
}
ilOrgUnit::sortChilds ( )

Definition at line 287 of file class.ilOrgUnit.php.

{
usort($this->childs, array($this,'sortCallback'));
foreach($this->childs as $child)
{
if( $child->hasChilds() ) $child->sortChilds();
}
}
ilOrgUnit::update ( )

Definition at line 103 of file class.ilOrgUnit.php.

{
global $ilDB;
$ilDB->update(
'org_unit_data',
array(
'ou_title' => array('text', $this->title),
'ou_subtitle' => array('text', $this->subtitle),
'ou_import_id' => array('text', $this->import_id)
),
array('ou_id' => array('integer', $this->id))
);
}

Field Documentation

ilOrgUnit::$assignment_list = null
private

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

ilOrgUnit::$childs = array()
private

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

Referenced by getChilds().

ilOrgUnit::$id = 0
private

Definition at line 10 of file class.ilOrgUnit.php.

Referenced by getId().

ilOrgUnit::$import_id = 0
private

Definition at line 13 of file class.ilOrgUnit.php.

Referenced by getImportId().

ilOrgUnit::$import_id_cache = array()
staticprivate

Definition at line 8 of file class.ilOrgUnit.php.

ilOrgUnit::$instance_cache = array()
staticprivate

Definition at line 7 of file class.ilOrgUnit.php.

ilOrgUnit::$parent = 0
private

Definition at line 15 of file class.ilOrgUnit.php.

Referenced by getParent().

ilOrgUnit::$subtitle = ''
private

Definition at line 12 of file class.ilOrgUnit.php.

Referenced by getSubTitle().

ilOrgUnit::$title = ''
private

Definition at line 11 of file class.ilOrgUnit.php.

Referenced by getTitle().


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