make numbers nice on dreambox, do not show from/to when only one type gets logged
authorChristian Weiske <cweiske@cweiske.de>
Sat, 25 Aug 2012 21:18:51 +0000 (23:18 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Sat, 25 Aug 2012 21:18:51 +0000 (23:18 +0200)
src/callnotifier/Logger/CallFileTop.php

index 4dc6b6c82a99fcdd28c6854a71d18fc067675593..58f3174a625e1ef8758b85071279c311d9dc5e81 100644 (file)
@@ -18,7 +18,7 @@ class Logger_CallFileTop extends Logger_CallBase
     protected $file;
 
     /**
-     * Create a new file call logger. 
+     * Create a new file call logger.
      *
      * @param string $file      Path to the file to log the calls in.
      * @param string $callTypes Which types of call to log:
@@ -85,9 +85,18 @@ class Logger_CallFileTop extends Logger_CallBase
         $this->addUnsetVars($call);
         $str = '  ' . date('H:i', $call->start);
         if ($call->type == CallMonitor_Call::INCOMING) {
-            $str .= ' von  ' . str_pad($this->getNumberString($call, 'from'), 30);
+            $prefix = ' von  ';
+            $numstr = $this->getNumberString($call, 'from');
         } else {
-            $str .= ' nach ' . str_pad($this->getNumberString($call, 'to'), 30);
+            $prefix = ' nach ';
+            $numstr = $this->getNumberString($call, 'to');
+        }
+
+        if ($this->callTypes == 'io') {
+            $str .= $prefix;
+            $str .= str_pad($numstr, 20);
+        } else {
+            $str .= '  ' . str_pad($numstr, 25);
         }
 
         $str .= ' ' . date('H:i:s', $call->end - $call->start - 3600);