fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [12903] return old versi?\195?\179n for meeting aleja


From: Nelson Guerra
Subject: [Fmsystem-commits] [12903] return old versi?\195?\179n for meeting alejandro
Date: Wed, 25 Mar 2015 23:28:28 +0000

Revision: 12903
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=12903
Author:   nelson224
Date:     2015-03-25 23:28:27 +0000 (Wed, 25 Mar 2015)
Log Message:
-----------
return old versi?\195?\179n for meeting alejandro

Modified Paths:
--------------
    branches/dev-syncromind/property/inc/class.uigab.inc.php

Modified: branches/dev-syncromind/property/inc/class.uigab.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.uigab.inc.php    2015-03-25 
23:26:36 UTC (rev 12902)
+++ branches/dev-syncromind/property/inc/class.uigab.inc.php    2015-03-25 
23:28:27 UTC (rev 12903)
@@ -31,10 +31,9 @@
         * Description
         * @package property
         */
-       phpgw::import_class('phpgwapi.uicommon_jquery');
-       phpgw::import_class('phpgwapi.jquery');
+       phpgw::import_class('phpgwapi.yui');
 
-       class property_uigab extends phpgwapi_uicommon_jquery
+       class property_uigab
        {
                var $grants;
                var $cat_id;
@@ -51,7 +50,6 @@
                        (
                                'index'                 => true,
                                'list_detail'   => true,
-                               'query'                 => true,
                                'view'                  => true,
                                'edit'                  => true,
                                'delete'                => true,
@@ -60,8 +58,6 @@
 
                function __construct()
                {
-                       parent::__construct();
-                       
                        $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
'property::location::gabnr';
 
@@ -191,202 +187,236 @@
                        $feste_nr                       = 
phpgw::get_var('feste_nr', 'int');
                        $seksjons_nr            = phpgw::get_var('seksjons_nr', 
'int');
 
-            if( phpgw::get_var('phpgw_return_as') == 'json' )
-            {
-                return $this->query();
-            }
-            
-            
self::add_javascript('phpgwapi','jquery','editable/jquery.jeditable.js');
-            
self::add_javascript('phpgwapi','jquery','editable/jquery.dataTables.editable.js');
-                       
-                       $appname                = lang('gab');
-                       $function_msg   = lang('list gab');
-                       
-            $data   = array(
-                'datatable_name'    => $appname,
-                'form'  => array(
-                               'toolbar'    => array(
-                                   'item'   => array(
-                                                                               
array
-                                                                               
( // check label
-                                                                               
        'type' => 'label',
-                                                                               
        'id' => 'lbl_check',
-                                                                               
        'value' => lang('check payments'),
-                                                                               
        'style' => 'filter'
-                                                                               
),
-                                                                               
array
-                                                                               
( // TEXT IMPUT
-                                                                               
        'name'   => 'check',
-                                                                               
        'id'     => 'txt_check',
-                                                                               
        'value'  => 0,//$query,
-                                                                               
        'type' => 'checkbox',
-                                                                               
        'style' => 'filter'
-                                                                               
),
-                                                                               
array
-                                                                               
( //hidden check_payments
-                                                                               
        'type'  => 'hidden',
-                                                                               
        'name'     => 'check_payments',
-                                                                               
        'id'    => 'txt_check_payments',
-                                                                               
        'value' => 0,
-                                                                               
        'style' => 'filter'
-                                                                               
),                                                                         
-                                        array(
-                                           'type'   => 'link',
-                                           'value'  => lang('new'),
-                                           'href'   => self::link(array(
-                                               'menuaction'    => 
'property.uigab.add'
-                                           )),
-                                           'class'  => 'new_item'
-                                        ),
-                                        array(
-                                           'type'   => 'link',
-                                           'value'  => lang('columns'),
-                                           'href'   => '#',
-                                           'class'  => '',
-                                           'onclick'    => 
"JqueryPortico.openPopup({menuaction:'property.uigab.columns'},{closeAction:'reload'})"
-                                       )
-                                   )
-                               )
-                            ),
-                'datatable' =>  array(
-                    'source'    => self::link(array(
-                        'menuaction'           => 'property.uigab.index',
-                        'phpgw_return_as'   => 'json'
-                    )),
-                                       'download'      => self::link(array(
-                                                       'menuaction'    => 
'property.uigab.download',
-                                                       'export'                
=> true,
-                                                       'skip_origin'   => true,
-                                                       'allrows'               
=> true
-                                       )),
-                    'allrows'   => true,
-                    'editor_action' => '',
-                    'field' =>  array()
-                )
-            );
-                       
-                       /*$gab_list = $this->bo->read();
+                       $datatable = array();
+                       $values_combo_box = array();
 
-                       $config         = 
CreateObject('phpgwapi.config','property');
-
-                       $config->read_repository();
-
-                       $link_to_map = 
(isset($config->config_data['map_url'])?$config->config_data['map_url']:'');
-                       if($link_to_map)
+                       if( phpgw::get_var('phpgw_return_as') != 'json' )
                        {
-                               $text_map=lang('Map');
-                       }
+                               $datatable['menu']                              
= $this->bocommon->get_menu();
 
-                       $link_to_gab = 
isset($config->config_data['gab_url'])?$config->config_data['gab_url']:'';
-                       $gab_url_paramtres = 
isset($config->config_data['gab_url_paramtres']) ? 
$config->config_data['gab_url_paramtres']:'type=eiendom&Gnr=__gaards_nr__&Bnr=__bruks_nr__&Fnr=__feste_nr__&Snr=__seksjons_nr__';
+                               $datatable['config']['base_url']        = 
$GLOBALS['phpgw']->link('/index.php', array
+                                       (
+                                               'menuaction'            => 
'property.uigab.index',
+                                               'location_code'         => 
$location_code,
+                                               'gaards_nr'                     
=> $gaards_nr,
+                                               'bruksnr'                       
=> $bruksnr,
+                                               'feste_nr'                      
=> $feste_nr,
+                                               'seksjons_nr'           => 
$seksjons_nr,
+                                               'address'                       
=> $address,
+                                               'check_payments'        => 
$check_payments
 
-                       if($link_to_gab)
-                       {
-                               $text_gab=lang('GAB');
-                       }*/
+                                       ));
+                               $datatable['config']['allow_allrows'] = true;
 
-                       $payment_date = $this->bo->payment_date;
+                               $datatable['config']['base_java_url'] = 
"menuaction:'property.uigab.index',"
+                                       ."location_code:'{$location_code}',"
+                                       ."gaards_nr:'{$gaards_nr}',"
+                                       ."bruksnr: '{$bruksnr}',"
+                                       ."feste_nr:'{$feste_nr}',"
+                                       ."seksjons_nr:'{$seksjons_nr}',"
+                                       ."address:'{$address}',"
+                                       ."check_payments:'{$check_payments}'";
 
-                       $uicols = array (
-                               'input_type'    =>      
array('hidden','text','text','text','text','hidden','text','text','text','link','link'),
-                               'name'                  =>      
array('gab_id','gaards_nr','bruksnr','feste_nr','seksjons_nr','hits','owner','location_code','address','map','gab'),
-                               'formatter'             =>      
array('','','','','','','','','','',''),
-                               'descr'                 =>      
array('dummy',lang('Gaards nr'),lang('Bruks nr'),lang('Feste 
nr'),lang('Seksjons 
nr'),lang('hits'),lang('Owner'),lang('Location'),lang('Address'),lang('Map'),lang('Gab')),
-                               'className'             =>      
array('','','','','','','','','','','')
-                       );
-
-                       while (is_array($payment_date) && list(,$date) = 
each($payment_date))
-                       {
-                               $uicols['input_type'][] = 'date';
-                               $uicols['name'][] = str_replace('/','_',$date);
-                               $uicols['formatter'][] = '';
-                               $uicols['descr'][] = $date;
-                               $uicols['className'][] = 'rightClasss';
-
-                               /*$uicols_add['input_type'][] = 'date';
-                               $uicols_add['name'][] = 
str_replace('/','_',$date);
-                               $uicols_add['formatter'][] = '';
-                               $uicols_add['descr'][] = $date;
-                               $uicols_add['className'][] = 'rightClasss';*/
-                       }
-                       
-                       $count_uicols_name = count($uicols['name']);
-
-            for ($k = 0; $k < $count_uicols_name; $k++) 
-                       {
-                $params = array
-                            (
-                                'key'   =>  $uicols['name'][$k],
-                                'label' =>  $uicols['descr'][$k],
-                                'sortable'  =>  
($uicols['sortable'][$k])?true:false,
-                                'hidden'    =>  ($uicols['input_type'][$k] == 
'hidden')?true:false
-                            );               
-                
-                array_push($data['datatable']['field'], $params);
-            }
-                       
-                       $parameters = array
-                               (
-                                       'parameter' => array
+                               $datatable['actions']['form'] = array
                                        (
                                                array
                                                (
-                                                       'name'          => 
'gab_id',
-                                                       'source'        => 
'gab_id'
+                                                       'action'        => 
$GLOBALS['phpgw']->link('/index.php',
+                                                       array
+                                                       (
+                                                               'menuaction'    
        => 'property.uigab.index',
+                                                               'location_code' 
        => $location_code,
+                                                               'gaards_nr'     
        => $gaards_nr,
+                                                               'bruksnr'       
        => $bruksnr,
+                                                               'feste_nr'      
        => $feste_nr,
+                                                               'seksjons_nr'   
=> $seksjons_nr,
+                                                               'address'       
        => $address,
+                                                               
'check_payments'        => $check_payments
+                                                       )
                                                ),
-                                       )
-                               );
-
-                       if($this->acl_read)
-                       {
-                               $data['datatable']['actions'][] = array
-                                       (
-                                               'my_name'               => 
'view',
-                                               'text'                  => 
lang('view'),
-                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                               'fields'        => array
                                                (
-                                                       'menuaction'    => 
'property.uigab.list_detail'
-                                               )),
-                                               'parameters'    => $parameters
-                                       );
-                       }
+                                                       'field' => array
+                                                       (
 
-                       if($this->acl_add)
-                       {
-                               $data['datatable']['actions'][] = array
-                                       (
-                                               'my_name'               => 
'add',
-                                               'text'                  => 
lang('add'),
-                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
-                                               (
-                                                       'menuaction'    => 
'property.uigab.edit',
-                                                       'from'                  
=> 'index'
-                                               ))
-                                       );
-                       }
-                       unset($parameters);
+                                                               array
+                                                               ( // address 
label
+                                                                       'type' 
=> 'label',
+                                                                       'id' => 
'lbl_address',
+                                                                       'value' 
=> lang('Address'),
+                                                                       'style' 
=> 'filter'
+                                                               ),
+                                                               array
+                                                               ( // TEXT IMPUT
+                                                                       'name'  
   => 'address',
+                                                                       'id'    
 => 'txt_address',
+                                                                       'value' 
   => '',//$query,
+                                                                       'type' 
=> 'text',
+                                                                       'size'  
  => 28,
+                                                                       
'tab_index' => 1,
+                                                                       
'onkeypress' => 'return pulsar(event)',
+                                                                       'style' 
=> 'filter'
+                                                               ),
+                                                               array
+                                                               ( // check label
+                                                                       'type' 
=> 'label',
+                                                                       'id' => 
'lbl_check',
+                                                                       'value' 
=> lang('check payments'),
+                                                                       'style' 
=> 'filter'
+                                                               ),
+                                                               array
+                                                               ( // TEXT IMPUT
+                                                                       'name'  
   => 'check',
+                                                                       'id'    
 => 'txt_check',
+                                                                       'value' 
   => 0,//$query,
+                                                                       'type' 
=> 'checkbox',
+                                                                       
'tab_index' => 2,
+                                                                       'style' 
=> 'filter'
+                                                               ),
+                                                               array
+                                                               ( //hidden 
check_payments
+                                                                       'type'  
=> 'hidden',
+                                                                       'name'  
   => 'check_payments',
+                                                                       'id'    
=> 'txt_check_payments',
+                                                                       'value' 
=> 0,
+                                                                       'style' 
=> 'filter'
+                                                               ),
+                                                               array
+                                                               ( // 
location_code label
+                                                                       'type' 
=> 'label',
+                                                                       'id' => 
'lbl_property_id',
+                                                                       'value' 
=> lang('property id'),
+                                                                       'style' 
=> 'filter'
+                                                               ),
+                                                               array
+                                                               ( // TEXT IMPUT
+                                                                       'name'  
   => 'location_code',
+                                                                       'id'    
 => 'txt_location_code',
+                                                                       'value' 
   => $location_code,
+                                                                       'type' 
=> 'text',
+                                                                       'size'  
  => 6,
+                                                                       
'tab_index' => 3,
+                                                                       
'onkeypress' => 'return pulsar(event)',
+                                                                       'style' 
=> 'filter'
+                                                               ),
+                                                               array
+                                                               ( // gaards_nr 
label
+                                                                       'type' 
=> 'label',
+                                                                       'id' => 
'lbl_gaards_nr',
+                                                                       'value' 
=> lang('gaards nr'),
+                                                                       'style' 
=> 'filter'
+                                                               ),
+                                                               array
+                                                               ( // TEXT IMPUT
+                                                                       'name'  
   => 'gaards_nr',
+                                                                       'id'    
 => 'txt_gaards_nr',
+                                                                       'value' 
   => '',//$query,
+                                                                       'type' 
=> 'text',
+                                                                       'size'  
  => 6,
+                                                                       
'tab_index' => 4,
+                                                                       
'onkeypress' => 'return pulsar(event)',
+                                                                       'style' 
=> 'filter'
+                                                               ),
+                                                               array
+                                                               ( // bruksnr 
label
+                                                                       'type' 
=> 'label',
+                                                                       'id' => 
'lbl_bruksnr',
+                                                                       'value' 
=> lang('bruks nr'),
+                                                                       'style' 
=> 'filter'
+                                                               ),
+                                                               array
+                                                               ( // TEXT IMPUT
+                                                                       'name'  
   => 'bruksnr',
+                                                                       'id'    
 => 'txt_bruksnr',
+                                                                       'value' 
   => '',//$query,
+                                                                       'type' 
=> 'text',
+                                                                       'size'  
  => 6,
+                                                                       
'tab_index' => 5,
+                                                                       
'onkeypress' => 'return pulsar(event)',
+                                                                       'style' 
=> 'filter'
+                                                               ),
+                                                               array
+                                                               ( // feste_nr 
label
+                                                                       'type' 
=> 'label',
+                                                                       'id' => 
'lbl_feste_nr',
+                                                                       'value' 
=> lang('Feste nr'),
+                                                                       'style' 
=> 'filter'
+                                                               ),
+                                                               array
+                                                               ( // TEXT IMPUT
+                                                                       'name'  
   => 'feste_nr',
+                                                                       'id'    
 => 'txt_feste_nr',
+                                                                       'value' 
   => '',//$query,
+                                                                       'type' 
=> 'text',
+                                                                       'size'  
  => 6,
+                                                                       
'tab_index' => 6,
+                                                                       
'onkeypress' => 'return pulsar(event)',
+                                                                       'style' 
=> 'filter'
+                                                               ),
+                                                               array
+                                                               ( // 
seksjons_nr label
+                                                                       'type' 
=> 'label',
+                                                                       'id' => 
'lbl_seksjons_nr',
+                                                                       'value' 
=> lang('Seksjons nr'),
+                                                                       'style' 
=> 'filter'
+                                                               ),
+                                                               array
+                                                               ( // TEXT IMPUT
+                                                                       'name'  
   => 'seksjons_nr',
+                                                                       'id'    
 => 'txt_seksjons_nr',
+                                                                       'value' 
   => '',//$query,
+                                                                       'type' 
=> 'text',
+                                                                       'size'  
  => 6,
+                                                                       
'tab_index' => 7,
+                                                                       
'onkeypress' => 'return pulsar(event)',
+                                                                       'style' 
=> 'filter'
+                                                               ),
+                                                               array
+                                                               ( //boton     
SEARCH
+                                                                       'id' => 
'btn_search',
+                                                                       'name' 
=> 'search',
+                                                                       'value' 
   => lang('search'),
+                                                                       'type' 
=> 'button',
+                                                                       
'tab_index' => 8,
+                                                                       'style' 
=> 'filter'
+                                                               ),
+                                                               array
+                                                               ( //boton     
reset
+                                                                       'id' => 
'btn_reset',
+                                                                       'name' 
=> 'reset',
+                                                                       'value' 
   => lang('reset'),
+                                                                       'type' 
=> 'reset',
+                                                                       
'tab_index' => 9,
+                                                                       'style' 
=> 'filter'
+                                                               ),
+                                                               array
+                                                               (
+                                                                       'type'  
=> 'button',
+                                                                       'id'    
=> 'btn_new',
+                                                                       
'tab_index' => 10,
+                                                                       'value' 
=> lang('add'),
+                                                                       'style' 
=> 'filter'
+                                                               ),
+                                                               array
+                                                               (
+                                                                       'type'  
=> 'button',
+                                                                       'id'    
=> 'btn_export',
+                                                                       
'tab_index' => 11,
+                                                                       'value' 
=> lang('download'),
+                                                                       'style' 
=> 'filter'
+                                                               )
 
-                       //Title of Page
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
 
-                       // Prepare YUI Library
-                       //$GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'gab.index', 'property' );
-                       self::render_template_xsl('datatable_jquery',$data);
+                                                       ),
+                                                       'hidden_value' => array
+                                                       (
+                                                               )
+                                                       )
+                                               )
+                                       );
 
