From e37e983edbbcde001a193db471175f54d3bd22de Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 9 Apr 2010 15:52:43 +0000 Subject: [PATCH] Replace placeholders in comboboxes too. git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6@17573 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 16b93b674..d8250055f 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