<?php
function page_title_table () {
GLOBAL $group_term, $organization_term, $system_title, $group_name, $org_name, $user_name, $access_level, $page_title, $head_dynamic_style, $instructions, $help, $message, $message_type, $question_validation_error, $page_id, $system_directory, $page_profile, $_SESSION;
GLOBAL $just_adding_empty_client_id_entry_forms_so_no_errors_please;
$head_dynamic_style .= "
#right {text-align: right}
H1 {margin: \"0\"}
H2 {margin: \"0\"}
H3 {margin: \"0\"}
H4 {margin: \"0\"}
H5 {margin: \"0\"}
H6 {margin: \"0\"}
.headertable {width: 100%; height: 80;}
.titlebold {white-space: nowrap; position: absolute; z-index: 1; color: #EEEEEE; font-weight: bolder; font-size: 80; font-family: Arial,Helvetica,sans-serif; width: 100%; padding: 0}
.pagetitle {position: relative; z-index: 2; color: #FF6600; Font: italic bold 20 arial; letter-spacing: .2em}
.instructions {position: relative; z-index: 2; font-size: 13; font-family: Arial,Helvetica,sans-serif}
.tiny {position: relative; z-index: 2; font-size: 10; font-varient: small-caps}
";
//echo $_SESSION['super_user_idB'].'<-supe accesslevel->'.$access_level .'<br>';
//Check if they are in superuser status, and create approproate HTML
if ( $_SESSION['super_user_idB'] ) {
$super_user_html = "<a class=\"superlink\"
href=\"".$system_directory."change_id.php?revert_id=".$_SESSION["super_user_idB"].
"\">Click Here to Change Back to Original Identity of: ".$_SESSION["super_user_nameB"]."</a>";
$head_dynamic_style .= "\n.superlink {position: relative; z-index: 2; font-size: 10; font-family: \"ariel\"; text-decoration: none; color: #FF6600; font-weight: bold}";
}
switch ( $access_level )
{
case '10':
$access_description = 'System Administrator';
break;
case '20':
$access_description = $group_term.' Administrator';
break;
case '30':
$access_description = $organization_term.' Administrator';
break;
case '40':
$access_description = 'System User';
break;
default:
$access_description = 'Not Defined';
break;
}
if ( $question_validation_error && !$just_adding_empty_client_id_entry_forms_so_no_errors_please )
{
if ( !$message )
{
$message .= 'ERROR: Incorrect form input, see below. ';
}
$message_type = 'error';
}
if ( $message_type == 'ok' ) {
$head_dynamic_style .= "\n.message {position: relative; z-index: 2; text-align: center; text-indent: 4em; color: #32CD32; font-size: \"120%\" } ";
}
elseif ( $message_type == 'error' ) {
$head_dynamic_style .= "\n.message {position: relative; z-index: 2; text-align: center; text-indent: 5em; color: #FF6347; font-size: \"120%\" } ";
}
$final_html = "
<table class=\"headertable\">
<tr>
<td colspan=\"2\"><span class=\"titlebold\">".$system_title."</span></td>
</tr>
<tr>
<td>
<table>
<tr>
<td><h3 class=\"pagetitle\">".$page_title."</h3></td>
</tr>
<tr>
<td><h4 class=\"instructions\">".$instructions."
<a class=\"tiny\" href=\"".$system_directory.'help_'.$access_level.'.html#'.$page_id."\" target=\"_blank\">Help</a></h4></td>
</tr>
<tr>
<td><h2 id=\"message\" class=\"message\">".htmlentities($message)." </h2></td>
</tr>
</table>
</td>
<td width=300>
<table>
<tr>
<td id=\"right\"><h6 class=\"tiny\">User:</h6></td>
<td><h6 class=\"tiny\"> ".$user_name."</h6></td>
</tr>
<tr>
<td id=\"right\"><h6 class=\"tiny\">".$group_term.":</h6></td>
<td><h6 class=\"tiny\"> ".$group_name."</h6></td>
</tr>
<tr>
<td id=\"right\"><h6 class=\"tiny\">".$organization_term.":</h6></td>
<td><h6 class=\"tiny\"> ".$org_name."</h6></td>
</tr>
<tr>
<td id=\"right\"><h6 class=\"tiny\">Access Level:</h6></td>
<td><h6 class=\"tiny\"> ".$access_description."</h6></td>
</tr>
<tr>
<td align=center colspan=\"2\"> ".$super_user_html." </td>
</tr>
</table>
</td>
</tr>
</table>";
return $final_html;
}
function menu () {
GLOBAL $access_level, $head_dynamic_style, $system_directory, $page_id;
$head_dynamic_style .= "
.menutd {background-color: #FFFFCC;}
.menutd:hover {color: #FF9966;}
.menulink {font-size: 12; font-family: Arial,Helvetica,sans-serif; text-decoration: none; color: #660033}
.menulink:hover {font-size: 12; font-family: Arial,Helvetica,sans-serif; text-decoration: none; color: #0000CC}
.menutop {color: #FFFFFF; font-size: 18; font-family: \"times\"; font-varient: small-caps; background-color: #000099; font-weight: bolder}
";
$sql = "SELECT menu.menu_title, menu.menu_link FROM menu, menu_permissions WHERE (menu.menu_element_id LIKE menu_permissions.menu_element_id) AND (menu_permissions.menu_permissions_level LIKE '".$access_level."' OR menu_permissions.menu_permissions_level LIKE 'all') AND (menu_permissions.menu_permissions_page_id LIKE '".$page_id."' OR menu_permissions.menu_permissions_page_id LIKE 'all') ORDER BY menu.menu_order";
//echo $sql;
$menu_list = run_query ($sql, "Menu Items");
$count = num_rows ($menu_list);
$final_html .= "<table class=\"menuwidth\"><tr><td class=\"menutop\">Menu</td></tr>";
for ($i=0; $i < $count; $i++) {
$menu_list_array = fetch_array($menu_list, "Menu Items", $i);
$link_title = $menu_list_array["menu_title"];
if(strstr($menu_list_array["menu_link"], "#")) {
$link_path = menu_dynamic_link ($menu_list_array["menu_link"]);
}
else {
$link_path = $menu_list_array["menu_link"];
}
$final_html .= "<tr><td class=\"menutd\">";
$final_html .= "<a class=\"menulink\" href=\"".$system_directory.$link_path."\">".$link_title."</a>";
$final_html .= "</td></tr>";
}
$final_html .= "</table>";
return $final_html;
}
function menu_dynamic_link ($function_name) {
GLOBAL $this_page;
switch ($function_name) {
case "#system_critique":
$link_path = "system_critique.php?critique_page_url=".$this_page." ".htmlentities($GLOBALS["QUERY_STRING"])."\" target=\"_blank";
break;
default:
$link_path = "No_function_name_found";
}
return $link_path;
}
function footer () {
GLOBAL $system_directory, $debug, $access_level, $page_id;
if ( $page_id == "query_report" ) {
$final_html = "<br>WARNING: reports may contain personal identifiable information. This information must be treated as CONFIDENTIAL.";
}
else {
$final_html = "<br>WARNING: The above web page may contain personal identifiable information. This information must be treated as CONFIDENTIAL.";
}
//This link now launches a new browser as "back" button does not always work to get back to HMIS! ~Jeff
$final_html .= "<br><br>This is open source software. <a target=_blank href=\"".$system_directory."contact_info.txt\">Click here</a> for details.";
if($debug && $access_level == 10) {
$final_html .= "<p/><table><tr><td>The Following is Debugging Information:<p/></td></tr><tr><td style=\"color: #000000; font-size: 13; font-family: Arial, Helvetica, sans-serif; text-align: left\"><p></p>".$debug."</td></tr></table></body>";
}
return $final_html;
}
function display_ecma ($page_id) {
GLOBAL $head_dynamic_ecma;
$sql = "SELECT validation_ecma FROM validation WHERE validation_page_id LIKE '".$page_id."'";
$sqlp = run_query ($sql, "Pull ECMA");
if(num_rows ($sqlp) > 0) {
$ecma = fetch_array($sqlp, "ECMA display", "0");
$head_dynamic_ecma['1'] .= "onload=\"startup()\"";
}
$head_dynamic_ecma['0'] .= stripslashes($ecma[0]);
//return $final_script;
}
?>