fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [12911]


From: Nelson Guerra
Subject: [Fmsystem-commits] [12911]
Date: Thu, 26 Mar 2015 23:17:21 +0000

Revision: 12911
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=12911
Author:   nelson224
Date:     2015-03-26 23:17:20 +0000 (Thu, 26 Mar 2015)
Log Message:
-----------


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-26 
23:07:18 UTC (rev 12910)
+++ branches/dev-syncromind/property/inc/class.uigab.inc.php    2015-03-26 
23:17:20 UTC (rev 12911)
@@ -31,9 +31,10 @@
         * Description
         * @package property
         */
-       phpgw::import_class('phpgwapi.yui');
+       phpgw::import_class('phpgwapi.uicommon_jquery');
+       phpgw::import_class('phpgwapi.jquery');
 
-       class property_uigab
+       class property_uigab extends phpgwapi_uicommon_jquery
        {
                var $grants;
                var $cat_id;
@@ -50,6 +51,7 @@
                        (
                                'index'                 => true,
                                'list_detail'   => true,
+                               'query'                 => true,
                                'view'                  => true,
                                'edit'                  => true,
                                'delete'                => true,
@@ -58,6 +60,8 @@
 
                function __construct()
                {
+                       parent::__construct();
+                       
                        $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
'property::location::gabnr';
 
@@ -179,244 +183,172 @@
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
                        }
 
-                       $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');
+            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(
+                                           '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,
+                                                       'allrows'               
=> true
+                                       )),
+                    'allrows'   => true,
+                    'editor_action' => '',
+                    'field' =>  array()
+                )
+            );
 
-                       $datatable = array();
-                       $values_combo_box = array();
+                       $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('','','','','','','','','','linktToMap','linktToGab'),
+                               'sortable'              =>      
array('','true','','','','','','true','','',''),
+                               '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('','','','','','','','center','','center','center')
+                       );
+                       
+                       $count_uicols_name = count($uicols['name']);
 
-                       if( phpgw::get_var('phpgw_return_as') != 'json' )
+            for ($k = 0; $k < $count_uicols_name; $k++) 
                        {
-                               $datatable['menu']                              
= $this->bocommon->get_menu();
-
-                               $datatable['config']['base_url']        = 
$GLOBALS['phpgw']->link('/index.php', array
+                $params = array
+                            (
+                                'key'          =>  $uicols['name'][$k],
+                                'label'                =>  
$uicols['descr'][$k],
+                                'sortable'  =>  
($uicols['sortable'][$k])?true:false,
+                                'hidden'    =>  ($uicols['input_type'][$k] == 
'hidden')?true:false,
+                                                               'className' =>  
($uicols['className'][$k])?$uicols['className'][$k]:''
+                            );               
+                
+                if($uicols['formatter'][$k])
+                               {
+                                       $params['formatter'] = 
$uicols['formatter'][$k];
+                               }
+                                       
+                array_push($data['datatable']['field'], $params);
+            }
+                       
+                       $parameters = array
+                               (
+                                       'parameter' => 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
-
-                                       ));
-                               $datatable['config']['allow_allrows'] = true;
-
-                               $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}'";
-
-                               $datatable['actions']['form'] = array
-                                       (
                                                array
                                                (
-                                                       '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
-                                                       )
+                                                       'name'          => 
'gab_id',
+                                                       'source'        => 
'gab_id'
                                                ),
