<?php
$page_id = "edit_questions";
$page_title = "Edit Questions for Page: ".$page_id;
$edit_page_id = $HTTP_GET_VARS["edit_page_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");
/*
<a href="edit_questions.php/?page_id=add_groups" target="_blank">Click Here to Edit Questions on This Page</a>
*/
$pull_questions_edit = new Questions_into_array ($edit_page_id, $access_level, $org_id, $group_id, "edit");
$pull_questions_optional = new Questions_into_array ($edit_page_id, $access_level, $org_id, $group_id, "optional_only");
$edit_class = new Edit_questions();
$optional_questions = new Optional_questions();
if ( $form_submitted == 'edit_questions' ){
//echo "Form was submitted<p>";
$edit_class->process_edited_questions ($pull_questions_edit->questions, $pull_questions_edit->question_elements, $form_answer_edit);
$optional_questions->process_edited_optional_questions ($pull_questions_optional->questions);
if ( $new_question_answer["question_title"] ) {
$edit_class->process_new_question_entry ( $new_question_answer );
}
if ( !$question_validation_error ) {
$edit_class->insert_edited_questions ( $edit_class->form_answer_edit );
}
}
/*
elseif ( $form_submitted == 'edit_questions_choices' ) {
$new_report = Add_report_profile ( )
}
*/
$pull_questions_edit_two = new Questions_into_array ($edit_page_id, $access_level, $org_id, $group_id, "edit");
if($access_level == "10") {
$tag_values["{FORM_END}"] .= "<a href=\"".$system_directory."edit_ecma.php?edit_page_id=".$edit_page_id."\" target=\"_blank\">Click Here to Edit ECMA for these Questions</a><p/>";
}
//Define the values for tags contained in the html template
$tag_values["{FORM_START}"] = form_start ($this_page."?edit_page_id=".$edit_page_id);
$tag_values["{FORM_END}"] .= form_end ("Submit Edited Questions");
$tag_values["{MENU}"] = menu();
$tag_values["{FOOTER}"] = footer();
$tag_values["{EDIT_QUESTIONS_TABLE}"] = $edit_class->edit_questions_table ($pull_questions_edit_two->questions, $pull_questions_edit_two->question_elements);
$tag_values["{NEW_QUESTION_ENTRY}"] = $edit_class->display_new_question_entry ();
$tag_values["{OPTIONAL_QUESTIONS_TABLE}"] = $optional_questions->display_optional_questions_table ($pull_questions_optional->questions, $pull_questions_optional->question_elements, $optional_questions->form_answer_optional_questions);
$tag_values["{PAGE TITLE}"] = page_title_table();
$tag_values["{HEAD}"] = head ($page_title, $head_page_specific, $head_dynamic_style);
echo "pge id is".$page_id."<p>";
//Substitute the specific question tags, leftover question tags, and specific tags in the html template with dynamic values, and display the result
template_parser ($page_id.".html", $tag_values);
//template_parser($page_id.".html","", "", $tag_values, $validation->form_answer);
?>