3 * Table Definition for Group_Members
5 class_exists('DB_DataObject') ? '' : require_once 'DB/DataObject.php';
7 class Pman_Core_DataObjects_Core_group_member extends DB_DataObject
10 /* the code below is auto generated do not remove the above tag */
12 public $__table = 'core_group_member'; // 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 */
26 function change($person, $group, $state)
28 $gm = DB_DataObject::factory($this->tableName());
29 $gm->group_id = $group->id;
30 $gm->user_id = $person->id;
46 * Get a list of memberships for a person
47 * @param Pman_Core_DataObjects_Person $person who
48 * @param String column to fetch.. eg. group_id or 'name'
53 function listGroupMembership($person, $arrayof = 'group_id')
55 $this->inAdmin = false;
57 //DB_DataObject::debugLevel(1);
59 $grp = DB_DataObject::factory('core_group');
60 $t->joinAdd($grp , 'LEFT');
61 //$person->id = (int)$person->id;
63 user_id = {$person->id}
66 $t->selectAdd("distinct(group_id), {$grp->tableName()}.name as name");
67 $t->whereAdd('group_id IS NOT NULL');
72 // $ret = $arrayof == 'group_id' ? array(0) : array();
73 // default member of 'All groups'!!
76 $ret[] = $t->$arrayof;
77 if ($t->name == 'Administrators') { /// mmh... bit risky?
78 $this->inAdmin = true;
81 if ($arrayof == 'group_id' && !count($ret)) {
82 $ret = array(0); /// default if they are not a member of any group.
88 function checkPerm($lvl, $au)