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:
if (isset($arLines[0]) && $arLines[0] == $date) {
//same date as previous log entry
$arLines = array_pad($arLines, -count($arLines) - 1, '');
- } else {
+ } else if (!isset($arLines[0])) {
+ //empty file
$arLines = array_pad($arLines, -count($arLines) - 2, '');
+ } else {
+ //new date
+ $arLines = array_pad($arLines, -count($arLines) - 3, '');
+ $arLines[2] = "\n";
}
$arLines[0] = $date;
$arLines[1] = $logline;
$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 {
+ $prefix = ' nach ';
+ $numstr = $this->getNumberString($call, 'to');
+ }
+
+ if ($this->callTypes == 'io') {
+ $str .= $prefix;
+ $str .= Functions::mb_str_pad($numstr, 20);
} else {
- $str .= ' nach ' . str_pad($this->getNumberString($call, 'to'), 30);
+ $str .= ' ' . Functions::mb_str_pad($numstr, 25);
}
$str .= ' ' . date('H:i:s', $call->end - $call->start - 3600);