egroupware_official/resources/inc/class.resources_so.inc.php

71 lines
1.7 KiB
PHP
Raw Normal View History

2005-02-03 17:42:20 +01:00
<?php
2005-11-11 00:35:55 +01:00
/**
* eGroupWare - resources
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package resources
* @link http://www.egroupware.org
* @author Cornelius Weiss <egw@von-und-zu-weiss.de>
* @author Lukas Weiss <wnz_gh05t@users.sourceforge.net>
* @version $Id$
*/
/**
* General storage object for resources
*
* @author Cornelius Weiss <egw@von-und-zu-weiss.de>
* @package resources
*/
class resources_so extends so_sql_cf
2005-02-03 17:42:20 +01:00
{
function __construct()
2005-02-03 17:42:20 +01:00
{
parent::__construct('resources','egw_resources', 'egw_resources_extra', '',
'extra_name', 'extra_value', 'extra_id' );
$this->columns_to_search = array('name','short_description','inventory_number','long_description','location');
2005-02-03 17:42:20 +01:00
}
/**
* gets the value of $key from resource of $res_id
*
* @param string $key key of value to get
* @param int $res_id resource id
* @return mixed value of key and resource, false if key or id not found.
*/
function get_value($key,$res_id)
2005-02-03 17:42:20 +01:00
{
return $this->db->select($this->table_name,$key,array('res_id' => $res_id),__LINE__,__FILE__)->fetchColumn();
2005-02-03 17:42:20 +01:00
}
/**
* reads resource including custom fields
*
* @param interger $res_id res_id
* @return array/boolean data if row could be retrived else False
*/
function read($res_id)
{
// read main data
$resource = parent::read($res_id);
return $resource;
}
2005-02-17 16:27:43 +01:00
/**
* saves a resource including extra fields
*
* @param array $resource key => value
* @return mixed id of resource if all right, false if fale
*/
2005-02-12 16:49:38 +01:00
function save($resource)
{
$this->data = $resource;
if(parent::save() != 0) return false;
$res_id = $this->data['res_id'];
return $res_id;
2005-02-12 16:49:38 +01:00
}
2005-02-03 17:42:20 +01:00
}