phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] CVS: property/inc class.boentrance.inc.php,NONE,1.1 c


From: Sigurd Nes <address@hidden>
Subject: [Phpgroupware-cvs] CVS: property/inc class.boentrance.inc.php,NONE,1.1 class.soentrance.inc.php,NONE,1.1 class.uientrance.inc.php,NONE,1.1 class.solookup.inc.php,1.8,1.9 class.soXport.inc.php,1.14,1.15 class.uibuilding.inc.php,1.9,1.10
Date: Sun, 23 Feb 2003 16:45:37 -0500

Update of /cvsroot/phpgroupware/property/inc
In directory subversions:/tmp/cvs-serv20858/inc

Modified Files:
        class.solookup.inc.php class.soXport.inc.php 
        class.uibuilding.inc.php 
Added Files:
        class.boentrance.inc.php class.soentrance.inc.php 
        class.uientrance.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 boentrance
        {
                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
                );

                var $soap_functions = array(
                        'list' => array(
                                'in'  => 
array('int','int','struct','string','int'),
                                'out' => array('array')
                        ),
                        'read' => array(
                                'in'  => array('int','struct'),
                                'out' => array('array')
                        ),
                        'save' => array(
                                'in'  => array('int','struct'),
                                'out' => array()
                        ),
                        'delete' => array(
                                'in'  => array('int','struct'),
                                'out' => array()
                        )
                );

                function boentrance($session=False)
                {
                        $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->so               = 
CreateObject($this->currentapp.'.soentrance');
                        $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'));

                        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;
                        }
                }


                function read()
                {
                        $entrance = $this->so->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
                                                                                
        'filter' => $this->filter,'cat_id' => $this->cat_id));
                        $this->total_records = $this->so->total_records;

                        for ($i=0; $i<count($entrance); $i++)
                        {
                                $entrance[$i]['date']  = 
$GLOBALS['phpgw']->common->show_date($entrance[$i]['date']);
                                $entrance[$i]['owner'] = 
$GLOBALS['phpgw']->accounts->id2name($entrance[$i]['owner']);
                        }
                        return $entrance;
                }

                function read_single($location_code)
                {
                        return $this->so->read_single($location_code);
                }

                function read_category_name($cat_id)
                {
                        return $this->so->read_category_name($cat_id);
                }


                function save($entrance,$action='')
                {
                        if ($entrance['access'])
                        {
                                $entrance['access'] = 'private';
                        }
                        else
                        {
                                $entrance['access'] = 'public';
                        }

                        if ($action=='edit')
                        {
                                if 
($this->socommon->check_entrance($entrance['property_id'],$entrance['building_id'],$entrance['entrance_id']))
                                {
                                        $receipt = $this->so->edit($entrance);
                                }
                                else
                                {
                                        
$receipt['error'][]=array('msg'=>lang('This entrance_id ID does not exist!'));
                                }
                        }
                        else
                        {

                                
if(!$this->socommon->check_building($entrance['property_id'],$entrance['building_id']))
                                {
                                        
$receipt['error'][]=array('msg'=>lang('This property ID does not exist!'));
                                }

                                if(!$receipt['error'])
                                {
                                        
$entrance['location_code']=$this->bocommon->location_code($entrance['property_id'],$entrance['building_id'],$entrance['entrance_id']);
                                        $receipt = $this->so->add($entrance);
                                }
                        }
                        return $receipt;
                }

                function delete($property_id,$building_id,$entrance_id)
                {
                        
$this->so->delete($property_id,$building_id,$entrance_id);
                }
        }
?>

