Location: PHPKode > projects > Homeless Mangement Information System > hmis/edit_specific_question.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 = "edit_questions";
$page_title = "Edit Questions for Page: ".htmlentities( ucfirst($HTTP_GET_VARS["edit_page_id"]))." Form";
$question_id = $HTTP_GET_VARS["question_edit_id"];
$page_access_levels = ":10:20:30:";

////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_edit.inc");
include($include_root."questions_display.inc");
//include($include_root."Questions_answers_validation_class.inc");
include($include_root."head.inc");	
include($include_root."template_parser.inc");
include($include_root."Questions_answers_validation_class.inc");
include($include_root."edit_questions_class.inc");
include($include_root."page_elements_display.inc");
include($include_root."edit_specific_question_class.inc");
include($include_root."services_functions.inc");


//Vet the get variables
if( ereg("[^A-Za-z0-9]\_", $HTTP_GET_VARS["page_id"]) )
{
    $edit_page_id = "";
    echo "Improper page id";
    exit;
}
else
{
    $edit_page_id = $HTTP_GET_VARS["page_id"];
}

if( ereg("[^A-Za-z0-9]\_", $HTTP_GET_VARS["question_edit_id"]) )
{
    $question_edit_id = "";
    echo "Improper question id";
    exit;
}
else
{
    $question_edit_id = $HTTP_GET_VARS["question_edit_id"];
}

//echo "question id is: ".$question_edit_id."<br/>";
//echo "page id is: ".$edit_page_id."<br/>";


//Pull out the attributes for the question defined by the page id and question id above.  This will only return question values for question owned by the user, based on org_id
$pull_questions_edit = new Questions_into_array ($edit_page_id, $access_level, $org_id, $group_id, "edit");
//echo "<br>Questions_into_array ($edit_page_id, $access_level, $org_id, $group_id, \"edit\")=<br>";
//echo pretty_var_dump($pull_questions_edit->questions[$question_edit_id]);
//echo pretty_var_dump(array_keys($pull_questions_edit->question_elements));

//echo "<br>Edit_question(".$pull_questions_edit->questions[$question_edit_id].", ".$pull_questions_edit->question_elements[$question_edit_id].", ".$form_answer.")=";
$question_def_html = new Edit_question($pull_questions_edit->questions[$question_edit_id], $pull_questions_edit->question_elements[$question_edit_id], $form_answer);
//var_dump($question_def_html);

//echo "<br>Questions_into_array (".$edit_page_id.", ".$access_level.", ".$org_id.", ".$group_id.", \"display\")=";
$pull_questions_display = new Questions_into_array ($edit_page_id, $access_level, $org_id, $group_id, "display");
//echo var_dump($pull_questions_display);

//$make_sample_html = new Display_table ($pull_questions_display->questions[$question_edit_id], $pull_questions_display->question_elements[$question_edit_id], "", "yes_td");
//$tag_values["{QUESTION_SAMPLE_OUTPUT}"] = $make_sample_html->final_html;

//You must have something in the form answer slot, or foreach fails in display_checkboxes_question, hence "blank_form_answer"
$tag_values["{QUESTION_SAMPLE_OUTPUT}"] = question_display ($pull_questions_display->questions[$question_edit_id], 
                                                            $pull_questions_display->question_elements[$question_edit_id], 
															$blank_form_answer);
//echo '<br>2.pull_q_display:'.pretty_var_dump($pull_questions_display->questions);
$tag_values["{QUESTION_DEFINTION_FORM_TABLE}"] = $question_def_html->final_html;
$tag_values["{HEAD}"] = head ($page_title, $head_page_specific, $head_dynamic_style);

template_parser ("edit_specific_question.html", $tag_values);

//Ouptput sample of table question formatted as described above

//$tag_values["{QUESTION_DEFINTION_FORM_TABLE}"] = $question_def_html->final_html;

//echo $question_def_html->final_html;
//echo $final_html
?>
Return current item: Homeless Mangement Information System