" .$_LOGIN['logout'].'' ." || " .$_WORDS['administrate'].''); } else { return($_LOGIN['mesg_loggedout'] ." || " .$_LOGIN['login'] .''); } } ###################################################################################################### gets the page title # parameters: none # returns: correct title of page function html_get_page_title() { global $_MENU,$_CMDS; $title = isset($_CMDS['query'][0]) ? $_MENU[$_CMDS['query'][0]] : $_MENU['home']; return($title); } ###################################################################################################### gets the ouline of the page # parameters: none # returns: the html for the current page's outline function html_get_page_outline() { global $_LANG,$_CMDS,$_DOC_ROOT,$_PATH_PREFIX; $html = ''; $file = $_DOC_ROOT."/data/outlines/{$_LANG}_ol-{$_CMDS['query'][0]}.txt"; if(!file_exists($file)) { return; } $outline = file_get_contents($file); // get the outline for this page if(empty($outline)) { // each page needs a file, but it can be empty return; } $outline = explode("\n",$outline); // break the outline file contents apart by line foreach($outline as $line) { $line = ltrim(rtrim($line)); if(empty($line)) { continue; } list($type,$text,$link) = explode('=',$line); if(preg_match("/^(\[#([\w_]+)\])/",$link,$matches)) { $replacement = ''; eval('$replacement = $'.$matches[2].';'); $link = str_replace($matches[1],$replacement,$link); } if($type == 'section') { $html .= "~ $text
\n"; } else if($type == 'subsection') { $html .= "    - $text
\n"; } else { $html .= $text; } } return($html); } ###################################################################################################### gets the select box to choose the language # parameters: none # returns: the html for the select box for language selection function html_get_lang_select() { global $_LANG,$_CONFIG,$_CLEAN_PATH,$_LANG_LONG; $select_box = "[ "; foreach($_CONFIG['langs'] as $lang) { if($_LANG == $lang) { continue; } $lang_path = preg_replace("/^\/?$_LANG/","$lang",$_CLEAN_PATH); // replace the current language with this selectable language //$lang_path = str_replace('.php','',$lang_path); // take out the .php in pae.php (only works when MultiViews works $select_box .= "{$_LANG_LONG[$lang]}\n"; } $select_box .= "]"; return($select_box); } ###################################################################################################### prints a trainer's biography # parameters: 1) path to bios; 2) name of specific bio # returns: nothing function html_print_bio($bios_path,$bio,$type) { global $_PATH_PREFIX,$_TRAINERS,$_MENU,$_WORDS,$_LANG,$_DOC_ROOT; $bio_data = xml_parse_file($bios_path.$bio); // parse this trainer's xml file $bio_name = str_replace('.xml','',$bio); // the name for the link will be the same as the file name without the extension $desc = '

'.$_TRAINERS['default_desc'].'

'; // if no description in the current language is found if(!empty($bio_data['trainer']['biography'])) { if(isset($bio_data['trainer']['biography'][0])) { // if there are several language present foreach($bio_data['trainer']['biography'] as $biography) { // step through each biography (in a different language) if($biography['lang'] == $_LANG) { // if there is one for the current language $desc = "

{$biography['paragraph'][0]}

"; $c = 1; while((250 - strlen($desc)) > 20) { // we just want a snippet for the who we are page, not the whole biography $desc .= "

{$biography['paragraph'][$c]}

"; // but we also want whole paragraphs, so we don't end in the middle of one $c++; } } } } else { // if only one language is present if($bio_data['trainer']['biography']['lang'] == $_LANG) { $desc = "

{$bio_data['trainer']['biography']['paragraph'][0]}

"; // same as above for many languages $c = 1; while((250 - strlen($desc)) > 20) { $desc .= "

{$bio_data['trainer']['biography']['paragraph'][$c]}

"; $c++; } } } } $img = $_DOC_ROOT."/data/trainer_pics/thumb_{$bio_data['trainer']['portrait']}"; // the picture file indicated in the xml doc $height = 80; // default height of each trainers div if(file_exists($img)) { // make sure the image file exists list($width,$height) = getimagesize($img); // get the image size, all we will use is the height $img = ""; // $img is now the html for the bio image } 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 .= " ({$note['content']}) \n"; } if($type == 'trainer') { // bio summaries must be printed slightly different for staff and trainers $name_degrees = $bio_data['trainer']['name']; if(!empty($bio_data['trainer']['degrees'])) { $name_degrees .= ', '.$bio_data['trainer']['degrees']; } print "
{$name_degrees}
$img $desc {$_WORDS['readmore']}
"; } else if($type == 'staff') { print "
{$bio_data['trainer']['name']}, {$bio_data['trainer']['title'][$_LANG]} $notes
$img $desc {$_WORDS['readmore']} | {$_WORDS['contactme']}
"; } } ###################################################################################################### gets a random panorama image # parameters: 1) path to pictures # returns: the html for the select box for language selection function html_get_random_img($path) { $pictures = scandir($path); $pictures = filesys_remove_unwanted_children($pictures,$path,'folders'); $num_pics = count($pictures); $rand_pic = $pictures[floor(rand(0,$num_pics - 1))]; return($rand_pic); } ###################################################################################################### print a page from xml data array # parameters: 1) array of data from xml file # returns: the html for the select box for language selection function html_print_xml_page($data) { $page_name = $data['name']; $page_content = ''; $sections = 0; $paras = 0; isset($data['content']['section']) ? $sections = 1 : $paras = 1; if($sections ) { $contents = xml_force_array($data['content']['section']); $page_content = html_print_sections($contents); } else if($paras) { $contents = xml_force_array($data['content']['para']); $page_content = html_print_paragraphs($contents); } print "
$page_name
\n"; print "
\n"; print $page_content; print "
\n"; } ###################################################################################################### print sections of an xml page # parameters: 1) array of sections to print # returns: the html for the sections function html_print_sections(&$sections) { $page_content = ''; foreach($sections as $sec) { $page_content .= "
\n"; $page_content .= "
{$sec['name']}
\n"; $page_content .= "
\n"; $paras = xml_force_array($sec['text']['para']); $page_content .= html_print_paragraphs($paras); $page_content .= "
\n"; $page_content .= "
\n"; } return $page_content; } ###################################################################################################### print paragraphs of an xml page # parameters: 1) array of paragraphs to print # returns: the html for the paragraphs function html_print_paragraphs(&$paragraphs) { $page_content = ''; foreach($paragraphs as $para) { $page_content .= '

'; if(is_array($para)) { foreach($para as $key => $value) { switch($key) { case 'line': if(is_array($value)) { foreach($value as $line) { $page_content .= '
'.$line; } } else { $page_content .= '
'.$value; } break; case 'paracontent': $page_content .= $value; break; case 'list': $page_content .= "

\n"; break; case 'heading': $page_content .= "$value\n"; break; case 'link': if(is_array($value)) { $page_content .= " {$value['linktext']}"; } else { $page_content .= " $value"; } break; case 'image': $images = xml_force_array($para['image']); $page_content .= html_print_images($images); break; default: break; } } } else { $page_content .= $para; } $page_content .= "

\n"; } return $page_content; } ###################################################################################################### print images of an xml page # parameters: 1) array of images to print # returns: the html for the images function html_print_images(&$images) { $page_content = ''; foreach($images as $image) { if(is_array($image)) { foreach($image as $key => $value) { switch($key) { case 'link': $page_content .= "