-                       //$this->save_sessiondata();
+                       }
 
-               }
-
-        public function query()
-        {
-                       $address                        = 
phpgw::get_var('address');
-                       $check_payments         = 
phpgw::get_var('check_payments', 'bool');
-                       $location_code          = 
phpgw::get_var('location_code');
-                       $gaards_nr                      = 
phpgw::get_var('gaards_nr', 'int');
-                       $bruksnr                        = 
phpgw::get_var('bruksnr', 'int');
-                       $feste_nr                       = 
phpgw::get_var('feste_nr', 'int');
-                       $seksjons_nr            = phpgw::get_var('seksjons_nr', 
'int');
-                       
             $search                    = phpgw::get_var('search');
                        $order                  = phpgw::get_var('order');
                        $draw                   = phpgw::get_var('draw', 'int');
@@ -408,8 +438,6 @@
                                'check_payments' => $check_payments
                                
             );
-
-            //$values = $this->bo->read($params);
                        
                        $gab_list = $this->bo->read($params);
 
@@ -448,10 +476,15 @@
                                $uicols['formatter'][] = '';
                                $uicols['descr'][] = $date;
                                $uicols['className'][] = 'rightClasss';
+
+                               $uicols_add['input_type'][] = 'date';
+                               $uicols_add['name'][] = 
str_replace('/','_',$date);
+                               $uicols_add['formatter'][] = '';
+                               $uicols_add['descr'][] = $date;
+                               $uicols_add['className'][] = 'rightClasss';
                        }
 
                        $content = array();
