Ejemplo n.º 1
0
 /**
  * Retrieve all items in a group.
  *
  * @param string $group
  *   (required) The group name of the item.
  * @param int $componentID
  *   The optional component ID (so componenets can share the same name space).
  *
  * @return object
  *   The data if present in cache, else null
  */
 public static function &getItems($group, $componentID = NULL)
 {
     if (self::$_cache === NULL) {
         self::$_cache = array();
     }
     $argString = "CRM_CT_CI_{$group}_{$componentID}";
     if (!array_key_exists($argString, self::$_cache)) {
         $cache = CRM_Utils_Cache::singleton();
         self::$_cache[$argString] = $cache->get($argString);
         if (!self::$_cache[$argString]) {
             $dao = new CRM_Core_DAO_Cache();
             $dao->group_name = $group;
             $dao->component_id = $componentID;
             $dao->find();
             $result = array();
             while ($dao->fetch()) {
                 $result[$dao->path] = unserialize($dao->data);
             }
             $dao->free();
             self::$_cache[$argString] = $result;
             $cache->set($argString, self::$_cache[$argString]);
         }
     }
     return self::$_cache[$argString];
 }