-                                               'fields'        => array
+                                       )
+                               );
+
+                       if($this->acl_read)
+                       {
+                               $data['datatable']['actions'][] = array
+                                       (
+                                               'my_name'               => 
'view',
+                                               'text'                  => 
lang('view'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
                                                (
-                                                       'field' => array
-                                                       (
+                                                       'menuaction'    => 
'property.uigab.list_detail'
+                                               )),
+                                               'parameters'    => 
json_encode($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'
-                                                               )
+                       if($this->acl_add)
+                       {
+                               $data['datatable']['actions'][] = array
+                                       (
+                                               'my_name'               => 
'add',
+                                               'text'                  => 
lang('add'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                               (
+                                                       'menuaction'    => 
'property.uigab.add',
+                                                       'from'                  
=> 'index'
+                                               ))
+                                       );
+                       }
+                       unset($parameters);
 
+                       $code = <<<JS
 
-                                                       ),
-                                                       'hidden_value' => array
-                                                       (
-                                                               )
-                                                       )
-                                               )
-                                       );
+                               var columns = ["gaards_nr","bruksnr"];          
                
 
-                       }
+                               function initCompleteDatatable(oSettings, json, 
oTable) 
+                               {
+                                       
$('#datatable-container_filter').empty();
+                                       columns.forEach(function(col)
+                                       {
+                                               
$('#datatable-container_filter').append('<input type="text" placeholder="Search 
'+col+'" id="'+col+'" />');
+                                       });
+                                       
+                                       // Apply the search
+                                       var api = oTable.api();
+                                       columns.forEach(function(col)
+                                       {
+                                               $( '#' + col).on( 'keyup 
change', function () 
+                                               {
+                                                       
oTable.dataTableSettings[0]['ajax']['data'][col] = this.value;
+                                                       oTable.fnDraw();
+                                               });
+                                       });
+                               };
+                                       
+JS;
 
+                       $GLOBALS['phpgw']->js->add_code('', $code, true);
+                                       
+                       //Title of Page
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                                       
+                       self::add_javascript('property', 'portico', 
'gab.index.js');
+                       self::render_template_xsl('datatable_jquery',$data);
+
+               }
+
+        public function query()
+        {
+                       $address                        = 
phpgw::get_var('address');
+                       $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');
@@ -434,9 +366,7 @@
                                'bruksnr' => $bruksnr,
                                'feste_nr' => $feste_nr,
                                'seksjons_nr' => $seksjons_nr,
-                               'address' => $address,
-                               'check_payments' => $check_payments
-                               
+                               'address' => $address
             );
                        
                        $gab_list = $this->bo->read($params);
@@ -459,7 +389,7 @@
                                $text_gab=lang('GAB');
                        }
 
-                       $payment_date = $this->bo->payment_date;
+                       //$payment_date = $this->bo->payment_date;
 
                        $uicols = array (
                                'input_type'    =>      
array('hidden','text','text','text','text','hidden','text','text','text','link','link'),
@@ -469,22 +399,16 @@
                                'className'             =>      
array('','','','','','','','','','','')
                        );
 
-                       while (is_array($payment_date) && list(,$date) = 
each($payment_date))
+                       /*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['className'][] = 'rightClass';
+                       }*/
 
-                               $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))
                        {
@@ -492,8 +416,6 @@
                                {
                                        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);
@@ -523,9 +445,8 @@
                                                                $value  = 
isset($gab[$uicols['name'][$i]]) ? $gab[$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';
+                                                       
//$values[$j][$uicols['name'][$i]]                      = $value;
+                                                       
//$values['rows']['row'][$j]['column'][$i]['name']                      = 
$uicols['name'][$i];
 
                                                        
if(isset($uicols['input_type']) && isset($uicols['input_type'][$i]) && 
$uicols['input_type'][$i]=='link' && $uicols['name'][$i] == 'map' )
                                                        {
@@ -534,10 +455,12 @@
                                                                $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);
 
-                                                               
$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';
+                                                               
/*$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';*/
+                                                               
$values[$j]['link_map']                         = $link;
+                                                               $value = 
$text_map;
                                                        }
                                                        
if(isset($uicols['input_type']) && isset($uicols['input_type'][$i]) && 
$uicols['input_type'][$i]=='link' && $uicols['name'][$i] == 'gab' )
                                                        {
@@ -565,241 +488,36 @@
 
                                                                $link = 
phpgw::safe_redirect("$link_to_gab?{$_param}");
 
-                                                               
$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';
+                                                               
/*$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';*/
+                                                               
$values[$j]['link_gab']                         = $link;
+                                                               $value = 
$text_gab;
                                                        }
+                                                       
+                                                       
$values[$j][$uicols['name'][$i]]                        = $value;
 
-                                                       if 
(isset($uicols['input_type'][$i]) && $uicols['input_type'][$i]=='date')
-                                                       {
-                                                               
$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';
-                                                       }
-                                               }
-                                               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++;
                                }
                        }
-
-                       // 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();
-
-               }
-
+                       
+            
+            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);
+        }
+               
+               
                function list_detail()
                {
                        if(!$this->acl_read)




reply via email to

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