From faf3707ac767a20f105b4304520333b23e347fa4 Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 9 Apr 2010 15:53:29 +0000 Subject: [PATCH] Replace placeholder in combo boxes too git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17574 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../gofon/phoneaccount/class_phoneAccount.inc | 58 ++++++++++++++----- 1 file changed, 42 insertions(+), 16 deletions(-) diff --git a/gosa-plugins/gofon/gofon/phoneaccount/class_phoneAccount.inc b/gosa-plugins/gofon/gofon/phoneaccount/class_phoneAccount.inc index 28ea37717..672f51c39 100644 --- a/gosa-plugins/gofon/gofon/phoneaccount/class_phoneAccount.inc +++ b/gosa-plugins/gofon/gofon/phoneaccount/class_phoneAccount.inc @@ -244,23 +244,49 @@ class phoneAccount extends plugin /* Go through available parameters and parse all attributes, like parametername, type, default ...*/ if((isset($attrs['goFonMacroParameter']))&&(is_array($attrs['goFonMacroParameter']))){ + foreach($attrs['goFonMacroParameter'] as $pkey=>$pval){ + /* Split Data in readable values, by delimiter ! */ + $data = explode("!",$attrs['goFonMacroParameter'][$pkey]); + + $string = $data[3]; + $string=preg_replace("/%uid/i",$this->uid,$string); + $string=preg_replace("/%pager/i",$this->pager,$string); + $string=preg_replace("/%context/i",$this->context,$string); + $string=preg_replace("/%voicemailcontext/i",$this->voice_context,$string); + + if(isset($this->cn)){ + $string=preg_replace("/%cn/i",$this->cn,$string); + } - foreach($attrs['goFonMacroParameter'] as $pkey=>$pval){ - /* Split Data in readable values, by delimiter ! */ - $data = explode("!",$attrs['goFonMacroParameter'][$pkey]); - - /* Set all attrs */ - $id = $data[0]; - $this->macroarray[$attrs['dn']][$id]['var'] ="var".$id; - $this->macroarray[$attrs['dn']][$id]['choosen']=$data[3]; - $this->macroarray[$attrs['dn']][$id]['id'] =$id; - $this->macroarray[$attrs['dn']][$id]['name'] =$data[1]; - $this->macroarray[$attrs['dn']][$id]['type'] =$data[2]; - $this->macroarray[$attrs['dn']][$id]['default']=$data[3]; - if($data[2] == "bool"){ - $this->macroarray[$attrs['dn']][$id]['choosen']=$data[3]; - } - }//foreach + + $tmp = array(); + foreach($this->phoneNumbers as $phonenum){ + $tmp[] = $phonenum; + } + + for($i = 0 ; $i < 10; $i++){ + if(isset($tmp[$i])){ + $string = preg_replace("/%telephoneNumber_".($i+1)."/i",$tmp[$i],$string); + } + } + if(isset($tmp[0])){ + $string = preg_replace("/%telephoneNumber/i",$tmp[0],$string); + } + $data[3] = $string; + + + /* Set all attrs */ + $id = $data[0]; + $this->macroarray[$attrs['dn']][$id]['var'] ="var".$id; + $this->macroarray[$attrs['dn']][$id]['choosen']=$data[3]; + $this->macroarray[$attrs['dn']][$id]['id'] =$id; + $this->macroarray[$attrs['dn']][$id]['name'] =$data[1]; + $this->macroarray[$attrs['dn']][$id]['type'] =$data[2]; + $this->macroarray[$attrs['dn']][$id]['default']=$data[3]; + if($data[2] == "bool"){ + $this->macroarray[$attrs['dn']][$id]['choosen']=$data[3]; + } + }//foreach }//is_array }//while -- 2.30.2