Location: PHPKode > projects > Homeless Mangement Information System > hmis/client_lookup.php
<?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."question_set_validation_function.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_report_entry_class.inc");
include($include_root."client_profile_class.inc");
include($include_root."reports_class.inc");
//include($include_root."report_date_questions_class.inc");
include($include_root."insert_household_report_class.inc");  //needed for edit profile
include($include_root."relationships_class.inc");
include($include_root."insert_client_report_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' );

//echo "report type: ".$report_type."<br>";
//var_dump($edit_client_identifiers_for_client_id);
//echo "<br>";
//echo "<p><font color=purple size=2>form_submitted: ";
//echo pretty_var_dump($form_submitted);

//var_dump($edit_client_identifiers_for_client_id);
//echo "</p></font>";

//reset values
$message = '';
$message_type = 'ok';

if (!$cli_prof)
{
	$cli_prof = new Client_profile();
}

if ( $form_submitted == 'relationship_change' )
{
    //$cli_prof = new Client_profile;
    $cli_prof->edit_client_relationship_session ( $form_answer['rel'] );
    $form_answer = '';
}

if ( $form_submitted == 'client_ids_edit' )
{
	//the message is overwritten below if there is an error
	$message = "Client Identifiers/Profile successfully edited. ";
    $message_type = "ok";
}

if ( ereg ( '[0-9]', $_GET['add_client_to_household_session'] ) )
{
    //$cli_prof = new Client_profile;
    $cli_prof->add_client_to_household_session ( $_GET['add_client_to_household_session'] );
}

if ( ereg ( '[0-9]', $_GET['remove_client_from_household_session'] ) )
{
    //$cli_prof = new Client_profile;
    $cli_prof->remove_client_from_household_session ( $_GET['remove_client_from_household_session'] );
}

//Client Lookup Form

	//$cli_prof = new Client_profile();
	//echo pretty_var_dump($client_info);
    
    if ( $form_answer )
	{
		$id_quests = new Client_id;
	    $id_quests->pull_client_id_entry_questions_array ( '0', 'yes' );
        
        $validated_iden_ans = new Questions_answers_validation ( $id_quests->questions, $id_quests->question_elements, $form_answer ); 
        
		//Ensure all client names submitted for search are cased just as they are entered into the database.
		//That is, first letter of first, middle, and last name are capetalized and rest is lowercase.  This
		//is done because search, queries are all case sensative on encrypted values.  Note hardcoded 0!
		if (strlen($validated_iden_ans->vetted_value["name_first0"])>0)
			$validated_iden_ans->vetted_value["name_first0"] = 
			     ucfirst(strtolower(trim($validated_iden_ans->vetted_value["name_first0"])));
		if (strlen($validated_iden_ans->vetted_value["name_middle0"])>0)
			$validated_iden_ans->vetted_value["name_middle0"] =
			     ucfirst(strtolower(trim($validated_iden_ans->vetted_value["name_middle0"])));
		if (strlen($form_answer["name_last0"])>0)
			$validated_iden_ans->vetted_value["name_last0"] = 
			     ucfirst(strtolower(trim($validated_iden_ans->vetted_value["name_last0"])));
		
        $tag_values['{CLIENT_PROFILE}'] = $cli_prof->display_client_profile ( $client_info, 'Clients in View', 'client_profile_edit' );
        $rel = new Relationships ( $client_info[0]['client_id'] );
        $tag_values['{RELATIONSHIPS}'] = $rel->display_other_related_clients_table();
        
		//echo '<hr color=purple>'.pretty_var_dump($client_info).'<hr color=purple>';
        //echo "<p><font size=2 color=green>validated_iden_ans: ";
        //echo pretty_var_dump($validated_iden_ans->vetted_value);
        //echo "</p></font>";
        
		//Display Lookup Form with submitted data
        display_client_lookup_entry_form ( $validated_iden_ans->vetted_form_answer );
        $clup = new Client_lookup;
        
        $matching_clients_identifier_array = $clup->lookup_client_using_identifiers ( $id_quests->questions, $validated_iden_ans->vetted_value );
        //echo 'matchin array<p>'; var_dump ( $matching_clients_identifier_array ); echo '<p>';
        $tag_values['{MATCHING_CLIENTS}'] = display_client_identifiers_table ( $matching_clients_identifier_array, 'Clients matching query' );
        
        $tag_values['{FORM_END}'] .= form_end ($button_label, 2);
   		//echo '<hr color=purple>';
	}
	else
	{
        $tag_values['{CLIENT_PROFILE}'] = $cli_prof->display_client_profile ( $client_info, 'Clients in View', 'client_profile_edit' );
        $rel = new Relationships ( $client_info[0]['client_id'] );
        $tag_values['{RELATIONSHIPS}'] = $rel->display_other_related_clients_table();
		//echo '<hr color=blue>'.pretty_var_dump($client_info).'<hr color=blue>';
		//Display Lookup Form
        display_client_lookup_entry_form ();
        $tag_values["{FORM_END}"] .= submit_button ( 'list', 'Return list of matching clients' );
        $tag_values["{FORM_END}"] .= "</form>";
	}
//End Client Lookup Form


//Define the values for tags contained in the html template
$tag_values["{FORM_START}"] = form_start ( $form_action );
//$tag_values["{FORM_END}"] .= form_end ($button_label, 1);
$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();
//So that the "Other matches" tage does not show up as undefined when not used, give it an invisible value
//$tag_values["{OTHER_MATCHES}"] .= " ";
template_parser ($html_template, $tag_values);




//var_dump($client_info);
//echo "Client info:<p>";
//display_value($_SESSION['client_infoB']);
?>
Return current item: Homeless Mangement Information System