phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] property/class.uitenant.php, 1.1.1.3


From: nomail
Subject: [Phpgroupware-cvs] property/class.uitenant.php, 1.1.1.3
Date: Fri, 21 May 2004 19:14:31 -0000

Update of /property
Modified Files:
        Branch: 
          class.uitenant.php

date: 2004/04/23 21:26:42;  author: sigurdne;  state: Exp;  lines: +381 -381

Log Message:
no message
=====================================================================
Index: property/class.uitenant.php
diff -u property/class.uitenant.php:1.1.1.2 property/class.uitenant.php:1.1.1.3
--- property/class.uitenant.php:1.1.1.2 Fri Apr 23 20:27:00 2004
+++ property/class.uitenant.php Fri Apr 23 21:26:42 2004
@@ -1,381 +1,381 @@
-<?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.                                            
   *
-       
\**************************************************************************/
-       /* $Id$ */
-
-       class property_uitenant
-       {
-               var $grants;
-               var $cat_id;
-               var $start;
-               var $query;
-               var $sort;
-               var $order;
-               var $filter;
-
-               var $public_functions = array
-               (
-                       'index'  => True,
-                       'view'   => True,
-                       'edit'   => True,
-                       'delete' => True
-               );
-
-               function property_uitenant()
-               {
-                       $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
-                       $this->currentapp       = 'property'; 
//$GLOBALS['phpgw_info']['flags']['currentapp'];
-                       $this->account          = 
$GLOBALS['phpgw_data']['user']['id'];
-
-                       $this->bo                       = 
CreateObject($this->currentapp.'_botenant',True);
-                       $this->bocommon         = 
CreateObject($this->currentapp.'_bocommon');
-                       $this->menu                                     = 
CreateObject($this->currentapp.'_menu');
-                       $this->fm_session       = 
CreateObject($this->currentapp.'_session');
-
-                       $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->allrows          = $this->bo->allrows;
-               }
-
-               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,
-                               'allrows'       => $this->allrows
-                       );
-                       $this->bo->save_sessiondata($data);
-               }
-
-               function index()
-               {
-                       $this->bocommon->xsl_add_file(array('tenant',
-                                                                               
'menu',
-                                                                               
'receipt',
-                                                                               
'search_field',
-                                                                               
'nextmatchs'));
-
-                       $links = $this->menu->links();
-
-                       $receipt = 
$this->fm_session->appsession('session_data','tenant_receipt');
-                       
$this->fm_session->appsession('session_data','tenant_receipt','');
-
-                       $tenants_list = $this->bo->read();
-
-                       while (is_array($tenants_list) && list(,$tenant) = 
each($tenants_list))
-                       {
-                               $content[] = array
-                               (
-                                       'tenant_id'                             
        => $tenant['tenant_id'],
-                                       'name'                                  
        => $tenant['name'],
-                                       'entry_date'                            
=> $tenant['entry_date'],
-                                       'category'                              
        => $tenant['category'],
-                                       'link_view'                             
        => 
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uitenant.view&tenant_id='
 . $tenant['tenant_id']),
-                                       'link_edit'                             
        => 
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uitenant.edit&tenant_id='
 . $tenant['tenant_id']),
-                                       'link_delete'                           
=> 
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uitenant.delete&tenant_id='
 . $tenant['tenant_id']),
-                                       'lang_view_statustext'          => 
lang('view the tenant'),
-                                       'lang_edit_statustext'          => 
lang('edit the tenant'),
-                                       'lang_delete_statustext'        => 
lang('delete the tenant'),
-                                       'text_view'                             
        => lang('view'),
-                                       'text_edit'                             
        => lang('edit'),
-                                       'text_delete'                           
=> lang('delete')
-                               );
-                       }
-
-                       $table_header = array
-                       (
-                               'lang_name'                     => lang('name'),
-                               'lang_time_created'     => lang('time created'),
-                               'lang_view'                     => lang('view'),
-                               'lang_edit'                     => lang('edit'),
-                               'lang_delete'           => lang('delete'),
-                               'lang_tenant_id'                => lang('tenant 
id'),
-                               'sort_name'             => 
$this->bocommon->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'last_name',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra'         => array('sid=cookie&op'        => 
$this->currentapp.'.uitenant.index',
-                                                                               
                                                        'cat_id'        => 
$this->cat_id,
-                                                                               
                                                        'query'         
=>$this->query,
-                                                                               
                                                        'allrows'       
=>$this->allrows)
-                                                                               
)),
-                               'sort_tenant_id'                => 
$this->bocommon->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'tenant_id',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra'         => array('sid=cookie&op'        => 
$this->currentapp.'.uitenant.index',
-                                                                               
                                                        'cat_id'        => 
