summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-01-21 02:22:10 -0500
committerEvan Prodromou <evan@controlyourself.ca>2009-01-21 02:22:10 -0500
commit26652e92f2ef0cedda9823e17c81fc78be82fe9b (patch)
tree06cda4f98d37dac0824e96f98f727f25ce3146da /classes
parent97f14ef1f9c9a1151c149eb1e95646081918befb (diff)
First pass at a group home page
This is the first pass at a group home page.
Diffstat (limited to 'classes')
-rwxr-xr-xclasses/Group_member.php2
-rw-r--r--classes/User.php28
-rwxr-xr-xclasses/User_group.php29
3 files changed, 57 insertions, 2 deletions
diff --git a/classes/Group_member.php b/classes/Group_member.php
index 6aba84f65..32243fe45 100755
--- a/classes/Group_member.php
+++ b/classes/Group_member.php
@@ -2,7 +2,7 @@
/**
* Table Definition for group_member
*/
-require_once 'classes/Memcached_DataObject';
+require_once 'classes/Memcached_DataObject.php';
class Group_member extends Memcached_DataObject
{
diff --git a/classes/User.php b/classes/User.php
index 92ff8776b..51e23fccf 100644
--- a/classes/User.php
+++ b/classes/User.php
@@ -492,4 +492,32 @@ class User extends Memcached_DataObject
return true;
}
+ function isMember($group)
+ {
+ $mem = new Group_member();
+
+ $mem->group_id = $group->id;
+ $mem->profile_id = $this->id;
+
+ if ($mem->find()) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ function isAdmin($group)
+ {
+ $mem = new Group_member();
+
+ $mem->group_id = $group->id;
+ $mem->profile_id = $this->id;
+ $mem->is_admin = 1;
+
+ if ($mem->find()) {
+ return true;
+ } else {
+ return false;
+ }
+ }
}
diff --git a/classes/User_group.php b/classes/User_group.php
index e8aaec744..e0b6f2885 100755
--- a/classes/User_group.php
+++ b/classes/User_group.php
@@ -2,7 +2,7 @@
/**
* Table Definition for user_group
*/
-require_once 'classes/Memcached_DataObject';
+require_once 'classes/Memcached_DataObject.php';
class User_group extends Memcached_DataObject
{
@@ -28,4 +28,31 @@ class User_group extends Memcached_DataObject
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
+
+ function defaultLogo($size) {
+ static $sizenames = array(AVATAR_PROFILE_SIZE => 'profile',
+ AVATAR_STREAM_SIZE => 'stream',
+ AVATAR_MINI_SIZE => 'mini');
+ return theme_path('default-avatar-'.$sizenames[$size].'.png');
+ }
+
+ function homeUrl() {
+ return common_local_url('showgroup',
+ array('nickname' => $this->nickname));
+ }
+
+ function permalink() {
+ return common_local_url('groupbyid',
+ array('id' => $this->id));
+ }
+
+ function getNotices($offset, $limit) {
+ $qry =
+ 'SELECT notice.* ' .
+ 'FROM notice JOIN group_inbox ON notice.id = group_inbox.notice_id ' .
+ 'WHERE group_inbox.group_id = %d ';
+ return Notice::getStream(sprintf($qry, $this->id),
+ 'group:notices:'.$this->id,
+ $offset, $limit);
+ }
}