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;
47 $grp = DB_DataObject::factory('core_group');
48 $grp->get($this->group_id);
54 * Get a list of memberships for a person
55 * @param Pman_Core_DataObjects_Person $person who
56 * @param String column to fetch.. eg. group_id or 'name'
61 function listGroupMembership($person, $arrayof = 'group_id')
63 $this->inAdmin = false;
65 //DB_DataObject::debugLevel(1);
67 $grp = DB_DataObject::factory('core_group');
68 $t->joinAdd($grp , 'LEFT');
69 //$person->id = (int)$person->id;
71 user_id = {$person->id}
74 $t->selectAdd("distinct(group_id), {$grp->tableName()}.name as name");
75 $t->whereAdd('group_id IS NOT NULL');
80 // $ret = $arrayof == 'group_id' ? array(0) : array();
81 // default member of 'All groups'!!
84 $ret[] = $t->$arrayof;
85 if ($t->name == 'Administrators') { /// mmh... bit risky?
86 $this->inAdmin = true;
89 if ($arrayof == 'group_id' && !count($ret)) {
90 $ret = array(0); /// default if they are not a member of any group.
97 function checkPerm($lvl, $au)
99 // not sure if this is correct - but we need it on texon
100 return $au->hasPerm("Core.Staff", $lvl);