<?php
//*Client Data System, Copyright (C) 2000, 2001, 2002, 2003 Tedd Kelleher. This is free software, subject to the
//*GNU GENERAL PUBLIC LICENSE, Version 2, June 1991 (in file named gpl.txt), which should accompany
//*any distribution of this file. Tedd Kelleher can be contacted at hide@address.com
//$page_id = "clients";
$page_access_levels = ':40:';
//$page_profile = "View Client Information";
////Header for every page that finds the include directory, connects to db, authenticates user access
include("initialize_pointer.php");
if(!include($include_root."authenticate.inc")){echo "No Authentication"; exit; };
include($include_root."Questions_into_array_class.inc");
include($include_root."questions_display.inc");
include($include_root."Questions_answers_validation_class.inc");
include($include_root."questions_into_tags_function.inc");
include($include_root."head.inc");
include($include_root."template_parser.inc");
include($include_root."page_elements_display.inc");
include($include_root."client_id_class.inc");
include($include_root."client_id_org_generated_class.inc");
include($include_root."client_profile_class.inc");
include($include_root."reports_class.inc");
include($include_root."relationships_class.inc");
include ( $include_root.'encryption_class.inc' );
include ( $include_root.'client_lookup_class.inc' );
include ( $include_root.'date_encrypted_functions.inc' );
convert_post_and_get_variable ( 'edit_client_identifiers_for_client_id' );
convert_post_and_get_variable ( 'form_submitted' );
//reset values
$message = '';
$message_type = 'ok';
if (!$cli_prof)
{
$cli_prof = new Client_profile();
}
if ( $_GET['display_client_overview'] ) //Client Overview
{
//first clean out view...
$client_info = null;
if ( ereg ( '[0-9]', $_GET['display_client_overview'] ) )
{
display_client_overview ( $_GET['display_client_overview'] );
$tag_values['{FORM_END}'] .= form_end ( $button_label, 1 );
}
else
{
echo 'Illegal non-numeric client id'; exit;
}
}
//MUST REMOVE OR ADD CLIENTS TO SESSION BEFORE CALLING SHOW REPORT OPTIONS...
if ( ereg ( '[0-9]', $_GET['remove_client_from_household_session'] ) )
{
if (count($client_info)==1)
{
$message = 'While you are viewing this page one client must always be defined in the View.';
$message_type = 'error';
}
else
{
$message = '';
$message_type = 'ok';
$cli_prof->remove_client_from_household_session ( $_GET['remove_client_from_household_session'] );
}
//display_client_overview ( $client_info[0]['client_id'] );
}
elseif ( ereg ( '[0-9]', $_GET['add_client_to_household_session'] ) )
{
$message = '';
$message_type = 'ok';
$cli_prof->add_client_to_household_session ( $_GET['add_client_to_household_session'] );
}
if ( $_GET['remove_client_from_household_session'] || $_GET['add_client_to_household_session'] )
{
$page_title = 'Client Overview';
$instructions .= 'Displays information regarding a client. ';
$page_id = 'client_overview';
$form_action = $this_page.'?display_client_overview='.$client_id;
$html_template = "client_overview.html";
//display_client_overview ( $client_info[0]['client_id'] );
$relationships = new Relationships ( $client_info[0]['client_id'] );
//if there is only one client in view don't allow user to remove...
if (count($client_info)==1)
{
$tag_values['{CLIENT_PROFILE}'] = $cli_prof->display_client_profile_table ( $client_info, '', 'client_overview' );
}
else
{
$tag_values['{CLIENT_PROFILE}'] = $cli_prof->display_client_profile_table ( $client_info, 'Clients in View', 'client_overview' );
}
$tag_values['{CLIENT_PROFILE}'] .= "<p/><a href=\"".$system_directory."client_editprofile.php?edit_client_identifiers_for_client_id=".$client_info[0]['client_id']."\">Edit client identifiers</a>";
$tag_values['{RELATIONSHIPS}'] = $relationships->display_other_related_clients_table ( );
$reports = new Reports;
$tag_values['{EXISTING_REPORTS}'] = $reports->display_household_reports_table ( $client_id, $org_id) ;
$tag_values['{EXISTING_CLIENT_REPORTS}'] = $reports->display_client_reports_table ( $client_id, $org_id );
}
//Define the values for tags contained in the html template
$tag_values["{FORM_START}"] = form_start ( $form_action );
$tag_values["{PAGE TITLE}"] = page_title_table();
$tag_values["{MENU}"] = menu();
$tag_values["{HEAD}"] = head ($page_title, $head_page_specific, $head_dynamic_style);
$tag_values["{FOOTER}"] = footer();
template_parser ($html_template, $tag_values);
function display_client_overview ( $client_id )
{
GLOBAL $tag_values, $org_id, $page_id, $html_template, $button_label, $form_action, $this_page, $form_answer, $form_submitted,
$system_directory, $page_title, $instructions;
$page_title = 'Client Overview';
$instructions .= 'Displays information regarding the client. ';
$page_id = 'client_overview';
$form_action = $this_page.'?display_client_overview='.$client_id;
$html_template = "client_overview.html";
$profile = new Client_profile;
$relationships = new Relationships ( $client_id );
$selected_client_variables = $profile->pull_client_profile_array ($client_id);
$client_variables[0] = $selected_client_variables;
//$relationships->assign_looked_up_client_as_lead();
$profile->put_client_profile_associated_with_client_report_into_client_info_session_variable ($client_id);
//$client_variables = $selected_client_variables;
//echo '<br>'.pretty_var_dump($client_variables);
//Should probably make a function for getting clients_id relationship now
$client_variables[0]['client_relationship_to_lead'] = $relationships->related_clients_profile_array[$client_id]['client_relationship_to_lead'];
//echo pretty_var_dump($relationships->related_clients_profile_array);
$tag_values['{CLIENT_PROFILE}'] = $profile->display_client_profile_table ( $client_variables, '', 'client_overview' );
//$tag_values['{CLIENT_PROFILE}'] = $profile->display_client_profile_table ( $client_variables, '', 'client_overview' );
$tag_values['{CLIENT_PROFILE}'] .= "<p/><a href=\"".$system_directory."client_editprofile.php?edit_client_identifiers_for_client_id=".$client_id."\">Edit client identifiers</a>";
//Place the client profile tags questions into tags, and process them
/////////////////////display_client_profile_table_edit_table ($client_id);
$tag_values['{RELATIONSHIPS}'] = $relationships->display_other_related_clients_table ( );
$reports = new Reports;
$tag_values['{EXISTING_REPORTS}'] = $reports->display_household_reports_table ( $client_id, $org_id) ;
$tag_values['{EXISTING_CLIENT_REPORTS}'] = $reports->display_client_reports_table ( $client_id, $org_id );
//$tag_values["{NEW_REPORT}"] = "<table><tr><td>
//<a href=\"".$system_directory."report.php?form_submitted=client_report_entry_with_existing_client_id
//&report_type=service&new_report_client_id=".$client_id."\">Submit a New Service Report for this Client</a></td></tr></table>";
$button_label = 'Press to Submit Changes';
}
?>