Location: PHPKode > projects > Homeless Mangement Information System > hmis/survey.php
<?php
//*Client Data System, Copyright (C) 2000, 2001 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 = "survey";
//$page_access_levels = ":20:30:40:";

include("initialize_pointer.php");
include($include_root."initialize.inc");
include($include_root."authenticate_public.inc");
include($include_root."user_info_functions.inc");
include($include_root."Questions_into_array_class.inc");
include($include_root."questions_display.inc");
include($include_root."questions_into_tags_function.inc");
include($include_root."Questions_answers_validation_class.inc");
include($include_root."template_parser.inc");
include($include_root."head.inc");
include($include_root."page_elements_display.inc");
include($include_root."survey.inc");
include_once($include_root."db_connection.inc");
include_once($include_root."reports_class.inc");
include_once($include_root."client_report_class.inc");
include_once($include_root."insert_client_report_class.inc");

$holder = $HTTP_GET_VARS["name"];

if ( strlen($holder) < 1 )  {
    echo "No survey defined";
    exit;

}
elseif ( ereg( "[^a-z\_]", $holder ) )  {
    echo "Illegal survey name";
    exit;

}
else {
    $survey_title_submitted = $holder;
}

$sur = new Survey($survey_title_submitted);
$page_title = $sur->survey_profile["report_title"];

$existing_report_id = $sur->check_for_recent_survey_submission ();
//echo "Existing report id is: ".$existing_report_id."<p>";


if ( $form_answer )   {
    $validation = new Questions_answers_validation($sur->survey_questions->questions, $sur->survey_questions->question_elements, $form_answer);
    $survey_answers = $validation->vetted_form_answer;

    if ( !$question_validation_error )  {
        
        $sur->insert_survey_answers ( $validation->vetted_value, $existing_report_id );
        $message = "Survey accepted. Thank you for participating. You can edit your response below. Only one survey can be submitted per IP address every 24 hours. ";
    $message_type = "ok";
    
    } 
}

elseif ( $existing_report_id > 0 ) {

    $cnt_rpt = new Client_report;
    $cnt_rpt->pull_existing_client_report_answers ( $existing_report_id, $sur->survey_questions->questions, $sur->survey_questions->question_elements, "do_not_modify" );
    $survey_answers = $cnt_rpt->vetted_frm_ans[0];
    $message = "The survey answers submitted from this computer less than 24 hours ago are entered below. You can edit your reponse below. Only one survey can be submitted per IP address every 24 hours. ";
    $message_type = "ok";
    
}

//else {
//    $survey_answers = "";
//}

    





$tag_values["{VACANCY_TABLE}"] = $sur->display_survey ($survey_answers);
    $html_template = "vacancies.html";
$tag_values["{HEAD}"] = head ($page_title, $head_page_specific, $head_dynamic_style);
template_parser ($html_template, $tag_values);




?>
Return current item: Homeless Mangement Information System