[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] property/class.botenant.php, 1.1.1.3
From: |
nomail |
Subject: |
[Phpgroupware-cvs] property/class.botenant.php, 1.1.1.3 |
Date: |
Fri, 21 May 2004 16:04:17 -0000 |
Update of /property
Modified Files:
Branch:
class.botenant.php
date: 2004/04/23 21:26:33; author: sigurdne; state: Exp; lines: +297 -297
Log Message:
no message
=====================================================================
Index: property/class.botenant.php
diff -u property/class.botenant.php:1.1.1.2 property/class.botenant.php:1.1.1.3
--- property/class.botenant.php:1.1.1.2 Fri Apr 23 20:25:28 2004
+++ property/class.botenant.php Fri Apr 23 21:26:33 2004
@@ -1,297 +1,297 @@
-<?php
-
/**************************************************************************\
- * phpGroupWare - property
*
- * http://www.phpgroupware.org
*
- *
*
- * Facilities Management
*
- * Written by Sigurd Nes [sigurdne at online.no]
*
- *
------------------------------------------------------------------------ *
- * Copyright 2000 - 2003 Free Software Foundation, Inc
*
- * This program is part of the GNU project, see http://www.gnu.org/
*
- *
------------------------------------------------------------------------ *
- * This program is free software; you can redistribute it and/or modify
it *
- * under the terms of the GNU General Public License as published by the
*
- * Free Software Foundation; either version 2 of the License, or (at
your *
- * option) any later version.
*
-
\**************************************************************************/
- /* $Id$ */
-
- class property_botenant
- {
- var $start;
- var $query;
- var $filter;
- var $sort;
- var $order;
- var $cat_id;
-
- var $public_functions = array
- (
- 'read' => True,
- 'read_single' => True,
- 'save' => True,
- 'delete' => True,
- 'check_perms' => True
- );
-
- var $soap_functions = array(
- 'list' => array(
- 'in' =>
array('int','int','struct','string','int'),
- 'out' => array('array')
- ),
- 'read' => array(
- 'in' => array('int','struct'),
- 'out' => array('array')
- ),
- 'save' => array(
- 'in' => array('int','struct'),
- 'out' => array()
- ),
- 'delete' => array(
- 'in' => array('int','struct'),
- 'out' => array()
- )
- );
-
- function property_botenant($session=False)
- {
- $this->currentapp = 'property';
//$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->so = CreateObject($this->currentapp.'_sotenant');
- $this->fm_session =
CreateObject($this->currentapp.'_session');
-
- if ($session)
- {
- $this->read_sessiondata();
- $this->use_session = True;
- }
-
- $start = get_var('start',array('POST','GET'));
- $query = get_var('query',array('POST','GET'));
- $sort = get_var('sort',array('POST','GET'));
- $order = get_var('order',array('POST','GET'));
- $filter = get_var('filter',array('POST','GET'));
- $cat_id = get_var('cat_id',array('POST','GET'));
- $allrows =
get_var('allrows',array('POST','GET'));
-
- if ($start)
- {
- $this->start=$start;
- }
- else
- {
- $this->start=0;
- }
-
- if(isset($query))
- {
- $this->query = $query;
- }
- if(!empty($filter))
- {
- $this->filter = $filter;
- }
- if(isset($sort))
- {
- $this->sort = $sort;
- }
- if(isset($order))
- {
- $this->order = $order;
- }
- if(isset($cat_id) && !empty($cat_id))
- {
- $this->cat_id = $cat_id;
- }
- else
- {
- unset($this->cat_id);
- }
- if(isset($allrows))
- {
- $this->allrows = $allrows;
- }
- }
-
- function list_methods($_type='xmlrpc')
- {
- /*
- This handles introspection or discovery by the logged
in client,
- in which case the input might be an array. The
server always calls
- this function to fill the server dispatch map using a
string.
- */
- if (is_array($_type))
- {
- $_type = $_type['type'] ? $_type['type'] :
$_type[0];
- }
- switch($_type)
- {
- case 'xmlrpc':
- $xml_functions = array(
- 'read' => array(
- 'function' => 'read',
- 'signature' =>
array(array(xmlrpcInt,xmlrpcStruct)),
- 'docstring' =>
lang('Read a single entry by passing the id and fieldlist.')
- ),
- 'save' => array(
- 'function' => 'save',
- 'signature' =>
array(array(xmlrpcStruct,xmlrpcStruct)),
- 'docstring' =>
lang('Update a single entry by passing the fields.')
- ),
- 'delete' => array(
- 'function' => 'delete',
- 'signature' =>
array(array(xmlrpcBoolean,xmlrpcInt)),
- 'docstring' =>
lang('Delete a single entry by passing the id.')
- ),
- 'list' => array(
- 'function' => '_list',
- 'signature' =>
array(array(xmlrpcStruct,xmlrpcStruct)),
- 'docstring' =>
lang('Read a list of entries.')
- ),
- 'list_methods' => array(
- 'function' =>
'list_methods',
- 'signature' =>
array(array(xmlrpcStruct,xmlrpcString)),
- 'docstring' =>
lang('Read this list of methods.')
- )
- );
- return $xml_functions;
- break;
- case 'soap':
- return $this->soap_functions;
- break;
- default:
- return array();
- break;
- }
- }
-
- function save_sessiondata($data)
- {
- if ($this->use_session)
- {
-
$this->fm_session->appsession('session_data','tenant',$data);
- }
- }
-
- function read_sessiondata()
- {
- $data =
$this->fm_session->appsession('session_data','tenant');
-
- //html_print_r($data);
-
- $this->start = $data['start'];
- $this->query = $data['query'];
- $this->filter = $data['filter'];
- $this->sort = $data['sort'];
- $this->order = $data['order'];
- $this->cat_id = $data['cat_id'];
- }
-
- function check_perms($has, $needed)
- {
- return (!!($has & $needed) == True);
- }
-
-
- function read_category_name($cat_id='')
- {
-// return $this->so->read_category_name($cat_id);
- }
-
- function select_category_list($format='',$selected='')
- {
- switch($format)
- {
- case 'select':
-
$this->bocommon->xsl_add_file(array('cat_select'));
- break;
- case 'filter':
-
$this->bocommon->xsl_add_file(array('cat_filter'));
- break;
- }
-
- $categories= $this->so->select_category_list();
-
-/* $categories[0]['id'] = 1;
- $categories[0]['name'] = lang('male');
- $categories[1]['id'] = 2;
- $categories[1]['name'] = lang('female');
- $categories[2]['id'] = 3;
- $categories[2]['name'] = lang('organization');
-
-*/
- while (is_array($categories) && list(,$category) =
each($categories))
- {
- $sel_category = '';
- if ($category['id']==$selected)
- {
- $sel_category = 'selected';
- }
-
- $category_list[] = array
- (
- 'cat_id' => $category['id'],
- 'name' => $category['name'],
- 'selected' => $sel_category
- );
- }
-
- for ($i=0;$i<count($category_list);$i++)
- {
- if ($category_list[$i]['selected'] !=
'selected')
- {
- unset($category_list[$i]['selected']);
- }
- }
-
- return $category_list;
- }
-
- function read()
- {
- $tenant = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'filter' => $this->filter,'cat_id' =>
$this->cat_id,'allrows'=>$this->allrows));
- $this->total_records = $this->so->total_records;
-
- for ($i=0; $i<count($tenant); $i++)
- {
- $tenant[$i]['entry_date'] =
$GLOBALS['phpgw']->common->show_date($tenant[$i]['date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- }
- return $tenant;
- }
-
- function read_single($tenant_id)
- {
- return $this->so->read_single($tenant_id);
- }
-
- function save($tenant)
- {
-
- if ($tenant['tenant_id'])
- {
- if ($tenant['tenant_id'] != 0)
- {
- $tenant_id = $tenant['tenant_id'];
- $receipt=$this->so->edit($tenant);
- }
- }
- else
- {
- $receipt = $this->so->add($tenant);
- }
- return $receipt;
- }
-
- function delete($params)
- {
- if (is_array($params))
- {
- $this->so->delete($params[0]);
- }
- else
- {
- $this->so->delete($params);
- }
- }
- }
-?>
+<?php
+
/**************************************************************************\
+ * phpGroupWare - property
*
+ * http://www.phpgroupware.org
*
+ *
*
+ * Facilities Management
*
+ * Written by Sigurd Nes [sigurdne at online.no]
*
+ *
------------------------------------------------------------------------ *
+ * Copyright 2000 - 2003 Free Software Foundation, Inc
*
+ * This program is part of the GNU project, see http://www.gnu.org/
*
+ *
------------------------------------------------------------------------ *
+ * This program is free software; you can redistribute it and/or modify
it *
+ * under the terms of the GNU General Public License as published by the
*
+ * Free Software Foundation; either version 2 of the License, or (at
your *
+ * option) any later version.
*
+
\**************************************************************************/
+ /* $Id$ */
+
+ class property_botenant
+ {
+ var $start;
+ var $query;
+ var $filter;
+ var $sort;
+ var $order;
+ var $cat_id;
+
+ var $public_functions = array
+ (
+ 'read' => True,
+ 'read_single' => True,
+ 'save' => True,
+ 'delete' => True,
+ 'check_perms' => True
+ );
+
+ var $soap_functions = array(
+ 'list' => array(
+ 'in' =>
array('int','int','struct','string','int'),
+ 'out' => array('array')
+ ),
+ 'read' => array(
+ 'in' => array('int','struct'),
+ 'out' => array('array')
+ ),
+ 'save' => array(
+ 'in' => array('int','struct'),
+ 'out' => array()
+ ),
+ 'delete' => array(
+ 'in' => array('int','struct'),
+ 'out' => array()
+ )
+ );
+
+ function property_botenant($session=False)
+ {
+ $this->currentapp = 'property';
//$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->so = CreateObject($this->currentapp.'_sotenant');
+ $this->fm_session =
CreateObject($this->currentapp.'_session');
+
+ if ($session)
+ {
+ $this->read_sessiondata();
+ $this->use_session = True;
+ }
+
+ $start = get_var('start',array('POST','GET'));
+ $query = get_var('query',array('POST','GET'));
+ $sort = get_var('sort',array('POST','GET'));
+ $order = get_var('order',array('POST','GET'));
+ $filter = get_var('filter',array('POST','GET'));
+ $cat_id = get_var('cat_id',array('POST','GET'));
+ $allrows =
get_var('allrows',array('POST','GET'));
+
+ if ($start)
+ {
+ $this->start=$start;
+ }
+ else
+ {
+ $this->start=0;
+ }
+
+ if(isset($query))
+ {
+ $this->query = $query;
+ }
+ if(!empty($filter))
+ {
+ $this->filter = $filter;
+ }
+ if(isset($sort))
+ {
+ $this->sort = $sort;
+ }
+ if(isset($order))
+ {
+ $this->order = $order;
+ }
+ if(isset($cat_id) && !empty($cat_id))
+ {
+ $this->cat_id = $cat_id;
+ }
+ else
+ {
+ unset($this->cat_id);
+ }
+ if(isset($allrows))
+ {
+ $this->allrows = $allrows;
+ }
+ }
+
+ function list_methods($_type='xmlrpc')
+ {
+ /*
+ This handles introspection or discovery by the logged
in client,
+ in which case the input might be an array. The
server always calls
+ this function to fill the server dispatch map using a
string.
+ */
+ if (is_array($_type))
+ {
+ $_type = $_type['type'] ? $_type['type'] :
$_type[0];
+ }
+ switch($_type)
+ {
+ case 'xmlrpc':
+ $xml_functions = array(
+ 'read' => array(
+ 'function' => 'read',
+ 'signature' =>
array(array(xmlrpcInt,xmlrpcStruct)),
+ 'docstring' =>
lang('Read a single entry by passing the id and fieldlist.')
+ ),
+ 'save' => array(
+ 'function' => 'save',
+ 'signature' =>
array(array(xmlrpcStruct,xmlrpcStruct)),
+ 'docstring' =>
lang('Update a single entry by passing the fields.')
+ ),
+ 'delete' => array(
+ 'function' => 'delete',
+ 'signature' =>
array(array(xmlrpcBoolean,xmlrpcInt)),
+ 'docstring' =>
lang('Delete a single entry by passing the id.')
+ ),
+ 'list' => array(
+ 'function' => '_list',
+ 'signature' =>
array(array(xmlrpcStruct,xmlrpcStruct)),
+ 'docstring' =>
lang('Read a list of entries.')
+ ),
+ 'list_methods' => array(
+ 'function' =>
'list_methods',
+ 'signature' =>
array(array(xmlrpcStruct,xmlrpcString)),
+ 'docstring' =>
lang('Read this list of methods.')
+ )
+ );
+ return $xml_functions;
+ break;
+ case 'soap':
+ return $this->soap_functions;
+ break;
+ default:
+ return array();
+ break;
+ }
+ }
+
+ function save_sessiondata($data)
+ {
+ if ($this->use_session)
+ {
+
$this->fm_session->appsession('session_data','tenant',$data);
+ }
+ }
+
+ function read_sessiondata()
+ {
+ $data =
$this->fm_session->appsession('session_data','tenant');
+
+ //html_print_r($data);
+
+ $this->start = $data['start'];
+ $this->query = $data['query'];
+ $this->filter = $data['filter'];
+ $this->sort = $data['sort'];
+ $this->order = $data['order'];
+ $this->cat_id = $data['cat_id'];
+ }
+
+ function check_perms($has, $needed)
+ {
+ return (!!($has & $needed) == True);
+ }
+
+
+ function read_category_name($cat_id='')
+ {
+// return $this->so->read_category_name($cat_id);
+ }
+
+ function select_category_list($format='',$selected='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$this->bocommon->xsl_add_file(array('cat_select'));
+ break;
+ case 'filter':
+
$this->bocommon->xsl_add_file(array('cat_filter'));
+ break;
+ }
+
+ $categories= $this->so->select_category_list();
+
+/* $categories[0]['id'] = 1;
+ $categories[0]['name'] = lang('male');
+ $categories[1]['id'] = 2;
+ $categories[1]['name'] = lang('female');
+ $categories[2]['id'] = 3;
+ $categories[2]['name'] = lang('organization');
+
+*/
+ while (is_array($categories) && list(,$category) =
each($categories))
+ {
+ $sel_category = '';
+ if ($category['id']==$selected)
+ {
+ $sel_category = 'selected';
+ }
+
+ $category_list[] = array
+ (
+ 'cat_id' => $category['id'],
+ 'name' => $category['name'],
+ 'selected' => $sel_category
+ );
+ }
+
+ for ($i=0;$i<count($category_list);$i++)
+ {
+ if ($category_list[$i]['selected'] !=
'selected')
+ {
+ unset($category_list[$i]['selected']);
+ }
+ }
+
+ return $category_list;
+ }
+
+ function read()
+ {
+ $tenant = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'filter' => $this->filter,'cat_id' =>
$this->cat_id,'allrows'=>$this->allrows));
+ $this->total_records = $this->so->total_records;
+
+ for ($i=0; $i<count($tenant); $i++)
+ {
+ $tenant[$i]['entry_date'] =
$GLOBALS['phpgw']->common->show_date($tenant[$i]['date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ }
+ return $tenant;
+ }
+
+ function read_single($tenant_id)
+ {
+ return $this->so->read_single($tenant_id);
+ }
+
+ function save($tenant)
+ {
+
+ if ($tenant['tenant_id'])
+ {
+ if ($tenant['tenant_id'] != 0)
+ {
+ $tenant_id = $tenant['tenant_id'];
+ $receipt=$this->so->edit($tenant);
+ }
+ }
+ else
+ {
+ $receipt = $this->so->add($tenant);
+ }
+ return $receipt;
+ }
+
+ function delete($params)
+ {
+ if (is_array($params))
+ {
+ $this->so->delete($params[0]);
+ }
+ else
+ {
+ $this->so->delete($params);
+ }
+ }
+ }
+?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] property/class.botenant.php, 1.1.1.3,
nomail <=