phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] property/inc/class.uiproject.inc.php, 1.2


From: nomail
Subject: [Phpgroupware-cvs] property/inc/class.uiproject.inc.php, 1.2
Date: Wed, 2 Jun 2004 20:54:28 +0200

Update of /property/inc
Added Files:
        Branch: 
          class.uiproject.inc.php

date: 2004/06/02 18:54:28;  author: sigurdne;  state: Exp;  lines: +1201 -0

Log Message:
no message
=====================================================================
<?php
        
/**************************************************************************\
        * phpGroupWare - property                                               
   *
        * http://www.phpgroupware.org                                           
   *
        *                                                                       
   *
        * Facilities Management                                                 
   *
        * Written by Sigurd Nes [sigurdne at online.no]                         
   *
        * 
------------------------------------------------------------------------ *
        * Copyright 2000 - 2003 Free Software Foundation, Inc                   
   *
        * This program is part of the GNU project, see http://www.gnu.org/      
   *
        * 
------------------------------------------------------------------------ *
        * This program is free software; you can redistribute it and/or modify 
it  *
        * under the terms of the GNU General Public License as published by the 
   *
        * Free Software Foundation; either version 2 of the License, or (at 
your   *
        * option) any later version.                                            
   *
        
\**************************************************************************/

        class uiproject
        {
                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
                (
                        'excel'  => True,
                        'index'  => True,
                        'view'   => True,
                        'edit'   => True,
                        'delete' => True,
                        'date_search'=>True
                );

                function uiproject()
                {
                        $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
                        $this->currentapp                       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->nextmatchs                       = 
CreateObject('phpgwapi.nextmatchs');
                        $this->account                          = 
$GLOBALS['phpgw_info']['user']['account_id'];

                        $this->bo                                       = 
CreateObject($this->currentapp.'.boproject',True);
                        $this->bocommon                         = 
CreateObject($this->currentapp.'.bocommon');
                        $this->menu                                     = 
CreateObject($this->currentapp.'.menu');

                        $this->acl2                             = 
CreateObject($this->currentapp.'.acl2');
                        $this->acl2_location            = '.project';
                        $this->acl_read                         = 
$this->acl2->check('.project',1);
                        $this->acl_add                          = 
$this->acl2->check('.project',2);
                        $this->acl_edit                         = 
$this->acl2->check('.project',4);
                        $this->acl_delete                       = 
$this->acl2->check('.project',8);

                        $this->start                            = 
$this->bo->start;
                        $this->query                            = 
$this->bo->query;
                        $this->sort                                     = 
$this->bo->sort;
                        $this->order                            = 
$this->bo->order;
                        $this->filter                           = 
$this->bo->filter;
                        $this->cat_id                           = 
$this->bo->cat_id;
                        $this->status_id                        = 
$this->bo->status_id;

                        $this->menu->sub                        ='project';
                }

                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,
                                'status_id'     => $this->status_id
                        );
                        $this->bo->save_sessiondata($data);
                }

                function excel()
                {
                        $GLOBALS['phpgw_info']['flags']['noframework'] = True;
                        require('PEAR.php');
                        $xls            = 
CreateObject($this->currentapp.'.excel');

                        $start_date = 
urldecode(get_var('start_date',array('POST','GET')));
                        $end_date       = 
urldecode(get_var('end_date',array('POST','GET')));
                        $list           = 
$this->bo->read($start_date,$end_date,$allrows=True);

                        $uicols = $this->bo->uicols;
                        $count_uicols_name=count($uicols['name']);

                        $j=0;
                        if (isset($list) AND is_array($list))
                        {
                                $str=$xls->Begin();
                                foreach($list as $entry)
                                {
                                        $m=0;
                                        for ($k=0;$k<$count_uicols_name;$k++)
                                        {
                                                
if($uicols['input_type'][$k]!='hidden')
                                                {
                                                        $content[$j][$m]        
= $entry[$uicols['name'][$k]];
                                                        
$str.=$xls->WriteLabel(0,$m,$uicols['descr'][$k]);
                                                        $m++;
                                                }
                                        }

                                        $j++;
                                }

                                foreach($content as $row)
                                {
                                        $line++;
                                        for ($i=0; $i<count($row); $i++)
                                        {
                                                
$str.=$xls->WriteLabel($line,$i,$row[$i]);
                                        }
                                }

                           $filename= 
$GLOBALS['phpgw_info']['user']['account_lid'].'.xls';

                                $str.=$xls->EOF();
                                $size=strlen($str);

                                $browser = CreateObject('phpgwapi.browser');
                                
$browser->content_header($filename,'application/vnd.ms-excel',$size);

                                echo $str;
                        }
                }

                function index()
                {
                        if(!$this->acl_read)
                        {
                                
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
 . $this->acl2_location);
                        }

                        
$GLOBALS['phpgw']->xslttpl->add_file(array('project','values','table_header',
                                                                                
'menu',
                                                                                
'nextmatchs',
                                                                                
'search_field'));

                        $lookup = get_var('lookup',array('POST','GET'));
                        $start_date             = 
urldecode(get_var('start_date',array('POST','GET')));
                        $end_date                       = 
