From e37cb1e87d63384329efa3e8fe3e964c56fd39d0 Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 19 Mar 2014 13:05:47 +0800 Subject: [PATCH] GroupCountries.php --- GroupCountries.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/GroupCountries.php b/GroupCountries.php index 7fbafbbd..5d97fc07 100644 --- a/GroupCountries.php +++ b/GroupCountries.php @@ -37,20 +37,28 @@ class Pman_Core_GroupCountries extends Pman $users = explode(',', $_REQUEST['user_ids']); - $cls = $_REQUEST['action'].'PersonToCountry'; + $cls = $_REQUEST['action'].'PersonToCountry';// add or sup $this->$cls($users); print_r($_REQUEST); } - function addPersonToCountry() + function addPersonToCountry($users) { foreach($users as $id){ + $p = DB_DataObject::factory('Person'); + if(!$p->get($id)){ + $this->jerr('This Person is not exsiting'); + } + $c = explode(',', $p->countries); + $c[] = $_REQUEST['country']; + $p->countries = implode(',', $c); + $p->update(); } } - function supPersonToCountry() + function supPersonToCountry($users) { } -- 2.39.2