4 * Description of GroupCountries
8 require_once 'Pman.php';
10 class Pman_Core_GroupCountries extends Pman
15 parent::getAuth(); // load company!
16 $au = $this->getAuthUser();
18 $this->jerror("LOGIN-NOAUTH", "Not authenticated", array('authFailure' => true));
20 if ($au->company()->comptype != 'OWNER') {
21 $this->jerr("Permission Denied" );
23 $this->authUser = $au;
27 function get($v, $opts=array())
34 if (!$this->hasPerm( 'Core.Groups','E')) { // editing groups..
35 $this->jerr("PERMISSION DENIED");
38 $users = explode(',', $_REQUEST['user_ids']);
40 $cls = $_REQUEST['action'].'PersonToCountry';// add or sup
46 function addPersonToCountry($users)
48 foreach($users as $id){
49 $p = DB_DataObject::factory('core_person');
51 $this->jerr('This Person is not exsiting');
53 $c = explode(',', $p->countries);
54 $c[] = $_REQUEST['country'];
57 $p->countries = implode(',', $c);
63 function subPersonToCountry($users)
65 foreach($users as $id){
66 $p = DB_DataObject::factory('core_person');
68 $this->jerr('This Person is not exsiting');
70 $c = explode(',', $p->countries);
71 if(($key = array_search($_REQUEST['country'], $c)) !== false) {
76 $p->countries = implode(',', $c);