function peopleaggregator_findGroup($args)
{
    $name = $args['name'];
    $groups = array();
    foreach (ContentCollection::findByTitle($name) as $group) {
        $groups[] = array("id" => "group:" . $group['ccid'], "name" => $group['title']);
    }
    return array('success' => TRUE, 'groups' => $groups);
}
Ejemplo n.º 2
0
 private function find_or_create_blog()
 {
     // we are looking for a soecific blog
     $groups = array();
     foreach (ContentCollection::findByTitle($this->blog_name) as $group) {
         $groups[] = array("gid" => $group['ccid'], "name" => $group['title']);
     }
     if (!empty($groups[0])) {
         $this->gid = $groups[0]['gid'];
         // $this->note .= "found blog ($this->gid) in: <pre>".print_r($groups,1)."</pre><br>";
     } else {
         // logged in user only beyond here
         if (empty(PA::$login_user->user_id)) {
             return false;
         }
         // ok, no group of this name - create it
         $this->note .= "Need to create blog {$this->blog_name}.";
         $g_name = $this->blog_name;
         $g_desc = $this->blog_name;
         // FIXME
         $g_pic = 'foo.gif';
         $g_tags = '';
         $g_category_id = 1;
         $access_type = 0;
         // public
         $reg_type = 0;
         // open
         $mod_type = 0;
         // direct
         $user = PA::$login_user;
         // now create the group
         $this->gid = $group_id = Group::save_new_group(0, $user->user_id, $g_name, $g_desc, $g_pic, $g_tags, $g_category_id, $access_type, $reg_type, $mod_type);
         $this->note .= "Created blog with gid={$this->gid}.";
     }
 }