Location: PHPKode > projects > Homeless Mangement Information System > hmis/include/questions_into_tags_function.inc
<?php

function questions_into_tags ($questions, $question_elements, $form_answer)
{
	GLOBAL $tag_values;
	
    foreach ($questions as $current_question)
    {
			//Take the question out of the array of questions
			unset ($questions[$current_question["question_id"]]);
					
			//Route the question to an HTML creation function based on what type it is, i.e., "text"
			switch ($current_question["question_type"])	{

				case "text":
					$question_tag = "{QUEST_".$current_question["question_id"]."}";
					$tag_values[$question_tag] = display_text_question ($current_question, $form_answer);
					$tag_values["tag_id"][$question_tag] = $current_question["question_id"];
					//$tag_values[$question_tag]["tag_id"] = $current_question["question_id"];
					break;

				case "password":
					$question_tag = "{QUEST_".$current_question["question_id"]."}";
					$tag_values[$question_tag] = display_text_question ($current_question, $form_answer,'',TRUE);
					$tag_values["tag_id"][$question_tag] = $current_question["question_id"];
					//$tag_values[$question_tag]["tag_id"] = $current_question["question_id"];
					break;

				case "number":
					$question_tag = "{QUEST_".$current_question["question_id"]."}";
					$tag_values[$question_tag] = display_number_question ($current_question, $form_answer);
					$tag_values["tag_id"][$question_tag] = $current_question["question_id"];
					break;
					
				case "radio":
					$question_tag = "{QUEST_".$current_question["question_id"]."}";
					$tag_values[$question_tag] = display_radio_buttons_question ($current_question, $question_elements[$current_question["question_id"]], $form_answer);
					$tag_values["tag_id"][$question_tag] = $current_question["question_id"];
					break;

				case "checkboxes":
					$question_tag = "{QUEST_".$current_question["question_id"]."}";
					$tag_values[$question_tag] = display_checkboxes_question ($current_question, $question_elements[$current_question["question_id"]], $form_answer);
					$tag_values["tag_id"][$question_tag] = $current_question["question_id"];
					break;

				case "dropdown":
					$question_tag = "{QUEST_".$current_question["question_id"]."}";
					$tag_values[$question_tag] = display_dropdown_list_question ($current_question, $question_elements[$current_question["question_id"]], $form_answer);
					$tag_values["tag_id"][$question_tag] = $current_question["question_id"];
					break;

				case "textarea":
					$question_tag = "{QUEST_".$current_question["question_id"]."}";
					$tag_values[$question_tag] = display_textarea_question ($current_question, $form_answer);
					$tag_values["tag_id"][$question_tag] = $current_question["question_id"];
					break;
                    
                case "table":
					$question_tag = "{QUEST_".$current_question["question_id"]."}";
					$make_table_html = new Display_table($current_question, 
                        $question_elements[$current_question["question_id"]], $form_answer);
                    $tag_values[$question_tag] = $make_table_html->final_html;
					$tag_values["tag_id"][$question_tag] = $current_question["question_id"];
					break;
                    
                case "date":
					$question_tag = "{QUEST_".$current_question["question_id"]."}";
					$make_html = new Display_date_question($current_question, $form_answer);
                    $tag_values[$question_tag] = $make_html->f_html;
					$tag_values["tag_id"][$question_tag] = $current_question["question_id"];
					break;

				default:
					echo "Question #".$current_question["question_id"]." - Title: ".$current_question["question_title"]."Not Found In Question Database, or question has not type defined<br>";
		}
    }


}
?>
Return current item: Homeless Mangement Information System