phpgroupware-cvs
[Top][All Lists]
Advanced

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

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


From: Sigurd Nes <address@hidden>
Subject: [Phpgroupware-cvs] CVS: property/inc class.bostandard_2.inc.php,NONE,1.1 class.bostandard_3.inc.php,NONE,1.1class.sostandard_2.inc.php,NONE,1.1 class.sostandard_3.inc.php,NONE,1.1class.uistandard_2.inc.php,NONE,1.1 class.uistandard_3.inc.php,NONE,1.1 class.socommon.inc.php,1.1,1.2 hook_admin.inc.php,1.8,1.9
Date: Thu, 12 Dec 2002 13:15:36 -0500

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

Modified Files:
        class.socommon.inc.php hook_admin.inc.php 
Added Files:
        class.bostandard_2.inc.php class.bostandard_3.inc.php 
        class.sostandard_2.inc.php class.sostandard_3.inc.php 
        class.uistandard_2.inc.php class.uistandard_3.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 bostandard_2
        {
                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 bostandard_2($session=False)
                {
                        $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->so               = 
CreateObject($this->currentapp.'.sostandard_2');
                        $this->socommon = 
CreateObject($this->currentapp.'.socommon');

                        $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($type='')
                {
                        $standard = $this->so->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
                                                                                
        'type' => $type));

                        $this->total_records = $this->so->total_records;

                        return $standard;
                }

                function read_single($id,$type)
                {
                        return $this->so->read_single($id,$type);
                }

                function select_part_of_town($part_of_town_id)
                {
                        return 
$this->socommon->select_part_of_town($part_of_town_id);
                }

                function save($standard,$action='',$type ='')
                {
                        if ($action=='edit')
                        {
                                if ($standard['id'] != '')
                                {

                                        $message = 
$this->so->edit($standard,$type);
                                }
                        }
                        else
                        {
                                $message = $this->so->add($standard,$type);
                        }
                        return $message;

                }

                function delete($id,$type)
                {
                        $this->so->delete($id,$type);
                }
        }
?>

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

                        $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($type='')
                {
                        $standard = $this->so->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
                                                                                
        'type' => $type));

                        $this->total_records = $this->so->total_records;

                        return $standard;
                }

                function read_single($id,$type)
                {
                        return $this->so->read_single($id,$type);
                }

                function save($standard,$action='',$type ='')
                {
                        if ($action=='edit')
                        {
                                if ($standard['id'] != '')
                                {

                                        $message = 
$this->so->edit($standard,$type);
                                }
                        }
                        else
                        {
                                $message = $this->so->add($standard,$type);
                        }
                        return $message;

                }

                function delete($id,$type)
                {
                        $this->so->delete($id,$type);
                }
        }
?>

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

                function sostandard_2()
                {
                        $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;
                                }
                                $query = 
(isset($data['query'])?$data['query']:'');
                                $sort = 
(isset($data['sort'])?$data['sort']:'DESC');
                                $order = 
(isset($data['order'])?$data['order']:'');
                                $type = (isset($data['type'])?$data['type']:0);
                        }

                        if ($order)
                        {
                                $ordermethod = " order by $order $sort";

                        }
                        else
                        {
                                $ordermethod = ' order by id asc';
                        }

                        $table = $this->select_table($type);

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

                                $querymethod = " where id LIKE '%$query%' or 
