/** * Get an array of ilObjOrgUnit objects using this type * * @param bool $include_deleted True if also deleted OrgUnits are returned * * @return array */ public function getOrgUnits($include_deleted = true) { $cache_key = $include_deleted ? 1 : 0; if (is_array($this->orgus[$cache_key])) { return $this->orgus[$cache_key]; } $this->orgus[$cache_key] = array(); $ids = $this->getOrgUnitIds($include_deleted); foreach ($ids as $id) { $orgu = new ilObjOrgUnit($id, false); if (!$include_deleted) { // Check if OrgUnit is in trash (each OrgUnit does only have one reference) $ref_ids = ilObject::_getAllReferences($id); $ref_ids = array_values($ref_ids); $ref_id = $ref_ids[0]; if ($orgu->_isInTrash($ref_id)) { continue; } } $this->orgus[$cache_key][] = $orgu; } return $this->orgus[$cache_key]; }