nicer save-function

This commit is contained in:
Cornelius Weiß 2005-02-14 12:03:06 +00:00
parent b6cc2d6d7b
commit 3d31b0e7fe
2 changed files with 10 additions and 17 deletions

View File

@ -174,7 +174,7 @@ class bo_resources
}
function get_images($params)
{
{
$id = implode($params);
$picture = $this->so->get_value('picture_thumb',$id);
if($picture)

View File

@ -115,26 +115,19 @@ class so_resources
@function save
@abstract saves a resource including binary datas
@param array $resource key => value
@return array with key => value or false if not found
@return bool succsess or not!
*/
function save($resource)
{
$where = array('id' => $resource['id']);
$data = array( 'name' => $resource['name'],
'cat_id' => $resource['cat_id'],
'short_description' => $resource['short_description'],
'long_description' => $resource['long_description'],
'location' => $resource['location'],
'quantity' => $resource['quantity'],
'useable' => $resource['useable'],
'bookable' => $resource['bookable'],
'buyable' => $resource['buyable'],
'prize' => $resource['prize'],
'accessories' => $resource['accessories'],
'picture_src' => $resource['picture_src'],
'picture_thumb' => $resource['picture_thumb'],
'picture' => $resource['picture']
);
// get rid of the non storeable datas
$tabledef = $this->db->metadata($table=$this->rs_table,$full=false);
foreach($tabledef as $n => $fielddef)
{
$data[$fielddef['name']] = $resource[$fielddef['name']];
}
return $this->db->insert($this->rs_table,$data,$where,__LINE__,__FILE__) ? true : false;
}