urldecode(get_var('end_date',array('POST','GET')));

                        $links = $this->menu->links('project');

                        $project_list = $this->bo->read($start_date,$end_date);
                        $uicols = $this->bo->uicols;
                        $count_uicols_name=count($uicols['name']);

                        $j=0;
                        if (isSet($project_list) AND is_array($project_list))
                        {
                                foreach($project_list as $project_entry)

                                {
                                        for ($k=0;$k<$count_uicols_name;$k++)
                                        {
                                                
if($uicols['input_type'][$k]=='text')
                                                {

                                                        
if($project_entry['query_location'][$uicols['name'][$k]])
                                                        {
                                                                
$content[$j]['row'][$k]['statustext']                   = lang('search');
                                                                
$content[$j]['row'][$k]['text']                                 = 
$project_entry[$uicols['name'][$k]];
                                                                
$content[$j]['row'][$k]['link']                         = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.index&query='
 . $project_entry['query_location'][$uicols['name'][$k]] . '&lookup=' . $lookup 
. '&filter=' . $this->filter);
                                                        }
                                                        else
                                                        {
                                                                
$content[$j]['row'][$k]['value']                        = 
$project_entry[$uicols['name'][$k]];
                                                                
$content[$j]['row'][$k]['name']                         = $uicols['name'][$k];
                                                        }
                                                }
                                                
elseif($uicols['input_type'][$k]=='link')
                                                {
                                                        
$content[$j]['row'][$k]['statustext']                   = lang('search');
                                                        
$content[$j]['row'][$k]['text']                                 = 
$project_entry[$uicols['name'][$k]];
                                                        
$content[$j]['row'][$k]['link']                         = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitts.view&id='
 . $project_entry[$uicols['name'][$k]]);
                                                }

                                                if($lookup && 
$k==($count_uicols_name-2))
                                                {
                                                        
$content[$j]['row'][$k]['lookup_action']                        = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.edit&project_id='
 . $project_entry['project_id']);
                                                }
                                        }

                                        if(!$lookup)
                                        {
                                                if ($this->acl_read && 
$this->bocommon->check_perms($project_entry['grants'],PHPGW_ACL_READ))
                                                {
                                                        
$content[$j]['row'][$k]['statustext']                   = lang('view the 
project');
                                                        
$content[$j]['row'][$k]['text']                                 = lang('view');
                                                        
$content[$j]['row'][$k]['link']                                 = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.view&id='
 . $project_entry['project_id']);
                                                        $k++;
                                                }
                                                else
                                                {
                                                        
$content[$j]['row'][$k++]['link']='dummy';
                                                }

                                                if ($this->acl_edit && 
$this->bocommon->check_perms($project_entry['grants'],PHPGW_ACL_EDIT))
                                                {
                                                        
$content[$j]['row'][$k]['statustext']                   = lang('edit the 
project');
                                                        
$content[$j]['row'][$k]['text']                                 = lang('edit');
                                                        
$content[$j]['row'][$k]['link']                                 = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.edit&id='
 . $project_entry['project_id']);
                                                        $k++;
                                                }
                                                else
                                                {
                                                        
$content[$j]['row'][$k++]['link']='dummy';
                                                }

                                                if ($this->acl_delete && 
$this->bocommon->check_perms($project_entry['grants'],PHPGW_ACL_DELETE))
                                                {
                                                        
$content[$j]['row'][$k]['statustext']                   = lang('delete the 
project');
                                                        
$content[$j]['row'][$k]['text']                                 = 
lang('delete');
                                                        
$content[$j]['row'][$k]['link']                                 = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.delete&id='
 . $project_entry['project_id']);
                                                        $k++;
                                                }
                                                else
                                                {
                                                        
$content[$j]['row'][$k++]['link']='dummy';
                                                }
                                        }

                                        $j++;
                                }
                        }

                        $count_uicols_descr=count($uicols['descr']);
                        for ($i=0;$i<$count_uicols_descr;$i++)
                        {
                                if($uicols['input_type'][$i]!='hidden')
                                {
                                        $table_header[$i]['header']     = 
$uicols['descr'][$i];
                                        $table_header[$i]['width']              
= '5%';
                                        $table_header[$i]['align']              
= 'center';
                                        if($uicols['name'][$i]=='loc1')
                                        {
                                                $table_header[$i]['sort_link']  
=true;
                                                $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
                                                                                
(
                                                                                
        'sort'  => $this->sort,
                                                                                
        'var'   =>      'location_code',
                                                                                
        'order' =>      $this->order,
                                                                                
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uiproject.index',
                                                                                
                                                        'type_id'       
=>$type_id,
                                                                                
                                                        'query'         
=>$this->query,
                                                                                
                                                        'lookup'        
=>$lookup,
                                                                                
                                                        'district_id'   => 
$this->district_id,
                                                                                
                                                        'cat_id'        
=>$this->cat_id,
                                                                                
                                                        
'start_date'=>$start_date,
                                                                                
                                                        'end_date'=>$end_date)
                                                                                
));
                                        }
                                        if($uicols['name'][$i]=='project_id')
                                        {
                                                $table_header[$i]['sort_link']  
=true;
                                                $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
                                                                                
(
                                                                                
        'sort'  => $this->sort,
                                                                                
        'var'   =>      'project_id',
                                                                                
        'order' =>      $this->order,
                                                                                
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uiproject.index',
                                                                                
                                                        'type_id'       
=>$type_id,
                                                                                
                                                        'query'         
=>$this->query,
                                                                                
                                                        'lookup'        
=>$lookup,
                                                                                
                                                        'district_id'   => 
$this->district_id,
                                                                                
                                                        'cat_id'        
=>$this->cat_id,
                                                                                
                                                        
'start_date'=>$start_date,
                                                                                
                                                        'end_date'=>$end_date)
                                                                                
));
                                        }
                                        if($uicols['name'][$i]=='address')
                                        {
                                                $table_header[$i]['sort_link']  
=true;
                                                $table_header[$i]['sort']       
        = $this->nextmatchs->show_sort_order(array
                                                                                
(
                                                                                
        'sort'  => $this->sort,
                                                                                
        'var'   =>      'address',
                                                                                
        'order' =>      $this->order,
                                                                                
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uiproject.index',
                                                                                
                                                        'type_id'       
=>$type_id,
                                                                                
                                                        'query'         
=>$this->query,
                                                                                
                                                        'lookup'        
=>$lookup,
                                                                                
                                                        'district_id'   => 
$this->district_id,
                                                                                
                                                        'cat_id'        
=>$this->cat_id,
                                                                                
                                                        
'start_date'=>$start_date,
                                                                                
                                                        'end_date'=>$end_date)
                                                                                
));
                                        }
                                }
                        }

                        if(!$lookup)
                        {
                                if($this->acl_read)
                                {
                                        $table_header[$i]['width']              
        = '5%';
                                        $table_header[$i]['align']              
        = 'center';
                                        $table_header[$i]['header']             
        = lang('view');
                                        $i++;
                                }
                                if($this->acl_edit)
                                {
                                        $table_header[$i]['width']              
        = '5%';
                                        $table_header[$i]['align']              
        = 'center';
                                        $table_header[$i]['header']             
        = lang('edit');
                                        $i++;
                                }
                                if($this->acl_delete)
                                {
                                        $table_header[$i]['width']              
        = '5%';
                                        $table_header[$i]['align']              
        = 'center';
                                        $table_header[$i]['header']             
        = lang('delete');
                                        $i++;
                                }
                        }
                        else
                        {
                                $table_header[$i]['width']                      
= '5%';
                                $table_header[$i]['align']                      
= 'center';
                                $table_header[$i]['header']             = 
lang('select');
                        }

