[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] property/inc/class.soasync.inc.php, 1.1
From: |
nomail |
Subject: |
[Phpgroupware-cvs] property/inc/class.soasync.inc.php, 1.1 |
Date: |
Wed, 21 Jul 2004 21:00:12 +0200 |
Update of /property/inc
Added Files:
Branch:
class.soasync.inc.php
date: 2004/07/21 19:00:12; author: sigurdne; state: Exp;
Log Message:
no message
=====================================================================
<?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 soasync
{
function soasync()
{
$this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
$this->db = $GLOBALS['phpgw']->db;
$this->db2 = $this->db;
$this->account =
$GLOBALS['phpgw_info']['user']['account_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']:'');
}
if ($order)
{
$ordermethod = " order by $order $sort";
}
else
{
$ordermethod = ' order by id asc';
}
$table='fm_async_method';
if($query)
{
$query = ereg_replace("'",'',$query);
$query = ereg_replace('"','',$query);
$querymethod = " where id LIKE '%$query%' or
descr LIKE '%$query%'";
}
$sql = "SELECT * FROM $table $querymethod";
$this->db2->query($sql,__LINE__,__FILE__);
$this->total_records = $this->db2->num_rows();
$this->db->limit_query($sql .
$ordermethod,$start,__LINE__,__FILE__);
while ($this->db->next_record())
{
$method[] = array
(
'id' => $this->db->f('id'),
'name' => $this->db->f('name'),
'data' => $this->db->f('data'),
'descr' => $this->db->f('descr')
);
}
return $method;
}
function read_single($id)
{
$table='fm_async_method';
$sql = "SELECT * FROM $table where id='$id'";
$this->db->query($sql,__LINE__,__FILE__);
if ($this->db->next_record())
{
$method['id'] = $this->db->f('id');
$method['name'] = $this->db->f('name');
$method['data'] = $this->db->f('data');
$method['descr'] = $this->db->f('descr');
return $method;
}
}
function add($method)
{
$table='fm_async_method';
$method['id'] = $this->socommon->next_id($table);
$method['name'] =
$this->db->db_addslashes($method['name']);
$method['descr'] =
$this->db->db_addslashes($method['descr']);
$this->db->query("INSERT INTO $table (id, name,data,
descr) "
. "VALUES ('" . $method['id'] . "','" .
$method['name'] . "','" . $method['data'] . "','" . $method['descr'].
"')",__LINE__,__FILE__);
$receipt['message'][] = array('msg' => lang('async
method has been saved'));
return $receipt;
}
function edit($method)
{
$table='fm_async_method';
$method['name'] =
$this->db->db_addslashes($method['name']);
$method['descr'] =
$this->db->db_addslashes($method['descr']);
$this->db->query("UPDATE $table set descr='" .
$method['descr'] . "', name='". $method['name'] . "', data='". $method['data']
. "' WHERE id='" .
$method['id']. "'",__LINE__,__FILE__);
$receipt['message'][] = array('msg' =>lang('method has
been edited'));
return $receipt;
}
function delete($id)
{
$table='fm_async_method';
$this->db->query("DELETE FROM $table WHERE id='" . $id
. "'",__LINE__,__FILE__);
}
}
?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] property/inc/class.soasync.inc.php, 1.1,
nomail <=