3 * Table Definition for user_group
5 require_once 'classes/Memcached_DataObject.php';
7 class User_group extends Memcached_DataObject
10 /* the code below is auto generated do not remove the above tag */
12 public $__table = 'user_group'; // table name
13 public $id; // int(4) primary_key not_null
14 public $nickname; // varchar(64) unique_key
15 public $fullname; // varchar(255)
16 public $homepage; // varchar(255)
17 public $description; // varchar(140)
18 public $location; // varchar(255)
19 public $original_logo; // varchar(255)
20 public $homepage_logo; // varchar(255)
21 public $stream_logo; // varchar(255)
22 public $mini_logo; // varchar(255)
23 public $created; // datetime() not_null
24 public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
27 function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('User_group',$k,$v); }
29 /* the code above is auto generated do not remove the tag below */
32 function defaultLogo($size)
34 static $sizenames = array(AVATAR_PROFILE_SIZE => 'profile',
35 AVATAR_STREAM_SIZE => 'stream',
36 AVATAR_MINI_SIZE => 'mini');
37 return theme_path('default-avatar-'.$sizenames[$size].'.png');
42 return common_local_url('showgroup',
43 array('nickname' => $this->nickname));
48 return common_local_url('groupbyid',
49 array('id' => $this->id));
52 function getNotices($offset, $limit)
56 'FROM notice JOIN group_inbox ON notice.id = group_inbox.notice_id ' .
57 'WHERE group_inbox.group_id = %d ';
58 return Notice::getStream(sprintf($qry, $this->id),
59 'group:notices:'.$this->id,
63 function allowedNickname($nickname)
65 static $blacklist = array('new');
66 return !in_array($nickname, $blacklist);
69 function getMembers($offset=0, $limit=null)
73 'FROM profile JOIN group_member '.
74 'ON profile.id = group_member.profile_id ' .
75 'WHERE group_member.group_id = %d ' .
76 'ORDER BY group_member.created DESC ';
78 if (common_config('db','type') == 'pgsql') {
79 $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
81 $qry .= ' LIMIT ' . $offset . ', ' . $limit;
84 $members = new Profile();
86 $cnt = $members->query(sprintf($qry, $this->id));