phpgroupware-cvs
[Top][All Lists]
Advanced

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

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


From: nomail
Subject: [Phpgroupware-cvs] property/class.uistandard_entity.php, 1.1.1.3
Date: Fri, 21 May 2004 16:34:03 -0000

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

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

Log Message:
no message
=====================================================================
Index: property/class.uistandard_entity.php
diff -u property/class.uistandard_entity.php:1.1.1.2 
property/class.uistandard_entity.php:1.1.1.3
--- property/class.uistandard_entity.php:1.1.1.2        Fri Apr 23 20:26:57 2004
+++ property/class.uistandard_entity.php        Fri Apr 23 21:26:42 2004
@@ -1,512 +1,512 @@
-<?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 property_uistandard_entity
-       {
-               var $grants;
-               var $start;
-               var $query;
-               var $sort;
-               var $order;
-               var $sub;
-               var $currentapp;
-
-               var $public_functions = array
-               (
-                       'index'                         => True,
-                       'view'                          => True,
-                       'edit'                          => True,
-                       'delete'                        => True,
-                       'list_attribute'        => True,
-                       'edit_attrib'           => True,
-               );
-
-               function property_uistandard_entity()
-               {
-                       $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.'_bostandard_entity',True);
-                       $this->bocommon                         = 
CreateObject($this->currentapp.'_bocommon');
-                       $this->menu                                     = 
CreateObject($this->currentapp.'_menu');
-
-                       $this->start                            = 
$this->bo->start;
-                       $this->query                            = 
$this->bo->query;
-                       $this->sort                                     = 
$this->bo->sort;
-                       $this->order                            = 
$this->bo->order;
-               }
-
-               function save_sessiondata()
-               {
-                       $data = array
-                       (
-                               'start'         => $this->start,
-                               'query'         => $this->query,
-                               'sort'          => $this->sort,
-                               'order'         => $this->order,
-                       );
-                       $this->bo->save_sessiondata($data);
-               }
-
-               function index()
-               {
-                       $type   = get_var('type',array('POST','GET'));
-
-                       $this->bocommon->xsl_add_file(array(
-                                                                               
'standard_entity',
-                                                                               
'nextmatchs',
-                                                                               
'menu',
-                                                                               
'search_field'));
-                       $links = $this->menu->links();
-
-                       $standard_list = $this->bo->read($type);
-
-                       while (is_array($standard_list) && list(,$standard) = 
each($standard_list))
-                       {
-                               $words = split(' ',$standard['descr']);
-                               $first = "$words[0] $words[1] $words[2] 
$words[3]";
-
-                               $content[] = array
-                               (
-                                       'id'                                    
        => $standard['id'],
-                                       'name'                                  
        => $standard['name'],
-                                       'prefix'                                
        => $standard['prefix'],
-                                       'first'                                 
        => $first,
-                                       'link_attribute'                        
=> 
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uistandard_entity.list_attribute&type_id='
 . $standard['id'].'&type='.$type),
-                                       'link_edit'                             
        => 
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uistandard_entity.edit&id='
 . $standard['id'].'&type='.$type),
-                                       'link_delete'                           
=> 
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uistandard_entity.delete&id='
 . $standard['id'].'&type='.$type),
-                                       'lang_view_standardtext'        => 
lang('view the standard'),
-                                       'lang_attribute_standardtext'   => 
lang('attributes for the standard'). ' ' . lang($type),
-                                       'lang_edit_standardtext'        => 
lang('edit the standard'),
-                                       'lang_delete_standardtext'      => 
lang('delete the standard'),
-                                       'text_attribute'                        
=> lang('Attributes'),
-                                       'text_edit'                             
        => lang('edit'),
-                                       'text_delete'                           
=> lang('delete')
-                               );
-                       }
-
-//html_print_r($content);
-
-                       $table_header[] = array
-                       (
-
-                               'lang_descr'            => lang('Descr'),
-                               'lang_prefix'           => lang('prefix'),
-                               'lang_attribute'        => lang('Attributes'),
-                               'lang_edit'                     => lang('edit'),
-                               'lang_delete'           => lang('delete'),
-                               'sort_id'       => 
$this->bocommon->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'id',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('sid=cookie&op'        => 
$this->currentapp.'.uistandard_entity.index',
-                                                                               
                                                        'type'  =>$type)
-                                                                               
)),
-                               'lang_id'       => lang('standard id'),
-                               'sort_name'     => 
$this->bocommon->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'name',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('sid=cookie&op'        => 
$this->currentapp.'.uistandard_entity.index',
-                                                                               
                                                        'type'  =>$type)
