Horde_Group_Base::setData PHP Метод

setData() публичный Метод

Sets one or more attributes of a group.
public setData ( mixed $gid, array | string $attribute, string $value = null )
$gid mixed A group ID.
$attribute array | string An attribute name or a hash of attributes.
$value string An attribute value if $attribute is a string.
    public function setData($gid, $attribute, $value = null)
    {
        // Store data.
        $this->_setData($gid, $attribute, $value);
        // Update data cache.
        $sig = $this->_sig('data_' . $gid);
        try {
            if ($data = $this->_cache->get($sig, 0)) {
                $data = @unserialize($data);
            } else {
                $data = array();
            }
        } catch (Horde_Cache_Exception $e) {
        }
        if (is_array($attribute)) {
            $data = $attribute;
        } else {
            $data[$attribute] = $value;
        }
        try {
            $this->_cache->set($sig, serialize($data));
        } catch (Horde_Cache_Exception $e) {
        }
        // Update name and list caches.
        $name = null;
        if (is_array($attribute)) {
            if (isset($attribute['name'])) {
                $name = $attribute['name'];
            }
        } elseif ($attribute == 'name') {
            $name = $value;
        }
        if ($name) {
            try {
                $this->_cache->set($this->_sig('name_' . $gid), $name);
            } catch (Horde_Cache_Exception $e) {
            }
            if (($list = $this->_getListCache()) !== null) {
                $list[$gid] = $name;
                $this->_setListCache($list);
            }
        }
    }