summaryrefslogtreecommitdiff
path: root/program/include
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2010-10-22 15:24:39 +0000
committerthomascube <thomas@roundcube.net>2010-10-22 15:24:39 +0000
commitcb7d32ebdd1c783f201e2f3fa6c52f1fafdc6fcf (patch)
treef82963865616671696c87c3ff5a4ca577941bf7c /program/include
parent6a16031d043ab1a3999ecae6181ecb50cb6f1636 (diff)
List groups in address detail view and allow to subscribe/unsubscribe from there (#1486753)
Diffstat (limited to 'program/include')
-rw-r--r--program/include/rcube_contacts.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/program/include/rcube_contacts.php b/program/include/rcube_contacts.php
index 16e39fc7e..e1dc7c535 100644
--- a/program/include/rcube_contacts.php
+++ b/program/include/rcube_contacts.php
@@ -355,6 +355,33 @@ class rcube_contacts extends rcube_addressbook
/**
+ * Get group assignments of a specific contacr record
+ *
+ * @param mixed Record identifier
+ * @param array List of assigned groups as ID=>Name pairs
+ */
+ function get_record_groups($id)
+ {
+ $results = array();
+
+ if (!$this->groups)
+ return $results;
+
+ $sql_result = $this->db->query(
+ "SELECT cgm.contactgroup_id, cg.name FROM " . get_table_name($this->db_groupmembers) . " AS cgm" .
+ " LEFT JOIN " . get_table_name($this->db_groups) . " AS cg ON (cgm.contactgroup_id = cg.contactgroup_id AND cg.del<>1)" .
+ " WHERE cgm.contact_id=?",
+ $id
+ );
+ while ($sql_result && ($sql_arr = $this->db->fetch_assoc($sql_result))) {
+ $results[$sql_arr['contactgroup_id']] = $sql_arr['name'];
+ }
+
+ return $results;
+ }
+
+
+ /**
* Create a new contact record
*
* @param array Assoziative array with save data