[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] property/class.sostandard_2.php, 1.1.1.3
From: |
nomail |
Subject: |
[Phpgroupware-cvs] property/class.sostandard_2.php, 1.1.1.3 |
Date: |
Fri, 21 May 2004 16:04:18 -0000 |
Update of /property
Modified Files:
Branch:
class.sostandard_2.php
date: 2004/04/23 21:26:33; author: sigurdne; state: Exp; lines: +185 -185
Log Message:
no message
=====================================================================
Index: property/class.sostandard_2.php
diff -u property/class.sostandard_2.php:1.1.1.2
property/class.sostandard_2.php:1.1.1.3
--- property/class.sostandard_2.php:1.1.1.2 Fri Apr 23 20:26:00 2004
+++ property/class.sostandard_2.php Fri Apr 23 21:26:33 2004
@@ -1,185 +1,185 @@
-<?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_sostandard_2
- {
-
- function property_sostandard_2()
- {
- $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($data)
- {
- if(is_array($data))
- {
- if ($data['start'])
- {
- $start=$data['start'];
- }
- else
- {
- $start=0;
- }
- $query =
(isset($data['query'])?$data['query']:'');
- $sort =
(isset($data['sort'])?$data['sort']:'DESC');
- $order =
(isset($data['order'])?$data['order']:'');
- $type =
(isset($data['type'])?$data['type']:0);
- $allrows =
(isset($data['allrows'])?$data['allrows']:'');
- }
-
- if ($order)
- {
- $ordermethod = " order by $order $sort";
-
- }
- else
- {
- $ordermethod = ' order by id asc';
- }
-
- $table = $this->select_table($type);
-
- if($query)
- {
- $query = ereg_replace("'",'',$query);
- $query = ereg_replace('"','',$query);
-
- $querymethod = " where id LIKE '%$query%' or
descr LIKE '%$query%'";
- }
-
- $sql = "SELECT * FROM $table $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)
- {
- $standard[] = array
- (
- 'id' => $dbresult->fields['id'],
- 'descr' => $dbresult->fields['descr']
- );
- $dbresult->MoveNext();
- }
- return $standard;
- }
-
-
- function select_table($type)
- {
-
- switch($type)
- {
- case 'workorder_status':
- $table='fm_workorder_status';
- break;
- case 'request_status':
- $table='fm_request_status';
- break;
- case 'agreement_status':
- $table='fm_agreement_status';
- break;
- case 'building_part':
- $table='fm_building_part';
- break;
- case 'drawing_status':
- $table='fm_drawing_status';
- break;
- case 'document_status':
- $table='fm_document_status';
- break;
- case 'unit':
- $table='fm_standard_unit';
- break;
- }
-
- return $table;
- }
-
-
- function read_single($id,$type)
- {
-
- $table = $this->select_table($type);
-
- $sql = "SELECT * FROM $table where id='$id'";
-
- $dbresult = $GLOBALS['phpgw']->db->Execute($sql);
-
- if (!$dbresult->EOF)
- {
- $standard['id'] =
$dbresult->fields['id'];
- $standard['descr']
= $dbresult->fields['descr'];
-
- return $standard;
- }
- }
-
- function add($standard,$type)
- {
- $table = $this->select_table($type);
-
- $standard['descr'] =
$this->db->db_addslashes($standard['descr']);
-
- $GLOBALS['phpgw']->db->Execute("INSERT INTO $table (id,
descr) "
- . "VALUES ('" . $standard['id'] . "','" .
$standard['descr']. "')");
-
- $receipt['message'][] = array('msg' => lang('standard
has been saved'));
- return $receipt;
- }
-
- function edit($standard,$type)
- {
-
- $table = $this->select_table($type);
-
- $standard['descr'] =
$this->db->db_addslashes($standard['descr']);
-
- $GLOBALS['phpgw']->db->Execute("UPDATE $table set
descr='" . $standard['descr']
- . "' WHERE id='" .
$standard['id']. "'");
-
- $receipt['message'][] = array('msg' => lang('standard
has been edited'));
- return $receipt;
- }
-
- function delete($id,$type)
- {
- $table = $this->select_table($type);
-
- $GLOBALS['phpgw']->db->Execute("DELETE FROM $table
WHERE id='" . $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_sostandard_2
+ {
+
+ function property_sostandard_2()
+ {
+ $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($data)
+ {
+ if(is_array($data))
+ {
+ if ($data['start'])
+ {
+ $start=$data['start'];
+ }
+ else
+ {
+ $start=0;
+ }
+ $query =
(isset($data['query'])?$data['query']:'');
+ $sort =
(isset($data['sort'])?$data['sort']:'DESC');
+ $order =
(isset($data['order'])?$data['order']:'');
+ $type =
(isset($data['type'])?$data['type']:0);
+ $allrows =
(isset($data['allrows'])?$data['allrows']:'');
+ }
+
+ if ($order)
+ {
+ $ordermethod = " order by $order $sort";
+
+ }
+ else
+ {
+ $ordermethod = ' order by id asc';
+ }
+
+ $table = $this->select_table($type);
+
+ if($query)
+ {
+ $query = ereg_replace("'",'',$query);
+ $query = ereg_replace('"','',$query);
+
+ $querymethod = " where id LIKE '%$query%' or
descr LIKE '%$query%'";
+ }
+
+ $sql = "SELECT * FROM $table $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)
+ {
+ $standard[] = array
+ (
+ 'id' => $dbresult->fields['id'],
+ 'descr' => $dbresult->fields['descr']
+ );
+ $dbresult->MoveNext();
+ }
+ return $standard;
+ }
+
+
+ function select_table($type)
+ {
+
+ switch($type)
+ {
+ case 'workorder_status':
+ $table='fm_workorder_status';
+ break;
+ case 'request_status':
+ $table='fm_request_status';
+ break;
+ case 'agreement_status':
+ $table='fm_agreement_status';
+ break;
+ case 'building_part':
+ $table='fm_building_part';
+ break;
+ case 'drawing_status':
+ $table='fm_drawing_status';
+ break;
+ case 'document_status':
+ $table='fm_document_status';
+ break;
+ case 'unit':
+ $table='fm_standard_unit';
+ break;
+ }
+
+ return $table;
+ }
+
+
+ function read_single($id,$type)
+ {
+
+ $table = $this->select_table($type);
+
+ $sql = "SELECT * FROM $table where id='$id'";
+
+ $dbresult = $GLOBALS['phpgw']->db->Execute($sql);
+
+ if (!$dbresult->EOF)
+ {
+ $standard['id'] =
$dbresult->fields['id'];
+ $standard['descr']
= $dbresult->fields['descr'];
+
+ return $standard;
+ }
+ }
+
+ function add($standard,$type)
+ {
+ $table = $this->select_table($type);
+
+ $standard['descr'] =
$this->db->db_addslashes($standard['descr']);
+
+ $GLOBALS['phpgw']->db->Execute("INSERT INTO $table (id,
descr) "
+ . "VALUES ('" . $standard['id'] . "','" .
$standard['descr']. "')");
+
+ $receipt['message'][] = array('msg' => lang('standard
has been saved'));
+ return $receipt;
+ }
+
+ function edit($standard,$type)
+ {
+
+ $table = $this->select_table($type);
+
+ $standard['descr'] =
$this->db->db_addslashes($standard['descr']);
+
+ $GLOBALS['phpgw']->db->Execute("UPDATE $table set
descr='" . $standard['descr']
+ . "' WHERE id='" .
$standard['id']. "'");
+
+ $receipt['message'][] = array('msg' => lang('standard
has been edited'));
+ return $receipt;
+ }
+
+ function delete($id,$type)
+ {
+ $table = $this->select_table($type);
+
+ $GLOBALS['phpgw']->db->Execute("DELETE FROM $table
WHERE id='" . $id . "'");
+ }
+ }
+?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] property/class.sostandard_2.php, 1.1.1.3,
nomail <=