-                       $values = array();
                        $j=0;
                        if (isset($gab_list) && is_array($gab_list))
                        {
@@ -459,7 +492,8 @@
                                {
                                        for 
($i=0;$i<count($uicols['name']);$i++)
                                        {
-
+                                               
if($uicols['input_type'][$i]!='hidden')
+                                               {
                                                        if ($uicols['name'][$i] 
== 'gaards_nr')
                                                        {
                                                                
$value_gaards_nr        = substr($gab['gab_id'],4,5);
@@ -489,8 +523,9 @@
                                                                $value  = 
isset($gab[$uicols['name'][$i]]) ? $gab[$uicols['name'][$i]] : '';
                                                        }
 
-                                                       
//$values[$j][$uicols['name'][$i]]                      = $value;
-                                                       
//$values['rows']['row'][$j]['column'][$i]['name']                      = 
$uicols['name'][$i];
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['value']                    = 
$value;
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['name']                     = 
$uicols['name'][$i];
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['align']                    = 
'center';
 
                                                        
if(isset($uicols['input_type']) && isset($uicols['input_type'][$i]) && 
$uicols['input_type'][$i]=='link' && $uicols['name'][$i] == 'map' )
                                                        {
@@ -499,11 +534,10 @@
                                                                $value_feste_nr 
        = substr($gab['gab_id'],13,4);
                                                                $link = 
phpgw::safe_redirect($link_to_map . '?maptype=Eiendomskart&gnr=' . 
(int)$value_gaards_nr . '&bnr=' . (int)$value_bruks_nr . '&fnr=' . 
(int)$value_feste_nr);
 
-                                                               
/*$values['rows']['row'][$j]['column'][$i]['format']    = 'link';
-                                                               
$values['rows']['row'][$j]['column'][$i]['value']       = $text_map;
-                                                               
$values['rows']['row'][$j]['column'][$i]['link']                = $link;
-                                                               
$values['rows']['row'][$j]['column'][$i]['target']      = '_blank';*/
-                                                               $value = $link;
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['format']   = 'link';
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['value']    = $text_map;
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['link']             = $link;
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['target']   = '_blank';
                                                        }
                                                        
if(isset($uicols['input_type']) && isset($uicols['input_type'][$i]) && 
$uicols['input_type'][$i]=='link' && $uicols['name'][$i] == 'gab' )
                                                        {
@@ -531,40 +565,241 @@
 
                                                                $link = 
phpgw::safe_redirect("$link_to_gab?{$_param}");
 
-                                                               
/*$values['rows']['row'][$j]['column'][$i]['format']    = 'link';
-                                                               
$values['rows']['row'][$j]['column'][$i]['value']       = $text_gab;
-                                                               
$values['rows']['row'][$j]['column'][$i]['link']                = $link;
-                                                               
$values['rows']['row'][$j]['column'][$i]['target']      = '_blank';*/
-                                                               $value = $link;
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['format']   = 'link';
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['value']    = $text_gab;
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['link']             = $link;
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['target']   = '_blank';
                                                        }
 
                                                        if 
(isset($uicols['input_type'][$i]) && $uicols['input_type'][$i]=='date')
                                                        {
-                                                               $value = 
$gab['payment'][str_replace('_','/',$uicols['name'][$i])];
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['value']                    = 
$gab['payment'][str_replace('_','/',$uicols['name'][$i])];
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['name']                     = 
$uicols['name'][$i];
+                                                               
$datatable['rows']['row'][$j]['column'][$i]['align']                    = 
'right';
                                                        }
-                                                       
-                                                       
$values[$j][$uicols['name'][$i]]                        = $value;
+                                               }
+                                               else
+                                               {
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['name']                     = 
$uicols['name'][$i];
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['value']                    = 
$gab[$uicols['name'][$i]];
+                                               }
 
+                                               
$datatable['rows']['row'][$j]['hidden'][$i]['value']                    = 
isset($gab[$uicols['name'][$i]]) ? $gab[$uicols['name'][$i]] : '';
+                                               
$datatable['rows']['row'][$j]['hidden'][$i]['name']                     = 
$uicols['name'][$i];
                                        }
 
                                        $j++;
                                }
                        }
