Esempio n. 1
0
 /**
  * Returns an array that maps from OrgUnit object IDs to its icon defined by the assigned OrgUnit type.
  * Keys = OrgUnit object IDs, values = Path to the icon
  * This allows to get the Icons of OrgUnits without loading the object (e.g. used in the tree explorer)
  *
  * @return array
  */
 public static function getIconsCache()
 {
     if (is_array(self::$icons_cache)) {
         return self::$icons_cache;
     }
     global $ilDB;
     /** @var ilDB $ilDB */
     $sql = 'SELECT orgu_id, ot.id AS type_id FROM orgu_data
             INNER JOIN orgu_types AS ot ON (ot.id = orgu_data.orgu_type_id)
             WHERE ot.icon IS NOT NULL';
     $set = $ilDB->query($sql);
     $icons_cache = array();
     while ($row = $ilDB->fetchObject($set)) {
         $type = ilOrgUnitType::getInstance($row->type_id);
         if ($type && is_file($type->getIconPath(true))) {
             $icons_cache[$row->orgu_id] = $type->getIconPath(true);
         }
     }
     self::$icons_cache = $icons_cache;
     return $icons_cache;
 }