descr LIKE '%$query%'";
                        }

                        $sql = "SELECT * FROM $table $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())
                        {
                                $standard[] = array
                                (
                                        'id'    => $this->db->f('id'),
                                        'descr'                 => 
$this->db->f('descr')
                                );
                        }
                        return $standard;
                }


                function select_table($type)
                {

                        switch($type)
                        {
                                case 'workorder_status':
                                        $table='fm_wo_wrkorders_status';
                                        break;
                                case 'request_status':
                                        $table='fm_request_status';
                                        break;
                                case 'accounting':
                                        $table='fm_wo_accounts';
                                        break;
                                case 'dim_d':
                                        $table='fm_wo_dim_d';
                                        break;
                                case 'request_type':
                                        $table='fm_request_type';
                                        break;
                                case 'tender_chapter':
                                        $table='fm_wo_chapter';
                                        break;

                        }

                        return $table;
                }


                function read_single($id,$type)
                {

                        $table = $this->select_table($type);

                        $sql = "SELECT * FROM $table  where id='$id'";

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

                        if ($this->db->next_record())
                        {
                                $standard['id']                 = 
$this->db->f('id');
                                $standard['descr']                              
= $this->db->f('descr');

                                return $standard;
                        }
                }

                function add($standard,$type)
                {
                        $table = $this->select_table($type);

                        $standard['descr'] = 
$this->db->db_addslashes($standard['descr']);

                        $this->db->query("INSERT INTO $table (id, descr) "
                                . "VALUES ('" . $standard['id'] . "','" . 
$standard['descr']. "')",__LINE__,__FILE__);

                        $message = lang('standard has been saved');
                        return $message;
                }

                function edit($standard,$type)
                {

                        $table = $this->select_table($type);

                        $standard['descr'] = 
$this->db->db_addslashes($standard['descr']);

                        $this->db->query("UPDATE $table set descr='" . 
$standard['descr']
                                                        . "' WHERE id='" . 
$standard['id']. "'",__LINE__,__FILE__);

                        $message = lang('standard has been edited');
                        return $message;
                }

                function delete($id,$type)
                {
                        $table = $this->select_table($type);

                        $this->db->query("DELETE FROM $table WHERE id='" . $id 
. "'",__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 sostandard_3
        {
                var $grants;

                function sostandard_3()
                {
                        $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'];
                        $this->socommon = 
CreateObject($this->currentapp.'.socommon');

                        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;
                                }
                                $query = 
(isset($data['query'])?$data['query']:'');
                                $sort = 
(isset($data['sort'])?$data['sort']:'DESC');
                                $order = 
(isset($data['order'])?$data['order']:'');
                                $type = (isset($data['type'])?$data['type']:0);
                        }

                        if ($order)
                        {
                                $ordermethod = " order by $order $sort";

                        }
                        else
                        {
                                $ordermethod = ' order by id asc';
                        }

                        $table = $this->select_table($type);

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

                                $querymethod = " where id LIKE '%$query%' or 
descr LIKE '%$query%'";
                        }

                        $sql = "SELECT * FROM $table $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())
                        {
                                $standard[] = array
                                (
                                        'id'    => $this->db->f('id'),
                                        'num'   => $this->db->f('num'),
                                        'descr' => $this->db->f('descr')
                                );
                        }
                        return $standard;
                }


                function select_table($type)
                {

                        switch($type)
                        {
                                case 'branch':
                                        $table='fm_wo_branch';
                                        break;
                        }

                        return $table;
                }


                function read_single($id,$type)
                {

                        $table = $this->select_table($type);

                        $sql = "SELECT * FROM $table  where id='$id'";

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

                        if ($this->db->next_record())
                        {
                                $standard['id']                 = 
$this->db->f('id');
                                $standard['num']                = 
$this->db->f('num');
                                $standard['descr']              = 
$this->db->f('descr');

                                return $standard;
                        }
                }

                function add($standard,$type)
                {
                        $table = $this->select_table($type);

                        $standard['id'] = $this->socommon->next_id($table);
                        $standard['num'] = 
$this->db->db_addslashes($standard['descr']);
                        $standard['descr'] = 
$this->db->db_addslashes($standard['descr']);

                        $this->db->query("INSERT INTO $table (id, num, descr) "
                                . "VALUES ('" . $standard['id'] . "','" . 
$standard['num'] . "','" . $standard['descr']. "')",__LINE__,__FILE__);

                        $receipt = array(
                                'id'            => $standard['id'],
                                'message'       => lang('standard has been 
saved')
                        );

                        return $receipt;
                }

                function edit($standard,$type)
                {

                        $table = $this->select_table($type);

                        $standard['num'] = 
$this->db->db_addslashes($standard['descr']);
                        $standard['descr'] = 
$this->db->db_addslashes($standard['descr']);

                        $this->db->query("UPDATE $table set descr='" . 
$standard['descr'] . "', num='". $standard['num']
                                                        . "' WHERE id='" . 
$standard['id']. "'",__LINE__,__FILE__);

                        $message = lang('standard has been edited');
                        return $message;
                }

                function delete($id,$type)
                {
                        $table = $this->select_table($type);

                        $this->db->query("DELETE FROM $table WHERE id='" . $id 
. "'",__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 uistandard_2
        {
                var $grants;
                var $start;
                var $query;
                var $sort;
                var $order;
                var $sub;
                var $currentapp;

                var $public_functions = array
                (
                        'index'  => True,
                        'view'   => True,
                        'edit'   => True,
                        'delete' => True
                );

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

                        $this->start                            = 
$this->bo->start;
                        $this->query                            = 
$this->bo->query;
                        $this->sort                                     = 
$this->bo->sort;
                        $this->order                            = 
$this->bo->order;
                }

                function save_sessiondata()
                {
                        $data = array
                        (
                                'start'         => $this->start,
                                'query'         => $this->query,
                                'sort'          => $this->sort,
                                'order'         => $this->order,
                        );
                        $this->bocommon->save_sessiondata($data);
                }

                function index()
                {
                        $type   = get_var('type',array('POST','GET'));

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

                        $standard_list = $this->bo->read($type);

                        while (is_array($standard_list) && list(,$standard) = 
each($standard_list))
                        {
                                $words = split(' ',$standard['descr']);
                                $first = "$words[0] $words[1] $words[2] 
$words[3]";

                                $content[] = array
                                (
                                        'id'                                    
=> $standard['id'],
                                        'first'                                 
        => $first,
                                        'link_edit'                             
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_2.edit&id='
 . $standard['id'].'&type='.$type),
                                        'link_delete'                           
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_2.delete&id='
 . $standard['id'].'&type='.$type),
                                        'lang_view_standardtext'                
=> lang('view the standard'),
                                        'lang_edit_standardtext'                
=> lang('edit the standard'),
                                        'lang_delete_standardtext'      => 
lang('delete the standard'),
                                        'text_view'                             
        => lang('view'),
                                        'text_edit'                             
        => lang('edit'),
                                        'text_delete'                           
=> lang('delete')
                                );
                        }

//_debug_array($content);

                        $table_header[] = array
                        (

                                'lang_descr'            => lang('Descr'),
                                'lang_edit'                     => lang('edit'),
                                'lang_delete'           => lang('delete'),
                                'sort_id'       => 
$this->nextmatchs->show_sort_order(array
                                                                                
(
                                                                                
        'sort'  => $this->sort,
                                                                                
        'var'   =>      'id',
                                                                                
        'order' =>      $this->order,
                                                                                
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uistandard_2.index',
                                                                                
                                                        'type'  =>$type)
                                                                                
)),
                                'lang_id'       => lang('standard id'),
                        );

                        $table_add[] = array
                        (
                                'lang_add'                              => 
lang('add'),
                                'lang_add_standardtext' => lang('add a 
standard'),
                                'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_2.edit&type='.$type),
                                'lang_done'                             => 
lang('done'),
                                'lang_done_standardtext'        => lang('back 
to admin'),
                                'done_action'                   => 
$GLOBALS['phpgw']->link('/admin/index.php')
                        );


                        $data = array
                        (
                                'allow_all_rows'                                
=> False,
                                'start_record'                                  
=> $this->start,
                                'record_limit'                                  
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
                                'num_records'                                   
=> count($standard_list),
                                'all_records'                                   
=> $this->bo->total_records,
                                'link_url'                                      
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_2.index&type='.$type),
                                'img_path'                                      
        => $GLOBALS['phpgw']->common->get_image_path('phpgwapi'),
                                'appname'                                       
        => lang($this->currentapp),
                                'function_msg'                                  
=> lang('list '.$type.' standard'),
                                'lang_searchfield_standardtext' => lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again'),
                                'lang_searchbutton_standardtext'        => 
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()
                {
                        $type   = get_var('type',array('POST','GET'));
                        $id     = get_var('id',array('POST','GET'));
                        $values                 = 
get_var('values',array('POST'));

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

                        if ($values['save'])
                        {
                                if($id)
                                {
                                        $values['id']=$id;
                                        $action='edit';
                                }
                                else
                                {
                                        $id =   $values['id'];
                                }


                                $message = 
$this->bo->save($values,$action,$type);
                        }

                        if ($id)
                        {
                                $standard = $this->bo->read_single($id,$type);
                                $function_msg = lang('edit standard');
                                $action='edit';
                        }
                        else
                        {
                                $function_msg = lang('add standard');
                                $action='add';
                        }


                        $link_data = array
                        (
                                'menuaction'    => 
$this->currentapp.'.uistandard_2.edit',
                                'id'    => $id,
                                'type' => $type
                        );
//_debug_array($link_data);
                        $data = array
                        (
                                'appname'                                       
        => lang($type),
                                'function_msg'                                  
=> $function_msg,
                                'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
                                'done_action'                                   
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_2.index&type='.$type),
                                'lang_id'                               => 
lang('standard ID'),
                                'lang_name'                                     
        => lang('name'),
                                'lang_descr'                                    
=> lang('Descr'),
                                'lang_save'                                     
        => lang('save'),
                                'lang_done'                                     
        => lang('done'),
                                'value_id'                              => $id,
                                'value_name'                                    
=> $standard['name'],
                                'value_generaladdress'                  => 
$standard['generaladdress'],
                                'message'                                       
        => $message,
                                'lang_id_standardtext'  => lang('Enter the 
standard ID'),
                                'lang_descr_standardtext'                       
=> lang('Enter a description the standard'),
                                'lang_generaladdress_standardtext'=> 
lang('Enter the general address'),
                                'lang_done_standardtext'                        
=> lang('Back to the list'),
                                'lang_save_standardtext'                        
=> lang('Save the standard'),
                                'type_id'                               => 
$standard['type_id'],
                                'location_code'                                 
=> $standard['location_code'],
                                'value_descr'                                   
=> $standard['descr']


                        );

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

                function delete()
                {
                        $type   = get_var('type',array('POST','GET'));
                        $id             = get_var('id',array('POST','GET'));
                        $confirm                = 
get_var('confirm',array('POST'));

                        $link_data = array
                        (
                                'menuaction' => 
$this->currentapp.'.uistandard_2.index',
                                'type' => $type
                        );

                        if (get_var('confirm',array('POST')))
                        {
                                $this->bo->delete($id,$type);
                                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($type),
                                'function_msg'                  => lang('delete 
standard'),
                                'done_action'                   => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
                                'delete_action'                 => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_2.delete&id='
 . $id.'&type='.$type),
                                'lang_confirm_msg'              => lang('do you 
really want to delete this entry'),
                                'lang_yes'                              => 
lang('yes'),
                                'lang_yes_standardtext' => lang('Delete the 
entry'),
                                'lang_no_standardtext'  => lang('Back to the 
list'),
                                'lang_no'                               => 
lang('no')
                        );

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

        }
?>

--- 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 uistandard_3
        {
                var $grants;
                var $start;
                var $query;
                var $sort;
                var $order;
                var $sub;
                var $currentapp;

                var $public_functions = array
                (
                        'index'  => True,
                        'view'   => True,
                        'edit'   => True,
                        'delete' => True
                );

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

                        $this->start                            = 
$this->bo->start;
                        $this->query                            = 
$this->bo->query;
                        $this->sort                                     = 
$this->bo->sort;
                        $this->order                            = 
$this->bo->order;
                }

                function save_sessiondata()
                {
                        $data = array
                        (
                                'start'         => $this->start,
                                'query'         => $this->query,
                                'sort'          => $this->sort,
                                'order'         => $this->order,
                        );
                        $this->bocommon->save_sessiondata($data);
                }

                function index()
                {
                        $type   = get_var('type',array('POST','GET'));

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

                        $standard_list = $this->bo->read($type);

                        while (is_array($standard_list) && list(,$standard) = 
each($standard_list))
                        {
                                $words = split(' ',$standard['descr']);
                                $first = "$words[0] $words[1] $words[2] 
$words[3]";

                                $content[] = array
                                (
                                        'id'                                    
        => $standard['id'],
                                        'num'                                   
        => $standard['num'],
                                        'first'                                 
        => $first,
                                        'link_edit'                             
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_3.edit&id='
 . $standard['id'].'&type='.$type),
                                        'link_delete'                           
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_3.delete&id='
 . $standard['id'].'&type='.$type),
                                        'lang_view_standardtext'        => 
lang('view the standard'),
                                        'lang_edit_standardtext'        => 
lang('edit the standard'),
                                        'lang_delete_standardtext'      => 
lang('delete the standard'),
                                        'text_view'                             
        => lang('view'),
                                        'text_edit'                             
        => lang('edit'),
                                        'text_delete'                           
=> lang('delete')
                                );
                        }

//_debug_array($content);

                        $table_header[] = array
                        (

                                'lang_descr'            => lang('Descr'),
                                'lang_edit'                     => lang('edit'),
                                'lang_delete'           => lang('delete'),
                                'sort_id'       => 
$this->nextmatchs->show_sort_order(array
                                                                                
(
                                                                                
        'sort'  => $this->sort,
                                                                                
        'var'   =>      'id',
                                                                                
        'order' =>      $this->order,
                                                                                
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uistandard_3.index',
                                                                                
                                                        'type'  =>$type)
                                                                                
)),
                                'lang_id'       => lang('standard id'),
                                'sort_num'      => 
$this->nextmatchs->show_sort_order(array
                                                                                
(
                                                                                
        'sort'  => $this->sort,
                                                                                
        'var'   =>      'num',
                                                                                
        'order' =>      $this->order,
                                                                                
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uistandard_3.index',
                                                                                
                                                        'type'  =>$type)
                                                                                
)),
                                'lang_num'      => lang('Name'),
                        );

                        $table_add[] = array
                        (
                                'lang_add'                              => 
lang('add'),
                                'lang_add_standardtext' => lang('add a 
standard'),
                                'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_3.edit&type='.$type),
                                'lang_done'                             => 
lang('done'),
                                'lang_done_standardtext'        => lang('back 
to admin'),
                                'done_action'                   => 
$GLOBALS['phpgw']->link('/admin/index.php')
                        );


                        $data = array
                        (
                                'allow_all_rows'                                
=> False,
                                'start_record'                                  
=> $this->start,
                                'record_limit'                                  
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
                                'num_records'                                   
=> count($standard_list),
                                'all_records'                                   
=> $this->bo->total_records,
                                'link_url'                                      
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_3.index&type='.$type),
                                'img_path'                                      
        => $GLOBALS['phpgw']->common->get_image_path('phpgwapi'),
                                'appname'                                       
        => lang($this->currentapp),
                                'function_msg'                                  
=> lang('list '.$type.' standard'),
                                'lang_searchfield_standardtext' => lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again'),
                                'lang_searchbutton_standardtext'        => 
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()
                {
                        $type   = get_var('type',array('POST','GET'));
                        $id     = get_var('id',array('POST','GET'));
                        $values                 = 
get_var('values',array('POST'));

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

                        if ($values['save'])
                        {
                                if($id)
                                {
                                        $values['id']=$id;
                                        $action='edit';
                                }
                                else
                                {
                                        $id =   $values['id'];
                                }


                                $message = 
$this->bo->save($values,$action,$type);
                        }

                        if ($id)
                        {
                                $standard = $this->bo->read_single($id,$type);
                                $function_msg = lang('edit standard');
                                $action='edit';
                        }
                        else
                        {
                                $function_msg = lang('add standard');
                                $action='add';
                        }


                        $link_data = array
                        (
                                'menuaction'    => 
$this->currentapp.'.uistandard_3.edit',
                                'id'    => $id,
                                'type' => $type
                        );
//_debug_array($link_data);
                        $data = array
                        (
                                'appname'                                       
        => lang($type),
                                'function_msg'                                  
=> $function_msg,
                                'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
                                'done_action'                                   
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_3.index&type='.$type),
                                'lang_id'                               => 
lang('standard ID'),
                                'lang_num'                                      
        => lang('Name'),
                                'lang_descr'                                    
=> lang('Descr'),
                                'lang_save'                                     
        => lang('save'),
                                'lang_done'                                     
        => lang('done'),
                                'value_id'                              => $id,
                                'value_num'                                     
=> $standard['num'],
                                'value_generaladdress'                  => 
$standard['generaladdress'],
                                'message'                                       
        => $message,
                                'lang_id_standardtext'  => lang('Enter the 
standard ID'),
                                'lang_descr_standardtext'                       
=> lang('Enter a description the standard'),
                                'lang_generaladdress_standardtext'=> 
lang('Enter the general address'),
                                'lang_done_standardtext'                        
=> lang('Back to the list'),
                                'lang_save_standardtext'                        
=> lang('Save the standard'),
                                'type_id'                               => 
$standard['type_id'],
                                'location_code'                                 
=> $standard['location_code'],
                                'value_descr'                                   
=> $standard['descr']


                        );

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

                function delete()
                {
                        $type   = get_var('type',array('POST','GET'));
                        $id             = get_var('id',array('POST','GET'));
                        $confirm                = 
get_var('confirm',array('POST'));

                        $link_data = array
                        (
                                'menuaction' => 
$this->currentapp.'.uistandard_3.index',
                                'type' => $type
                        );

                        if (get_var('confirm',array('POST')))
                        {
                                $this->bo->delete($id,$type);
                                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($type),
                                'function_msg'                  => lang('delete 
standard'),
                                'done_action'                   => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
                                'delete_action'                 => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_3.delete&id='
 . $id.'&type='.$type),
                                'lang_confirm_msg'              => lang('do you 
really want to delete this entry'),
                                'lang_yes'                              => 
lang('yes'),
                                'lang_yes_standardtext' => lang('Delete the 
entry'),
                                'lang_no_standardtext'  => lang('Back to the 
list'),
                                'lang_no'                               => 
lang('no')
                        );

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

        }
?>

Index: class.socommon.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.socommon.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.socommon.inc.php      11 Dec 2002 19:31:22 -0000      1.1
--- class.socommon.inc.php      12 Dec 2002 18:15:33 -0000      1.2
***************
*** 70,73 ****
--- 70,81 ----
                }
  
+               function next_id($table='')
+               {
+                       $this->db->query("SELECT max(id) as maximum FROM $table 
",__LINE__,__FILE__);
+                       $this->db->next_record();
+                       $next_id = $this->db->f('maximum')+1;
+                       return "$next_id";
+               }
+ 
        }
  ?>

Index: hook_admin.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/hook_admin.inc.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** hook_admin.inc.php  11 Dec 2002 19:31:22 -0000      1.8
--- hook_admin.inc.php  12 Dec 2002 18:15:33 -0000      1.9
***************
*** 28,42 ****
                                'Property type attributes class'=> 
$GLOBALS['phpgw']->link('/property/list_property_type_attribute_class.php'),
                                'Workorder template'=> 
$GLOBALS['phpgw']->link('/property/list_wo_template.php'),
                                'ID Controle'=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiadmin.edit_id'),
                                'Permissions'=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiadmin.list_perm'),
!                               'Workorders status'=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uistatus.index&status_type=workorder'),
!                               'Request status'=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uistatus.index&status_type=request'),
!                               'Request type'=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uistatus.index&status_type=request'),
                //              'Request type attributes'=> 
$GLOBALS['phpgw']->link('/property/list_request_type_attribute.php'),
                                'Key location'=> 
$GLOBALS['phpgw']->link('/property/list_key_location.php'),
!                               'Branch'=> 
$GLOBALS['phpgw']->link('/property/list_branch.php'),
!                               'Accounting'=> 
$GLOBALS['phpgw']->link('/property/list_account.php'),
!                               'Accounting extra'=> 
$GLOBALS['phpgw']->link('/property/dim_d.php'),
!                               'Import workorder from FacilityCenter'=> 
$GLOBALS['phpgw']->link('/property/import_fc_workorder.php')
                        );
        //Do not modify below this line
--- 28,43 ----
                                'Property type attributes class'=> 
$GLOBALS['phpgw']->link('/property/list_property_type_attribute_class.php'),
                                'Workorder template'=> 
$GLOBALS['phpgw']->link('/property/list_wo_template.php'),
+                               'Tender chapter'=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uistandard_2.index&type=tender_chapter'),
                                'ID Controle'=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiadmin.edit_id'),
                                'Permissions'=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiadmin.list_perm'),
!                               'Workorders status'=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uistandard_2.index&type=workorder_status'),
!                               'Request status'=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uistandard_2.index&type=request_status'),
!                               'Request type'=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uistandard_2.index&type=request_type'),
                //              'Request type attributes'=> 
$GLOBALS['phpgw']->link('/property/list_request_type_attribute.php'),
                                'Key location'=> 
$GLOBALS['phpgw']->link('/property/list_key_location.php'),
!                               'Branch'=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uistandard_3.index&type=branch'),
!                               'Accounting'=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uistandard_2.index&type=accounting'),
!                               'Accounting extra'=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uistandard_2.index&type=dim_d'),
!       //                      'Import workorder from FacilityCenter'=> 
$GLOBALS['phpgw']->link('/property/import_fc_workorder.php')
                        );
        //Do not modify below this line




reply via email to

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