--- 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 soentrance
        {
                var $grants;

                function soentrance()
                {
                        $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_category_name($cat_id)
                {
                        $this->db->query("SELECT descr FROM  
fm_entrance_category  where id='$cat_id'");
                        $this->db->next_record();
                        return $this->db->f('descr');
                }

                function read($data)
                {
                        if(is_array($data))
                        {
                                if ($data['start'])
                                {
                                        $start=$data['start'];
                                }
                                else
                                {
                                        $start=0;
                                }
                                $filter = 
(isset($data['filter'])?$data['filter']:'none');
                                $query = 
(isset($data['query'])?$data['query']:'');
                                $sort = 
(isset($data['sort'])?$data['sort']:'DESC');
                                $order = 
(isset($data['order'])?$data['order']:'');
                                $cat_id = 
(isset($data['cat_id'])?$data['cat_id']:0);
                        }

                        if ($order)
                        {
                                $ordermethod = " order by $order $sort";
                        }
                        else
                        {
                                $ordermethod = ' order by property_id DESC';
                        }

                        if ($filter == 'none')
                        {
                                $filtermethod = ' ( owner=' . $this->account;
                                if (is_array($this->grants))
                                {
                                        $grants = $this->grants;
                                        while (list($user) = each($grants))
                                        {
                                                $public_user_list[] = $user;
                                        }
                                        reset($public_user_list);
                                        $filtermethod .= " OR (access='public' 
OR owner IN(" . implode(',',$public_user_list) . ")))";
                                }
                                else
                                {
                                        $filtermethod .= ' )';
                                }
                        }
                        elseif ($filter == 'yours')
                        {
                                $filtermethod = " owner='" . $this->account . 
"'";
                        }
                        else
                        {
                                $filtermethod = " owner='" . $this->account . 
"' AND access='private'";
                        }

                        if ($cat_id > 0)
                        {
                                $filtermethod .= " AND cat_id='$cat_id' ";
                        }

                        if($query)
                        {
                                $query = ereg_replace("'",'',$query);
                                $query = ereg_replace('"','',$query);

                                $querymethod = " AND property_id LIKE 
'%$query%' or descr LIKE '%$query%'";
                        }

                        $sql = "SELECT * FROM fm_entrance WHERE $filtermethod 
$querymethod";

                        $this->db2->query($sql,__LINE__,__FILE__);
                        $this->total_records = $this->db2->num_rows();
                        $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);

                        while ($this->db->next_record())
                        {
                                $ngrants = 
(int)$this->grants[$this->db->f('entrance_owner')];
                                $entrance[] = array
                                (
                                        'location_code' => 
$this->db->f('location_code'),
                                        'property_id'   => 
$this->db->f('property_id'),
                                        'building_id'   => 
$this->db->f('building_id'),
                                        'entrance_id'   => 
$this->db->f('entrance_id'),
                                        'owner'                 => 
$this->db->f('owner'),
                                        'owner_id'              => 
(int)$this->db->f('owner'),
                                        'access'                => 
$this->db->f('access'),
                                        'date'                  => 
$this->db->f('entry_date'),
                                        'cat_id'                => 
(int)$this->db->f('cat_id'),
                                        'descr'                 => 
stripslashes($this->db->f('descr')),
                                        'grants'                => $ngrants
                                );
                        }
                        return $entrance;
                }

                function read_single($location_code)
                {
                        $sql = "SELECT fm_entrance.*, name FROM fm_entrance 
$this->join fm_property on fm_entrance.property_id = fm_property.property_id  
where fm_entrance.location_code='$location_code'";

                        $this->db->query($sql,__LINE__,__FILE__);

                        if ($this->db->next_record())
                        {
                                $entrance['location_code']              = 
$this->db->f('location_code');
                                $entrance['property_id']                = 
$this->db->f('property_id');
                                $entrance['property_name']              = 
$this->db->f('name');
                                $entrance['building_id']                = 
$this->db->f('building_id');
                                $entrance['entrance_id']                = 
$this->db->f('entrance_id');
                                $entrance['owner']                              
= $this->db->f('owner');
                                $entrance['descr']                              
= stripslashes($this->db->f('descr'));
                                $entrance['access']                             
= $this->db->f('access');
                                $entrance['date']                               
= $this->db->f('entry_date');
                                $entrance['cat_id']                             
= (int)$this->db->f('cat_id');
                                $entrance['remark']                             
= $this->db->f('remark');

                                return $entrance;
                        }
                }

                function add($entrance)
                {
                        $entrance['remark'] = 
$this->db->db_addslashes($entrance['remark']);

                        $this->db->query("INSERT INTO fm_entrance 
(location_code, 
property_id,building_id,entrance_id,owner,access,entry_date,building_name,general_address,cat_id,remark)
 "
                                . "VALUES ('" .
                                $entrance['location_code']. "','" .
                                $entrance['property_id'] . "','" .
                                $entrance['building_id'] . "','" .
                                $entrance['entrance_id'] . "','" .
                                $this->account . "','" .
                                $entrance['access'] . "','" .
                                time() . "','" .
                                $entrance['name']. "','" .
                                $entrance['general_address'] ."','" .
                                $entrance['cat_id'] ."','" .
                                $entrance['remark']. "')",__LINE__,__FILE__);

                        $receipt['message'][] = array('msg'=>lang('Entrance has 
been saved'));
                        return $receipt;
                }

                function edit($entrance)
                {
                        $entrance['remark'] = 
$this->db->db_addslashes($entrance['remark']);

                        $this->db->query("UPDATE fm_entrance set descr='" . 
$building['descr'] . "', entry_date='" . time()
                                                . "', cat_id='" . 
$entrance['cat_id'] . "', general_address='" . $entrance['general_address'] . 
"', access='" . $entrance['access'] . "', remark='" . $entrance['remark']
                                                . "' WHERE property_id= '" . 
$entrance['property_id']
                                                . "' AND building_id=" . 
$entrance['building_id']
                                                . "' AND entrance_id=" . 
$entrance['entrance_id'],__LINE__,__FILE__);

                        $receipt['message'][] = array('msg'=>lang('Entrance has 
been edited'));
                        return $receipt;
                }

                function delete($location_code )
                {
                        $this->db->query("DELETE FROM fm_entrance WHERE 
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 uientrance
        {
                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,
                        'view'   => True,
                        'edit'   => True,
                        'delete' => True
                );

                function uientrance()
                {
                        $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.'.boentrance',True);
                        $this->bocommon                                 = 
CreateObject($this->currentapp.'.bocommon',True);
                        $this->socommon                                 = 
CreateObject($this->currentapp.'.socommon',True);

                        $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->part_of_town_id          = 
$this->bocommon->part_of_town_id;

                        
$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('entrance',
                                                                                
'menu',
                                                                                
'nextmatchs',
                                                                                
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'app_header',
                                                                                
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'filter_select',
                                                                                
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'search_field'));

                        $links = $this->bocommon->menu($sub);

                        $entrance_list = $this->bo->read();

                        while (is_array($entrance_list) && list(,$entrance) = 
each($entrance_list))
                        {
                                $content[] = array
                                (
                                        'property_id'                           
=> $entrance['property_id'],
                                        'building_id'                           
=> $entrance['building_id'],
                                        'entrance_id'                           
=> $entrance['entrance_id'],
                                        'descr'                                 
        => $entrance['descr'],
                                        'owner'                                 
        => $entrance['owner'],
                                        'link_view'                             
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uientrance.view&location_code='
 . $entrance['location_code']),
                                        'link_edit'                             
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uibuilding.edit&location_code='
 . $entrance['location_code']),
                                        'link_delete'                           
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uibuilding.delete&location_code='
 . $entrance['location_code']),
                                        'lang_view_statustext'          => 
lang('view the entrance'),
                                        'lang_edit_statustext'          => 
lang('edit the entrance'),
                                        'lang_delete_statustext'        => 
lang('delete the entrance'),
                                        'text_view'                             
        => lang('view'),
                                        'text_edit'                             
        => lang('edit'),
                                        'text_delete'                           
=> lang('delete')
                                );
                        }

                        $table_header[] = array
                        (
                                'sort_descr'    => 
$this->nextmatchs->show_sort_order(array
                                                                                
(
                                                                                
        'sort'  => $this->sort,
                                                                                
        'var'   =>      'descr',
                                                                                
        'order' =>      $this->order,
                                                                                
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uientrance.index',
                                                                                
                                                        'cat_id'        
=>$this->cat_id)
                                                                                
)),
                                'lang_descr'                    => 
lang('descr'),
                                'lang_view'                     => lang('view'),
                                'lang_edit'                     => lang('edit'),
                                'lang_delete'           => lang('delete'),
                                'sort_property_id'      => 
$this->nextmatchs->show_sort_order(array
                                                                                
(
                                                                                
        'sort'  => $this->sort,
                                                                                
        'var'   =>      'property_id',
                                                                                
        'order' =>      $this->order,
                                                                                
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uientrance.index',
                                                                                
                                                        'cat_id'        
=>$this->cat_id)
                                                                                
)),
                                'lang_property_id'      => lang('property id'),
                                'lang_property_id'              => 
lang('property id'),
                                'lang_building_id'              => 
lang('building id'),
                                'lang_entrance_id'              => 
lang('entrance id'),
                                'lang_owner'            => lang('owner')
                        );

                        $table_add[] = array
                        (
                                'lang_add'                              => 
lang('add'),
                                'lang_add_statustext'   => lang('add a 
entrance'),
                                'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uientrance.edit')
                        );

                        $link_data = array
                        (
                                'menuaction'    => 
$this->currentapp.'.uientrance.index',
                                                'sort'                  
=>$this->sort,
                                                'order'                 
=>$this->order,
                                                'cat_id'                
=>$this->cat_id,
                                                'district_id'   
=>$this->district_id,
                                                'filter'                
=>$this->filter,
                                                'query'                 
=>$this->query
                        );

                        $data = array
                        (
                                'links'                                         
        => $links,
                                'allow_allrows'                         => 
false,
                                'start_record'                                  
=> $this->start,
                                'record_limit'                                  
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
                                'num_records'                                   
=> count($entrance_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'),
                                'appname'                                       
        => lang($this->currentapp),
                                'function_msg'                                  
=> lang('list entrance'),
                                'lang_no_cat'                                   
=> lang('no category'),
                                'lang_cat_statustext'                   => 
lang('Select the category the entrance belongs to. To do not use a category 
select NO CATEGORY'),
                                'select_name'                                   
=> 'cat_id',
                                'cat_list'                                      
        => 
$this->bocommon->select_category_entrance_list('filter',$this->cat_id),
                                'select_action'                                 
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uientrance.index'),
                                'filter_list'                                   
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter,'yours' => 
'yes')),
                                'lang_filter_statustext'                => 
lang('Select the filter. To show all entries select SHOW ALL'),
                                'lang_searchfield_statustext'   => lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again'),
                                'lang_searchbutton_statustext'  => lang('Submit 
the search string'),
                                'query'                                         
        => $this->query,
                                'lang_submit'                                   
=> lang('submit'),
                                'table_header'                                  
=> $table_header,
                                'values'                                        
        => $content,
                                'table_add'                                     
        => $table_add
                        );

                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
                        $this->save_sessiondata();
                }

                function edit()
                {
                        $location_code                  = 
get_var('location_code',array('GET'));
                        $location = split('-',$location_code);
                        $property_id = $location[0];
                        $building_id = $location[1];
                        $entrance_id = $location[2];

                        $values                                 = 
get_var('values',array('POST','GET'));
                        $values['property_id']  = 
get_var('property_id',array('POST'));
                        $values['property_name']        = 
get_var('property_name',array('POST'));
                        $values['building_id']  = 
get_var('building_id',array('POST'));

                        $values_attribute               = 
get_var('values_attribute',array('POST','GET'));

                        
$GLOBALS['phpgw']->xslttpl->add_file(array('entrance',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
 . SEP . 'app_header'));

                        if ($values['save'])
                        {
                                if(!$values['property_id']  && !$property_id)
                                {
                                        
$receipt['error'][]=array('msg'=>lang('Please select a Property ID !'));
                                        $error_property_id=true;
                                        $error_id=true;
                                }

                                if(!$values['building_id']  && !$building_id)
                                {
                                        
$receipt['error'][]=array('msg'=>lang('Please select a Building ID !'));
                                        $error_building_id=true;
                                        $error_id=true;
                                }

                                if(!$values['entrance_id']  && !$entrance_id)
                                {
                                        
$receipt['error'][]=array('msg'=>lang('Please enter a Entrance ID !'));
                                        $error_entrance_id=true;
                                        $error_id=true;
                                }

                                if($values['property_id']  && 
$values['building_id'] && $values['entrance_id'])
                                {
                                        
if($this->socommon->check_building($values['property_id'],$values['building_id'],$values['entrance_id']))
                                        {
                                                
$receipt['error'][]=array('msg'=>lang('This entrance is already registered!') . 
'[ 
'.$values['property_id'].'-'.$values['building_id'].'-'.$values['entrance_id'].'
 ]');
                                                $error_entrance_id=true;
                                                $error_id=true;
                                        }
                                }

                                if($entrance_id)
                                {
                                        $values['property_id']=$property_id;
                                        $values['building_id']=$building_id;
                                        $values['entrance_id']=$entrance_id;
                                        $action='edit';
                                }
                                else
                                {
                                        $property_id =  $values['property_id'];
                                        $building_id =  $values['building_id'];
                                        $entrance_id =  $values['entrance_id'];
                                }

//_debug_array($values);
                                if(!$receipt['error'])
                                {
                                        $receipt = 
$this->bo->save($values,$action);
                                        if($values_attribute)
                                        {
                                                
$this->bocommon->save_attributes($values_attribute,'location');
                                        }
                                }
                        }
                        else
                        {
                                $values['property_id']= $property_id;
                                $values['building_id']= $building_id;
                                $values['entrance_id']= $entrance_id;
                                $values = 
$this->bo->read_single($location_code);
                        }

                        if ($entrance_id)
                        {
                                $function_msg = lang('edit entrance');
                        }
                        else
                        {
                                $function_msg = lang('add entrance');
                        }

                        if ($values['cat_id'] > 0)
                        {
                                $this->cat_id = $values['cat_id'];
                        }

                        if($error_property_id)
                        {
                                unset($values['property_id']);
                        }
                        if($error_entrance_id)
                        {
                                unset($values['entrance_id']);
                        }

                        $link_data = array
                        (
                                'menuaction'    => 
$this->currentapp.'.uientrance.edit',
                                'location_code' => $property_id . '-' . 
$building_id . '-' .$entrance_id
                        );

                        if($values['entrance_id'])
                        {
                                $attributes_values              = 
$this->bocommon->read_attibutes(array('form'=>true,'type'=>location,'type_id'=>3,'id'=>$property_id
 . '-' . $building_id . '-' . $entrance_id));
                                $attributes_header[]    = array
                                (
                                        'lang_name'             => lang('Name'),
                                        'lang_descr'    => lang('Description'),
                                        'lang_datatype' => lang('Datatype'),
                                        'lang_value'    => lang('Value')
                                        );
                                $location_type='view';
                        }
                        else
                        {
                                $location_type='form';
                        }

                        
$location_data=$this->bocommon->initiate_ui_location(array(
                                                'location_type' => 
$location_type,
                                                'building'              => True,
                                                'property_id'   => 
$values['property_id'],
                                                'property_name' => 
$values['property_name'],
                                                'building_id'   => 
$values['building_id'],
                                                ));

                        $data = array
                        (
                                'location_type'                                 
=> $location_type,
                                'location_data'                                 
=> $location_data,
                                'lang_attributes'                               
=> lang('Attributes'),
                                'attributes_header'                             
=> $attributes_header,
                                'attributes_values'                             
=> $attributes_values,
                                'appname'                                       
        => lang('entrance'),
                                'function_msg'                                  
=> $function_msg,
                                'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
                                'done_action'                                   
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uientrance.index'),
                                'lang_entrance_id'                              
=> lang('Entrance ID'),
                                'lang_name'                                     
        => lang('name'),
                                'lang_general_address'                  => 
lang('General Address'),
                                'lang_category'                                 
=> lang('category'),
                                'lang_access'                                   
=> lang('private'),
                                'lang_save'                                     
        => lang('save'),
                                'lang_done'                                     
        => lang('done'),
                                'lang_remark'                                   
=> lang('remark'),
                                'value_entrance_id'                             
=> $values['entrance_id'],
                                'value_name'                                    
=> $values['name'],
                                'value_general_address'                 => 
$values['general_address'],
                                'value_access'                                  
=> $values['access'],
                                'value_remark'                                  
=> $values['remark'],
                                'error'                                         
        => $receipt['error'],
                                'error_flag'                                    
=> $error_id,
                                'message'                                       
        => $receipt['message'],
                                'lang_name_statustext'                  => 
lang('Enter the name of the entrance'),
                                'lang_entrance_id_statustext'   => lang('Enter 
entrance ID'),
                                'lang_general_address_statustext'=> lang('Enter 
the general address'),
                                'lang_done_statustext'                  => 
lang('Back to the list'),
                                'lang_save_statustext'                  => 
lang('Save the entrance'),
                                'lang_access_off_statustext'    => lang('The 
entrance is public. If the entrance should be private, check this box'),
                                'lang_access_on_statustext'             => 
lang('The entrance is private. If the entrance should be public, uncheck this 
box'),
                                'lang_no_cat'                                   
=> lang('no category'),
                                'lang_cat_statustext'                   => 
lang('Select the category the entrance belongs to. To do not use a category 
select NO CATEGORY'),
                                'select_name'                                   
=> 'values[cat_id]',
                                'lang_remark_statustext'                => 
lang('Enter any remarks regarding this entrance'),
                                'cat_list'                                      
        => 
$this->bocommon->select_category_entrance_list('select',$values['cat_id'])
                        );

                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
                }

                function delete()
                {
                        $location_code          = 
get_var('location_code',array('GET'));
                        $location                       = 
split('-',$location_code);
                        $property_id            = $location[0];
                        $building_id            = $location[1];
                        $entrance_id            = $location[2];

                        $confirm        = get_var('confirm',array('POST'));

                        $link_data = array
                        (
                                'menuaction' => 
$this->currentapp.'.uientrance.index'
                        );

                        if (get_var('confirm',array('POST')))
                        {
                                
$this->bo->delete($property_id,$building_id,$entrance_id);
                                Header('Location: ' . 
$GLOBALS['phpgw']->link('/index.php',$link_data));
                        }

                        
$GLOBALS['phpgw']->xslttpl->add_file(array($GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
 . SEP . 'app_delete',
                                                                                
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'app_header'));

                        $data = array
                        (
                                'appname'                               => 
lang('entrance'),
                                'function_msg'                  => lang('delete 
entrance'),
                                'done_action'                   => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
                                'delete_action'                 => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uientrance.delete&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')
                        );

                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
                }

                function view()
                {
                        $location_code          = 
get_var('location_code',array('GET'));
                        $location                       = 
split('-',$location_code);
                        $property_id            = $location[0];
                        $building_id            = $location[1];
                        $entrance_id            = $location[2];

                        
$GLOBALS['phpgw']->xslttpl->add_file(array('entrance',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default')
 . SEP . 'app_header'));

                        $values = $this->bo->read_single($location_code);

                        $attributes_values              = 
$this->bocommon->read_attibutes(array('form'=>true,'type'=>location,'type_id'=>3,'id'=>$location_code));
                        $attributes_header[]    = array
                                (
                                        'lang_name'             => lang('Name'),
                                        'lang_descr'    => lang('Description'),
                                        'lang_datatype' => lang('Datatype'),
                                        'lang_value'    => lang('Value')
                                        );
                        $location_type='view';

                        
$location_data=$this->bocommon->initiate_ui_location(array(
                                                'location_type' => 
$location_type,
                                                'building'      => True,
                                                'property_id'   => 
$values['property_id'],
                                                'building_id'   => 
$values['building_id'],
                                                'property_name' => 
$values['property_name']));

                        $data = array
                        (
                                'location_type'                                 
=> $location_type,
                                'location_data'                                 
=> $location_data,
                                'lang_attributes'                               
=> lang('Attributes'),
                                'attributes_header'                             
=> $attributes_header,
                                'attributes_values'                             
=> $attributes_values,
                                'appname'                                       
        => lang('entrance'),
                                'function_msg'                                  
=> lang('view entrance'),
                                'value_entrance_id'                             
=> $values['entrance_id'],
                                'value_name'                                    
=> $values['name'],
                                'value_general_address'                 => 
$values['general_address'],
                                'value_access'                                  
=> $values['access'],
                                'value_remark'                                  
=> $values['remark'],
                                'lang_remark'                                   
=> lang('remark'),
                                'value_category'                                
=> $this->bo->read_category_name($values['cat_id']),
                                'lang_entrance_id'                              
=> lang('Entrance ID'),
                                'lang_name'                                     
        => lang('name'),
                                'lang_general_address'                  => 
lang('General Address'),
                                'lang_category'                                 
=> lang('category'),
                                'lang_done'                                     
=> lang('done'),
                                'lang_edit'                                     
=> lang('Edit'),
                                'edit_action'                           => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uientrance.edit&location_code='
 . $location_code),
                                'done_action'                                   
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uientrance.index'),
                                'lang_done_statustext'          => lang('Back 
to the list'),
                                'lang_edit_statustext'          => lang('Edit 
this entry equipment'),
                        );

                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
                }
        }
?>

Index: class.solookup.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.solookup.inc.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** class.solookup.inc.php      18 Feb 2003 20:38:18 -0000      1.8
--- class.solookup.inc.php      23 Feb 2003 21:45:34 -0000      1.9
***************
*** 507,515 ****
                                $query = ereg_replace('"','',$query);
  
!                               $querymethod = " AND ( street_name LIKE 
'%$query%' OR fm_property.location_code LIKE '%$query%' OR fm_property.navn 
LIKE '%$query%')";
                        }
  
  
!                       $sql = "SELECT 
fm_property.property_id,fm_property.navn,building_id,entrance_id,description"
                        . "     FROM fm_entrance $this->join"
                        . " fm_property ON fm_entrance.property_id = 
fm_property.property_id $this->join"
--- 507,515 ----
                                $query = ereg_replace('"','',$query);
  
!                               $querymethod = " AND ( descr LIKE '%$query%' OR 
fm_property.location_code LIKE '%$query%' OR fm_property.navn LIKE '%$query%')";
                        }
  
  
!                       $sql = "SELECT 
fm_property.property_id,fm_property.navn,building_id,entrance_id,fm_entrance.descr"
                        . "     FROM fm_entrance $this->join"
                        . " fm_property ON fm_entrance.property_id = 
fm_property.property_id $this->join"
***************
*** 530,534 ****
                                        'building_id'   => 
$this->db->f('building_id'),
                                        'entrance_id'   => 
$this->db->f('entrance_id'),
!                                       'street_name'   => 
$this->db->f('description')
                                        );
                        }
