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);
58 $t->joinAdd(DB_DataObject::factory('Groups'), 'LEFT');
59 //$person->id = (int)$person->id;
61 user_id = {$person->id}
64 $t->selectAdd('distinct(group_id), Groups.name as name');
69 // $ret = $arrayof == 'group_id' ? array(0) : array();
70 // default member of 'All groups'!!
73 $ret[] = $t->$arrayof;
74 if ($t->name == 'Administrators') { /// mmh... bit risky?
75 $this->inAdmin = true;
78 if ($arrayof == 'group_id' && !count($ret)) {
79 $ret = array(0); /// default if they are not a member of any group.
85 function checkPerm($lvl, $au)