[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: property/inc class.bogab.inc.php,NONE,1.1 class.
From: |
Sigurd Nes <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: property/inc class.bogab.inc.php,NONE,1.1 class.sogab.inc.php,NONE,1.1 class.uigab.inc.php,NONE,1.1 |
Date: |
Tue, 06 May 2003 14:55:03 -0400 |
Update of /cvsroot/phpgroupware/property/inc
In directory subversions:/tmp/cvs-serv2633/inc
Added Files:
class.bogab.inc.php class.sogab.inc.php class.uigab.inc.php
Log Message:
no message
--- NEW FILE ---
<?php
/***************************************************************************\
* 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 bogab
{
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 bogab($session=False)
{
$this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
$this->so =
CreateObject($this->currentapp.'.sogab');
$this->socommon =
CreateObject($this->currentapp.'.socommon');
$this->bocommon =
CreateObject($this->currentapp.'.bocommon');
$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(!empty($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
read($property_id='',$gaards_nr='',$bruksnr='',$feste_nr='',$seksjons_nr='')
{
$gab = $this->so->read(array('start' =>
$this->start,'sort' => $this->sort,'order' =>
$this->order,'allrows'=>$this->allrows,
'cat_id' => $this->cat_id,'property_id' => $property_id,
'gaards_nr' => $gaards_nr,'bruksnr' => $bruksnr,'feste_nr' =>
$feste_nr,'seksjons_nr' => $seksjons_nr,));
$this->total_records = $this->so->total_records;
return $gab;
}
function read_detail($gab_id='')
{
$gab = $this->so->read_detail(array('start' =>
$this->start,'sort' => $this->sort,'order' => $this->order,
'cat_id' => $this->cat_id,'gab_id' =>
$gab_id,'allrows'=>$this->allrows));
$this->total_records = $this->so->total_records;
for ($i=0;$i<count($gab);$i++)
{
$location_data=$this->socommon->read_location_data($gab[$i]['location_code']);
$gab[$i]=$gab[$i] + $location_data;
}
return $gab;
}
function read_single($gab_id='',$location_code='')
{
$gab = $this->so->read_single($gab_id,$location_code);
$location_data=$this->socommon->read_location_data($gab['location_code']);
if($gab)
{
$gab=$gab + $location_data;
}
return $gab;
}
function save($values)
{
if(!$values['location_code'])
{
$values['location_code']=$this->bocommon->location_code($values['property_id'],$values['building_id'],$values['entrance_id'],$values['apartment_id']);
}
if ($values['action']=='edit')
{
$receipt = $this->so->edit($values);
}
else
{
$receipt = $this->so->add($values);
}
$receipt['location_code']=$values['location_code'];
return $receipt;
}
function delete($gab_id='',$location_code='')
{
$this->so->delete($gab_id,$location_code);
}
}
?>
--- NEW FILE ---
<?php
/***************************************************************************\
* 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 sogab
{
var $grants;
function sogab()
{
$this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
$this->db = $GLOBALS['phpgw']->db;
$this->db2 = $this->db;
$this->grants =
$GLOBALS['phpgw']->acl->get_grants($this->currentapp);
$this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
if
($GLOBALS['phpgw_info']['server']['db_type']=='pgsql')
{
$this->join = " JOIN ";
}
else
{
$this->join = " LEFT JOIN ";
}
}
function read($data)
{
if(is_array($data))
{
if ($data['start'])
{
$start=$data['start'];
}
else
{
$start=0;
}
$sort =
(isset($data['sort'])?$data['sort']:'DESC');
$order =
(isset($data['order'])?$data['order']:'');
$cat_id =
(isset($data['cat_id'])?$data['cat_id']:0);
$property_id =
(isset($data['property_id'])?$data['property_id']:'');
$gaards_nr =
(isset($data['gaards_nr'])?$data['gaards_nr']:'');
$bruksnr =
(isset($data['bruksnr'])?$data['bruksnr']:'');
$feste_nr =
(isset($data['feste_nr'])?$data['feste_nr']:'');
$seksjons_nr =
(isset($data['seksjons_nr'])?$data['seksjons_nr']:'');
$allrows =
(isset($data['allrows'])?$data['allrows']:'');
}
if ($order)
{
$ordermethod = " order by $order $sort";
}
else
{
$ordermethod = ' order by gab_id ASC';
}
$where = 'WHERE';
if ($cat_id > 0)
{
$filtermethod .= " $where
fm_gab_location.category='$cat_id' ";
$where = 'AND';
}
if ($status_id)
{
$filtermethod .= " $where
fm_gab_location.status='$status_id' ";
$where = 'AND';
}
if ($property_id)
{
$len=strlen($property_id);
$filtermethod .= " $where
left(location_code,$len)='$property_id' ";
$where = 'AND';
}
if ($gaards_nr)
{
$filtermethod .= " $where SUBSTRING(gab_id,5,5)
like '%$gaards_nr%' ";
$where = 'AND';
}
if ($bruksnr)
{
$filtermethod .= " $where
SUBSTRING(gab_id,10,4) like '%$bruksnr%' ";
$where = 'AND';
}
if ($feste_nr)
{
$filtermethod .= " $where
SUBSTRING(gab_id,14,4) like '%$feste_nr%' ";
$where = 'AND';
}
if ($seksjons_nr)
{
$filtermethod .= " $where
SUBSTRING(gab_id,18,3) like '%$seksjons_nr%' ";
$where = 'AND';
}
$sql = "select location_code, gab_id
,count(location_code) as hits FROM fm_gab_location $filtermethod GROUP BY
gab_id";
$this->db2->query($sql,__LINE__,__FILE__);
$this->total_records = $this->db2->num_rows();
if(!$allrows)
{
$this->db->limit_query($sql .
$ordermethod,$start,__LINE__,__FILE__);
}
else
{
$this->db->query($sql .
$ordermethod,__LINE__,__FILE__);
}
while ($this->db->next_record())
{
$gab_list[] = array
(
'gab_id' =>
$this->db->f('gab_id'),
'location_code' =>
$this->db->f('location_code'),
'hits' => $this->db->f('hits')
);
}
return $gab_list;
}
function read_detail($data)
{
if(is_array($data))
{
if ($data['start'])
{
$start=$data['start'];
}
else
{
$start=0;
}
$sort =
(isset($data['sort'])?$data['sort']:'DESC');
$order =
(isset($data['order'])?$data['order']:'');
$cat_id =
(isset($data['cat_id'])?$data['cat_id']:0);
$gab_id =
(isset($data['gab_id'])?$data['gab_id']:'0');
$allrows =
(isset($data['allrows'])?$data['allrows']:'');
}
if ($order)
{
$ordermethod = " order by $order $sort";
}
else
{
$ordermethod = ' order by location_code ASC';
}
$filtermethod = " WHERE
fm_gab_location.gab_id='$gab_id'";
if ($cat_id > 0)
{
$filtermethod .= " AND
fm_gab_location.category='$cat_id' ";
}
if ($status_id)
{
$filtermethod .= " AND
fm_gab_location.status='$status_id' ";
}
$sql = "select location_code, gab_id FROM
fm_gab_location $filtermethod";
$this->db2->query($sql,__LINE__,__FILE__);
$this->total_records = $this->db2->num_rows();
if(!$allrows)
{
$this->db->limit_query($sql .
$ordermethod,$start,__LINE__,__FILE__);
}
else
{
$this->db->query($sql .
$ordermethod,__LINE__,__FILE__);
}
while ($this->db->next_record())
{
$gab_list[] = array
(
'gab_id' =>
$this->db->f('gab_id'),
'location_code' =>
$this->db->f('location_code')
);
}
return $gab_list;
}
function read_single($gab_id='',$location_code='')
{
$sql = "SELECT * from fm_gab_location where
gab_id='$gab_id' and location_code='$location_code' ";
$this->db->query($sql,__LINE__,__FILE__);
if ($this->db->next_record())
{
$gab['location_code'] =
$this->db->f('location_code');
$gab['remark'] =
$this->db->f('remark');
}
//_debug_array($gab);
return $gab;
}
function exist_gab_location($gab_id='',$location_code='')
{
$this->db2->query("SELECT count(*) FROM fm_gab_location
where gab_id='$gab_id' and location_code='$location_code'");
$this->db2->next_record();
if ( $this->db2->f(0))
{
return True;
}
}
function add($gab)
{
$gab['remark'] =
$this->db->db_addslashes($gab['remark']);
$gab_id= $gab['kommune_nr'] .
sprintf("%05s",$gab['gaards_nr']) . sprintf("%04s",$gab['bruks_nr']) .
sprintf("%04s",$gab['feste_nr']) . sprintf("%03s",$gab['seksjons_nr']);
if($gab['propagate'])
{
$sql = "select location_code FROM fm_entrance
where location_code LIKE '%" . $gab['location_code'] . "%'";
$this->db->query($sql,__LINE__,__FILE__);
while ($this->db->next_record())
{
if(!$this->exist_gab_location($gab['gab_id'],$this->db->f('location_code')))
{
$gab_insert[] =
array('location_code'=> $this->db->f('location_code'),
'gab_id' => $gab_id,
'remark' => $gab['remark']);
}
else
{
$gab_update[] =
array('location_code'=> $this->db->f('location_code'),
'gab_id' => $gab_id,
'remark' => $gab['remark']);
}
}
}
else
{
$gab_insert[] = array('location_code'=>
$gab['location_code'],
'gab_id' => $gab_id,
'remark' => $gab['remark']);
}
if($gab_insert)
{
$receipt = $this->insert($gab_insert);
}
else
{
$receipt['message'][] =
array('msg'=>lang('Could not find any location to save to!'));
}
if($gab_update)
{
$receipt = $this->update($gab_update,$receipt);
}
$receipt['gab_id'] = $gab_id;
return $receipt;
}
function insert($gab_insert)
{
$receipt['message'][] = array('msg'=>lang('gab %1 has
been added',$gab_insert[0]['gab_id']));
for ($i=0;$i<count($gab_insert);$i++)
{
$this->db->query("INSERT INTO fm_gab_location
(location_code,gab_id,remark,entry_date,user) "
. "VALUES ('"
. $gab_insert[$i]['location_code'].
"','"
. $gab_insert[$i]['gab_id']. "','"
. $gab_insert[$i]['remark']. "','"
. time() . "','"
. $this->account.
"')",__LINE__,__FILE__);
$receipt['message'][] =
array('msg'=>lang('at location %1',$gab_insert[$i]['location_code']));
}
return $receipt;
}
function update($gab_update,$receipt)
{
$receipt['message'][] = array('msg'=>lang('gab %1 has
been updated',$gab_update[0]['gab_id']));
for ($i=0;$i<count($gab_update);$i++)
{
$this->db->query("UPDATE fm_gab_location set
gab_id ='" .
$gab_insert[$i]['gab_id'] . "',
remark ='" .
$gab_insert[$i]['remark'] . "',
entry_date ='" .
time() . "',
user ='" .
$this->account
. "' WHERE location_code = '" .
$gab_insert[$i]['location_code'] ."'",__LINE__,__FILE__);
$receipt['message'][] =
array('msg'=>lang('at location %1',$gab_update[$i]['location_code']));
}
return $receipt;
}
function edit($gab)
{
//_debug_array($gab);
$this->db->query("UPDATE fm_gab_location set
remark ='" . $gab['remark'] .
"',
entry_date ='" . time() . "',
user ='" . $this->account
. "' WHERE location_code= '" .
$gab['location_code'] ."' and gab_id= '" . $gab['gab_id']
."'",__LINE__,__FILE__);
$receipt['gab_id'] = $gab['gab_id'];
$receipt['message'][] = array('msg'=>lang('gab %1 has
been edited',"'".$gab['gab_id']."'"));
$receipt['message'][] = array('msg'=>lang('at location
%1',$gab['location_code']));
return $receipt;
}
function delete($gab_id='',$location_code='')
{
$this->db->query("DELETE FROM fm_gab_location WHERE
gab_id='$gab_id' and location_code='$location_code'",__LINE__,__FILE__);
}
}
?>
--- NEW FILE ---
<?php
/***************************************************************************\
* -------------------------------------------------
*
* 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 uigab
{
var $grants;
var $cat_id;
var $start;
var $query;
var $sort;
var $order;
var $filter;
var $part_of_town_id;
var $sub;
var $currentapp;
var $public_functions = array
(
'index' => True,
'list_detail' => True,
'view' => True,
'edit' => True,
'delete' => True
);
function uigab()
{
$GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
$this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
$this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
$this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
$this->grants =
$GLOBALS['phpgw']->acl->get_grants($this->currentapp);
$this->grants[$this->account] = PHPGW_ACL_READ +
PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE;
$this->bo =
CreateObject($this->currentapp.'.bogab',True);
$this->bocommon =
CreateObject($this->currentapp.'.bocommon',True);
$this->config =
CreateObject('phpgwapi.config');
$this->start =
$this->bo->start;
$this->query =
$this->bo->query;
$this->sort =
$this->bo->sort;
$this->order =
$this->bo->order;
$this->filter =
$this->bo->filter;
$this->cat_id =
$this->bo->cat_id;
$this->status_id =
$this->bo->status_id;
$this->allrows =
$this->bo->allrows;
$GLOBALS['phpgw']->session->appsession('sub',$this->currentapp,'property');
}
function save_sessiondata()
{
$data = array
(
'start' => $this->start,
'query' => $this->query,
'sort' => $this->sort,
'order' => $this->order,
'filter' => $this->filter,
'cat_id' => $this->cat_id
);
$this->bocommon->save_sessiondata($data);
}
function index()
{
$GLOBALS['phpgw']->xslttpl->add_file(array('gab',
'menu',
'nextmatchs'));
$property_id =
get_var('property_id',array('POST','GET'));
$gaards_nr =
get_var('gaards_nr',array('POST','GET'));
$bruksnr =
get_var('bruksnr',array('POST','GET'));
$feste_nr =
get_var('feste_nr',array('POST','GET'));
$seksjons_nr =
get_var('seksjons_nr',array('POST','GET'));
$reset_query =
get_var('reset_query',array('POST','GET'));
if($reset_query)
{
unset($property_id);
unset($gaards_nr);
unset($bruksnr);
unset($feste_nr);
unset($seksjons_nr);
}
$links = $this->bocommon->menu();
$gab_list =
$this->bo->read($property_id,$gaards_nr,$bruksnr,$feste_nr,$seksjons_nr);
//_debug_array($gab_list);
while (is_array($gab_list) && list(,$gab) =
each($gab_list))
{
$content[] = array
(
'hits'
=> $gab['hits'],
'gaards_nr'
=> substr($gab['gab_id'],4,5),
'bruks_nr'
=> substr($gab['gab_id'],9,4),
'feste_nr'
=> substr($gab['gab_id'],13,4),
'seksjons_nr'
=> substr($gab['gab_id'],17,3),
'link_view'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uigab.list_detail&gab_id='
. $gab['gab_id']),
'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uigab.edit&gab_id='
. $gab['gab_id']),
'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uigab.delete&gab_id='
. $gab['gab_id']),
'lang_view_statustext' =>
lang('view gab detail'),
'lang_edit_statustext' =>
lang('edit information about the gab'),
'lang_delete_statustext' =>
lang('delete this gab'),
'text_view'
=> lang('view'),
'text_edit'
=> lang('edit'),
'text_delete'
=> lang('delete')
);
}
$table_header[] = array
(
'sort_gab_id' =>
$this->nextmatchs->show_sort_order(array
(
'sort' => $this->sort,
'var' => 'gab_id',
'order' => $this->order,
'extra' => array('menuaction' =>
$this->currentapp.'.uigab.index',
'cat_id'
=>$this->cat_id,
'district_id' =>
$this->district_id,
'filter'
=>$this->filter,
'query'
=>$this->query)
)),
'lang_gab' => lang('gab'),
'sort_hits' =>
$this->nextmatchs->show_sort_order(array
(
'sort' => $this->sort,
'var' => 'hits',
'order' => $this->order,
'extra' => array('menuaction' =>
$this->currentapp.'.uigab.index',
'cat_id'
=>$this->cat_id,
'district_id' =>
$this->district_id,
'filter'
=>$this->filter,
'query'
=>$this->query)
)),
'lang_hits' => lang('number'),
'lang_gaards_nr' => lang('gaards nr'),
'lang_bruksnr' => lang('bruks nr'),
'lang_feste_nr' => lang('Feste nr'),
'lang_seksjons_nr' => lang('Seksjons nr'),
'lang_view' => lang('view'),
'lang_edit' => lang('edit'),
'lang_delete' => lang('delete'),
);
$search_field_header[] = array
(
'lang_property' => lang('Property ID'),
'lang_gaards_nr' => lang('gaards nr'),
'lang_bruksnr' => lang('bruks nr'),
'lang_feste_nr' => lang('Feste nr'),
'lang_seksjons_nr' => lang('Seksjons nr')
);
$table_add[] = array
(
'lang_add' =>
lang('add'),
'lang_add_statustext' => lang('add a gab'),
'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uigab.edit&from=index')
);
$link_data = array
(
'menuaction' =>
$this->currentapp.'.uigab.index',
'sort'
=>$this->sort,
'order'
=>$this->order,
'cat_id'
=>$this->cat_id,
'filter'
=>$this->filter,
'property_id' =>$property_id,
'gaards_nr'
=>$gaards_nr,
'bruksnr'
=>$bruksnr,
'feste_nr'
=>$feste_nr,
'seksjons_nr' =>$seksjons_nr
);
if(!$this->allrows)
{
$record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
}
else
{
$record_limit = $this->bo->total_records;
}
$data = array
(
'search_field_header' =>
$search_field_header,
'links'
=> $links,
'allrows'
=> $this->allrows,
'allow_allrows'
=> true,
'start_record'
=> $this->start,
'record_limit'
=> $record_limit,
'num_records'
=> count($gab_list),
'all_records'
=> $this->bo->total_records,
'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi'),
'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
'property_id'
=> $property_id,
'gaards_nr'
=> $gaards_nr,
'bruksnr'
=> $bruksnr,
'feste_nr'
=> $feste_nr,
'seksjons_nr'
=> $seksjons_nr,
'lang_search_property_statustext' =>
lang('search by property_id. To show all entries, empty all fields and press
the SUBMIT button again'),
'lang_search_gaard_statustext' => lang('search
by gaards nr. To show all entries, empty all fields and press the SUBMIT button
again'),
'lang_search_bruk_statustext' => lang('search
by bruk. To show all entries, empty all fields and press the SUBMIT button
again'),
'lang_search_feste_statustext' => lang('search
by feste. To show all entries, empty all fields and press the SUBMIT button
again'),
'lang_search_seksjon_statustext'=> lang('search
by seksjon. To show all entries, empty all fields and press the SUBMIT button
again'),
'lang_searchbutton_statustext' => lang('Submit
the search string'),
'lang_reset_query_statustext' => lang('check
to reset the query'),
'lang_search'
=> lang('search'),
'table_header_gab'
=> $table_header,
'values_gab'
=> $content,
'table_add'
=> $table_add
);
$appname = lang('gab');
$function_msg = lang('list gab');
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_gab' => $data));
$this->save_sessiondata();
}
function list_detail()
{
$GLOBALS['phpgw']->xslttpl->add_file(array('gab',
'menu',
'nextmatchs'));
$gab_id =
get_var('gab_id',array('POST','GET'));
$links = $this->bocommon->menu();
$gab_list = $this->bo->read_detail($gab_id);
while (is_array($gab_list) && list(,$gab) =
each($gab_list))
{
$content[] = array
(
'property_id'
=> $gab['property_id'],
'building_id'
=> $gab['building_id'],
'entrance_id'
=> $gab['entrance_id'],
'address'
=> $gab['street_name'],
'link_view'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uigab.view&gab_id='
. $gab['gab_id'] . '&location_code=' . $gab['location_code']),
'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uigab.edit&gab_id='
. $gab['gab_id'] . '&location_code=' . $gab['location_code'] .
'&from=list_detail'),
'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uigab.delete&gab_id='
. $gab['gab_id'] . '&location_code=' . $gab['location_code']),
'lang_view_file_statustext' =>
lang('view the gab'),
'lang_view_statustext' =>
lang('view information about the gab'),
'lang_edit_statustext' =>
lang('edit information about the gab'),
'lang_delete_statustext' =>
lang('delete this gab'),
'text_view'
=> lang('view'),
'text_edit'
=> lang('edit'),
'text_delete'
=> lang('delete')
);
}
$table_header[] = array
(
'lang_property' => lang('Property'),
'lang_building' => lang('Building'),
'lang_entrance' => lang('Entrance'),
'lang_address' => lang('Address'),
'lang_gaards_nr' => lang('gaards nr'),
'lang_bruksnr' => lang('bruks nr'),
'lang_feste_nr' => lang('Feste nr'),
'lang_seksjons_nr' => lang('Seksjons nr'),
'lang_view' => lang('view'),
'lang_edit' => lang('edit'),
'lang_delete' => lang('delete')
);
$table_add[] = array
(
'lang_add' =>
lang('add'),
'lang_add_statustext' => lang('add a gab'),
'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uigab.edit&from=list_detail&gab_id='
. $gab_id . '&new=true')
);
$table_done[] = array
(
'lang_done' =>
lang('done'),
'lang_done_statustext' => lang('back to list'),
'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uigab.index')
);
$link_data = array
(
'menuaction' =>
$this->currentapp.'.uigab.list_detail',
'sort'
=>$this->sort,
'order'
=>$this->order,
'cat_id'
=>$this->cat_id,
'filter'
=>$this->filter,
'gab_id'
=>$gab_id
);
if(!$this->allrows)
{
$record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
}
else
{
$record_limit = $this->bo->total_records;
}
$data = array
(
'gaards_nr'
=> substr($gab_id,4,5),
'bruks_nr'
=> substr($gab_id,9,4),
'feste_nr'
=> substr($gab_id,13,4),
'seksjons_nr'
=> substr($gab_id,17,3),
'lang_gaards_nr'
=> lang('gaards nr'),
'lang_bruksnr'
=> lang('bruks nr'),
'lang_feste_nr'
=> lang('Feste nr'),
'lang_seksjons_nr'
=> lang('Seksjons nr'),
'links'
=> $links,
'allrows'
=> $this->allrows,
'allow_allrows'
=> true,
'start_record'
=> $this->start,
'record_limit'
=> $record_limit,
'num_records'
=> count($gab_list),
'all_records'
=> $this->bo->total_records,
'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi'),
'table_header_gab_detail' =>
$table_header,
'values_gab_detail'
=> $content,
'table_add'
=> $table_add,
'table_done'
=> $table_done
);
$appname = lang('gab');
$function_msg = lang('list gab detail');
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_gab_detail' => $data));
$this->save_sessiondata();
}
function edit()
{
$from =
get_var('from',array('POST','GET'));
$new =
get_var('new',array('POST','GET'));
$gab_id =
get_var('gab_id',array('POST','GET'));
$location_code =
get_var('location_code',array('POST','GET'));
$values =
get_var('values',array('POST'));
$GLOBALS['phpgw']->xslttpl->add_file(array('gab'));
if($values)
{
$values = $values +
$this->bocommon->get_location();
}
else
{
if($location_code)
{
$location_data=$this->bocommon->read_location_data($location_code);
$values = $location_data;
}
}
//_debug_array($values);
if ($values['save'])
{
$values['gab_id'] = $gab_id;
$values['location_code'] = $location_code;
if(!$receipt['error'])
{
$receipt =
$this->bo->save($values);
$location_code =
$receipt['location_code'];
$gab_id =
$receipt['gab_id'];
//_debug_array($receipt);
}
}
if ($gab_id && !$new)
{
$values =
$this->bo->read_single($gab_id,$location_code);
}
if ($values['property_id'])
{
$function_msg = lang('Edit gab');
$action='edit';
$location_type ='view';
}
else
{
$function_msg = lang('Add gab');
$action='add';
$location_type ='form';
}
if ($values['cat_id'])
{
$this->cat_id = $values['cat_id'];
}
$location_data=$this->bocommon->initiate_ui_location(array(
'location_type' =>
$location_type,
'entrance' => true,
'address' => true,
'equipment_id' =>
$values['equipment_id'],
'property_id' =>
$values['property_id'],
'property_name' =>
$values['property_name'],
'building_id' =>
$values['building_id'],
'entrance_id' =>
$values['entrance_id'],
'floor' =>
$values['floor'],
'street_name' =>
$values['street_name'],
'street_number' =>
$values['street_number'],
'apartment_id' =>
$values['apartment_id']));
$link_data = array
(
'menuaction' =>
$this->currentapp.'.uigab.edit',
'gab_id' => $gab_id,
'location_code' => $location_code,
'from' => $from
);
if($from=='list_detail')
{
$gab_done='&gab_id=' . $gab_id;
}
$kommune_nr = substr($gab_id,0,4);
if(!$kommune_nr > 0)
{
$this->config->read_repository();
$kommune_nr=
$this->config->config_data['default_municipal'];
}
$data = array
(
'kommune_nr'
=> $kommune_nr,
'gaards_nr'
=> substr($gab_id,4,5),
'bruks_nr'
=> substr($gab_id,9,4),
'feste_nr'
=> substr($gab_id,13,4),
'seksjons_nr'
=> substr($gab_id,17,3),
'lang_kommune_nr'
=> lang('kommune nr'),
'lang_gaards_nr'
=> lang('gaards nr'),
'lang_bruksnr'
=> lang('bruks nr'),
'lang_feste_nr'
=> lang('Feste nr'),
'lang_seksjons_nr'
=> lang('Seksjons nr'),
'action'
=> $action,
'location_type'
=> $location_type,
'location_data'
=> $location_data,
'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uigab.'.$from.$gab_done),
'lang_save'
=> lang('save'),
'lang_done'
=> lang('done'),
'lang_propagate'
=> lang('propagate'),
'lang_propagate_statustext' =>
lang('check to inherit from this location'),
'error'
=> $receipt['error'],
'message'
=> $receipt['message'],
'lang_remark_statustext' =>
lang('Enter a remark for this entity'),
'lang_remark'
=> lang('remark'),
'value_remark'
=> $values['remark'],
'lang_done_statustext' =>
lang('Back to the list'),
'lang_save_statustext' =>
lang('Save the gab')
);
$appname = lang('gab');
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
}
function delete()
{
$gab_id = get_var('gab_id',array('POST','GET'));
$location_code =
get_var('location_code',array('POST','GET'));
$confirm = get_var('confirm',array('POST'));
$link_data = array
(
'menuaction' =>
$this->currentapp.'.uigab.list_detail',
'gab_id' => $gab_id
);
if (get_var('confirm',array('POST')))
{
$this->bo->delete($gab_id,$location_code);
Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
}
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
$data = array
(
'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uigab.delete&gab_id='
. $gab_id . '&location_code=' . $location_code),
'lang_confirm_msg' => lang('do you
really want to delete this entry'),
'lang_yes' =>
lang('yes'),
'lang_yes_statustext' => lang('Delete the
entry'),
'lang_no_statustext' => lang('Back to the
list'),
'lang_no' =>
lang('no')
);
$appname
= lang('gab');
$function_msg =
lang('delete gab at:') . ' ' . $location_code;
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
}
function view()
{
$gab_id =
get_var('gab_id',array('POST','GET'));
$location_code =
get_var('location_code',array('POST','GET'));
$GLOBALS['phpgw']->xslttpl->add_file(array('gab'));
//_debug_array($values);
if ($gab_id && !$new)
{
$values =
$this->bo->read_single($gab_id,$location_code);
}
$function_msg = lang('View gab');
$location_type ='view';
$location_data=$this->bocommon->initiate_ui_location(array(
'location_type' =>
$location_type,
'entrance' => true,
'address' => true,
'equipment_id' =>
$values['equipment_id'],
'property_id' =>
$values['property_id'],
'property_name' =>
$values['property_name'],
'building_id' =>
$values['building_id'],
'entrance_id' =>
$values['entrance_id'],
'floor' =>
$values['floor'],
'street_name' =>
$values['street_name'],
'street_number' =>
$values['street_number'],
'apartment_id' =>
$values['apartment_id']));
$data = array
(
'kommune_nr'
=> substr($gab_id,0,4),
'gaards_nr'
=> substr($gab_id,4,5),
'bruks_nr'
=> substr($gab_id,9,4),
'feste_nr'
=> substr($gab_id,13,4),
'seksjons_nr'
=> substr($gab_id,17,3),
'lang_kommune_nr'
=> lang('kommune nr'),
'lang_gaards_nr'
=> lang('gaards nr'),
'lang_bruksnr'
=> lang('bruks nr'),
'lang_feste_nr'
=> lang('Feste nr'),
'lang_seksjons_nr'
=> lang('Seksjons nr'),
'location_type'
=> $location_type,
'location_data'
=> $location_data,
'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uigab.list_detail&gab_id='
. $gab_id),
'lang_save'
=> lang('save'),
'lang_done'
=> lang('done'),
'lang_remark'
=> lang('remark'),
'value_remark'
=> $values['remark'],
'lang_done_statustext' =>
lang('Back to the list'),
'edit_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uigab.edit&from=list_detail&gab_id='
. $gab_id . '&location_code=' . $location_code),
'lang_edit_statustext'
=> lang('Edit this entry'),
'lang_edit'
=> lang('Edit')
);
$appname = lang('gab');
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
}
}
?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: property/inc class.bogab.inc.php,NONE,1.1 class.sogab.inc.php,NONE,1.1 class.uigab.inc.php,NONE,1.1,
Sigurd Nes <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: property/setup setup.inc.php,1.43,1.44 tables_current.inc.php,1.67,1.68
- Next by Date:
[Phpgroupware-cvs] CVS: property/templates/default config.tpl,1.8,1.9
- Previous by thread:
[Phpgroupware-cvs] CVS: property/setup setup.inc.php,1.43,1.44 tables_current.inc.php,1.67,1.68
- Next by thread:
[Phpgroupware-cvs] CVS: property/templates/default config.tpl,1.8,1.9
- Index(es):