1,13 → 1,29 |
<?php |
|
include_once('includes/common.php'); |
include_once('includes/export_types.php'); |
|
if($_GET['type'] == 'panasonic') { |
$db->query("select person_name, category_export_key, entry_title, entry_value" |
. " from telbook_persons p" |
$id = $_GET['id']; |
$db->query_params("select export_name, export_type from telbook_export where export_id=$1", |
array($id)); |
if(!($line = $db->fetch_row())) { |
die("Export id not found"); |
} |
|
$rev_export_types = array_flip($export_types); |
|
if($line['export_type'] == $rev_export_types['panasonic']) { |
$db->query_params("select person_name, category_export_title, entry_title, entry_value," |
. " person_export_title" |
. " from telbook_entries e" |
. " join telbook_entries_export ee on ee.entry_id=e.entry_id" |
. " left join telbook_persons p on p.person_id=e.entry_person" |
. " left join telbook_persons_export pe on p.person_id=pe.person_id" |
. " 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"); |
. " left join telbook_categories_export ce on ce.category_id=c.category_id" |
. " where ee.export_id=$1" |
. " order by person_name, entry_title, entry_value", |
array($id)); |
|
header("Content-Type: text/plain"); |
echo "; Panasonic Communications Co., Ltd. Phonebook DECT Version 2.00\n"; |
16,8 → 32,10 |
|
while($line = $db->fetch_row()) { |
if($line[entry_value]) { |
$key_base = $line['person_name'] . |
($line['entry_title'] ? "/" . $line['entry_title'] : ''); |
$key_base = ($line['person_export_title'] ? $line['person_export_title'] |
: $line['person_name']); |
$key_base .= ($line['entry_title'] ? "/" . $line['entry_title'] : ''); |
|
$key = $key_base; |
$count = 0; |
while($keys[$key]) { |
26,11 → 44,14 |
$keys[$key] = true; |
|
echo '"' . $key . '",' |
. ($line[category_export_key] ? $line[category_export_key] : 0) |
. ($line[category_export_title] ? $line[category_export_title] : 0) |
. ',' . $line[entry_value] . "\n"; |
} |
|
} |
} |
else { |
die("Unknown export type"); |
} |
|
?> |