Subversion Repositories general

Compare Revisions

No changes between revisions

Ignore whitespace Rev 1384 → Rev 1385

//asterisk-stats/trunk/telbook_details.php
0,0 → 1,81
<?php
 
include_once('includes/common.php');
Prolog();
 
$id = $_GET['id'];
 
# person and entries
$person = array();
$table = new Table(array('Type', 'Number', 'Comment'));
$table->set_table_class('telbook list');
 
$entry_count = 0;
function add_entry_inputs($table, $entry_count, $entry_title, $entry_value, $entry_comment)
{
++$entry_count;
$table->newrow();
$table->addcell(array('html' => display_input(
'text', 'entry_title-' . $entry_count, $entry_title)));
$table->addcell(array('html' => display_input(
'text', 'entry_value-' . $entry_count, $entry_value)));
$table->addcell(array('html' => display_input(
'text', 'entry_comment-' . $entry_count, $entry_comment)));
 
return $entry_count;
}
 
if($id) {
$db->query_params("select person_id, person_name, person_comment, person_category,"
. " entry_title, entry_value, entry_comment"
. " from telbook_persons p"
. " left join telbook_entries e on p.person_id=e.entry_person"
. " where person_id=$1", array($id));
 
$first_line = true;
while($line = $db->fetch_row()) {
if($first_line) {
$person['PERSON_ID'] = $line['person_id'];
$person['PERSON_NAME'] = $line['person_name'];
$person['PERSON_COMMENT'] = $line['person_comment'];
$person['PERSON_CATEGORY'] = $line['person_category'];
$first_line = false;
}
 
if($line['entry_value']) {
$entry_count = add_entry_inputs($table, $entry_count,
$line['entry_title'], $line['entry_value'], $line['entry_comment']);
}
}
}
else {
$person['PERSON_ID'] = '';
$person['PERSON_NAME'] = '';
$person['PERSON_COMMENT'] = '';
$person['PERSON_CATEGORY'] = '';
}
$g_display->add_variables($person);
 
for($i = 0; $i < 5; ++$i) {
$entry_count = add_entry_inputs($table, $entry_count, '', '', '');
}
 
# categories select box
$db->query("select category_id, category_name from telbook_categories order by category_name");
$categories_list = "\n\t\t\t\t<option value=''>(none)</option>";
while($line = $db->fetch_row()) {
$categories_list .= "\n\t\t\t\t<option value='"
. htmlspecialchars($line['category_id']) . "'"
. ($line['category_id'] == $person['PERSON_CATEGORY'] ? " selected" : "")
. ">" . htmlspecialchars($line['category_name']) . "</option>";
}
$g_display->add_html_variables(array('CATEGORIES' => $categories_list));
 
# show
$g_display->add_template('telbook_details_begin');
$g_display->add_html_text($table->build());
$g_display->add_template('telbook_details_end');
 
Epilog();
 
?>
Property changes:
Added: svn:mergeinfo