summaryrefslogtreecommitdiffstats
path: root/lib/client/kolab_client_task_group.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/client/kolab_client_task_group.php')
-rw-r--r--lib/client/kolab_client_task_group.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/client/kolab_client_task_group.php b/lib/client/kolab_client_task_group.php
index 3d8c876..821d438 100644
--- a/lib/client/kolab_client_task_group.php
+++ b/lib/client/kolab_client_task_group.php
@@ -261,6 +261,27 @@ class kolab_client_task_group extends kolab_client_task
);
}
+ // Members (get member names)
+ if (!empty($data['group'])) {
+ // find members attribute name
+ foreach (array('member', 'uniquemember') as $attr) {
+ if (isset($fields[$attr]) && isset($data[$attr])) {
+ $attr_name = $attr;
+ }
+ }
+ if (!empty($attr_name)) {
+ $result = $this->api->get('group.members_list', array('group' => $data['group']));
+ $list = (array) $result->get('list');
+ $data[$attr_name] = $this->parse_members($list);
+ }
+ }
+
+$fields['debug'] = array(
+ 'label' => 'debug',
+ 'section' => 'system',
+ 'value' => '<pre>'.kolab_html::escape(print_r($data, true)).'</pre>',
+);
+
// Create form object and populate with fields
$form = $this->form_create('group', $attribs, $sections, $fields, $fields_map, $data);
@@ -271,6 +292,19 @@ class kolab_client_task_group extends kolab_client_task
return $form->output();
}
+ private function parse_members($list)
+ {
+ // convert to key=>value array, see kolab_api_service_form_value::list_options_uniquemember()
+ foreach ($list as $idx => $value) {
+ $list[$idx] = $value['displayname'];
+ if (!empty($value['mail'])) {
+ $list[$idx] .= ' <' . $value['mail'] . '>';
+ }
+ }
+
+ return $list;
+ }
+
/**
* Returns list of group types.
*