phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] property/class.sotenant.php, 1.1.1.3


From: nomail
Subject: [Phpgroupware-cvs] property/class.sotenant.php, 1.1.1.3
Date: Fri, 21 May 2004 19:07:21 -0000

Update of /property
Modified Files:
        Branch: 
          class.sotenant.php

date: 2004/04/23 21:26:33;  author: sigurdne;  state: Exp;  lines: +173 -173

Log Message:
no message
=====================================================================
Index: property/class.sotenant.php
diff -u property/class.sotenant.php:1.1.1.2 property/class.sotenant.php:1.1.1.3
--- property/class.sotenant.php:1.1.1.2 Fri Apr 23 20:26:09 2004
+++ property/class.sotenant.php Fri Apr 23 21:26:33 2004
@@ -1,173 +1,173 @@
-<?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.                                            
   *
-       
\**************************************************************************/
-
-       class property_sotenant
-       {
-
-               function property_sotenant()
-               {
-                       $this->currentapp       = 'property'; 
//$GLOBALS['phpgw_info']['flags']['currentapp'];
-                       $this->db               = $GLOBALS['phpgw']->db;
-                       $this->db2              = $this->db;
-                       $this->account  = $GLOBALS['phpgw_data']['user']['id'];
-                       $this->socommon         = 
CreateObject($this->currentapp.'_socommon');
-
-                       $this->join                     = $this->socommon->join;
-                       $this->left_join        = $this->socommon->left_join;
-               }
-
-               function select_category_list()
-               {
-                       $dbresult = $GLOBALS['phpgw']->db->Execute("SELECT 
id,descr FROM fm_tenant_category  ORDER BY descr ");
-
-                       $i = 0;
-                       while (!$dbresult->EOF)
-                       {
-                               $categories[$i]['id']                           
= $dbresult->fields['id'];
-                               $categories[$i]['name']                         
= stripslashes($dbresult->fields['descr']);
-                               $i++;
-                               $dbresult->MoveNext();
-                       }
-                       return $categories;
-               }
-
-               function read_category_name($cat_id)
-               {
-                       $dbresult = $GLOBALS['phpgw']->db->Execute("SELECT 
descr FROM fm_tenant_sex  where id='$cat_id'");
-
-                       return $dbresult->fields['descr'];
-               }
-
-               function read($data)
-               {
-                       if(is_array($data))
-                       {
-                               $start  = 
(isset($data['start'])?$data['start']:0);
-                               $filter = 
(isset($data['filter'])?$data['filter']:'none');
-                               $query = 
(isset($data['query'])?$data['query']:'');
-                               $sort = 
(isset($data['sort'])?$data['sort']:'DESC');
-                               $order = 
(isset($data['order'])?$data['order']:'');
-                               $cat_id = 
(isset($data['cat_id'])?$data['cat_id']:0);
-                               $allrows                = 
(isset($data['allrows'])?$data['allrows']:'');
-                       }
-
-                       if ($order)
-                       {
-                               $ordermethod = " order by $order $sort";
-                       }
-                       else
-                       {
-                               $ordermethod = ' order by last_name DESC';
-                       }
-
-
-                       $where = 'WHERE';
-                       if ($cat_id > 0)
-                       {
-                               $filtermethod .= " $where category='$cat_id' ";
-                               $where = 'AND';
-
-                       }
-
-                       if($query)
-                       {
-                               $query = ereg_replace("'",'',$query);
-                               $query = ereg_replace('"','',$query);
-
-                               $querymethod = " $where ( last_name LIKE 
'%$query%' OR first_name LIKE '%$query%' OR contact_phone LIKE '%$query%')";
-                       }
-
-                       $sql = "SELECT fm_tenant.*,  fm_tenant_category.descr 
as category FROM fm_tenant $this->left_join fm_tenant_category on 
fm_tenant.category=fm_tenant_category.id $filtermethod $querymethod";
-
-                       $dbresult2 = $GLOBALS['phpgw']->db->Execute($sql);
-                       $this->total_records = $dbresult2->_numOfRows;
-
-                       $maxmatchs = 15;
-
-                       if(!$allrows)
-                       {
-                               $dbresult = 
$GLOBALS['phpgw']->db->SelectLimit($sql . $ordermethod,$maxmatchs,$start);
-
-                       }
-                       else
-                       {
-                               $dbresult = $GLOBALS['phpgw']->db->Execute($sql 
. $ordermethod);
-                       }
-
-                       while (!$dbresult->EOF)
-                       {
-                               $tenants[] = array
-                               (
-                                       'tenant_id'             => 
$dbresult->fields['tenant_id'],
-                                       'entry_date'    => 
$dbresult->fields['entry_date'],
-                                       'category'              => 
$dbresult->fields['category'],
-                                       'name'                  => 
stripslashes($dbresult->fields['last_name']) . ' ' . 
stripslashes($dbresult->fields['first_name']),
-                               );
-                               $dbresult->MoveNext();
-                       }
-                       return $tenants;
-               }
-
-               function read_single($tenant_id)
-               {
-                       $dbresult = $GLOBALS['phpgw']->db->Execute("SELECT * 
from fm_tenant where tenant_id='$tenant_id'");
-
-                       if (!$dbresult->EOF)
-                       {
-                               $tenant['id']                   = 
(int)$dbresult->fields['tenant_id'];
-                               $tenant['last_name']            = 
stripslashes($dbresult->fields['last_name']);
-                               $tenant['first_name']           = 
stripslashes($dbresult->fields['first_name']);
-                               $tenant['contact_phone']        = 
$dbresult->fields['contact_phone'];
-                               $tenant['entry_date']           = 
$dbresult->fields['entry_date'];
-                               $tenant['cat_id']                       = 
(int)$dbresult->fields['category'];
-
-                               return $tenant;
-                       }
-               }
-
-               function add($tenant)
-               {
-                       $tenant['last_name'] = 
$this->db->db_addslashes($tenant['last_name']);
-                       $tenant['first_name'] = 
$this->db->db_addslashes($tenant['first_name']);
-
-                       $GLOBALS['phpgw']->db->Execute("INSERT INTO fm_tenant 
(entry_date,last_name,first_name,contact_phone,category) "
-                               . "VALUES ('" . time() . "','" . 
$tenant['last_name'] . "','" . $tenant['first_name'] . "','" . 
$tenant['contact_phone'] . "','" . $tenant['cat_id'] . "')");
-
-                       $receipt['tenant_id']= 
$this->db->get_last_insert_id('fm_tenant','tenant_id');
-                       $receipt['message'][] = array('msg'=>lang('tenant %1 
has been saved',$receipt['tenant_id']));
-                       return $receipt;
-               }
-
-               function edit($tenant)
-               {
-                       $tenant['last_name'] = 
$this->db->db_addslashes($tenant['last_name']);
-                       $tenant['first_name'] = 
$this->db->db_addslashes($tenant['first_name']);
-
-                       $GLOBALS['phpgw']->db->Execute("UPDATE fm_tenant set 
last_name='" . $tenant['last_name'] . "', first_name='" . $tenant['first_name'] 
. "', contact_phone='" . $tenant['contact_phone'] . "', entry_date='" . time() 
. "', category='"
-                                                       . $tenant['cat_id'] . 
"' WHERE tenant_id=" . intval($tenant['tenant_id']));
-
-                       $receipt['tenant_id']= $tenant['tenant_id'];
-                       $receipt['message'][] = array('msg'=>lang('tenant %1 
has been edited',$tenant['tenant_id']));
-                       return $receipt;
-               }
-
-               function delete($tenant_id)
-               {
-                       $GLOBALS['phpgw']->db->Execute('DELETE FROM fm_tenant 
WHERE tenant_id=' . intval($tenant_id));
-               }
-       }
-?>
+<?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.                                            
   *
+       
\**************************************************************************/
+
+       class property_sotenant
+       {
+
+               function property_sotenant()
+               {
+                       $this->currentapp       = 'property'; 
//$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       $this->db               = $GLOBALS['phpgw']->db;
+                       $this->db2              = $this->db;
+                       $this->account  = $GLOBALS['phpgw_data']['user']['id'];
+                       $this->socommon         = 
CreateObject($this->currentapp.'_socommon');
+
+                       $this->join                     = $this->socommon->join;
+                       $this->left_join        = $this->socommon->left_join;
+               }
+
+               function select_category_list()
+               {
+                       $dbresult = $GLOBALS['phpgw']->db->Execute("SELECT 
id,descr FROM fm_tenant_category  ORDER BY descr ");
+
+                       $i = 0;
+                       while (!$dbresult->EOF)
+                       {
+                               $categories[$i]['id']                           
= $dbresult->fields['id'];
+                               $categories[$i]['name']                         
= stripslashes($dbresult->fields['descr']);
+                               $i++;
+                               $dbresult->MoveNext();
+                       }
+                       return $categories;
+               }
+
+               function read_category_name($cat_id)
+               {
+                       $dbresult = $GLOBALS['phpgw']->db->Execute("SELECT 
descr FROM fm_tenant_sex  where id='$cat_id'");
+
+                       return $dbresult->fields['descr'];
+               }
+
+               function read($data)
+               {
+                       if(is_array($data))
+                       {
+                               $start  = 
(isset($data['start'])?$data['start']:0);
+                               $filter = 
(isset($data['filter'])?$data['filter']:'none');
+                               $query = 
(isset($data['query'])?$data['query']:'');
+                               $sort = 
(isset($data['sort'])?$data['sort']:'DESC');
+                               $order = 
(isset($data['order'])?$data['order']:'');
+                               $cat_id = 
(isset($data['cat_id'])?$data['cat_id']:0);
+                               $allrows                = 
(isset($data['allrows'])?$data['allrows']:'');
+                       }
+
+                       if ($order)
+                       {
+                               $ordermethod = " order by $order $sort";
+                       }
+                       else
+                       {
+                               $ordermethod = ' order by last_name DESC';
+                       }
+
+
+                       $where = 'WHERE';
+                       if ($cat_id > 0)
+                       {
+                               $filtermethod .= " $where category='$cat_id' ";
+                               $where = 'AND';
+
+                       }
+
+                       if($query)
+                       {
+                               $query = ereg_replace("'",'',$query);
+                               $query = ereg_replace('"','',$query);
+
+                               $querymethod = " $where ( last_name LIKE 
'%$query%' OR first_name LIKE '%$query%' OR contact_phone LIKE '%$query%')";
+                       }
+
+                       $sql = "SELECT fm_tenant.*,  fm_tenant_category.descr 
as category FROM fm_tenant $this->left_join fm_tenant_category on 
fm_tenant.category=fm_tenant_category.id $filtermethod $querymethod";
+
+                       $dbresult2 = $GLOBALS['phpgw']->db->Execute($sql);
+                       $this->total_records = $dbresult2->_numOfRows;
+
+                       $maxmatchs = 15;
+
+                       if(!$allrows)
+                       {
+                               $dbresult = 
$GLOBALS['phpgw']->db->SelectLimit($sql . $ordermethod,$maxmatchs,$start);
+
+                       }
+                       else
+                       {
+                               $dbresult = $GLOBALS['phpgw']->db->Execute($sql 
. $ordermethod);
+                       }
+
+                       while (!$dbresult->EOF)
+                       {
+                               $tenants[] = array
+                               (
+                                       'tenant_id'             => 
$dbresult->fields['tenant_id'],
+                                       'entry_date'    => 
$dbresult->fields['entry_date'],
+                                       'category'              => 
$dbresult->fields['category'],
+                                       'name'                  => 
stripslashes($dbresult->fields['last_name']) . ' ' . 
stripslashes($dbresult->fields['first_name']),
+                               );
+                               $dbresult->MoveNext();
+                       }
+                       return $tenants;
+               }
+
+               function read_single($tenant_id)
+               {
+                       $dbresult = $GLOBALS['phpgw']->db->Execute("SELECT * 
from fm_tenant where tenant_id='$tenant_id'");
+
+                       if (!$dbresult->EOF)
+                       {
+                               $tenant['id']                   = 
(int)$dbresult->fields['tenant_id'];
+                               $tenant['last_name']            = 
stripslashes($dbresult->fields['last_name']);
+                               $tenant['first_name']           = 
stripslashes($dbresult->fields['first_name']);
+                               $tenant['contact_phone']        = 
$dbresult->fields['contact_phone'];
+                               $tenant['entry_date']           = 
$dbresult->fields['entry_date'];
+                               $tenant['cat_id']                       = 
(int)$dbresult->fields['category'];
+
+                               return $tenant;
+                       }
+               }
+
+               function add($tenant)
+               {
+                       $tenant['last_name'] = 
$this->db->db_addslashes($tenant['last_name']);
+                       $tenant['first_name'] = 
$this->db->db_addslashes($tenant['first_name']);
+
+                       $GLOBALS['phpgw']->db->Execute("INSERT INTO fm_tenant 
(entry_date,last_name,first_name,contact_phone,category) "
+                               . "VALUES ('" . time() . "','" . 
$tenant['last_name'] . "','" . $tenant['first_name'] . "','" . 
$tenant['contact_phone'] . "','" . $tenant['cat_id'] . "')");
+
+                       $receipt['tenant_id']= 
$this->db->get_last_insert_id('fm_tenant','tenant_id');
+                       $receipt['message'][] = array('msg'=>lang('tenant %1 
has been saved',$receipt['tenant_id']));
+                       return $receipt;
+               }
+
+               function edit($tenant)
+               {
+                       $tenant['last_name'] = 
$this->db->db_addslashes($tenant['last_name']);
+                       $tenant['first_name'] = 
$this->db->db_addslashes($tenant['first_name']);
+
+                       $GLOBALS['phpgw']->db->Execute("UPDATE fm_tenant set 
last_name='" . $tenant['last_name'] . "', first_name='" . $tenant['first_name'] 
. "', contact_phone='" . $tenant['contact_phone'] . "', entry_date='" . time() 
. "', category='"
+                                                       . $tenant['cat_id'] . 
"' WHERE tenant_id=" . intval($tenant['tenant_id']));
+
+                       $receipt['tenant_id']= $tenant['tenant_id'];
+                       $receipt['message'][] = array('msg'=>lang('tenant %1 
has been edited',$tenant['tenant_id']));
+                       return $receipt;
+               }
+
+               function delete($tenant_id)
+               {
+                       $GLOBALS['phpgw']->db->Execute('DELETE FROM fm_tenant 
WHERE tenant_id=' . intval($tenant_id));
+               }
+       }
+?>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]