[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] property/inc/class.botenant.inc.php, 1.1.1.2
From: |
nomail |
Subject: |
[Phpgroupware-cvs] property/inc/class.botenant.inc.php, 1.1.1.2 |
Date: |
Tue, 18 May 2004 15:45:21 +0200 |
Update of /property/inc
Modified Files:
Branch:
class.botenant.inc.php
date: 2004/05/18 13:45:21; author: sigurdne; state: Exp; lines: +174 -18
Log Message:
no message
=====================================================================
Index: property/inc/class.botenant.inc.php
diff -u property/inc/class.botenant.inc.php:1.1.1.1
property/inc/class.botenant.inc.php:1.1.1.2
--- property/inc/class.botenant.inc.php:1.1.1.1 Fri Apr 23 13:13:57 2004
+++ property/inc/class.botenant.inc.php Tue May 18 13:45:21 2004
@@ -57,6 +57,7 @@
{
$this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
$this->so = CreateObject($this->currentapp.'.sotenant');
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
if ($session)
{
@@ -210,14 +211,6 @@
$categories= $this->so->select_category_list();
-/* $categories[0]['id'] = 1;
- $categories[0]['name'] = lang('male');
- $categories[1]['id'] = 2;
- $categories[1]['name'] = lang('female');
- $categories[2]['id'] = 3;
- $categories[2]['name'] = lang('organization');
-
-*/
while (is_array($categories) && list(,$category) =
each($categories))
{
$sel_category = '';
@@ -251,6 +244,8 @@
'filter' => $this->filter,'cat_id' =>
$this->cat_id,'allrows'=>$this->allrows));
$this->total_records = $this->so->total_records;
+ $this->uicols = $this->so->uicols;
+
for ($i=0; $i<count($tenant); $i++)
{
$tenant[$i]['entry_date'] =
$GLOBALS['phpgw']->common->show_date($tenant[$i]['date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
@@ -258,39 +253,200 @@
return $tenant;
}
- function read_single($tenant_id)
+ function read_single($data)
{
- return $this->so->read_single($tenant_id);
+ $contacts =
CreateObject('phpgwapi.contacts');
+
+ $tenant = $this->so->read_single($data);
+ $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+
+ $input_type_array = array(
+ 'R' => 'radio',
+ 'CH' => 'checkbox',
+ 'LB' => 'listbox'
+ );
+
+ $sep = '/';
+ $dlarr[strpos($dateformat,'Y')] = 'Y';
+ $dlarr[strpos($dateformat,'m')] = 'm';
+ $dlarr[strpos($dateformat,'d')] = 'd';
+ ksort($dlarr);
+
+ $dateformat= (implode($sep,$dlarr));
+
+//html_print_r($tenant);
+ $m=0;
+ for ($i=0;$i<count($tenant['attributes']);$i++)
+ {
+ if($tenant['attributes'][$i]['datatype']=='D'
&& $tenant['attributes'][$i]['value'])
+ {
+ $timestamp_date=
mktime(0,0,0,date(m,strtotime($tenant['attributes'][$i]['value'])),date(d,strtotime($tenant['attributes'][$i]['value'])),date(y,strtotime($tenant['attributes'][$i]['value'])));
+ $tenant['attributes'][$i]['value']
= $GLOBALS['phpgw']->common->show_date($timestamp_date,$dateformat);
+ }
+ if($tenant['attributes'][$i]['datatype']=='AB')
+ {
+ if($tenant['attributes'][$i]['value'])
+ {
+ $contact_data =
$contacts->read_single_entry($tenant['attributes'][$i]['value'],array('org_name'=>'org_name','email'=>'email'));
+
$tenant['attributes'][$i]['org_name'] = $contact_data[0]['org_name'];
+ }
+
+ $insert_record_tenant[] =
$tenant['attributes'][$i]['name'];
+ $lookup_link =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.addressbook&column='
. $tenant['attributes'][$i]['name']);
+
+ $lookup_functions[$m]['name'] =
'lookup_'. $tenant['attributes'][$i]['name'] .'()';
+ $lookup_functions[$m]['action'] =
'Window1=window.open('."'" . $lookup_link ."'"
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
+ $m++;
+ }
+ if($tenant['attributes'][$i]['datatype']=='R'
|| $tenant['attributes'][$i]['datatype']=='CH' ||
$tenant['attributes'][$i]['datatype']=='LB')
+ {
+ $tenant['attributes'][$i]['choice']
= $this->so->read_attrib_choice($tenant['attributes'][$i]['attrib_id']);
+
$input_type=$input_type_array[$tenant['attributes'][$i]['datatype']];
+
+
if($tenant['attributes'][$i]['datatype']=='CH')
+ {
+
$tenant['attributes'][$i]['value']=unserialize($tenant['attributes'][$i]['value']);
+
$tenant['attributes'][$i]['choice'] =
$this->bocommon->select_multi_list_2($tenant['attributes'][$i]['value'],$tenant['attributes'][$i]['choice'],$input_type);
+
+ }
+ else
+ {
+ for
($j=0;$j<count($tenant['attributes'][$i]['choice']);$j++)
+ {
+
$tenant['attributes'][$i]['choice'][$j]['input_type']=$input_type;
+
if($tenant['attributes'][$i]['choice'][$j]['id']==$tenant['attributes'][$i]['value'])
+ {
+
$tenant['attributes'][$i]['choice'][$j]['checked']='checked';
+ }
+ }
+ }
+ }
+
+ $tenant['attributes'][$i]['datatype_text'] =
$this->bocommon->translate_datatype($tenant['attributes'][$i]['datatype']);
+ $tenant['attributes'][$i]['counter'] = $i;
+ $tenant['attributes'][$i]['type_id'] =
$data['type_id'];
+ }
+
+ for ($j=0;$j<count($lookup_functions);$j++)
+ {
+ $tenant['lookup_functions'] .= 'function ' .
$lookup_functions[$j]['name'] ."\r\n";
+ $tenant['lookup_functions'] .= '{'."\r\n";
+ $tenant['lookup_functions'] .=
$lookup_functions[$j]['action'] ."\r\n";
+ $tenant['lookup_functions'] .= '}'."\r\n";
+ }
+
+
$GLOBALS['phpgw']->session->appsession('insert_record_tenant',$this->currentapp,$insert_record_tenant);
+
+//html_print_r($tenant);
+ return $tenant;
}
- function save($tenant)
+ function save($tenant,$values_attribute='')
{
+ for ($i=0;$i<count($values_attribute);$i++)
+ {
+ if($values_attribute[$i]['datatype']=='CH' &&
$values_attribute[$i]['value'])
+ {
+ $values_attribute[$i]['value'] =
serialize($values_attribute[$i]['value']);
+ }
+ if($values_attribute[$i]['datatype']=='R' &&
$values_attribute[$i]['value'])
+ {
+ $values_attribute[$i]['value'] =
$values_attribute[$i]['value'][0];
+ }
+
+ if($values_attribute[$i]['datatype']=='N' &&
$values_attribute[$i]['value'])
+ {
+ $values_attribute[$i]['value'] =
str_replace(",",".",$values_attribute[$i]['value']);
+ }
+
+ if($values_attribute[$i]['datatype']=='D' &&
$values_attribute[$i]['value'])
+ {
+ $values_attribute[$i]['value'] =
date($this->bocommon->dateformat,$this->bocommon->date_to_timestamp($values_attribute[$i]['value']));
+ }
+ }
+
if ($tenant['tenant_id'])
{
if ($tenant['tenant_id'] != 0)
{
$tenant_id = $tenant['tenant_id'];
- $receipt=$this->so->edit($tenant);
+
$receipt=$this->so->edit($tenant,$values_attribute);
}
}
else
{
- $receipt = $this->so->add($tenant);
+ $receipt =
$this->so->add($tenant,$values_attribute);
}
return $receipt;
}
- function delete($params)
+ function delete($tenant_id='',$id='',$attrib='')
+ {
+ if ($attrib)
+ {
+ $this->so->delete_attrib($id);
+ }
+ else
+ {
+ $this->so->delete($tenant_id);
+ }
+ }
+
+ function read_attrib($type_id='')
+ {
+ $attrib = $this->so->read_attrib(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'allrows'=>$this->allrows));
+
+ for ($i=0; $i<count($attrib); $i++)
+ {
+ $attrib[$i]['datatype'] =
$this->bocommon->translate_datatype($attrib[$i]['datatype']);
+ }
+
+ $this->total_records = $this->so->total_records;
+
+ return $attrib;
+ }
+
+ function read_single_attrib($id)
+ {
+ return $this->so->read_single_attrib($id);
+ }
+
+ function resort_attrib($data)
+ {
+ $this->so->resort_attrib($data);
+ }
+
+ function save_attrib($attrib,$action='')
{
- if (is_array($params))
+ if ($action=='edit')
{
- $this->so->delete($params[0]);
+ if ($attrib['id'] != '')
+ {
+
+ $receipt =
$this->so->edit_attrib($attrib);
+ }
}
else
{
- $this->so->delete($params);
+ $receipt = $this->so->add_attrib($attrib);
}
+ return $receipt;
+ }
+
+ function column_list($selected='',$allrows='')
+ {
+ if(!$selected)
+ {
+
$selected=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]["tenant_columns"];
+ }
+
+ $columns =
$this->so->read_attrib(array('allrows'=>$allrows));
+
+
$column_list=$this->bocommon->select_multi_list($selected,$columns);
+
+ return $column_list;
}
}
?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] property/inc/class.botenant.inc.php, 1.1.1.2,
nomail <=