예제 #1
0
파일: Sql.php 프로젝트: jubinpatel/horde
 /**
  * Sets one or more attributes of a group.
  *
  * @param mixed $gid               A group ID.
  * @param array|string $attribute  An attribute name or a hash of
  *                                 attributes.
  * @param string $value            An attribute value if $attribute is a
  *                                 string.
  *
  * @throws Horde_Group_Exception
  */
 public function setData($gid, $attribute, $value = null)
 {
     $attributes = is_array($attribute) ? $attribute : array($attribute => $value);
     $updates = array();
     foreach ($attributes as $attribute => $value) {
         $updates[] = $this->_db->quoteColumnName('group_' . $attribute) . ' = ' . $this->_db->quote($value);
     }
     try {
         $this->_db->update('UPDATE horde_groups SET ' . implode(', ', $updates) . ' WHERE group_uid = ?', array($gid));
     } catch (Horde_Db_Exception $e) {
         throw new Horde_Group_Exception($e);
     }
 }