Code

Replace placeholder in combo boxes too
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 9 Apr 2010 15:53:29 +0000 (15:53 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 9 Apr 2010 15:53:29 +0000 (15:53 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17574 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/gofon/gofon/phoneaccount/class_phoneAccount.inc

index 28ea37717eea02c685a1dcee95d34262a9e4c371..672f51c391c19ad22c5ce8c52b42587a5b2d0fbf 100644 (file)
@@ -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