--- 530,534 ----
                                        'building_id'   => 
$this->db->f('building_id'),
                                        'entrance_id'   => 
$this->db->f('entrance_id'),
!                                       'street_name'   => $this->db->f('descr')
                                        );
                        }

Index: class.soXport.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.soXport.inc.php,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** class.soXport.inc.php       18 Feb 2003 20:38:18 -0000      1.14
--- class.soXport.inc.php       23 Feb 2003 21:45:34 -0000      1.15
***************
*** 115,122 ****
                        $building_id=substr($dima,4,2);
                        $entrance_id=substr($dima,6,2);
!                       $sql = "select description from fm_entrance where 
property_id = '$property_id' and building_id= '$building_id' and entrance_id = 
'$entrance_id' ";
                        $GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__);
                        $GLOBALS['phpgw']->db->next_record();
!                       $adresse=$GLOBALS['phpgw']->db->f('description');
                        return $adresse;
  
--- 115,122 ----
                        $building_id=substr($dima,4,2);
                        $entrance_id=substr($dima,6,2);
!                       $sql = "select descr from fm_entrance where property_id 
= '$property_id' and building_id= '$building_id' and entrance_id = 
'$entrance_id' ";
                        $GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__);
                        $GLOBALS['phpgw']->db->next_record();
!                       $adresse=$GLOBALS['phpgw']->db->f('descr');
                        return $adresse;
  

