120 lines
3.9 KiB
PHP
Executable File
120 lines
3.9 KiB
PHP
Executable File
<?php
|
|
|
|
###################################################################################################### prints a single trainer's page
|
|
global $_TRAINERS,$_WORDS,$_MENU; // the globals we'll need
|
|
$bio_path = $_DOC_ROOT.'/data/trainer_bios/'.$_CMDS['query'][1].'.xml'; // the xml file with trainer's data
|
|
$desc = $_TRAINERS['default_desc']; // a default description in case there is not info on this person
|
|
$img = '';
|
|
|
|
if(!file_exists($bio_path)) { // if no file exists, neither does the person
|
|
print "
|
|
<div class='page_subtitle'>{$_ERRORS['trainer']['nosuch_title']}</div>
|
|
<div class='page_content'>
|
|
{$_ERRORS['trainer']['nosuch_msg']}
|
|
</div>";
|
|
|
|
return;
|
|
}
|
|
|
|
$bio_data = xml_parse_file($bio_path); // parse the xml into an associative array
|
|
$bio_name = $_CMDS['query'][1]; // the name of the bio is the second element of the query array (see main_get_commands)
|
|
|
|
if(!empty($bio_data['trainer']['biography'])) {
|
|
$bio_desc = '';
|
|
if(isset($bio_data['trainer']['biography'][0])) { // ...['biography'] will be an array if there are descriptions in more than one language for this guy
|
|
foreach($bio_data['trainer']['biography'] as $biography) { // if there is more than one language
|
|
if($biography['lang'] == $_LANG) { // find the right language desc and collect all the paragraphs of the description
|
|
$bio_desc = $biography;
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
if($bio_data['trainer']['biography']['lang'] == $_LANG) {
|
|
$bio_desc = $bio_data['trainer']['biography'];
|
|
}
|
|
}
|
|
|
|
$paras = xml_force_array($bio_desc['paragraph']);
|
|
if(!empty($paras)) {
|
|
$desc = '';
|
|
foreach($paras as $para) {
|
|
$desc .= "<p>$para</p>\n";
|
|
}
|
|
}
|
|
}
|
|
|
|
$img = $_DOC_ROOT."/data/trainer_pics/thumb_{$bio_data['trainer']['portrait']}"; // make bio picture image html
|
|
$height = 80;
|
|
if(file_exists($img)) {
|
|
list($width,$height) = getimagesize($img);
|
|
$img = "<img src='/pae.co.at/data/trainer_pics/{$bio_data['trainer']['portrait']}'
|
|
align='right' class='bio_picture' />";
|
|
}
|
|
else { $img = ''; }
|
|
|
|
$notes = '';
|
|
if(!empty($bio_data['trainer']['note'])) { // add notes to the details, if they are present
|
|
$note = '';
|
|
if(isset($bio_data['trainer']['note'][0])) {
|
|
foreach($bio_data['trainer']['note'] as $note_info) {
|
|
if($note_info['lang'] == $_LANG) {
|
|
$note = $note_info;
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
if($bio_data['trainer']['note']['lang'] == $_LANG) {
|
|
$note = $bio_data['trainer']['note'];
|
|
}
|
|
}
|
|
$notes .= "<span class='bio_note'>({$note['content']})</span>";
|
|
}
|
|
|
|
$contact = '';
|
|
foreach($bio_data['trainer']['contact'] as $key => $value) { // get contact information
|
|
if(!empty($value)) {
|
|
if($key == 'email')
|
|
$contact .= "<tr><td align='right'><strong>{$_WORDS[$key]}:</strong></td><td><a href='mailto:$value' title='$value'>$value</a></td></tr>\n";
|
|
else
|
|
$contact .= "<tr><td align='right'><strong>{$_WORDS[$key]}:</strong></td><td>$value</td></tr>\n";
|
|
}
|
|
}
|
|
if(!empty($contact)) { // put the contact info in correct html
|
|
$contact = "
|
|
<div class='text_div'>
|
|
<div class='text_header'>{$_MENU['contact']} Information</div>
|
|
<div class='text'>
|
|
<table cellpadding='2' cellspacing='0' border='0'>
|
|
$contact
|
|
</table>
|
|
</div>
|
|
</div>";
|
|
}
|
|
|
|
if(!empty($bio_data['trainer']['title'][$_LANG])) {
|
|
$bio_data['trainer']['title'][$_LANG] = "<br /><span class='bio_title'>{$bio_data['trainer']['title'][$_LANG]}</span>";
|
|
}
|
|
|
|
if(!empty($bio_data['trainer']['degrees'])) {
|
|
$bio_data['trainer']['name'] .= ',';
|
|
}
|
|
|
|
print "
|
|
<div class='page_subtitle' id='{$bio_data['trainer']['name']}'>
|
|
{$bio_data['trainer']['name']}
|
|
{$bio_data['trainer']['degrees']}
|
|
{$bio_data['trainer']['title'][$_LANG]}
|
|
$notes
|
|
</div>
|
|
<div class='page_content' style='min-height:{$height}px;'>
|
|
$img
|
|
$contact
|
|
<div class='text_div'>
|
|
<div class='text_header'>{$_WORDS['biography']}</div>
|
|
<div class='text'>
|
|
$desc
|
|
</div>
|
|
</div>
|
|
</div>";
|
|
|
|
?>
|