phpgroupware-cvs
[Top][All Lists]
Advanced

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

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


From: nomail
Subject: [Phpgroupware-cvs] property/class.sop_of_town.php, 1.1.1.3
Date: Fri, 21 May 2004 15:49:55 -0000

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

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

Log Message:
no message
=====================================================================
Index: property/class.sop_of_town.php
diff -u property/class.sop_of_town.php:1.1.1.2 
property/class.sop_of_town.php:1.1.1.3
--- property/class.sop_of_town.php:1.1.1.2      Fri Apr 23 20:25:57 2004
+++ property/class.sop_of_town.php      Fri Apr 23 21:26:33 2004
@@ -1,155 +1,155 @@
-<?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_sop_of_town
-       {
-
-               function property_sop_of_town()
-               {
-                       $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;
-               }
-
-
-               function read_district_name($id)
-               {
-                       $dbresult = $GLOBALS['phpgw']->db->Execute("SELECT 
descr FROM fm_district  where id='$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']:'');
-                               $district_id = 
(isset($data['district_id'])?$data['district_id']:0);
-                               $allrows                = 
(isset($data['allrows'])?$data['allrows']:'');
-                       }
-
-                       if ($order)
-                       {
-                               $ordermethod = " order by $order $sort";
-                       }
-                       else
-                       {
-                               $ordermethod = ' order by part_of_town_id ASC';
-                       }
-
-
-                       $where = 'WHERE';
-                       if ($district_id > 0)
-                       {
-                               $filtermethod .= " $where 
district_id='$district_id' ";
-                               $where = 'AND';
-
-                       }
-
-                       if($query)
-                       {
-                               $query = ereg_replace("'",'',$query);
-                               $query = ereg_replace('"','',$query);
-
-                               $querymethod = " $where ( name LIKE 
'%$query%')";
-                       }
-
-                       $sql = "SELECT fm_part_of_town.*, descr as category 
FROM fm_part_of_town $this->join fm_district on 
fm_part_of_town.district_id=fm_district.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)
-                       {
-                               $p_of_towns[] = array
-                               (
-                                       'part_of_town_id'       => 
$dbresult->fields['part_of_town_id'),
-                                       'name'                          => 
stripslashes($dbresult->fields['name')),
-                                       'category'                      => 
stripslashes($dbresult->fields['category')),
-                                       'district_id'           => 
$dbresult->fields['district_id']
-                               );
-                               $dbresult->MoveNext();
-                       }
-                       return $p_of_towns;
-               }
-
-               function read_single($part_of_town_id)
-               {
-                       $dbresult = $GLOBALS['phpgw']->db->Execute("SELECT * 
from fm_part_of_town where part_of_town_id='$part_of_town_id'");
-
-                       if (!$dbresult->EOF)
-                       {
-                               $p_of_town['id']                        = 
(int)$dbresult->fields['part_of_town_id'];
-                               $p_of_town['name']                      = 
stripslashes($dbresult->fields['name']);
-                               $p_of_town['district_id']       = 
(int)$dbresult->fields['district_id'];
-
-                               return $p_of_town;
-                       }
-               }
-
-               function add($p_of_town)
-               {
-                       $p_of_town['name'] = 
$this->db->db_addslashes($p_of_town['name']);
-
-                       $GLOBALS['phpgw']->db->Execute("INSERT INTO 
fm_part_of_town (name,district_id) "
-                               . "VALUES ('" . $p_of_town['name']
-                               . "','" . $p_of_town['district_id'] . "')");
-
-                       $receipt['part_of_town_id']= 
$this->db->get_last_insert_id('fm_part_of_town','part_of_town_id');
-                       $receipt['message'][] = array('msg'=>lang('Part of town 
%1 has been saved',$receipt['part_of_town_id']));
-                       return $receipt;
-               }
-
-               function edit($p_of_town)
-               {
-                       $p_of_town['name'] = 
$this->db->db_addslashes($p_of_town['name']);
-
-                       $GLOBALS['phpgw']->db->Execute("UPDATE fm_part_of_town 
set name='" . $p_of_town['name'] . "', district_id='"
-                                                       . 
$p_of_town['district_id'] . "' WHERE part_of_town_id=" . 
intval($p_of_town['part_of_town_id']));
-
-                       $receipt['part_of_town_id']= 
$p_of_town['part_of_town_id'];
-                       $receipt['message'][] = array('msg'=>lang('Part of town 
%1 has been edited',$p_of_town['part_of_town_id']));
-                       return $receipt;
-               }
-
-               function delete($part_of_town_id)
-               {
-                       $GLOBALS['phpgw']->db->Execute('DELETE FROM 
fm_part_of_town WHERE part_of_town_id=' . intval($part_of_town_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.                                            
   *
+       
\**************************************************************************/
+       /* $Id$ */
+
+       class property_sop_of_town
+       {
+
+               function property_sop_of_town()
+               {
+                       $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;
+               }
+
+
+               function read_district_name($id)
+               {
+                       $dbresult = $GLOBALS['phpgw']->db->Execute("SELECT 
descr FROM fm_district  where id='$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']:'');
+                               $district_id = 
(isset($data['district_id'])?$data['district_id']:0);
+                               $allrows                = 
(isset($data['allrows'])?$data['allrows']:'');
+                       }
+
+                       if ($order)
+                       {
+                               $ordermethod = " order by $order $sort";
+                       }
+                       else
+                       {
+                               $ordermethod = ' order by part_of_town_id ASC';
+                       }
+
+
+                       $where = 'WHERE';
+                       if ($district_id > 0)
+                       {
+                               $filtermethod .= " $where 
district_id='$district_id' ";
+                               $where = 'AND';
+
+                       }
+
+                       if($query)
+                       {
+                               $query = ereg_replace("'",'',$query);
+                               $query = ereg_replace('"','',$query);
+
+                               $querymethod = " $where ( name LIKE 
'%$query%')";
+                       }
+
+                       $sql = "SELECT fm_part_of_town.*, descr as category 
FROM fm_part_of_town $this->join fm_district on 
fm_part_of_town.district_id=fm_district.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)
+                       {
+                               $p_of_towns[] = array
+                               (
+                                       'part_of_town_id'       => 
$dbresult->fields['part_of_town_id'),
+                                       'name'                          => 
stripslashes($dbresult->fields['name')),
+                                       'category'                      => 
stripslashes($dbresult->fields['category')),
+                                       'district_id'           => 
$dbresult->fields['district_id']
+                               );
+                               $dbresult->MoveNext();
+                       }
+                       return $p_of_towns;
+               }
+
+               function read_single($part_of_town_id)
+               {
+                       $dbresult = $GLOBALS['phpgw']->db->Execute("SELECT * 
from fm_part_of_town where part_of_town_id='$part_of_town_id'");
+
+                       if (!$dbresult->EOF)
+                       {
+                               $p_of_town['id']                        = 
(int)$dbresult->fields['part_of_town_id'];
+                               $p_of_town['name']                      = 
stripslashes($dbresult->fields['name']);
+                               $p_of_town['district_id']       = 
(int)$dbresult->fields['district_id'];
+
+                               return $p_of_town;
+                       }
+               }
+
+               function add($p_of_town)
+               {
+                       $p_of_town['name'] = 
$this->db->db_addslashes($p_of_town['name']);
+
+                       $GLOBALS['phpgw']->db->Execute("INSERT INTO 
fm_part_of_town (name,district_id) "
+                               . "VALUES ('" . $p_of_town['name']
+                               . "','" . $p_of_town['district_id'] . "')");
+
+                       $receipt['part_of_town_id']= 
$this->db->get_last_insert_id('fm_part_of_town','part_of_town_id');
+                       $receipt['message'][] = array('msg'=>lang('Part of town 
%1 has been saved',$receipt['part_of_town_id']));
+                       return $receipt;
+               }
+
+               function edit($p_of_town)
+               {
+                       $p_of_town['name'] = 
$this->db->db_addslashes($p_of_town['name']);
+
+                       $GLOBALS['phpgw']->db->Execute("UPDATE fm_part_of_town 
set name='" . $p_of_town['name'] . "', district_id='"
+                                                       . 
$p_of_town['district_id'] . "' WHERE part_of_town_id=" . 
intval($p_of_town['part_of_town_id']));
+
+                       $receipt['part_of_town_id']= 
$p_of_town['part_of_town_id'];
+                       $receipt['message'][] = array('msg'=>lang('Part of town 
%1 has been edited',$p_of_town['part_of_town_id']));
+                       return $receipt;
+               }
+
+               function delete($part_of_town_id)
+               {
+                       $GLOBALS['phpgw']->db->Execute('DELETE FROM 
fm_part_of_town WHERE part_of_town_id=' . intval($part_of_town_id));
+               }
+       }
+?>




reply via email to

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