addMember() public method

Adds a new contact entry to this group.
public addMember ( string $contactId, string $sourceId = null )
$contactId string The id of the contact to add.
$sourceId string The source $contactId is from.
Exemplo n.º 1
0
Arquivo: data.php Projeto: horde/horde
                 $notification->push(sprintf(_("There was an error importing the data: %s"), $e->getMessage()), 'horde.error');
                 $error = true;
                 break;
             }
         }
     }
     // Now attempt to create Turba group objects.
     foreach ($contact_groups as $group) {
         $attributes = $group;
         unset($attributes['__members']);
         $group_obj = new Turba_Object_Group($driver, $attributes);
         foreach (explode(',', $group['__members']) as $uid) {
             $results = $driver->search(array('__uid' => $uid));
             if (count($results->objects)) {
                 $object = array_pop($results->objects);
                 $group_obj->addMember($object->getValue('__key'), $object->getSource());
             }
         }
         // We don't actually use the group object to save to storage since
         // it's not an existing group. We use it so it's responsible for
         // properly formatting the __members data, which we pull out and
         // place in the attributes array.
         $attributes['__members'] = $group_obj->getValue('__members');
         $attributes['__type'] = 'group';
         $driver->add($attributes);
     }
     if (!$error && $imported) {
         $notification->push(sprintf(_("%s file successfully imported."), $file_types[$data->storage->get('format')]), 'horde.success');
     }
 }
 $next_step = $data->cleanup();