[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] property/class.botemplate.php, 1.1.1.3
From: |
nomail |
Subject: |
[Phpgroupware-cvs] property/class.botemplate.php, 1.1.1.3 |
Date: |
Fri, 21 May 2004 15:59:17 -0000 |
Update of /property
Modified Files:
Branch:
class.botemplate.php
date: 2004/04/23 21:26:33; author: sigurdne; state: Exp; lines: +251 -251
Log Message:
no message
=====================================================================
Index: property/class.botemplate.php
diff -u property/class.botemplate.php:1.1.1.2
property/class.botemplate.php:1.1.1.3
--- property/class.botemplate.php:1.1.1.2 Fri Apr 23 20:25:28 2004
+++ property/class.botemplate.php Fri Apr 23 21:26:33 2004
@@ -1,251 +1,251 @@
-<?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 property_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 property_botemplate($session=False)
- {
- $this->currentapp = 'property';
//$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->so =
CreateObject($this->currentapp.'_sotemplate');
- $this->fm_session =
CreateObject($this->currentapp.'_session');
-
- 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)
- {
-
$this->fm_session->appsession('session_data','template',$data);
- }
- }
-
- function read_sessiondata()
- {
- $data =
$this->fm_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)
- {
- $this->bocommon->xsl_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);
- }
-
- }
-?>
+<?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 property_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 property_botemplate($session=False)
+ {
+ $this->currentapp = 'property';
//$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->so =
CreateObject($this->currentapp.'_sotemplate');
+ $this->fm_session =
CreateObject($this->currentapp.'_session');
+
+ 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)
+ {
+
$this->fm_session->appsession('session_data','template',$data);
+ }
+ }
+
+ function read_sessiondata()
+ {
+ $data =
$this->fm_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)
+ {
+ $this->bocommon->xsl_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/class.botemplate.php, 1.1.1.3,
nomail <=