$this->cat_id,
-                                                                               
                                                        'query'         
=>$this->query,
-                                                                               
                                                        'allrows'       
=>$this->allrows)
-                                                                               
)),
-                               'sort_time_created'     => 
$this->bocommon->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'entry_date',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('sid=cookie&op'        => 
$this->currentapp.'.uitenant.index',
-                                                                               
                                                        'cat_id'        
=>$this->cat_id,
-                                                                               
                                                        'query'         
=>$this->query,
-                                                                               
                                                        'allrows'       
=>$this->allrows)
-                                                                               
)),
-                               'sort_category' => 
$this->bocommon->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'descr',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('sid=cookie&op'        => 
$this->currentapp.'.uitenant.index',
-                                                                               
                                                        'cat_id'        
=>$this->cat_id,
-                                                                               
                                                        'query'         
=>$this->query,
-                                                                               
                                                        'allrows'       
=>$this->allrows)
-                                                                               
)),
-                               'lang_category'         => lang('category')
-                       );
-
-                       $table_add = array
-                       (
-                               'lang_add'                              => 
lang('add'),
-                               'lang_add_statustext'   => lang('add a tenant'),
-                               'add_action'                    => 
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uitenant.edit')
-                       );
-
-                       $link_data = array
-                       (
-                               'sid=cookie&op' => 
$this->currentapp.'.uitenant.index',
-                                               'sort'                  
=>$this->sort,
-                                               'order'                 
=>$this->order,
-                                               'cat_id'                
=>$this->cat_id,
-                                               'filter'                
=>$this->filter,
-                                               'query'                 
=>$this->query
-                       );
-
-                       if(!$this->allrows)
-                       {
-                               $record_limit   = 15; 
//$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
-                       }
-                       else
-                       {
-                               $record_limit   = $this->bo->total_records;
-                       }
-
-                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
-                       $data = array
-                       (
-                               'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
-                               'links'                                         
        => $links,
-                               'allow_allrows'                                 
=> false,
-                               'allrows'                                       
        => $this->allrows,
-                               'start_record'                                  
=> $this->start,
-                               'record_limit'                                  
=> $record_limit,
-                               'num_records'                                   
=> count($tenants_list),
-                               'all_records'                                   
=> $this->bo->total_records,
-                               'link_url'                                      
        => $this->bocommon->link('/index.php',$link_data),
-                               'img_path'                                      
        => 
dirname($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']).'/api/skins/default/images',
-                               'lang_no_cat'                                   
=> lang('no category'),
-                               'lang_cat_statustext'                   => 
lang('Select the category the tenant belongs to. To do not use a category 
select NO CATEGORY'),
-                               'select_name'                                   
=> 'cat_id',
-                               'cat_list'                                      
        => $this->bo->select_category_list('filter',$this->cat_id),
-                               'select_action'                                 
=> $this->bocommon->link('/index.php',$link_data),
-                               'filter_list'                                   
=> $this->bocommon->xslt_filter(array('filter' => $this->filter)),
-                               'lang_filter_statustext'                => 
lang('Select the filter. To show all entries select SHOW ALL'),
-                               'lang_searchfield_statustext'   => lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again'),
-                               'lang_searchbutton_statustext'  => lang('Submit 
the search string'),
-                               'query'                                         
        => $this->query,
-                               'lang_search'                                   
=> lang('search'),
-                               'table_header'                                  
=> $table_header,
-                               'values'                                        
        => $content,
-                               'table_add'                                     
        => $table_add
-                       );
-                       //$this->save_sessiondata();
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('tenant') . ': ' . lang('list tenant');
-
-                       return array('list' => $data);
-               }
-
-               function edit()
-               {
-                       $tenant_id      = 
get_var('tenant_id',array('POST','GET'));
-                       $values         = get_var('values',array('POST'));
-
-                       $this->bocommon->xsl_add_file(array('tenant'));
-
-                       if (is_array($values))
-                       {
-                               if ($values['save'] || $values['apply'])
-                               {
-
-                                       if(!$values['cat_id'])
-                                       {
-                                               
$receipt['error'][]=array('msg'=>lang('Please select a category !'));
-                                       }
-
-                                       if(!$values['last_name'])
-                                       {
-                                               
$receipt['error'][]=array('msg'=>lang('Please enter a name !'));
-                                       }
-
-                                       if(!$receipt['error'])
-                                       {
-                                               $values['tenant_id']    = 
$tenant_id;
-                                               $receipt = 
$this->bo->save($values);
-                                               $tenant_id = 
$receipt['tenant_id'];
-                                               $this->cat_id = 
($values['cat_id']?$values['cat_id']:$this->cat_id);
-
-                                               if ($values['save'])
-                                               {
-                                                       
$this->fm_session->appsession('session_data','tenant_receipt',$receipt);
-                                                       
$this->bocommon->redirect_link('/index.php','sid=cookie&op='.$this->currentapp.'.uitenant.index');
-                                               }
-                                       }
-                               }
-                               else
-                               {
-                                       
$this->bocommon->redirect_link('/index.php','sid=cookie&op='.$this->currentapp.'.uitenant.index');
-                               }
-                       }
-
-
-                       if ($tenant_id)
-                       {
-                               $tenant = $this->bo->read_single($tenant_id);
-                               $this->cat_id = 
($tenant['cat_id']?$tenant['cat_id']:$this->cat_id);
-                       }
-
-                       $link_data = array
-                       (
-                               'sid=cookie&op' => 
$this->currentapp.'.uitenant.edit',
-                               'tenant_id'             => $tenant_id
-                       );
-//html_print_r($link_data);
-
-                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
-                       $data = array
-                       (
-                               'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
-                               'edit_url'                                      
        => $this->bocommon->link('/index.php',$link_data),
-                               'lang_tenant_id'                                
        => lang('Owner ID'),
-                               'value_tenant_id'                               
=> $tenant_id,
-                               'lang_first_name'                               
=> lang('first name'),
-                               'lang_last_name'                                
=> lang('last name'),
-                               'lang_contact_phone'                    => 
lang('contact phone'),
-                               'lang_category'                                 
=> lang('category'),
-                               'lang_save'                                     
        => lang('save'),
-                               'lang_cancel'                                   
=> lang('cancel'),
-                               'lang_apply'                                    
=> lang('apply'),
-                               'value_first_name'                              
=> $tenant['first_name'],
-                               'value_last_name'                               
=> $tenant['last_name'],
-                               'value_contact_phone'                   => 
$tenant['contact_phone'],
-                               'value_cat'                                     
        => $tenant['cat'],
-                               'lang_first_name_statustext'    => lang('Enter 
the first name of the tenant'),
-                               'lang_last_name_statustext'             => 
lang('Enter the last name of the tenant'),
-                               'lang_contact_phone_statustext' => lang('Enter 
the contact phone for the tenant'),
-                               'lang_apply_statustext'                 => 
lang('Apply the values'),
-                               'lang_cancel_statustext'                => 
lang('Leave the tenant untouched and return back to the list'),
-                               'lang_save_statustext'                  => 
lang('Save the tenant and return back to the list'),
-                               'lang_no_cat'                                   
=> lang('no category'),
-                               'lang_cat_statustext'                   => 
lang('Select the category the tenant belongs to. To do not use a category 
select NO CATEGORY'),
-                               'select_name'                                   
=> 'values[cat_id]',
-                               'cat_list'                                      
        => $this->bo->select_category_list('select',$this->cat_id)
-                       );
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('tenant') . ': ' . ($tenant_id?lang('edit tenant'):lang('add tenant'));
-
-                       return array('edit' => $data);
-               }
-
-
-               function delete()
-               {
-                       $tenant_id      = 
get_var('tenant_id',array('POST','GET'));
-                       $delete         = get_var('delete',array('POST'));
-                       $confirm        = get_var('confirm',array('POST'));
-
-                       $link_data = array
-                       (
-                               'sid=cookie&op' => 
$this->currentapp.'.uitenant.index'
-                       );
-
-                       if (get_var('confirm',array('POST')))
-                       {
-                               $this->bo->delete($tenant_id);
-//                             Header('Location: ' . 
$this->bocommon->link('/index.php',$link_data));
-                               
$this->bocommon->redirect_link('/index.php',$link_data);
-                       }
-
-                       $this->bocommon->xsl_add_file(array('app_delete'));
-
-                       $data = array
-                       (
-                               'done_action'                   => 
$this->bocommon->link('/index.php',$link_data),
-                               'delete_action'                 => 
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uitenant.delete&tenant_id='
 . $tenant_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('tenant');
-                       $function_msg                                   = 
lang('delete tenant');
-
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-                       return array('delete' => $data);
-               }
-
-
-
-               function view()
-               {
-                       $tenant_id      = get_var('tenant_id',array('GET'));
-                       $action         = get_var('action',array('GET'));
-
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('tenant') . ': ' . lang('view tenant');
-
-                       $this->bocommon->xsl_add_file('tenant');
-
-                       $tenant = $this->bo->read_single($tenant_id);
-
-                       $data = array
-                       (
-                               'done_action'                           => 
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uitenant.index'),
-                               'lang_first_name'                               
=> lang('first name'),
-                               'lang_last_name'                                
=> lang('last name'),
-                               'lang_contact_phone'            => 
lang('contact phone'),
-                               'lang_category'                         => 
lang('category'),
-                               'lang_time_created'                     => 
lang('time created'),
-                               'lang_done'                                     
=> lang('done'),
-                               'value_first_name'                      => 
$tenant['first_name'],
-                               'value_last_name'                       => 
$tenant['last_name'],
-                               'value_contact_phone'           => 
$tenant['contact_phone'],
-                               'cat_list'                                      
=> $this->bo->select_category_list('',$tenant['cat_id']),
-                               'value_date'                            => 
$GLOBALS['phpgw']->common->show_date($tenant['entry_date'])
-                       );
-
-                       return array('view' => $data);
-               }
-       }
-?>
+<?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.                                            
   *
+       
\**************************************************************************/
+       /* $Id$ */
+
+       class property_uitenant
+       {
+               var $grants;
+               var $cat_id;
+               var $start;
+               var $query;
+               var $sort;
+               var $order;
+               var $filter;
+
+               var $public_functions = array
+               (
+                       'index'  => True,
+                       'view'   => True,
+                       'edit'   => True,
+                       'delete' => True
+               );
+
+               function property_uitenant()
+               {
+                       $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
+                       $this->currentapp       = 'property'; 
//$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       $this->account          = 
$GLOBALS['phpgw_data']['user']['id'];
+
+                       $this->bo                       = 
CreateObject($this->currentapp.'_botenant',True);
+                       $this->bocommon         = 
CreateObject($this->currentapp.'_bocommon');
+                       $this->menu                                     = 
CreateObject($this->currentapp.'_menu');
+                       $this->fm_session       = 
CreateObject($this->currentapp.'_session');
+
+                       $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->allrows          = $this->bo->allrows;
+               }
+
+               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,
+                               'allrows'       => $this->allrows
+                       );
+                       $this->bo->save_sessiondata($data);
+               }
+
+               function index()
+               {
+                       $this->bocommon->xsl_add_file(array('tenant',
+                                                                               
'menu',
+                                                                               
'receipt',
+                                                                               
'search_field',
+                                                                               
'nextmatchs'));
+
+                       $links = $this->menu->links();
+
+                       $receipt = 
$this->fm_session->appsession('session_data','tenant_receipt');
+                       
$this->fm_session->appsession('session_data','tenant_receipt','');
+
+                       $tenants_list = $this->bo->read();
+
+                       while (is_array($tenants_list) && list(,$tenant) = 
each($tenants_list))
+                       {
+                               $content[] = array
+                               (
+                                       'tenant_id'                             
        => $tenant['tenant_id'],
+                                       'name'                                  
        => $tenant['name'],
+                                       'entry_date'                            
=> $tenant['entry_date'],
+                                       'category'                              
        => $tenant['category'],
+                                       'link_view'                             
        => 
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uitenant.view&tenant_id='
 . $tenant['tenant_id']),
+                                       'link_edit'                             
        => 
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uitenant.edit&tenant_id='
 . $tenant['tenant_id']),
+                                       'link_delete'                           
=> 
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uitenant.delete&tenant_id='
 . $tenant['tenant_id']),
+                                       'lang_view_statustext'          => 
lang('view the tenant'),
+                                       'lang_edit_statustext'          => 
lang('edit the tenant'),
+                                       'lang_delete_statustext'        => 
lang('delete the tenant'),
+                                       'text_view'                             
        => lang('view'),
+                                       'text_edit'                             
        => lang('edit'),
+                                       'text_delete'                           
=> lang('delete')
+                               );
+                       }
+
+                       $table_header = array
+                       (
+                               'lang_name'                     => lang('name'),
+                               'lang_time_created'     => lang('time created'),
+                               'lang_view'                     => lang('view'),
+                               'lang_edit'                     => lang('edit'),
+                               'lang_delete'           => lang('delete'),
+                               'lang_tenant_id'                => lang('tenant 
id'),
+                               'sort_name'             => 
$this->bocommon->show_sort_order(array
+                                                                               
(
+                                                                               
        'sort'  => $this->sort,
+                                                                               
        'var'   => 'last_name',
+                                                                               
        'order' => $this->order,
+                                                                               
        'extra'         => array('sid=cookie&op'        => 
$this->currentapp.'.uitenant.index',
+                                                                               
                                                        'cat_id'        => 
$this->cat_id,
+                                                                               
                                                        'query'         
=>$this->query,
+                                                                               
                                                        'allrows'       
=>$this->allrows)
+                                                                               
)),
+                               'sort_tenant_id'                => 
$this->bocommon->show_sort_order(array
+                                                                               
(
+                                                                               
        'sort'  => $this->sort,
+                                                                               
        'var'   => 'tenant_id',
+                                                                               
        'order' => $this->order,
+                                                                               
        'extra'         => array('sid=cookie&op'        => 
$this->currentapp.'.uitenant.index',
+                                                                               
                                                        'cat_id'        => 
$this->cat_id,
+                                                                               
                                                        'query'         
=>$this->query,
+                                                                               
                                                        'allrows'       
=>$this->allrows)
+                                                                               
)),
+                               'sort_time_created'     => 
$this->bocommon->show_sort_order(array
+                                                                               
(
+                                                                               
        'sort'  => $this->sort,
+                                                                               
        'var'   =>      'entry_date',
+                                                                               
        'order' =>      $this->order,
+                                                                               
        'extra'         => array('sid=cookie&op'        => 
$this->currentapp.'.uitenant.index',
+                                                                               
                                                        'cat_id'        
=>$this->cat_id,
+                                                                               
                                                        'query'         
=>$this->query,
+                                                                               
                                                        'allrows'       
=>$this->allrows)
+                                                                               
)),
+                               'sort_category' => 
$this->bocommon->show_sort_order(array
+                                                                               
(
+                                                                               
        'sort'  => $this->sort,
+                                                                               
        'var'   =>      'descr',
+                                                                               
        'order' =>      $this->order,
+                                                                               
        'extra'         => array('sid=cookie&op'        => 
$this->currentapp.'.uitenant.index',
+                                                                               
                                                        'cat_id'        
=>$this->cat_id,
+                                                                               
                                                        'query'         
=>$this->query,
+                                                                               
                                                        'allrows'       
=>$this->allrows)
+                                                                               
)),
+                               'lang_category'         => lang('category')
+                       );
+
+                       $table_add = array
+                       (
+                               'lang_add'                              => 
lang('add'),
+                               'lang_add_statustext'   => lang('add a tenant'),
+                               'add_action'                    => 
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uitenant.edit')
+                       );
+
+                       $link_data = array
+                       (
+                               'sid=cookie&op' => 
$this->currentapp.'.uitenant.index',
+                                               'sort'                  
=>$this->sort,
+                                               'order'                 
=>$this->order,
+                                               'cat_id'                
=>$this->cat_id,
+                                               'filter'                
=>$this->filter,
+                                               'query'                 
=>$this->query
+                       );
+
+                       if(!$this->allrows)
+                       {
+                               $record_limit   = 15; 
//$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       }
+                       else
+                       {
+                               $record_limit   = $this->bo->total_records;
+                       }
+
+                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+                       $data = array
+                       (
+                               'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'links'                                         
        => $links,
+                               'allow_allrows'                                 
=> false,
+                               'allrows'                                       
        => $this->allrows,
+                               'start_record'                                  
=> $this->start,
+                               'record_limit'                                  
=> $record_limit,
+                               'num_records'                                   
=> count($tenants_list),
+                               'all_records'                                   
=> $this->bo->total_records,
+                               'link_url'                                      
        => $this->bocommon->link('/index.php',$link_data),
+                               'img_path'                                      
        => 
dirname($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']).'/api/skins/default/images',
+                               'lang_no_cat'                                   
=> lang('no category'),
+                               'lang_cat_statustext'                   => 
lang('Select the category the tenant belongs to. To do not use a category 
select NO CATEGORY'),
+                               'select_name'                                   
=> 'cat_id',
+                               'cat_list'                                      
        => $this->bo->select_category_list('filter',$this->cat_id),
+                               'select_action'                                 
=> $this->bocommon->link('/index.php',$link_data),
+                               'filter_list'                                   
=> $this->bocommon->xslt_filter(array('filter' => $this->filter)),
+                               'lang_filter_statustext'                => 
lang('Select the filter. To show all entries select SHOW ALL'),
+                               'lang_searchfield_statustext'   => lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again'),
+                               'lang_searchbutton_statustext'  => lang('Submit 
the search string'),
+                               'query'                                         
        => $this->query,
+                               'lang_search'                                   
=> lang('search'),
+                               'table_header'                                  
=> $table_header,
+                               'values'                                        
        => $content,
+                               'table_add'                                     
        => $table_add
+                       );
+                       //$this->save_sessiondata();
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('tenant') . ': ' . lang('list tenant');
+
+                       return array('list' => $data);
+               }
+
+               function edit()
+               {
+                       $tenant_id      = 
get_var('tenant_id',array('POST','GET'));
+                       $values         = get_var('values',array('POST'));
+
+                       $this->bocommon->xsl_add_file(array('tenant'));
+
+                       if (is_array($values))
+                       {
+                               if ($values['save'] || $values['apply'])
+                               {
+
+                                       if(!$values['cat_id'])
+                                       {
+                                               
$receipt['error'][]=array('msg'=>lang('Please select a category !'));
+                                       }
+
+                                       if(!$values['last_name'])
+                                       {
+                                               
$receipt['error'][]=array('msg'=>lang('Please enter a name !'));
+                                       }
+
+                                       if(!$receipt['error'])
+                                       {
+                                               $values['tenant_id']    = 
$tenant_id;
+                                               $receipt = 
$this->bo->save($values);
+                                               $tenant_id = 
$receipt['tenant_id'];
+                                               $this->cat_id = 
($values['cat_id']?$values['cat_id']:$this->cat_id);
+
+                                               if ($values['save'])
+                                               {
+                                                       
$this->fm_session->appsession('session_data','tenant_receipt',$receipt);
+                                                       
$this->bocommon->redirect_link('/index.php','sid=cookie&op='.$this->currentapp.'.uitenant.index');
+                                               }
+                                       }
+                               }
+                               else
+                               {
+                                       
$this->bocommon->redirect_link('/index.php','sid=cookie&op='.$this->currentapp.'.uitenant.index');
+                               }
+                       }
+
+
+                       if ($tenant_id)
+                       {
+                               $tenant = $this->bo->read_single($tenant_id);
+                               $this->cat_id = 
($tenant['cat_id']?$tenant['cat_id']:$this->cat_id);
+                       }
+
+                       $link_data = array
+                       (
+                               'sid=cookie&op' => 
$this->currentapp.'.uitenant.edit',
+                               'tenant_id'             => $tenant_id
+                       );
+//html_print_r($link_data);
+
+                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+                       $data = array
+                       (
+                               'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'edit_url'                                      
        => $this->bocommon->link('/index.php',$link_data),
+                               'lang_tenant_id'                                
        => lang('Owner ID'),
+                               'value_tenant_id'                               
=> $tenant_id,
+                               'lang_first_name'                               
=> lang('first name'),
+                               'lang_last_name'                                
=> lang('last name'),
+                               'lang_contact_phone'                    => 
lang('contact phone'),
+                               'lang_category'                                 
=> lang('category'),
+                               'lang_save'                                     
        => lang('save'),
+                               'lang_cancel'                                   
=> lang('cancel'),
+                               'lang_apply'                                    
=> lang('apply'),
+                               'value_first_name'                              
=> $tenant['first_name'],
+                               'value_last_name'                               
=> $tenant['last_name'],
+                               'value_contact_phone'                   => 
$tenant['contact_phone'],
+                               'value_cat'                                     
        => $tenant['cat'],
+                               'lang_first_name_statustext'    => lang('Enter 
the first name of the tenant'),
+                               'lang_last_name_statustext'             => 
lang('Enter the last name of the tenant'),
+                               'lang_contact_phone_statustext' => lang('Enter 
the contact phone for the tenant'),
+                               'lang_apply_statustext'                 => 
lang('Apply the values'),
+                               'lang_cancel_statustext'                => 
lang('Leave the tenant untouched and return back to the list'),
+                               'lang_save_statustext'                  => 
lang('Save the tenant and return back to the list'),
+                               'lang_no_cat'                                   
=> lang('no category'),
+                               'lang_cat_statustext'                   => 
lang('Select the category the tenant belongs to. To do not use a category 
select NO CATEGORY'),
+                               'select_name'                                   
=> 'values[cat_id]',
+                               'cat_list'                                      
        => $this->bo->select_category_list('select',$this->cat_id)
+                       );
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('tenant') . ': ' . ($tenant_id?lang('edit tenant'):lang('add tenant'));
+
+                       return array('edit' => $data);
+               }
+
+
+               function delete()
+               {
+                       $tenant_id      = 
get_var('tenant_id',array('POST','GET'));
+                       $delete         = get_var('delete',array('POST'));
+                       $confirm        = get_var('confirm',array('POST'));
+
+                       $link_data = array
+                       (
+                               'sid=cookie&op' => 
$this->currentapp.'.uitenant.index'
+                       );
+
+                       if (get_var('confirm',array('POST')))
+                       {
+                               $this->bo->delete($tenant_id);
+//                             Header('Location: ' . 
$this->bocommon->link('/index.php',$link_data));
+                               
$this->bocommon->redirect_link('/index.php',$link_data);
+                       }
+
+                       $this->bocommon->xsl_add_file(array('app_delete'));
+
+                       $data = array
+                       (
+                               'done_action'                   => 
$this->bocommon->link('/index.php',$link_data),
+                               'delete_action'                 => 
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uitenant.delete&tenant_id='
 . $tenant_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('tenant');
+                       $function_msg                                   = 
lang('delete tenant');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+                       return array('delete' => $data);
+               }
+
+
+
+               function view()
+               {
+                       $tenant_id      = get_var('tenant_id',array('GET'));
+                       $action         = get_var('action',array('GET'));
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('tenant') . ': ' . lang('view tenant');
+
+                       $this->bocommon->xsl_add_file('tenant');
+
+                       $tenant = $this->bo->read_single($tenant_id);
+
+                       $data = array
+                       (
+                               'done_action'                           => 
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uitenant.index'),
+                               'lang_first_name'                               
=> lang('first name'),
+                               'lang_last_name'                                
=> lang('last name'),
+                               'lang_contact_phone'            => 
lang('contact phone'),
+                               'lang_category'                         => 
lang('category'),
+                               'lang_time_created'                     => 
lang('time created'),
+                               'lang_done'                                     
=> lang('done'),
+                               'value_first_name'                      => 
$tenant['first_name'],
+                               'value_last_name'                       => 
$tenant['last_name'],
+                               'value_contact_phone'           => 
$tenant['contact_phone'],
+                               'cat_list'                                      
=> $this->bo->select_category_list('',$tenant['cat_id']),
+                               'value_date'                            => 
$GLOBALS['phpgw']->common->show_date($tenant['entry_date'])
+                       );
+
+                       return array('view' => $data);
+               }
+       }
+?>




reply via email to

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