fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [11480] property: more on generic import


From: Sigurd Nes
Subject: [Fmsystem-commits] [11480] property: more on generic import
Date: Thu, 21 Nov 2013 12:19:36 +0000

Revision: 11480
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11480
Author:   sigurdne
Date:     2013-11-21 12:19:07 +0000 (Thu, 21 Nov 2013)
Log Message:
-----------
property: more on generic import

Modified Paths:
--------------
    trunk/property/inc/class.uiimport.inc.php

Modified: trunk/property/inc/class.uiimport.inc.php
===================================================================
--- trunk/property/inc/class.uiimport.inc.php   2013-11-21 09:41:01 UTC (rev 
11479)
+++ trunk/property/inc/class.uiimport.inc.php   2013-11-21 12:19:07 UTC (rev 
11480)
@@ -34,11 +34,7 @@
                protected $defalt_values;
 
 
-               private $valid_tables = array
-                               (
-                                       'fm_vendor',
-                                       'fm_condition_survey'
-                               );
+               private $valid_tables = array();
 
                public function __construct()
                {
@@ -55,8 +51,21 @@
                        $this->db           = & $GLOBALS['phpgw']->db;
                        $this->table            = phpgw::get_var('table');
                        
-                       if($this->table && !in_array($this->table, 
$this->valid_tables))
+                       $this->valid_tables = array
+                       (
+                               'fm_vendor'                             => 
'fm_vendor (' . lang('vendor') . ')',
+                               'fm_condition_survey'   => 'fm_condition_survey 
(' . lang('condition survey') . ')'
+                       );
+
+                       $location_types = 
execMethod('property.soadmin_location.select_location_type');
+                       
+                       foreach ($location_types as $location_type)
                        {
+                               
$this->valid_tables["fm_location{$location_type['id']}"] = 
"fm_location{$location_type['id']} ({$location_type['name']})";
+                       }
+
+                       if($this->table && !in_array($this->table, 
array_keys($this->valid_tables)))
+                       {
                                throw new Exception("Not a valid table: 
{$this->table}");                       
                        }
                }
@@ -261,14 +270,14 @@
 
                                $tables = $this->valid_tables;
 
-                               sort($tables);
+                               ksort($tables);
 
                                $table_option = '<option value="">' . 
lang('none selected') . '</option>' . "\n";
-                               foreach ( $tables as $table)
+                               foreach ( $tables as $table => $table_info)
                                {
                                        $selected = $import_settings['table'] 
== $table ? 'selected =  "selected"' : '';
                                        $table_option .=  <<<HTML
-                                       <option 
value='{$table}'{$selected}>{$table}</option>
+                                       <option 
value='{$table}'{$selected}>{$table_info}</option>
 HTML;
                                }
 




reply via email to

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