From b2d4200034a7d96b314cdef836e382bad21b7219 Mon Sep 17 00:00:00 2001 From: Alan Garcia Date: Fri, 31 Jan 2014 15:21:36 +0000 Subject: [PATCH] Gere les tableaux de tableaux dans les variables. --- bureau/admin/adm_var_edit.php | 37 +++++++++++++++++++++++++++++++---- bureau/class/m_variables.php | 26 +++++++++++++++++++++--- 2 files changed, 56 insertions(+), 7 deletions(-) diff --git a/bureau/admin/adm_var_edit.php b/bureau/admin/adm_var_edit.php index 07ea315a..3734c8fa 100644 --- a/bureau/admin/adm_var_edit.php +++ b/bureau/admin/adm_var_edit.php @@ -21,6 +21,11 @@ $fields = array ( ); getFields($fields); +variable_get("aaa_test3", +array("ns1"=> array("ns"=>"ns1.%%FQDN%%", "ip"=>"%%PUBLIC_IP%%", "enabled"=>"%%ENABLED%%"), "ns2"=>array("ns"=>"fdsffsd", "ip"=>"fdsfdfds", "enabled"=>"fds"), 'ns55'=> 'arf' ), +"This is a test!", +array("ns1"=> array("ns"=>"ns name", "ip"=>"ip address", "enabled"=>"enabled"), "ns2"=>array("ns"=>"ns name", "ip"=>"ip address", "enabled"=>"enabled"), 'ns3'=>'toto' ) +); if (empty($var)) { echo "

";__("Missing var name");echo "

"; @@ -72,8 +77,20 @@ function edit_var($var_arr) { echo ""; @@ -104,8 +121,20 @@ function add_var($stratatata, $stratatata_arr=null) { echo ""; diff --git a/bureau/class/m_variables.php b/bureau/class/m_variables.php index a88799c8..0cc522dc 100644 --- a/bureau/class/m_variables.php +++ b/bureau/class/m_variables.php @@ -245,12 +245,32 @@ class m_variables { echo "
  • "; if (! is_numeric($k)) { if (is_null($varname)) { - echo "$k =>"; + echo "$k"; } else { - echo $this->variables_list()['DEFAULT'][null][$varname]['type'][$k]. " => "; + if ( !isset($this->variables_list()['DEFAULT'][null][$varname]['type'][$k]) || is_array( $this->variables_list()['DEFAULT'][null][$varname]['type'][$k] ) ) { + echo $k; + } else { + echo $this->variables_list()['DEFAULT'][null][$varname]['type'][$k]; + } } } - echo "$l
  • "; + if (is_array($l)) { + echo ""; + } else { + echo " => $l"; + } + echo ""; } echo ""; } // empty $v