X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=blobdiff_plain;f=GroupCountries.php;h=e694d8d8668675773cd932c36d01202837cbae7e;hp=e62da3f3c545fc08ec1116937531aa378c41155e;hb=refs%2Fheads%2Fwip_alan_T5884_add_photo_to_report;hpb=bf6509545e8d4d6ba34af34d07a3c6f61cc047ff diff --git a/GroupCountries.php b/GroupCountries.php index e62da3f3..e694d8d8 100644 --- a/GroupCountries.php +++ b/GroupCountries.php @@ -24,12 +24,12 @@ class Pman_Core_GroupCountries extends Pman return true; } - function get() + function get($v, $opts=array()) { - $this->post(); + $this->post($v); } - function post() + function post($v) { if (!$this->hasPerm( 'Core.Groups','E')) { // editing groups.. $this->jerr("PERMISSION DENIED"); @@ -46,23 +46,24 @@ class Pman_Core_GroupCountries extends Pman function addPersonToCountry($users) { foreach($users as $id){ - $p = DB_DataObject::factory('Person'); + $p = DB_DataObject::factory('core_person'); if(!$p->get($id)){ $this->jerr('This Person is not exsiting'); } $c = explode(',', $p->countries); $c[] = $_REQUEST['country']; sort($c); - print_r($c); -// $p->countries = implode(',', $c); -// $p->update(); +// print_r($c); + $p->countries = implode(',', $c); + $p->update(); } + $this->jok(true); } function subPersonToCountry($users) { foreach($users as $id){ - $p = DB_DataObject::factory('Person'); + $p = DB_DataObject::factory('core_person'); if(!$p->get($id)){ $this->jerr('This Person is not exsiting'); } @@ -70,12 +71,12 @@ class Pman_Core_GroupCountries extends Pman if(($key = array_search($_REQUEST['country'], $c)) !== false) { unset($c[$key]); } - sort($c); - print_r($c); -// $p->countries = implode(',', $c); -// $p->update(); + sort($c); +// print_r($c); + $p->countries = implode(',', $c); + $p->update(); } - + $this->jok(true); } }