-                                                                               
)),
-                               'lang_name'     => lang('Name'),
-                       );
-
-                       $table_add[] = array
-                       (
-                               'lang_add'                              => 
lang('add'),
-                               'lang_add_standardtext' => lang('add a 
standard'),
-                               'add_action'                    => 
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uistandard_entity.edit&type='.$type),
-                               'lang_done'                             => 
lang('done'),
-                               'lang_done_standardtext'        => lang('back 
to admin'),
-                               'done_action'                   => 
$this->bocommon->link('/admin/index.php')
-                       );
-
-
-                       $data = array
-                       (
-                               'links'                                         
        => $links,
-                               'allow_allrows'                                 
=> False,
-                               'start_record'                                  
=> $this->start,
-                               'record_limit'                                  
=> 15, //$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
-                               'num_records'                                   
=> count($standard_list),
-                               'all_records'                                   
=> $this->bo->total_records,
-                               'link_url'                                      
        => 
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uistandard_entity.index&type='.$type),
-                               'img_path'                                      
        => 
dirname($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']).'/api/skins/default/images',
-                               'lang_searchfield_standardtext' => lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again'),
-                               'lang_searchbutton_standardtext'        => 
lang('Submit the search string'),
-                               'query'                                         
        => $this->query,
-                               'lang_search'                                   
=> lang('search'),
-                               'table_header'                                  
=> $table_header,
-                               'values'                                        
        => $content,
-                               'table_add'                                     
        => $table_add
-                       );
-
-                       $appname                                                
= lang($type);
-                       $function_msg                                   = 
lang('list '.$type.' standard');
-
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-                       //$this->save_sessiondata();
-                       return array('list' => $data);
-               }
-
-               function edit()
-               {
-                       $type   = get_var('type',array('POST','GET'));
-                       $id     = get_var('id',array('POST','GET'));
-                       $values                 = 
get_var('values',array('POST'));
-
-                       $this->bocommon->xsl_add_file(array('standard_entity'));
-
-                       if ($values['save'])
-                       {
-                               if($id)
-                               {
-                                       $values['id']=$id;
-                                       $action='edit';
-                               }
-                               else
-                               {
-                       //              $id                             = 
$values['id'];
-                                       $standard['name']       = 
$values['name'];
-                                       $standard['descr']      = 
$values['descr'];
-                                       $standard['prefix']     = 
$values['prefix'];
-                               }
-
-
-                               $receipt = 
$this->bo->save($values,$action,$type);
-                               if(!$id)
-                               {
-                                       $id=$receipt['id'];
-                               }
-
-                       }
-
-                       if ($id)
-                       {
-                               $standard = $this->bo->read_single($id,$type);
-                               $function_msg = lang('edit standard');
-                               $action='edit';
-                       }
-                       else
-                       {
-                               $function_msg = lang('add standard');
-                               $action='add';
-                       }
-
-
-                       $link_data = array
-                       (
-                               'sid=cookie&op' => 
$this->currentapp.'.uistandard_entity.edit',
-                               'id'    => $id,
-                               'type' => $type
-                       );
-//html_print_r($link_data);
-
-                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
-                       $data = array
-                       (
-                               'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
-                               'lang_prefix'                                   
=> lang('Standard prefix'),
-                               'lang_prefix_standardtext'              => 
lang('Enter a standard prefix for the id'),
-                               'lang_name_standardtext'                => 
lang('Enter a name of the standard'),
-
-                               'form_action'                                   
=> $this->bocommon->link('/index.php',$link_data),
-                               'done_action'                                   
=> 
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uistandard_entity.index&type='.$type),
-                               'lang_id'                                       
        => lang('standard ID'),
-                               'lang_name'                                     
        => lang('Name'),
-                               'lang_descr'                                    
=> lang('Descr'),
-                               'lang_save'                                     
        => lang('save'),
-                               'lang_done'                                     
        => lang('done'),
-                               'value_id'                                      
        => $id,
-                               'value_name'                                    
=> $standard['name'],
-                               'value_prefix'                                  
=> $standard['prefix'],
-                               'lang_id_standardtext'                  => 
lang('Enter the standard ID'),
-                               'lang_descr_standardtext'               => 
lang('Enter a description of the standard'),
-                               'lang_done_standardtext'                => 
lang('Back to the list'),
-                               'lang_save_standardtext'                => 
lang('Save the standard'),
-                               'type_id'                                       
        => $standard['type_id'],
-                               'value_descr'                                   
=> $standard['descr']
-
-
-                       );
-
-                       $appname                                                
= lang($type);
-
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-                       return array('edit' => $data);
-               }
-
-               function delete()
-               {
-                       $attrib         = get_var('attrib',array('POST','GET'));
-                       $type           = get_var('type',array('POST','GET'));
-                       $type_id        = 
get_var('type_id',array('POST','GET'));
-                       $id                     = 
get_var('id',array('POST','GET'));
-                       $confirm        = get_var('confirm',array('POST'));
-
-                       if($attrib)
-                       {
-                               $function='list_attribute';
-                       }
-                       else
-                       {
-                               $function='index';
-                       }
-                       $link_data = array
-                       (
-                               'sid=cookie&op' => 
$this->currentapp.'.uistandard_entity.'.$function,
-                               'type' => $type,
-                               'type_id' => $type_id
-                       );
-
-                       if (get_var('confirm',array('POST')))
-                       {
-                               $this->bo->delete($id,$type,$attrib);
-                               Header('Location: ' . 
$this->bocommon->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.'.uistandard_entity.delete&id='
 . $id.'&type='.$type.'&type_id='.$type_id),
-                               'lang_confirm_msg'              => lang('do you 
really want to delete this entry'),
-                               'lang_yes'                              => 
lang('yes'),
-                               'lang_yes_standardtext' => lang('Delete the 
entry'),
-                               'lang_no_standardtext'  => lang('Back to the 
list'),
-                               'lang_no'                               => 
lang('no')
-                       );
-
-                       $appname                                                
= lang($type);
-                       $function_msg                                   = 
lang('delete '.$type.' standard');
-
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-                       return array('delete' => $data);
-               }
-
-
-               function list_attribute()
-               {
-                       $type   = get_var('type',array('POST','GET'));
-                       $type_id        = 
get_var('type_id',array('POST','GET'));
-
-                       $this->bocommon->xsl_add_file(array(
-                                                                               
'standard_entity',
-                                                                               
'nextmatchs',
-                                                                               
'search_field'));
-
-                       $attrib_list = $this->bo->read_attrib($type,$type_id);
-
-                       while (is_array($attrib_list) && list(,$attrib) = 
each($attrib_list))
-                       {
-                               $words = split(' ',$attrib['descr']);
-                               $first = "$words[0] $words[1] $words[2] 
$words[3]";
-
-
-                               $content[] = array
-                               (
-                                       'name'                                  
        => $attrib['name'],
-                                       'type_name'                             
        => $attrib['type_name'],
-                                       'datatype'                              
        => $attrib['datatype'],
-                                       'first'                                 
        => $first,
-                                       'link_edit'                             
        => 
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uistandard_entity.edit_attrib&id='
 . $attrib['id'].'&type='.$type.'&type_id='.$type_id),
-                                       'link_delete'                           
=> 
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uistandard_entity.delete&id='
 . $attrib['id'].'&type='.$type.'&type_id='.$type_id.'&attrib=true'),
-                                       'lang_view_attribtext'          => 
lang('view the attrib'),
-                                       'lang_attribute_attribtext'     => 
lang('attributes for the attrib'). ' ' . lang($type),
-                                       'lang_edit_attribtext'          => 
lang('edit the attrib'),
-                                       'lang_delete_attribtext'        => 
lang('delete the attrib'),
-                                       'text_attribute'                        
=> lang('Attributes'),
-                                       'text_edit'                             
        => lang('edit'),
-                                       'text_delete'                           
=> lang('delete')
-                               );
-                       }
-
-//html_print_r($content);
-
-                       $table_header[] = array
-                       (
-                               'lang_type_name'                => lang('Type'),
-                               'lang_descr'            => lang('Descr'),
-                               'lang_datatype'         => lang('Datatype'),
-                               'lang_edit'                     => lang('edit'),
-                               'lang_delete'           => lang('delete'),
-                               'sort_name'     => 
$this->bocommon->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'name',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('sid=cookie&op'        => 
$this->currentapp.'.uistandard_entity.list_attribute',
-                                                                               
                                                        'type'  =>$type,
-                                                                               
                                                        'type_id'       
=>$type_id)
-                                                                               
)),
-                               'lang_name'     => lang('Name'),
-                       );
-
-                       $table_add[] = array
-                       (
-                               'lang_add'                              => 
lang('add'),
-                               'lang_add_attribtext'   => lang('add a attrib'),
-                               'add_action'                    => 
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uistandard_entity.edit_attrib&type='.$type.'&type_id='.$type_id),
-                               'lang_done'                             => 
lang('done'),
-                               'lang_done_attribtext'  => lang('back to 
admin'),
-                               'done_action'                   => 
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uistandard_entity.index&type='.$type),
-                       );
-
-
-                       $data = array
-                       (
-                               'allow_allrows'                                 
=> False,
-                               'start_record'                                  
=> $this->start,
-                               'record_limit'                                  
=> 15, //$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
-                               'num_records'                                   
=> count($attrib_list),
-                               'all_records'                                   
=> $this->bo->total_records,
-                               'link_url'                                      
        => 
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uistandard_entity.list_attribute&type='.$type
 .'&type_id=' . $type_id),
-                               'img_path'                                      
        => 
dirname($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']).'/api/skins/default/images',
-                               'lang_searchfield_attribtext'   => lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again'),
-                               'lang_searchbutton_attribtext'  => lang('Submit 
the search string'),
-                               'query'                                         
        => $this->query,
-                               'lang_search'                                   
=> lang('search'),
-                               'table_header_attrib'                   => 
$table_header,
-                               'values_attrib'                                 
=> $content,
-                               'table_add'                                     
        => $table_add
-                       );
-
-                       $appname                                                
= lang('attribute');
-                       $function_msg                                   = 
lang('list '.$type.' attribute');
-
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-                       return array('list_attribute' => $data);
-                       //$this->save_sessiondata();
-               }
-
-               function edit_attrib()
-               {
-                       $type_id        = 
get_var('type_id',array('POST','GET'));
-                       $type           = get_var('type',array('POST','GET'));
-                       $id                     = 
get_var('id',array('POST','GET'));
-                       $values         = get_var('values',array('POST'));
-
-                       $this->bocommon->xsl_add_file(array('standard_entity'));
-
-                       if ($values['save'])
-                       {
-                               if($id)
-                               {
-                                       $values['id']=$id;
-                                       $action='edit';
-                               }
-                               $attrib['name']         = $values['name'];
-                               $attrib['descr']        = $values['descr'];
-                               $type_id                        = 
$values['type_id'];
-
-                               $receipt = 
$this->bo->save_attrib($values,$action,$type);
-//html_print_r($receipt);
-
-                               if(!$id)
-                               {
-                                       $id=$receipt['id'];
-                               }
-
-                       }
-
-                       if ($id)
-                       {
-                               $attrib = 
$this->bo->read_single_attrib($id,$type);
-                               $type_name=$attrib['type_name'];
-                               $function_msg = lang('edit attribute'). ' ' . 
lang($type_name);
-                               $action='edit';
-                       }
-                       else
-                       {
-                               $function_msg = lang('add attribute');
-                               $action='add';
-                       }
-
-
-                       $link_data = array
-                       (
-                               'sid=cookie&op' => 
$this->currentapp.'.uistandard_entity.edit_attrib',
-                               'id'    => $id,
-                               'type' => $type
-                       );
-//html_print_r($link_data);
-
-                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
-                       if($attrib['datatype']=='R' || 
$attrib['datatype']=='CH')
-                       {
-                               $multiple_choice= True;
-                       }
-
-                       $data = array
-                       (
-                               'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
-                               'form_action'                           => 
$this->bocommon->link('/index.php',$link_data),
-                               'done_action'                           => 
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uistandard_entity.list_attribute&type='.$type.'&type_id='.$type_id),
-                               'lang_id'                                       
=> lang('Attribute ID'),
-                               'lang_name'                                     
=> lang('Name'),
-                               'lang_descr'                            => 
lang('Descr'),
-                               'lang_entity_type'                      => 
lang('Type'),
-                               'lang_no_entity_type'           => lang('No 
entity type'),
-                               'lang_save'                                     
=> lang('save'),
-                               'lang_done'                                     
=> lang('done'),
-                               'lang_choice'                           => 
lang('Choice'),
-                               'lang_new_value'                        => 
lang('New value'),
-                               'lang_new_value_statustext'     => lang('New 
value for mulitple choice'),
-                               'multiple_choice'                       => 
$multiple_choice,
-                               'value_choice'                          => 
$attrib['choice'],
-
-                               'lang_delete_value'                     => 
lang('Delete value'),
-                               'lang_value'                            => 
lang('value'),
-                               'lang_delete_choice_statustext'=> lang('Delete 
this value from the list of multiple choice'),
-                               'value_id'                                      
=> $id,
-                               'value_name'                                    
=> $attrib['name'],
-                               'lang_id_attribtext'            => lang('Enter 
the attribute ID'),
-                               'lang_entity_statustext'        => lang('Select 
a entity type'),
-                               'lang_descr_attribtext'         => lang('Enter 
a description the attribute'),
-                               'lang_done_attribtext'          => lang('Back 
to the list'),
-                               'lang_save_attribtext'          => lang('Save 
the attribute'),
-                               'type_id'                                       
=> $attrib['type_id'],
-                               'value_descr'                           => 
$attrib['descr'],
-                               'entity_list'                           => 
$this->bo->select_entity_type($type,$type_id),
-                               'select_entity_type'            => 
'values[type_id]',
-                               'lang_datatype'                         => 
lang('Datatype'),
-                               'lang_datatype_statustext'      => lang('Select 
a datatype'),
-                               'lang_no_datatype'                      => 
lang('No datatype'),
-                               'datatype_list'                         => 
$this->bo->select_datatype($attrib['datatype']),
-                               'select_datatype'                       => 
'values[datatype]',
-//                             'value_list'                            => 
$values['list'],
-//                             'lang_list'                                     
=> lang('show in list'),
-//                             'lang_list_statustext'          => lang('check 
to show this attribute in list')
-                       );
-//html_print_r($data);
-
-                       $appname                                                
= lang($type);
-
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-                       return array('edit_attrib' => $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.                                            
   *
+       
\**************************************************************************/
+
+       class property_uistandard_entity
+       {
+               var $grants;
+               var $start;
+               var $query;
+               var $sort;
+               var $order;
+               var $sub;
+               var $currentapp;
+
+               var $public_functions = array
+               (
+                       'index'                         => True,
+                       'view'                          => True,
+                       'edit'                          => True,
+                       'delete'                        => True,
+                       'list_attribute'        => True,
+                       'edit_attrib'           => True,
+               );
+
+               function property_uistandard_entity()
+               {
+                       $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.'_bostandard_entity',True);
+                       $this->bocommon                         = 
CreateObject($this->currentapp.'_bocommon');
+                       $this->menu                                     = 
CreateObject($this->currentapp.'_menu');
+
+                       $this->start                            = 
$this->bo->start;
+                       $this->query                            = 
$this->bo->query;
+                       $this->sort                                     = 
$this->bo->sort;
+                       $this->order                            = 
$this->bo->order;
+               }
+
+               function save_sessiondata()
+               {
+                       $data = array
+                       (
+                               'start'         => $this->start,
+                               'query'         => $this->query,
+                               'sort'          => $this->sort,
+                               'order'         => $this->order,
+                       );
+                       $this->bo->save_sessiondata($data);
+               }
+
+               function index()
+               {
+                       $type   = get_var('type',array('POST','GET'));
+
+                       $this->bocommon->xsl_add_file(array(
+                                                                               
'standard_entity',
+                                                                               
'nextmatchs',
+                                                                               
'menu',
+                                                                               
'search_field'));
+                       $links = $this->menu->links();
+
+                       $standard_list = $this->bo->read($type);
+
+                       while (is_array($standard_list) && list(,$standard) = 
each($standard_list))
+                       {
+                               $words = split(' ',$standard['descr']);
+                               $first = "$words[0] $words[1] $words[2] 
$words[3]";
+
+                               $content[] = array
+                               (
+                                       'id'                                    
        => $standard['id'],
+                                       'name'                                  
        => $standard['name'],
+                                       'prefix'                                
        => $standard['prefix'],
+                                       'first'                                 
        => $first,
+                                       'link_attribute'                        
=> 
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uistandard_entity.list_attribute&type_id='
 . $standard['id'].'&type='.$type),
+                                       'link_edit'                             
        => 
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uistandard_entity.edit&id='
 . $standard['id'].'&type='.$type),
+                                       'link_delete'                           
=> 
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uistandard_entity.delete&id='
 . $standard['id'].'&type='.$type),
+                                       'lang_view_standardtext'        => 
lang('view the standard'),
+                                       'lang_attribute_standardtext'   => 
lang('attributes for the standard'). ' ' . lang($type),
+                                       'lang_edit_standardtext'        => 
lang('edit the standard'),
+                                       'lang_delete_standardtext'      => 
lang('delete the standard'),
+                                       'text_attribute'                        
=> lang('Attributes'),
+                                       'text_edit'                             
        => lang('edit'),
+                                       'text_delete'                           
=> lang('delete')
+                               );
+                       }
+
+//html_print_r($content);
+
+                       $table_header[] = array
+                       (
+
+                               'lang_descr'            => lang('Descr'),
+                               'lang_prefix'           => lang('prefix'),
+                               'lang_attribute'        => lang('Attributes'),
+                               'lang_edit'                     => lang('edit'),
+                               'lang_delete'           => lang('delete'),
+                               'sort_id'       => 
$this->bocommon->show_sort_order(array
+                                                                               
(
+                                                                               
        'sort'  => $this->sort,
+                                                                               
        'var'   =>      'id',
+                                                                               
        'order' =>      $this->order,
+                                                                               
        'extra'         => array('sid=cookie&op'        => 
$this->currentapp.'.uistandard_entity.index',
+                                                                               
                                                        'type'  =>$type)
+                                                                               
)),
+                               'lang_id'       => lang('standard id'),
+                               'sort_name'     => 
$this->bocommon->show_sort_order(array
+                                                                               
(
+                                                                               
        'sort'  => $this->sort,
+                                                                               
        'var'   =>      'name',
+                                                                               
        'order' =>      $this->order,
+                                                                               
        'extra'         => array('sid=cookie&op'        => 
$this->currentapp.'.uistandard_entity.index',
+                                                                               
                                                        'type'  =>$type)
+                                                                               
)),
+                               'lang_name'     => lang('Name'),
+                       );
+
+                       $table_add[] = array
+                       (
+                               'lang_add'                              => 
lang('add'),
+                               'lang_add_standardtext' => lang('add a 
standard'),
+                               'add_action'                    => 
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uistandard_entity.edit&type='.$type),
+                               'lang_done'                             => 
lang('done'),
+                               'lang_done_standardtext'        => lang('back 
to admin'),
+                               'done_action'                   => 
$this->bocommon->link('/admin/index.php')
+                       );
+
+
+                       $data = array
+                       (
+                               'links'                                         
        => $links,
+                               'allow_allrows'                                 
=> False,
+                               'start_record'                                  
=> $this->start,
+                               'record_limit'                                  
=> 15, //$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
+                               'num_records'                                   
=> count($standard_list),
+                               'all_records'                                   
=> $this->bo->total_records,
+                               'link_url'                                      
        => 
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uistandard_entity.index&type='.$type),
+                               'img_path'                                      
        => 
dirname($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']).'/api/skins/default/images',
+                               'lang_searchfield_standardtext' => lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again'),
+                               'lang_searchbutton_standardtext'        => 
lang('Submit the search string'),
+                               'query'                                         
        => $this->query,
+                               'lang_search'                                   
=> lang('search'),
+                               'table_header'                                  
=> $table_header,
+                               'values'                                        
        => $content,
+                               'table_add'                                     
        => $table_add
+                       );
+
+                       $appname                                                
= lang($type);
+                       $function_msg                                   = 
lang('list '.$type.' standard');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+                       //$this->save_sessiondata();
+                       return array('list' => $data);
+               }
+
+               function edit()
+               {
+                       $type   = get_var('type',array('POST','GET'));
+                       $id     = get_var('id',array('POST','GET'));
+                       $values                 = 
get_var('values',array('POST'));
+
+                       $this->bocommon->xsl_add_file(array('standard_entity'));
+
+                       if ($values['save'])
+                       {
+                               if($id)
+                               {
+                                       $values['id']=$id;
+                                       $action='edit';
+                               }
+                               else
+                               {
+                       //              $id                             = 
$values['id'];
+                                       $standard['name']       = 
$values['name'];
+                                       $standard['descr']      = 
$values['descr'];
+                                       $standard['prefix']     = 
$values['prefix'];
+                               }
+
+
+                               $receipt = 
$this->bo->save($values,$action,$type);
+                               if(!$id)
+                               {
+                                       $id=$receipt['id'];
+                               }
+
+                       }
+
+                       if ($id)
+                       {
+                               $standard = $this->bo->read_single($id,$type);
+                               $function_msg = lang('edit standard');
+                               $action='edit';
+                       }
+                       else
+                       {
+                               $function_msg = lang('add standard');
+                               $action='add';
+                       }
+
+
+                       $link_data = array
+                       (
+                               'sid=cookie&op' => 
$this->currentapp.'.uistandard_entity.edit',
+                               'id'    => $id,
+                               'type' => $type
+                       );
+//html_print_r($link_data);
+
+                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+                       $data = array
+                       (
+                               'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'lang_prefix'                                   
=> lang('Standard prefix'),
+                               'lang_prefix_standardtext'              => 
lang('Enter a standard prefix for the id'),
+                               'lang_name_standardtext'                => 
lang('Enter a name of the standard'),
+
+                               'form_action'                                   
=> $this->bocommon->link('/index.php',$link_data),
+                               'done_action'                                   
=> 
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uistandard_entity.index&type='.$type),
+                               'lang_id'                                       
        => lang('standard ID'),
+                               'lang_name'                                     
        => lang('Name'),
+                               'lang_descr'                                    
=> lang('Descr'),
+                               'lang_save'                                     
        => lang('save'),
+                               'lang_done'                                     
        => lang('done'),
+                               'value_id'                                      
        => $id,
+                               'value_name'                                    
=> $standard['name'],
+                               'value_prefix'                                  
=> $standard['prefix'],
+                               'lang_id_standardtext'                  => 
lang('Enter the standard ID'),
+                               'lang_descr_standardtext'               => 
lang('Enter a description of the standard'),
+                               'lang_done_standardtext'                => 
lang('Back to the list'),
+                               'lang_save_standardtext'                => 
lang('Save the standard'),
+                               'type_id'                                       
        => $standard['type_id'],
+                               'value_descr'                                   
=> $standard['descr']
+
+
+                       );
+
+                       $appname                                                
= lang($type);
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+                       return array('edit' => $data);
+               }
+
+               function delete()
+               {
+                       $attrib         = get_var('attrib',array('POST','GET'));
+                       $type           = get_var('type',array('POST','GET'));
+                       $type_id        = 
get_var('type_id',array('POST','GET'));
+                       $id                     = 
get_var('id',array('POST','GET'));
+                       $confirm        = get_var('confirm',array('POST'));
+
+                       if($attrib)
+                       {
+                               $function='list_attribute';
+                       }
+                       else
+                       {
+                               $function='index';
+                       }
+                       $link_data = array
+                       (
+                               'sid=cookie&op' => 
$this->currentapp.'.uistandard_entity.'.$function,
+                               'type' => $type,
+                               'type_id' => $type_id
+                       );
+
+                       if (get_var('confirm',array('POST')))
+                       {
+                               $this->bo->delete($id,$type,$attrib);
+                               Header('Location: ' . 
$this->bocommon->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.'.uistandard_entity.delete&id='
 . $id.'&type='.$type.'&type_id='.$type_id),
+                               'lang_confirm_msg'              => lang('do you 
really want to delete this entry'),
+                               'lang_yes'                              => 
lang('yes'),
+                               'lang_yes_standardtext' => lang('Delete the 
entry'),
+                               'lang_no_standardtext'  => lang('Back to the 
list'),
+                               'lang_no'                               => 
lang('no')
+                       );
+
+                       $appname                                                
= lang($type);
+                       $function_msg                                   = 
lang('delete '.$type.' standard');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+                       return array('delete' => $data);
+               }
+
+
+               function list_attribute()
+               {
+                       $type   = get_var('type',array('POST','GET'));
+                       $type_id        = 
get_var('type_id',array('POST','GET'));
+
+                       $this->bocommon->xsl_add_file(array(
+                                                                               
'standard_entity',
+                                                                               
'nextmatchs',
+                                                                               
'search_field'));
+
+                       $attrib_list = $this->bo->read_attrib($type,$type_id);
+
+                       while (is_array($attrib_list) && list(,$attrib) = 
each($attrib_list))
+                       {
+                               $words = split(' ',$attrib['descr']);
+                               $first = "$words[0] $words[1] $words[2] 
$words[3]";
+
+
+                               $content[] = array
+                               (
+                                       'name'                                  
        => $attrib['name'],
+                                       'type_name'                             
        => $attrib['type_name'],
+                                       'datatype'                              
        => $attrib['datatype'],
+                                       'first'                                 
        => $first,
+                                       'link_edit'                             
        => 
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uistandard_entity.edit_attrib&id='
 . $attrib['id'].'&type='.$type.'&type_id='.$type_id),
+                                       'link_delete'                           
=> 
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uistandard_entity.delete&id='
 . $attrib['id'].'&type='.$type.'&type_id='.$type_id.'&attrib=true'),
+                                       'lang_view_attribtext'          => 
lang('view the attrib'),
+                                       'lang_attribute_attribtext'     => 
lang('attributes for the attrib'). ' ' . lang($type),
+                                       'lang_edit_attribtext'          => 
lang('edit the attrib'),
+                                       'lang_delete_attribtext'        => 
lang('delete the attrib'),
+                                       'text_attribute'                        
=> lang('Attributes'),
+                                       'text_edit'                             
        => lang('edit'),
+                                       'text_delete'                           
=> lang('delete')
+                               );
+                       }
+
+//html_print_r($content);
+
+                       $table_header[] = array
+                       (
+                               'lang_type_name'                => lang('Type'),
+                               'lang_descr'            => lang('Descr'),
+                               'lang_datatype'         => lang('Datatype'),
+                               'lang_edit'                     => lang('edit'),
+                               'lang_delete'           => lang('delete'),
+                               'sort_name'     => 
$this->bocommon->show_sort_order(array
+                                                                               
(
+                                                                               
        'sort'  => $this->sort,
+                                                                               
        'var'   =>      'name',
+                                                                               
        'order' =>      $this->order,
+                                                                               
        'extra'         => array('sid=cookie&op'        => 
$this->currentapp.'.uistandard_entity.list_attribute',
+                                                                               
                                                        'type'  =>$type,
+                                                                               
                                                        'type_id'       
=>$type_id)
+                                                                               
)),
+                               'lang_name'     => lang('Name'),
+                       );
+
+                       $table_add[] = array
+                       (
+                               'lang_add'                              => 
lang('add'),
+                               'lang_add_attribtext'   => lang('add a attrib'),
+                               'add_action'                    => 
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uistandard_entity.edit_attrib&type='.$type.'&type_id='.$type_id),
+                               'lang_done'                             => 
lang('done'),
+                               'lang_done_attribtext'  => lang('back to 
admin'),
+                               'done_action'                   => 
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uistandard_entity.index&type='.$type),
+                       );
+
+
+                       $data = array
+                       (
+                               'allow_allrows'                                 
=> False,
+                               'start_record'                                  
=> $this->start,
+                               'record_limit'                                  
=> 15, //$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
+                               'num_records'                                   
=> count($attrib_list),
+                               'all_records'                                   
=> $this->bo->total_records,
+                               'link_url'                                      
        => 
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uistandard_entity.list_attribute&type='.$type
 .'&type_id=' . $type_id),
+                               'img_path'                                      
        => 
dirname($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']).'/api/skins/default/images',
+                               'lang_searchfield_attribtext'   => lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again'),
+                               'lang_searchbutton_attribtext'  => lang('Submit 
the search string'),
+                               'query'                                         
        => $this->query,
+                               'lang_search'                                   
=> lang('search'),
+                               'table_header_attrib'                   => 
$table_header,
+                               'values_attrib'                                 
=> $content,
+                               'table_add'                                     
        => $table_add
+                       );
+
+                       $appname                                                
= lang('attribute');
+                       $function_msg                                   = 
lang('list '.$type.' attribute');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+                       return array('list_attribute' => $data);
+                       //$this->save_sessiondata();
+               }
+
+               function edit_attrib()
+               {
+                       $type_id        = 
get_var('type_id',array('POST','GET'));
+                       $type           = get_var('type',array('POST','GET'));
+                       $id                     = 
get_var('id',array('POST','GET'));
+                       $values         = get_var('values',array('POST'));
+
+                       $this->bocommon->xsl_add_file(array('standard_entity'));
+
+                       if ($values['save'])
+                       {
+                               if($id)
+                               {
+                                       $values['id']=$id;
+                                       $action='edit';
+                               }
+                               $attrib['name']         = $values['name'];
+                               $attrib['descr']        = $values['descr'];
+                               $type_id                        = 
$values['type_id'];
+
+                               $receipt = 
$this->bo->save_attrib($values,$action,$type);
+//html_print_r($receipt);
+
+                               if(!$id)
+                               {
+                                       $id=$receipt['id'];
+                               }
+
+                       }
+
+                       if ($id)
+                       {
+                               $attrib = 
$this->bo->read_single_attrib($id,$type);
+                               $type_name=$attrib['type_name'];
+                               $function_msg = lang('edit attribute'). ' ' . 
lang($type_name);
+                               $action='edit';
+                       }
+                       else
+                       {
+                               $function_msg = lang('add attribute');
+                               $action='add';
+                       }
+
+
+                       $link_data = array
+                       (
+                               'sid=cookie&op' => 
$this->currentapp.'.uistandard_entity.edit_attrib',
+                               'id'    => $id,
+                               'type' => $type
+                       );
+//html_print_r($link_data);
+
+                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+                       if($attrib['datatype']=='R' || 
$attrib['datatype']=='CH')
+                       {
+                               $multiple_choice= True;
+                       }
+
+                       $data = array
+                       (
+                               'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'form_action'                           => 
$this->bocommon->link('/index.php',$link_data),
+                               'done_action'                           => 
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uistandard_entity.list_attribute&type='.$type.'&type_id='.$type_id),
+                               'lang_id'                                       
=> lang('Attribute ID'),
+                               'lang_name'                                     
=> lang('Name'),
+                               'lang_descr'                            => 
lang('Descr'),
+                               'lang_entity_type'                      => 
lang('Type'),
+                               'lang_no_entity_type'           => lang('No 
entity type'),
+                               'lang_save'                                     
=> lang('save'),
+                               'lang_done'                                     
=> lang('done'),
+                               'lang_choice'                           => 
lang('Choice'),
+                               'lang_new_value'                        => 
lang('New value'),
+                               'lang_new_value_statustext'     => lang('New 
value for mulitple choice'),
+                               'multiple_choice'                       => 
$multiple_choice,
+                               'value_choice'                          => 
$attrib['choice'],
+
+                               'lang_delete_value'                     => 
lang('Delete value'),
+                               'lang_value'                            => 
lang('value'),
+                               'lang_delete_choice_statustext'=> lang('Delete 
this value from the list of multiple choice'),
+                               'value_id'                                      
=> $id,
+                               'value_name'                                    
=> $attrib['name'],
+                               'lang_id_attribtext'            => lang('Enter 
the attribute ID'),
+                               'lang_entity_statustext'        => lang('Select 
a entity type'),
+                               'lang_descr_attribtext'         => lang('Enter 
a description the attribute'),
+                               'lang_done_attribtext'          => lang('Back 
to the list'),
+                               'lang_save_attribtext'          => lang('Save 
the attribute'),
+                               'type_id'                                       
=> $attrib['type_id'],
+                               'value_descr'                           => 
$attrib['descr'],
+                               'entity_list'                           => 
$this->bo->select_entity_type($type,$type_id),
+                               'select_entity_type'            => 
'values[type_id]',
+                               'lang_datatype'                         => 
lang('Datatype'),
+                               'lang_datatype_statustext'      => lang('Select 
a datatype'),
+                               'lang_no_datatype'                      => 
lang('No datatype'),
+                               'datatype_list'                         => 
$this->bo->select_datatype($attrib['datatype']),
+                               'select_datatype'                       => 
'values[datatype]',
+//                             'value_list'                            => 
$values['list'],
+//                             'lang_list'                                     
=> lang('show in list'),
+//                             'lang_list_statustext'          => lang('check 
to show this attribute in list')
+                       );
+//html_print_r($data);
+
+                       $appname                                                
= lang($type);
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+                       return array('edit_attrib' => $data);
+               }
+
+       }
+?>




reply via email to

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