-                       
-            
-            if( phpgw::get_var('export','bool'))
-            {
-                return $values;
-            }
-            
-            $result_data = array('results'  => $values);
-            $result_data['total_records'] = $this->bo->total_records;
-            $result_data['draw'] = $draw;
-            
-            return $this->jquery_results($result_data);
-        }
-               
-               
+
+                       // NO pop-up
+                       $datatable['rowactions']['action'] = array();
+                       //                      if(!$lookup)
+                                               {
+                                                       $parameters = array
+                                                               (
+                                                                       
'parameter' => array
+                                                                       (
+                                                                               
array
+                                                                               
(
+                                                                               
        'name'          => 'gab_id',
+                                                                               
        'source'        => 'gab_id'
+                                                                               
),
+                                                                       )
+                                                               );
+
+                                                       if($this->acl_read)
+                                                       {
+                                                               
$datatable['rowactions']['action'][] = array
+                                                                       (
+                                                                               
'my_name'                       => 'view',
+                                                                               
'text'                  => lang('view'),
+                                                                               
'action'                => $GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'    => 'property.uigab.list_detail'
+                                                                               
)),
+                                                                               
'parameters'    => $parameters
+                                                                       );
+                                                       }
+
+                                                       if($this->acl_add)
+                                                       {
+                                                               
$datatable['rowactions']['action'][] = array
+                                                                       (
+                                                                               
'my_name'                       => 'add',
+                                                                               
'text'                  => lang('add'),
+                                                                               
'action'                => $GLOBALS['phpgw']->link('/index.php',array
+                                                                               
(
+                                                                               
        'menuaction'    => 'property.uigab.edit',
+                                                                               
        'from'                  => 'index'
+                                                                               
))
+                                                                       );
+                                                       }
+                                                       unset($parameters);
+                                               }
+
+                       //$uicols_count indicates the number of columns to 
display in actuall option-menu. this variable was set in $this->bo->read()
+                       $uicols_count   = count($uicols['descr']);
+
+                       for ($i=0;$i<$uicols_count;$i++)
+                       {
+                               //all colums should be have formatter
+                               
$datatable['headers']['header'][$i]['formatter'] = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$i]);
+
+                               if($uicols['input_type'][$i]!='hidden')
+                               {
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+
+                                       if($uicols['name'][$i]=='gaards_nr')
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'gab_id';
+                                       }
+                                       else 
if($uicols['name'][$i]=='location_code')
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']       = 'location_code';
+                                       }
+                               }
+                               else
+                               {
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = false;
+                                       
$datatable['headers']['header'][$i]['sortable']         = false;
+                                       
$datatable['headers']['header'][$i]['format']                   = 'hidden';
+                               }
+                       }
+
+                       // path for property.js
+                       $property_js = "/property/js/yahoo/property.js";
+
+                       if 
(!isset($GLOBALS['phpgw_info']['server']['no_jscombine']) || 
!$GLOBALS['phpgw_info']['server']['no_jscombine'])
+                       {
+                               $cachedir = 
urlencode($GLOBALS['phpgw_info']['server']['temp_dir']);
+                               $property_js = 
"/phpgwapi/inc/combine.php?cachedir={$cachedir}&type=javascript&files=" . 
str_replace('/', '--', ltrim($property_js,'/'));
+                       }
+
+                       $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url'] . $property_js;
+
+                       // Pagination and sort values
+                       $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
+                       $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $datatable['pagination']['records_returned']= 
count($gab_list);
+                       $datatable['pagination']['records_total']       = 
$this->bo->total_records;
+
+                       $datatable['sorting']['order']  = 
phpgw::get_var('order', 'string'); // Column
+
+                       $appname                = lang('gab');
+                       $function_msg   = lang('list gab');
+
+                       if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
+                       {
+                               $datatable['sorting']['order']          = 
'gab_id'; // name key Column in myColumnDef
+                               $datatable['sorting']['sort']           = 
'asc'; // ASC / DESC
+                       }
+                       else
+                       {
+                               $datatable['sorting']['order']          = 
phpgw::get_var('order', 'string'); // name of column of Database
+                               $datatable['sorting']['sort']           = 
phpgw::get_var('sort', 'string'); // ASC / DESC
+                       }
+
+
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('tabview');
+
+
+                       //-- BEGIN----------------------------- JSON CODE 
------------------------------
+
+                       //values for Pagination
+                       $json = array
+                               (
+                                       'recordsReturned'       => 
$datatable['pagination']['records_returned'],
+                                       'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
+                                       'startIndex'            => 
$datatable['pagination']['records_start'],
+                                       'sort'                          => 
$datatable['sorting']['order'],
+                                       'dir'                           => 
$datatable['sorting']['sort'],
+                                       'records'                       => 
array(),
+                                       'headers'                       => 
$uicols_add['name'],
+                                       'headers_all'           => 
$uicols['name']
+                               );
+
+                       // values for datatable
+                       if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row'])){
+                               foreach( $datatable['rows']['row'] as $row )
+                               {
+                                       $json_row = array();
+                                       foreach( $row['column'] as $column)
+                                       {
+                                               if(isset($column['format']) && 
$column['format']== "link" && isset($column['java_link']) && 
$column['java_link']==true)
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                               }
+                                               elseif(isset($column['format']) 
&& $column['format']== "link")
+                                               {
+                                                       
$json_row[$column['name']] = "<a href='".$column['link']."' target='_blank'>" 
.$column['value']."</a>";
+                                               }
+                                               else
+                                               {
+                                                       
$json_row[$column['name']] = $column['value'];
+                                               }
+                                       }
+                                       $json['records'][] = $json_row;
+                               }
+                       }
+
+                       // right in datatable
+                       if(isset($datatable['rowactions']['action']) && 
is_array($datatable['rowactions']['action']))
+                       {
+                               $json ['rights'] = 
$datatable['rowactions']['action'];
+                       }
+
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+                               return $json;
+                       }
+
+
+                       $datatable['json_data'] = json_encode($json);
+                       //-------------------- JSON CODE ----------------------
+
+                       // Prepare template variables and process XSLT
+                       $template_vars = array();
+                       $template_vars['datatable'] = $datatable;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
+                       $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
$template_vars);
+
+                       if ( !isset($GLOBALS['phpgw']->css) || 
!is_object($GLOBALS['phpgw']->css) )
+                       {
+                               $GLOBALS['phpgw']->css = 
createObject('phpgwapi.css');
+                       }
+                       // Prepare CSS Style
+                       $GLOBALS['phpgw']->css->validate_file('datatable');
+                       $GLOBALS['phpgw']->css->validate_file('property');
+                       
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+
+                       //Title of Page
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+
+                       // Prepare YUI Library
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'gab.index', 'property' );
+
+                       $this->save_sessiondata();
+
+               }
+
                function list_detail()
                {
                        if(!$this->acl_read)




reply via email to

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