[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] property/inc/class.botemplate.inc.php, 1.2
From: |
nomail |
Subject: |
[Phpgroupware-cvs] property/inc/class.botemplate.inc.php, 1.2 |
Date: |
Wed, 2 Jun 2004 20:54:28 +0200 |
Update of /property/inc
Added Files:
Branch:
class.botemplate.inc.php
date: 2004/06/02 18:54:28; author: sigurdne; state: Exp; lines: +250 -0
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 botemplate
{
var $start;
var $query;
var $filter;
var $sort;
var $order;
var $cat_id;
var $public_functions = array
(
'read' => True,
'read_single' => True,
'save' => True,
'delete' => True,
'check_perms' => True
);
function botemplate($session=False)
{
$this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
$this->so =
CreateObject($this->currentapp.'.sotemplate');
if ($session)
{
$this->read_sessiondata();
$this->use_session = True;
}
$start = get_var('start',array('POST','GET'));
$query = get_var('query',array('POST','GET'));
$sort = get_var('sort',array('POST','GET'));
$order = get_var('order',array('POST','GET'));
$filter = get_var('filter',array('POST','GET'));
$cat_id = get_var('cat_id',array('POST','GET'));
$allrows =
get_var('allrows',array('POST','GET'));
if ($start)
{
$this->start=$start;
}
else
{
$this->start=0;
}
if(isset($query))
{
$this->query = $query;
}
if(isset($filter))
{
$this->filter = $filter;
}
if(isset($sort))
{
$this->sort = $sort;
}
if(isset($order))
{
$this->order = $order;
}
if(isset($cat_id))
{
$this->cat_id = $cat_id;
}
if(isset($allrows))
{
$this->allrows = $allrows;
}
}
function save_sessiondata($data)
{
if ($this->use_session)
{
$GLOBALS['phpgw']->session->appsession('session_data','template',$data);
}
}
function read_sessiondata()
{
$data =
$GLOBALS['phpgw']->session->appsession('session_data','template');
$this->start = $data['start'];
$this->query = $data['query'];
$this->filter = $data['filter'];
$this->sort = $data['sort'];
$this->order = $data['order'];
$this->cat_id = $data['cat_id'];
$this->allrows = $data['allrows'];
}
function read()
{
$template = $this->so->read(array('filter' =>
$this->filter,'start' => $this->start,'query' => $this->query,'sort' =>
$this->sort,'order' => $this->order,
'chapter_id' => $this->chapter_id,'allrows'=>$this->allrows,
'template_id'=>$template_id));
$this->total_records = $this->so->total_records;
$dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
for ($i=0; $i<count($template); $i++)
{
$template[$i]['owner'] =
$GLOBALS['phpgw']->accounts->id2name($template[$i]['owner']);
$template[$i]['entry_date'] =
$GLOBALS['phpgw']->common->show_date($template[$i]['entry_date'],$dateformat);
}
return $template;
}
function read_template_hour($template_id)
{
$template = $this->so->read_template_hour(array('start'
=> $this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
'chapter_id' => $this->chapter_id,'allrows'=>$this->allrows,
'template_id'=>$template_id));
$this->total_records = $this->so->total_records;
$dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
for ($i=0; $i<count($template); $i++)
{
$template[$i]['owner'] =
$GLOBALS['phpgw']->accounts->id2name($template[$i]['owner']);
$template[$i]['entry_date'] =
$GLOBALS['phpgw']->common->show_date($template[$i]['entry_date'],$dateformat);
}
return $template;
}
function read_single_template($template_id)
{
return $this->so->read_single_template($template_id);
}
function read_single_hour($hour_id)
{
return $this->so->read_single_hour($hour_id);
}
function get_grouping_list($selected='',$template_id)
{
$GLOBALS['phpgw']->xslttpl->add_file(array('grouping_select'));
$groupings= $this->so->get_grouping_list($template_id);
while (is_array($groupings) && list(,$grouping_entry) =
each($groupings))
{
$sel_grouping_entry = '';
if ($grouping_entry['id']==$selected)
{
$sel_grouping_entry = 'selected';
}
$grouping_list[] = array
(
'id' =>
$grouping_entry['id'],
'name' =>
$grouping_entry['name'],
'selected' => $sel_grouping_entry
);
}
for ($i=0;$i<count($grouping_list);$i++)
{
if ($grouping_list[$i]['selected'] !=
'selected')
{
unset($grouping_list[$i]['selected']);
}
}
return $grouping_list;
}
function save_template($values)
{
if ($values['template_id'])
{
if ($values['template_id'] != 0)
{
$receipt =
$this->so->edit_template($values);
$receipt['template_id']=$values['template_id'];
}
}
else
{
$receipt = $this->so->add_template($values);
}
return $receipt;
}
function save_hour($values,$template_id)
{
$values['billperae'] =
str_replace(",",".",$values['billperae']);
$values['quantity'] =
str_replace(",",".",$values['quantity']);
$values['cost'] =
$values['billperae']*$values['quantity'];
if($values['ns3420_descr'])
{
$values['descr']=$values['ns3420_descr'];
}
if ($values['hour_id'])
{
if ($values['hour_id'] != 0)
{
$receipt =
$this->so->edit_hour($values,$template_id);
}
}
else
{
$receipt =
$this->so->add_custom_hour($values,$template_id);
}
return $receipt;
}
function delete($params)
{
if (is_array($params))
{
$this->so->delete($params[0]);
}
else
{
$this->so->delete($params);
}
}
function delete_hour($hour_id,$template_id)
{
return $this->so->delete_hour($hour_id,$template_id);
}
}
?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] property/inc/class.botemplate.inc.php, 1.2,
nomail <=