[6779] | 1 | <?php |
---|
| 2 | /**************************************************************************\ |
---|
| 3 | * eGroupWare API - Services Abstraction Class * |
---|
| 4 | * This file written by Miles Lott <milosch@groupwhere.org> * |
---|
| 5 | * Copyright (C) 2001 Miles Lott * |
---|
| 6 | * -------------------------------------------------------------------------* |
---|
| 7 | * This library is part of the eGroupWare API * |
---|
| 8 | * http://www.egroupware.org/api * |
---|
| 9 | * ------------------------------------------------------------------------ * |
---|
| 10 | * This library is free software; you can redistribute it and/or modify it * |
---|
| 11 | * under the terms of the GNU Lesser General Public License as published by * |
---|
| 12 | * the Free Software Foundation; either version 2.1 of the License, * |
---|
| 13 | * or any later version. * |
---|
| 14 | * This library is distributed in the hope that it will be useful, but * |
---|
| 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of * |
---|
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * |
---|
| 17 | * See the GNU Lesser General Public License for more details. * |
---|
| 18 | * You should have received a copy of the GNU Lesser General Public License * |
---|
| 19 | * along with this library; if not, write to the Free Software Foundation, * |
---|
| 20 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * |
---|
| 21 | \**************************************************************************/ |
---|
| 22 | |
---|
| 23 | |
---|
| 24 | class service |
---|
| 25 | { |
---|
| 26 | var $provider = ''; |
---|
| 27 | var $svc = ''; |
---|
| 28 | var $type = ''; |
---|
| 29 | var $function_map = array(); |
---|
| 30 | |
---|
| 31 | function exec($service) |
---|
| 32 | { |
---|
| 33 | if(is_array($service)) |
---|
| 34 | { |
---|
| 35 | $data = $service[2]; |
---|
| 36 | $function = $service[1]; |
---|
| 37 | $service = $service[0]; |
---|
| 38 | } |
---|
| 39 | switch ($service) |
---|
| 40 | { |
---|
| 41 | case 'schedule': |
---|
| 42 | case 'contacts': |
---|
| 43 | case 'notes': |
---|
| 44 | case 'todo': |
---|
| 45 | $this = CreateObject('phpgwapi.service_' . $service); |
---|
| 46 | break; |
---|
| 47 | default: |
---|
| 48 | $this = CreateObject($service); |
---|
| 49 | break; |
---|
| 50 | } |
---|
| 51 | if($function) |
---|
| 52 | { |
---|
| 53 | return $this->$function($data); |
---|
| 54 | } |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | function list_methods() |
---|
| 58 | { |
---|
| 59 | return $this->function_map; |
---|
| 60 | } |
---|
| 61 | } |
---|
| 62 | ?> |
---|