Index: class.uibuilding.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uibuilding.inc.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** class.uibuilding.inc.php    21 Feb 2003 10:28:59 -0000      1.9
--- class.uibuilding.inc.php    23 Feb 2003 21:45:34 -0000      1.10
***************
*** 187,191 ****
                        $property_id                    = 
get_var('property_id',array('GET'));
                        $building_id                    = 
get_var('building_id',array('POST','GET'));
-                       $err                                    = 
get_var('err',array('POST','GET'));
                        $values                                 = 
get_var('values',array('POST','GET'));
                        $values['property_id']  = 
get_var('property_id',array('POST'));
--- 187,190 ----
***************
*** 236,240 ****
                                if(!$receipt['error'])
                                {
!                                       $receipt = 
$this->bo->save($values,$action,$err);
                                        if($values_attribute)
                                        {
--- 235,239 ----
                                if(!$receipt['error'])
                                {
!                                       $receipt = 
$this->bo->save($values,$action);
                                        if($values_attribute)
                                        {
***************
*** 259,265 ****
                        }
  
!                       if ($building['cat_id'] > 0)
                        {
!                               $this->cat_id = $building['cat_id'];
                        }
  
--- 258,264 ----
                        }
  
!                       if ($values['cat_id'] > 0)
                        {
!                               $this->cat_id = $values['cat_id'];
                        }
  
***************
*** 330,334 ****
                                'message'                                       
        => $receipt['message'],
                                'lang_name_statustext'                  => 
lang('Enter the name of the building'),
-                               'lang_property_id_statustext'   => lang('Enter 
Property ID'),
                                'lang_building_id_statustext'   => lang('Enter 
Building ID'),
                                'lang_general_address_statustext'=> lang('Enter 
the general address'),
--- 329,332 ----





reply via email to

[Prev in Thread] Current Thread [Next in Thread]