Code

Replace placeholders in comboboxes too.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 9 Apr 2010 15:52:43 +0000 (15:52 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 9 Apr 2010 15:52:43 +0000 (15:52 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6@17573 594d385d-05f5-0310-b6e9-bd551577e9d8

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

index 16b93b674f8aa26c07082671d98c949be1224335..d8250055f9c101f11393ae9994e3fc93635097e8 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