Subversion Repositories general

Compare Revisions

Ignore whitespace Rev 1380 → Rev 1381

/asterisk-stats/trunk/telbook_export.php
0,0 → 1,39
<?php
 
include_once('includes/config.php');
include_once('includes/display.php');
include_once('includes/functions.php');
include_once('includes/db.php');
 
if($_GET['type'] == 'panasonic') {
$db->query("select person_name, category_export_key, entry_title, entry_value"
. " from telbook_persons p"
. " left join telbook_categories c on p.person_category=c.category_id"
. " left join telbook_entries e on p.person_id=e.entry_person"
. " order by person_name, entry_title, entry_value");
 
header("Content-Type: text/plain");
echo "; Panasonic Communications Co., Ltd. Phonebook DECT Version 2.00\n";
 
$keys = array();
 
while($line = $db->fetch_row()) {
if($line[entry_value]) {
$key_base = $line['person_name'] .
($line['entry_title'] ? "/" . $line['entry_title'] : '');
$key = $key_base;
$count = 0;
while($keys[$key]) {
$key = $key_base . (++$count);
}
$keys[$key] = true;
 
echo '"' . $key . '",'
. ($line[category_export_key] ? $line[category_export_key] : 0)
. ',' . $line[entry_value] . "\n";
}
 
}
}
 
?>