3 * Table Definition for Group_Members
5 require_once 'DB/DataObject.php';
7 class Pman_Core_DataObjects_Group_members extends DB_DataObject
10 /* the code below is auto generated do not remove the above tag */
12 public $__table = 'group_members'; // table name
13 public $group_id; // int(11)
14 public $id; // int(11) not_null primary_key auto_increment
15 public $user_id; // int(11) not_null
18 /* the code above is auto generated do not remove the tag below */
24 function change($person, $group, $state)
26 $gm = DB_DataObject::factory('group_members');
27 $gm->group_id = $group->id;
28 $gm->user_id = $person->id;
44 * Get a list of memberships for a person
45 * @param Pman_Core_DataObjects_Person $person who
46 * @param String column to fetch.. eg. group_id or 'name'
51 function listGroupMembership($person, $arrayof = 'group_id')
53 $this->inAdmin = false;
55 //DB_DataObject::debugLevel(1);
57 $grp = DB_DataObject::factory('Groups');
58 $t->joinAdd($grp , 'LEFT');
59 //$person->id = (int)$person->id;
61 user_id = {$person->id}
64 $t->selectAdd("distinct(group_id), {$grp->tableName()}.name as name");
65 $t->whereAdd('group_id IS NOT NULL');
70 // $ret = $arrayof == 'group_id' ? array(0) : array();
71 // default member of 'All groups'!!
74 $ret[] = $t->$arrayof;
75 if ($t->name == 'Administrators') { /// mmh... bit risky?
76 $this->inAdmin = true;
79 if ($arrayof == 'group_id' && !count($ret)) {
80 $ret = array(0); /// default if they are not a member of any group.
86 function checkPerm($lvl, $au)