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$
|
|
|
|
*/
|
|
|
|
|
2005-11-09 22:03:35 +01:00
|
|
|
|
2005-06-11 14:59:11 +02:00
|
|
|
include_once(EGW_INCLUDE_ROOT.'/etemplate/inc/class.so_sql.inc.php');
|
2005-11-09 22:03:35 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* General storage object for resources
|
|
|
|
*
|
|
|
|
* @package resources
|
|
|
|
*/
|
2005-06-11 14:59:11 +02:00
|
|
|
class so_resources extends so_sql
|
2005-02-03 17:42:20 +01:00
|
|
|
{
|
|
|
|
function so_resources()
|
|
|
|
{
|
2005-06-11 14:59:11 +02:00
|
|
|
$this->so_sql('resources','egw_resources');
|
2005-02-03 17:42:20 +01:00
|
|
|
}
|
|
|
|
|
2005-06-10 22:40:57 +02:00
|
|
|
/**
|
2005-06-29 11:30:08 +02:00
|
|
|
* gets the value of $key from resource of $res_id
|
2005-06-10 22:40:57 +02:00
|
|
|
*
|
2005-06-13 14:21:18 +02:00
|
|
|
* Cornelius Weiss <egw@von-und-zu-weiss.de>
|
2005-06-10 22:40:57 +02:00
|
|
|
* @param string $key key of value to get
|
2005-06-29 11:30:08 +02:00
|
|
|
* @param int $res_id resource id
|
2005-06-10 22:40:57 +02:00
|
|
|
* @return mixed value of key and resource, false if key or id not found.
|
|
|
|
*/
|
2005-06-29 11:30:08 +02:00
|
|
|
function get_value($key,$res_id)
|
2005-02-03 17:42:20 +01:00
|
|
|
{
|
2005-06-29 11:30:08 +02:00
|
|
|
if($this->db->select($this->table_name,$key,array('res_id' => $res_id),__LINE__,__FILE__))
|
2005-02-03 17:42:20 +01:00
|
|
|
{
|
2005-06-10 22:40:57 +02:00
|
|
|
$value = $this->db->row(row);
|
2005-02-03 17:42:20 +01:00
|
|
|
return $value[$key];
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2005-02-17 16:27:43 +01:00
|
|
|
|
2005-06-10 22:40:57 +02:00
|
|
|
/**
|
2005-06-13 14:21:18 +02:00
|
|
|
* saves a resource including binary datas
|
|
|
|
*
|
|
|
|
* Cornelius Weiss <egw@von-und-zu-weiss.de>
|
|
|
|
* @param array $resource key => value
|
|
|
|
* @return mixed id of resource if all right, false if fale
|
2005-06-10 22:40:57 +02:00
|
|
|
*/
|
2005-02-12 16:49:38 +01:00
|
|
|
function save($resource)
|
|
|
|
{
|
2005-06-13 14:21:18 +02:00
|
|
|
$this->data = $resource;
|
2005-06-29 11:30:08 +02:00
|
|
|
return parent::save() == 0 ? $this->data['res_id'] : false;
|
2005-02-12 16:49:38 +01:00
|
|
|
}
|
|
|
|
|
2005-02-03 17:42:20 +01:00
|
|
|
}
|