//_debug_array($content);
                        if($this->acl_add)
                        {
                                $table_add[] = array
                                (
                                        'lang_add'                              
=> lang('add'),
                                        'lang_add_statustext'   => lang('add a 
project'),
                                        'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.edit')
                                );
                        }

                        $link_data = array
                        (
                                'menuaction'    => 
$this->currentapp.'.uiproject.index',
                                                'sort'                  
=>$this->sort,
                                                'order'                 
=>$this->order,
                                                'cat_id'                
=>$this->cat_id,
                                                'district_id'   
=>$this->district_id,
                                                'filter'                
=>$this->filter,
                                                'status_id'             
=>$this->status_id,
                                                'lookup'                
=>$lookup,
                                                'query'                 
=>$this->query,
                                                'start_date'    =>$start_date,
                                                'end_date'              
=>$end_date
                        );

                        $link_date_search                                       
= 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.date_search');

                        $link_excel = array
                        (
                                'menuaction'    => 
$this->currentapp.'.uiproject.excel',
                                                'sort'                  
=>$this->sort,
                                                'order'                 
=>$this->order,
                                                'cat_id'                
=>$this->cat_id,
                                                'district_id'   
=>$this->district_id,
                                                'filter'                
=>$this->filter,
                                                'status_id'             
=>$this->status_id,
                                                'lookup'                
=>$lookup,
                                                'query'                 
=>$this->query,
                                                'start_date'    =>$start_date,
                                                'end_date'              
=>$end_date,
                                                'start' =>$this->start
                        );

                        $data = array
                        (
                                'lang_excel'                            => 
'excel',
                                'link_excel'                            => 
$GLOBALS['phpgw']->link('/index.php',$link_excel),
                                'lang_excel_help'                       => 
lang('Download table to MS Excel'),

                                'start_date'                            
=>$start_date,
                                'end_date'                                      
=>$end_date,
                                'lang_none'                                     
=>lang('None'),
                                'lang_date_search'                      => 
lang('Date search'),
                                'lang_date_search_help'         => lang('Narrow 
the search by dates'),
                                'link_date_search'                      => 
$link_date_search,
                                'overlib_source'                        => 
'./'.$this->currentapp.'/inc/overlib.js',

                                'lang_select'                                   
=> lang('select'),
                                'lookup_action'                                 
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.edit'),
                                'lookup'                                        
        => $lookup,
                                'links'                                         
        => $links,
                                'allow_allrows'                                 
=> false,
                                'start_record'                                  
=> $this->start,
                                'record_limit'                                  
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
                                'num_records'                                   
=> count($project_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','default'),
                                'lang_no_cat'                                   
=> lang('no category'),
                                'lang_cat_statustext'                   => 
lang('Select the category the project belongs to. To do not use a category 
select NO CATEGORY'),
                                'select_name'                                   
=> 'cat_id',
                                'cat_list'                                      
        => $this->bo->select_category_project_list('filter',$this->cat_id),
                                'district_list'                                 
=> $this->bocommon->select_district_list('filter',$this->district_id),
                                'lang_no_district'                              
=> lang('no district'),
                                'lang_district_statustext'              => 
lang('Select the district the selection belongs to. To do not use a district 
select NO DISTRICT'),
                                'select_district_name'                  => 
'district_id',
                                'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_data),

                                'lang_status_statustext'                => 
lang('Select the status the agreement belongs to. To do not use a category 
select NO STATUS'),
                                'status_name'                                   
=> 'status_id',
                                'lang_no_status'                                
=> lang('No status'),
                                'status_list'                                   
=> $this->bo->select_status_list('filter',$this->status_id),

                                'lang_user_statustext'                  => 
lang('Select the user the project belongs to. To do not use a category select 
NO USER'),
                                'select_user_name'                              
=> 'filter',
                                'lang_no_user'                                  
=> lang('No user'),
                                'user_list'                                     
        => 
$this->bocommon->get_user_list_right2('filter',4,$this->filter,$this->acl2_location,array('all'),$default=$this->account),

                                '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_search'                                   
=> lang('search'),
                                'table_header'                                  
=> $table_header,
                                'values'                                        
        => $content,
                                'table_add'                                     
        => $table_add
                        );

                        $appname                                                
= lang('Project');
                        $function_msg                                   = 
lang('list Project');

                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;

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

                function date_search()
                {
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('date_search'));
                        $GLOBALS['phpgw_info']['flags']['headonly']=true;
                        $values['start_date']           = 
get_var('start_date',array('POST'));
                        $values['end_date']                     = 
get_var('end_date',array('POST'));

                        $function_msg   = lang('Date search');
                        $appname                = lang('project');


                        $dateformat = 
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
                        $sep = '/';
                        $dlarr[strpos($dateformat,'y')] = 'yyyy';
                        $dlarr[strpos($dateformat,'m')] = 'MM';
                        $dlarr[strpos($dateformat,'d')] = 'DD';
                        ksort($dlarr);

                        $dateformat= (implode($sep,$dlarr));

                        if(!$values['end_date'])
                        {
                                $values['end_date'] = 
$GLOBALS['phpgw']->common->show_date(mktime(0,0,0,date("m"),date("d"),date("Y")),$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
                        }

                        $cal_info       = $this->bocommon->jscalendar();
                        $jsDateFormat=$cal_info['jsDateFormat'];

                        $data = array
                        (
                                'jsDateFormat'                                  
=> $jsDateFormat,
                                'date_img'                                      
        => $cal_info['img'],
                                'lang_datetitle'                                
=> lang('Select date'),
                                'calendar_setup_start'                  => 
"Calendar.setup({inputField  : 'start_date',ifFormat  : '" . $jsDateFormat . 
"',button : 'start_date-trigger'});",
                                'calendar_setup_end'                    => 
"Calendar.setup({inputField  : 'end_date',ifFormat  : '" . $jsDateFormat . 
"',button : 'end_date-trigger'});",

                                'lang_start_date_statustext'    => lang('Select 
the estimated end date for the Project'),
                                'lang_start_date'                               
=> lang('Start date'),
                                'value_start_date'                              
=> $values['start_date'],

                                'lang_end_date_statustext'              => 
lang('Select the estimated end date for the Project'),
                                'lang_end_date'                                 
=> lang('End date'),
                                'value_end_date'                                
=> $values['end_date'],

                                'dateformat'                                    
=> $dateformat,
                                'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
                                'lang_submit_statustext'                => 
lang('Select this dates'),
                                'lang_submit'                           => 
lang('Submit')
                        );

                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('date_search' => $data));
                }

                function edit()
                {
                        if(!$this->acl_add && !$this->acl_edit)
                        {
                                
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
 . $this->acl2_location);
                        }
                        $id                             = 
get_var('id',array('POST','GET'));
                        $values                         = 
get_var('values',array('POST'));
                        $add_request            = 
get_var('add_request',array('POST'));
                        $add_request            = 
get_var('add_request',array('POST'));

                        $config                         = 
CreateObject('phpgwapi.config');
                        $bolocation                     = 
CreateObject($this->currentapp.'.bolocation');

                        $insert_record = 
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp);
                        $insert_record_entity = 
$GLOBALS['phpgw']->session->appsession('insert_record_entity',$this->currentapp);

                        for ($j=0;$j<count($insert_record_entity);$j++)
                        {
                                
$insert_record['extra'][$insert_record_entity[$j]]      = 
$insert_record_entity[$j];
                        }

                        $GLOBALS['phpgw']->xslttpl->add_file(array('project'));

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

                        if($add_request)
                        {
                                $receipt = 
$this->bo->add_request($add_request,$id);
                        }

                        if($_POST && !$bypass)
                        {
                                for ($i=0; 
$i<count($insert_record['location']); $i++)
                                {
                                        
if($_POST[$insert_record['location'][$i]])
                                        {
                                                
$values['location'][$insert_record['location'][$i]]= 
$_POST[$insert_record['location'][$i]];
                                        }
                                }

                                while (is_array($insert_record['extra']) && 
list($key,$column) = each($insert_record['extra']))
                                {
                                        if($_POST[$key])
                                        {
                                                $values['extra'][$column]       
= $_POST[$key];
                                        }
                                }

                                $values['street_name']          = 
$_POST['street_name'];
                                $values['street_number']        = 
$_POST['street_number'];
                                $values['location_name']        = $_POST['loc' 
. (count($values['location'])).'_name']; // if not address - get the parent 
name as address

                        }
                        else
                        {
                                $location_code          = 
get_var('location_code',array('POST','GET'));
                                $tenant_id                      = 
get_var('tenant_id',array('POST','GET'));
                                $values['descr']        = 
get_var('descr',array('POST','GET'));
                                $ticket_id                      = 
get_var('ticket_id',array('POST','GET'));
                                $request_id             = 
get_var('request_id',array('POST','GET'));
                                $p_entity_id            = 
get_var('p_entity_id',array('POST','GET'));
                                $p_cat_id                       = 
get_var('p_cat_id',array('POST','GET'));
                                $values['p'][$p_entity_id]['p_entity_id']       
        = $p_entity_id;
                                $values['p'][$p_entity_id]['p_cat_id']          
        = $p_cat_id;
                                $values['p'][$p_entity_id]['p_num']             
                = get_var('p_num',array('POST','GET'));

                                if($p_entity_id && $p_cat_id)
                                {
                                        $boadmin_entity = 
CreateObject($this->currentapp.'.boadmin_entity');
                                        $entity_category = 
$boadmin_entity->read_single_category($p_entity_id,$p_cat_id);
                                        
$values['p'][$p_entity_id]['p_cat_name'] = $entity_category['name'];
                                }

                                if($ticket_id)
                                {
                                        $values['ticket_id'][0]['id']= 
$ticket_id;
                                        $values['origin']= 'tts';
                                        $values['origin_id']= $ticket_id;
                                }

                                if($request_id)
                                {
                                        $values['request_id'][0]['id']= 
$request_id;
                                        $values['origin']= 'request';
                                        $values['origin_id']= $request_id;
                                }

                                if($location_code)
                                {
                                        $values['location_data'] = 
$bolocation->read_single($location_code,array('tenant_id'=>$tenant_id,'p_num'=>$p_num));
                                }

                        }

                        $values['start_date']           = 
get_var('start_date',array('POST'));
                        $values['end_date']                     = 
get_var('end_date',array('POST'));

//_debug_array($values);
                        $config->read_repository();

                        if ($values['save'])
                        {
                                $save=true;

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

                                if(!$values['name'])
                                {
                                        
$receipt['error'][]=array('msg'=>lang('Please enter a project NAME !'));
                                        $error_id=true;
                                }

                                if(!$values['cat_id'])
                                {
                                        
$receipt['error'][]=array('msg'=>lang('Please select a category !'));
                                        $error_id=true;
                                }

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

                                if(!$values['status'])
                                {
                                        
$receipt['error'][]=array('msg'=>lang('Please select a status !'));
                                }

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

                                if(!$receipt['error'])
                                {
                                        if(!$id)
                                        {
                                                
$values['project_id']=$this->bo->next_project_id();
                                                $id     = $values['project_id'];
                                        }

                                        if($values['copy_project'])
                                        {
                                                $action='add';
                                                $values['project_id']   = 
$this->bo->next_project_id();
                                                $id     = $values['project_id'];
                                        }
                                        $receipt = 
$this->bo->save($values,$action);
                                        if($receipt['error'])
                                        {
                                                unset($id);
                                                unset($values['project_id']);
                                        }

                                        if ($values['approval'] && 
$values['mail_address'])
                                        {
                                                
$coordinator_name=$GLOBALS['phpgw_info']['user']['fullname'];
                                                
$coordinator_email=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['email'];
                                                $headers = "Return-Path: <". 
$coordinator_email .">\r\n";
                                                $headers .= "From: " . 
$coordinator_name . "<" . $coordinator_email .">\r\n";
                                                $headers .= "Bcc: " . 
$coordinator_name . "<" . $coordinator_email .">\r\n";
                                                $headers .= "Content-type: 
text/plain; charset=iso-8859-1\r\n";

                                                $subject = lang(Approval).": ". 
$values['project_id'];
                                                $message = lang(Project) . " " 
. $values['project_id'] ." ". lang('needs approval');

                                                $mail_method= 
$config->config_data['fmwrkorder_mail'];
                                                if ($mail_method=='smtp'):
                                                {
                                                        $bcc = 
$coordinator_email;
                                                        $send = 
CreateObject('phpgwapi.send');
                                                        $rcpt = 
$send->msg('email',$values['mail_address'], $subject, stripslashes($message), 
'', $cc, $bcc, $coordinator_email, $coordinator_name, 'plain');
                                                }
                                                elseif 
($mail_method=='sendmail'):
                                                {
                                                        
$rcpt=mail($values['mail_address'],$subject,$message, $headers);
                                                }
                                                else:
                                                {
                                                        
$receipt['error'][]=array('msg'=>lang('Mailing method is not chosen! (admin 
section)'));
                                                }
                                                endif;
                                        }

                                        if($rcpt)
                                        {
                                                
$receipt['message'][]=array('msg'=>lang('%1 is 
notified',$values['mail_address']));
                                        }
                                }

                                if($receipt['error'])
                                {
                                        if($values['location'])
                                        {
                                                $location_code=implode("-", 
$values['location']);
                                                $values['location_data'] = 
$bolocation->read_single($location_code,$values['extra']);
                                        }

                                        if($values['extra']['p_num'])
                                        {
                                                
$values['p'][$values['extra']['p_entity_id']]['p_num']=$values['extra']['p_num'];
                                                
$values['p'][$values['extra']['p_entity_id']]['p_entity_id']=$values['extra']['p_entity_id'];
                                                
$values['p'][$values['extra']['p_entity_id']]['p_cat_id']=$values['extra']['p_cat_id'];
                                                
$values['p'][$values['extra']['p_entity_id']]['p_cat_name']=$_POST['entity_cat_name_'.$values['extra']['p_entity_id']];
                                        }
                                }
                        }

                        if(((!$receipt['error'] || $add_request) && !$bypass) 
&& $id)
                        {
                                $values = $this->bo->read_single($id);

                                if(!$values['workorder_budget'] && $save)
                                {
                                        
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.edit&project_id='
 . $id);

                                }

                                if 
(!$this->bocommon->check_perms($values['grants'],PHPGW_ACL_EDIT))
                                {
                                        
$receipt['error'][]=array('msg'=>lang('You have no edit right for this 
project'));
                                        
$GLOBALS['phpgw']->session->appsession('receipt',$this->currentapp,$receipt);

                                        
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiproject.view&id='
 . $id);

                                }
                                else
                                {
                                        $record_history = 
$this->bo->read_record_history($id);
                                }
                        }


                        $table_header_history[] = array
                        (
                                'lang_date'                     => lang('Date'),
                                'lang_user'                     => lang('User'),
                                'lang_action'           => lang('Action'),
                                'lang_new_value'        => lang('New value')
                        );

                        $table_header_workorder_budget[] = array
                        (
                                'lang_workorder_id'     => lang('Workorder'),
                                'lang_budget'           => lang('Budget'),
                                'lang_calculation'      => lang('Calculation'),
                                'lang_vendor'   => lang('Vendor')
                        );

                        if ($id)
                        {
                                $function_msg = lang('Edit Project');
                        }
                        else
                        {
                                $function_msg = lang('Add Project');
                        }

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

                        $lookup_type='form';

//_debug_array($values);
                        $location_data=$bolocation->initiate_ui_location(array(
                                                'values'                => 
$values['location_data'],
                                                'type_id'               => -1, 
// calculated from location_types
                                                'no_link'               => 
False, // disable lookup links for location type less than type_id
                                                'tenant'                => True,
                                                'lookup_type'   => $lookup_type,
                                                'lookup_entity' => 
$this->bocommon->get_lookup_entity('project'),
                                                'entity_data'   => $values['p']
                                                ));


                        $link_data = array
                        (
                                'menuaction'    => 
$this->currentapp.'.uiproject.edit',
                                'id'                    => $id
                        );

                        $link_request_data = array
                        (
                                'menuaction'    => 
$this->currentapp.'.uirequest.index',
                                'query'                 => 
$values['location_code'],
                                'project_id'    => $values['project_id']
                        );


                        
$supervisor_id=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['approval_from'];
                        $need_approval = 
$config->config_data['workorder_approval'];

                        
$project_status=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['project_status'];
                        
$project_category=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['project_category'];
                        if(!$values['status'])
                        {
                                $values['status']=$project_status;
                        }

                        if(!$values['cat_id'])
                        {
                                $values['cat_id']=$project_category;
                        }

                        if(!$values['coordinator'])
                        {
                                $values['coordinator']=$this->account;
                        }

                        if ($supervisor_id && $need_approval=='yes')
                        {
                                $prefs = 
$this->bocommon->create_preferences($this->currentapp,$supervisor_id);
                                $supervisor_email = $prefs['email'];
                        }

                        if(!$values['start_date'])
                        {
                                $values['start_date'] = 
$GLOBALS['phpgw']->common->show_date(mktime(0,0,0,date("m"),date("d"),date("Y")),$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
                        }

                        if($receipt)
                        {
                                $msgbox_data = 
$this->bocommon->msgbox_data($receipt);
                        }

                        if($values['reserve'])
                        {
                                
$reserve_remainder=$values['reserve']-$values['deviation'];
                                $remainder_percent= 
number_format(($reserve_remainder/$values['reserve'])*100, 2, ',', '');
                        }

                        $cal_info       = $this->bocommon->jscalendar();
                        $jsDateFormat=$cal_info['jsDateFormat'];

                        $data = array
                        (
                                'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
                                'lang_ticket'                                   
=> lang('ticket'),
                                'lang_ticket_statustext'                => 
lang('Link to the ticket for this project'),
                                'link_ticket'                                   
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitts.view'),
                                'value_ticket_id'                               
=> $values['ticket_id'],

                                'value_origin'                                  
=> $values['origin'],
                                'value_origin_id'                               
=> $values['origin_id'],

                                'lang_request'                                  
=> lang('request'),
                                'lang_select_request'                   => 
lang('Select request'),
                                'lang_select_request_statustext'        => 
lang('Add request for this project'),
                                'lang_request_statustext'               => 
lang('Link to the request for this project'),
                                'lang_delete_request_statustext'=> lang('Check 
to delete this request from this project'),
                                'link_select_request'                   => 
$GLOBALS['phpgw']->link('/index.php',$link_request_data),
                                'value_request_id'                              
=> $values['request_id'],
                                'link_request'                                  
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uirequest.view'),

                                'add_workorder_action'                          
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.edit'),
                                'lang_add_workorder'                            
=> lang('Add Workorder'),
                                'lang_add_workorder_statustext'         => 
lang('Add a workorder to this project'),

                                'table_header_workorder_budget' => 
$table_header_workorder_budget,
                                'lang_no_workorders'                    => 
lang('No workorder bugdet'),
                                'workorder_link'                                
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.edit'),
                                'record_history'                                
=> $record_history,
                                'table_header_history'                  => 
$table_header_history,
                                'lang_history'                                  
=> lang('History'),
                                'lang_no_history'                               
=> lang('No history'),

//                              'cal_info'                                      
        => $cal_info,
                                'jsDateFormat'                                  
=> $jsDateFormat,
                                'date_img'                                      
        => $cal_info['img'],
                                'lang_datetitle'                                
=> lang('Select date'),
                                'calendar_setup_start'                  => 
"Calendar.setup({inputField  : 'start_date',ifFormat  : '" . $jsDateFormat . 
"',button : 'start_date-trigger'});",
                                'calendar_setup_end'                    => 
"Calendar.setup({inputField  : 'end_date',ifFormat  : '" . $jsDateFormat . 
"',button : 'end_date-trigger'});",

                                'lang_start_date_statustext'    => lang('Select 
the estimated end date for the Project'),
                                'lang_start_date'                               
=> lang('Project start date'),
                                'value_start_date'                              
=> $values['start_date'],

                                'lang_end_date_statustext'              => 
lang('Select the estimated end date for the Project'),
                                'lang_end_date'                                 
=> lang('Project end date'),
                                'value_end_date'                                
=> $values['end_date'],

                                'lang_copy_project'                             
=> lang('Copy project ?'),
                                'lang_copy_project_statustext'  => lang('Choose 
Copy Project to copy this project to a new project'),

                                'lang_charge_tenant'                    => 
lang('Charge tenant'),
                                'lang_charge_tenant_statustext' => lang('Choose 
charge tenant if the tenant i to pay for this project'),
                                'charge_tenant'                                 
=> $values['charge_tenant'],

                                'lang_power_meter'                              
=> lang('Power meter'),
                                'lang_power_meter_statustext'   => lang('Enter 
the power_meter'),
                                'value_power_meter'                             
=> $values['power_meter'],

                                'lang_budget'                                   
=> lang('Budget'),
                                'value_budget'                                  
=> $values['budget'],
                                'lang_budget_statustext'                => 
lang('Enter the budget'),

                                'lang_reserve'                                  
=> lang('reserve'),
                                'value_reserve'                                 
=> $values['reserve'],
                                'lang_reserve_statustext'               => 
lang('Enter the reserve'),

                                'lang_reserve_remainder'                => 
lang('reserve remainder'),
                                'value_reserve_remainder'               => 
$reserve_remainder,
                                'value_reserve_remainder_percent'=> 
$remainder_percent,

                                'vendor_data'                                   
=> $vendor_data,
                                'location_data'                                 
=> $location_data,
                                'location_type'                                 
=> 'form',
                                'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
                                'done_action'                                   
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.index'),
                                'lang_year'                                     
        => lang('Year'),
                                'lang_category'                                 
=> lang('category'),
                                'lang_save'                                     
        => lang('save'),
                                'lang_done'                                     
        => lang('done'),
                                'lang_name'                                     
        => lang('Name'),

                                'lang_project_id'                               
=> lang('Project ID'),
                                'value_project_id'                              
=> $values['project_id'],
                                'value_name'                                    
=> $values['name'],
                                'lang_name_statustext'                  => 
lang('Enter Project Name'),

                                'lang_other_branch'                             
        => lang('Other branch'),
                                'lang_other_branch_statustext'          => 
lang('Enter other branch if not found in the list'),
                                'value_other_branch'                            
=> $values['other_branch'],

                                'lang_descr_statustext'                 => 
lang('Enter a description of the project'),
                                'lang_descr'                                    
=> lang('Description'),
                                'value_descr'                                   
=> $values['descr'],
                                'lang_done_statustext'                  => 
lang('Back to the list'),
                                'lang_save_statustext'                  => 
lang('Save the project'),
                                'lang_no_cat'                                   
=> lang('Select category'),
                                'lang_cat_statustext'                   => 
lang('Select the category the project belongs to. To do not use a category 
select NO CATEGORY'),
                                'select_name'                                   
=> 'values[cat_id]',
                                'value_cat_id'                                  
=> $values['cat_id'],
                                'cat_list'                                      
        => $this->bo->select_category_project_list('select',$values['cat_id']),

                                'lang_workorder_id'                             
=> lang('Workorder ID'),
                                'sum_workorder_budget'                  => 
$values['sum_workorder_budget'],
                                'sum_workorder_calculation'             => 
$values['sum_workorder_calculation'],
                                'workorder_budget'                              
=> $values['workorder_budget'],

                                'lang_coordinator'                              
=> lang('Coordinator'),
                                'lang_sum'                                      
        => lang('Sum'),
                                'lang_user_statustext'                  => 
lang('Select the coordinator the project belongs to. To do not use a category 
select NO USER'),
                                'select_user_name'                              
=> 'values[coordinator]',
                                'lang_no_user'                                  
=> lang('Select coordinator'),
                                'user_list'                                     
        => 
$this->bocommon->get_user_list_right2('select',4,$values['coordinator'],$this->acl2_location),

                                'status_list'                                   
=> $this->bo->select_status_list('select',$values['status']),
                                'select_status_name'                    => 
'values[status]',
                                'lang_no_status'                                
=> lang('Select status'),
                                'lang_status'                                   
=> lang('Status'),
                                'lang_status_statustext'                => 
lang('What is the current status of this project ?'),

                                'branch_list'                                   
=> $this->bo->select_branch_p_list($values['project_id']),
                                'lang_branch'                                   
=> lang('branch'),
                                'lang_branch_statustext'                => 
lang('Select the branches for this project'),

                                'key_responsible_list'                          
        => $this->bo->select_branch_list($values['key_responsible']),
                                'lang_no_key_responsible'                       
        => lang('Select key responsible'),
                                'lang_key_responsible'                          
        => lang('key responsible'),
                                'lang_key_responsible_statustext'               
=> lang('Select the key responsible for this project'),

                                'key_fetch_list'                                
        => $this->bo->select_key_location_list($values['key_fetch']),
                                'lang_no_key_fetch'                             
        => lang('Where to fetch the key'),
                                'lang_key_fetch'                                
        => lang('key fetch location'),
                                'lang_key_fetch_statustext'                     
=> lang('Select where to fetch the key'),

                                'key_deliver_list'                              
        => $this->bo->select_key_location_list($values['key_deliver']),
                                'lang_no_key_deliver'                           
=> lang('Where to deliver the key'),
                                'lang_key_deliver'                              
        => lang('key deliver location'),
                                'lang_key_deliver_statustext'           => 
lang('Select where to deliver the key'),

                                'need_approval'                                 
        => $need_approval,
                                'lang_ask_approval'                             
        => lang('Ask for approval'),
                                'lang_ask_approval_statustext'          => 
lang('Check this to send a mail to your supervisor for approval'),
                                'value_approval_mail_address'           => 
$supervisor_email,


                                'currency'                                      
        => $GLOBALS['phpgw_info']['user']['preferences']['common']['currency']
                        );

                        $appname                = lang('project');
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
                }

                function delete()
                {
                        if(!$this->acl_delete)
                        {
                                
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=8&acl_location='
 . $this->acl2_location);
                        }

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

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

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

                        
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));

                        $data = array
                        (
                                'done_action'                   => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
                                'delete_action'                 => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.delete&project_id='
 . $project_id),
                                'lang_confirm_msg'              => lang('do you 
really want to delete this entry'),
                                'lang_yes'                              => 
lang('yes'),
                                'lang_yes_statustext'   => lang('Delete the 
entry'),
                                'lang_no_statustext'    => lang('Back to the 
list'),
                                'lang_no'                               => 
lang('no')
                        );

                        $appname                                                
= lang('project');
                        $function_msg                                   = 
lang('delete project');

                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
                }

                function view()
                {
                        if(!$this->acl_read)
                        {
                                
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
 . $this->acl2_location);
                        }

                        $receipt = 
$GLOBALS['phpgw']->session->appsession('receipt',$this->currentapp);
                        
$GLOBALS['phpgw']->session->appsession('receipt',$this->currentapp,'');
                        $bolocation                     = 
CreateObject($this->currentapp.'.bolocation');

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

                        $GLOBALS['phpgw']->xslttpl->add_file(array('project'));

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

                        $record_history = $this->bo->read_record_history($id);

                        $table_header_history[] = array
                        (
                                'lang_date'                     => lang('Date'),
                                'lang_user'                     => lang('User'),
                                'lang_action'           => lang('Action'),
                                'lang_new_value'        => lang('New value')
                        );

                        $table_header_workorder_budget[] = array
                        (
                                'lang_workorder_id'     => lang('Workorder'),
                                'lang_budget'           => lang('Budget'),
                                'lang_calculation'      => lang('Calculation'),
                                'lang_vendor'   => lang('Vendor')
                        );

                        $function_msg = lang('View Project');

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

                        $location_data=$bolocation->initiate_ui_location(array(
                                                'values'                => 
$values['location_data'],
                                                'type_id'               => 
count(explode('-',$values['location_data']['location_code'])),
                                                'no_link'               => 
False, // disable lookup links for location type less than type_id
                                                'tenant'                => 
$values['location_data']['tenant_id'],
                                                'lookup_type'   => 'view',
                                                'lookup_entity' => 
$this->bocommon->get_lookup_entity('project'),
                                                'entity_data'   => $values['p']
                                                ));


                        if($values['reserve'])
                        {
                                
$reserve_remainder=$values['reserve']-$values['deviation'];
                                $remainder_percent= 
number_format(($reserve_remainder/$values['reserve'])*100, 2, ',', '');
                        }

//_debug_array($values);
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);

                        $data = array
                        (
                                'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),

                                'lang_ticket'                                   
=> lang('ticket'),
                                'lang_ticket_statustext'                => 
lang('Link to the ticket for this project'),
                                'link_ticket'                                   
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitts.view'),
                                'value_ticket_id'                               
=> $values['ticket_id'],

                                'lang_request'                                  
=> lang('request'),
                                'lang_request_statustext'               => 
lang('Link to the request for this project'),
                                'value_request_id'                              
=> $values['request_id'],
                                'link_request'                                  
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uirequest.view'),

                                'table_header_workorder_budget' => 
$table_header_workorder_budget,
                                'lang_no_workorders'                    => 
lang('No workorder bugdet'),
                                'workorder_link'                                
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.view'),
                                'record_history'                                
=> $record_history,
                                'table_header_history'                  => 
$table_header_history,
                                'lang_history'                                  
=> lang('History'),
                                'lang_no_history'                               
=> lang('No history'),

                                'lang_start_date'                               
=> lang('Project start date'),
                                'value_start_date'                              
=> $values['start_date'],

                                'lang_end_date'                                 
=> lang('Project end date'),
                                'value_end_date'                                
=> $values['end_date'],

                                'lang_charge_tenant'                    => 
lang('Charge tenant'),
                                'charge_tenant'                                 
=> $values['charge_tenant'],

                                'lang_power_meter'                              
=> lang('Power meter'),
                                'value_power_meter'                             
=> $values['power_meter'],

                                'lang_budget'                                   
=> lang('Budget'),
                                'value_budget'                                  
=> $values['budget'],

                                'lang_reserve'                                  
=> lang('reserve'),
                                'value_reserve'                                 
=> $values['reserve'],
                                'lang_reserve_statustext'               => 
lang('Enter the reserve'),

                                'lang_reserve_remainder'                => 
lang('reserve remainder'),
                                'value_reserve_remainder'               => 
$reserve_remainder,
                                'value_reserve_remainder_percent'=> 
$remainder_percent,

                                'vendor_data'                                   
=> $vendor_data,
                                'location_data'                                 
=> $location_data,
                                'location_type'                                 
=> 'view',
                                'done_action'                                   
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.index'),
                                'lang_year'                                     
        => lang('Year'),
                                'lang_category'                                 
=> lang('category'),
                                'lang_save'                                     
        => lang('save'),
                                'lang_done'                                     
        => lang('done'),
                                'lang_name'                                     
        => lang('Name'),

                                'lang_project_id'                               
=> lang('Project ID'),
                                'value_project_id'                              
=> $values['project_id'],
                                'value_name'                                    
=> $values['name'],

                                'lang_other_branch'                             
        => lang('Other branch'),
                                'value_other_branch'                            
=> $values['other_branch'],

                                'lang_descr'                                    
=> lang('Description'),
                                'value_descr'                                   
=> $values['descr'],
                                'lang_done_statustext'                  => 
lang('Back to the list'),
                                'select_name'                                   
=> 'values[cat_id]',
                                'cat_list'                                      
        => $this->bo->select_category_project_list('select',$values['cat_id']),

                                'lang_workorder_id'                             
=> lang('Workorder ID'),
                                'sum_workorder_budget'                  => 
$values['sum_workorder_budget'],
                                'sum_workorder_calculation'             => 
$values['sum_workorder_calculation'],
                                'workorder_budget'                              
=> $values['workorder_budget'],

                                'lang_coordinator'                              
=> lang('Coordinator'),
                                'lang_sum'                                      
        => lang('Sum'),
                                'select_user_name'                              
=> 'values[coordinator]',
                                'lang_no_user'                                  
=> lang('Select coordinator'),
                                'user_list'                                     
        => $this->bocommon->get_user_list('select',$values['coordinator']),

                                'status_list'                                   
=> $this->bo->select_status_list('select',$values['status']),
                                'lang_no_status'                                
=> lang('Select status'),
                                'lang_status'                                   
=> lang('Status'),

                                'branch_list'                                   
=> $this->bo->select_branch_p_list($values['project_id']),
                                'lang_branch'                                   
=> lang('branch'),

                                'key_responsible_list'                          
        => $this->bo->select_branch_list($values['key_responsible']),
                                'lang_key_responsible'                          
        => lang('key responsible'),

                                'key_fetch_list'                                
        => $this->bo->select_key_location_list($values['key_fetch']),
                                'lang_key_fetch'                                
        => lang('key fetch location'),

                                'key_deliver_list'                              
        => $this->bo->select_key_location_list($values['key_deliver']),
                                'lang_key_deliver'                              
        => lang('key deliver location'),

                                'edit_action'                                   
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.edit&id='
 . $id),
                                'lang_edit_statustext'                          
=> lang('Edit this entry project'),
                                'lang_edit'                                     
                => lang('Edit'),
                                'currency'                                      
                => 
$GLOBALS['phpgw_info']['user']['preferences']['common']['currency']
                        );

                        $appname                = lang('project');
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
                }
        }
?>




reply via email to

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