Exemplo n.º 1
0
Arquivo: edit.php Projeto: rolwi/koala
$tpl->set_block("content", "button_mission", "BUTTON_MISSION_ROW");
$tpl->set_block("content", "no_question_row", "QUESTION_ROW");
$tpl->set_block("content", "question_row_edit", "QUESTION_ROW_EDIT");
$tpl->set_block("content", "question_row", "DUMMY");
$tpl->set_block("content", "button_label_general", "DUMMY");
$tpl->set_block("content", "button_label_insert", "DUMMY");
$tpl->set_block("content", "button_label_sort", "DUMMY");
$tpl->set_block("content", "button_img_sort", "BUTTON_IMG_SORT");
$tpl->set_block("content", "button_label_finish", "DUMMY");
$tpl->set_block("content", "button_spacer", "DUMMY");
$tpl->set_block("content", "enabling_row", "ENABLING_ROW");
$tpl->set_block("content", "enable", "DUMMY");
$tpl->set_block("content", "disable", "DUMMY");
$tpl->set_var(array("DUMMY" => "", "ENABLING_ROW" => "", "BUTTON_IMG_SORT" => "", "QUESTIONARY_ID" => $questionary->get_id(), "QUESTIONARY_NAME" => $questionary_name));
//parse out questionary
$options = $geo->get_all();
//if options are available parse list
$question_number = 1;
if (count($options) > 0) {
    //build array for option types blocks to parse out
    $blocks = array(QUESTIONARY_DESCRIPTION => "description", QUESTIONARY_EMPTY_LINE => "empty_line", QUESTIONARY_FULL_LINE => "full_line", QUESTIONARY_CAPTION => "caption", QUESTIONARY_INPUT_CHECKBOX => "input_checkbox", QUESTIONARY_INPUT_RADIO => "input_radiobutton", QUESTIONARY_INPUT_SELECT => "input_selectbox", QUESTIONARY_INPUT_TEXT => "input_text", QUESTIONARY_INPUT_TEXTAREA => "input_textarea", QUESTIONARY_NEW_PAGE => "new_page", QUESTIONARY_INPUT_GRADING => "input_grading", QUESTIONARY_INPUT_TENDENCY => "input_tendency");
    //parse list
    foreach ($options as $id => $option) {
        //get line data
        $data = $option;
        //set generell output values
        $type = $data["type"];
        if ($type == QUESTIONARY_INPUT_TEXTAREA) {
            $type = QUESTIONARY_INPUT_TEXT;
        }
        //textarea is the same formular like text
Exemplo n.º 2
0
$editanswer = $attributes["bid:questionary:editanswer"];
$resultcreator = $attributes["bid:questionary:resultcreator"];
$resultcreationtime = $attributes["bid:questionary:resultcreationtime"];
//check rights
$forbidden = !($is_author || $is_analyst);
//get questionary geometry
$questions = $question_folder->get_inventory();
$geo = new questionary_geo();
foreach ($questions as $question) {
    $question = $question->get_attribute("bid:question:geometry", 1);
}
$buffer = $steam->buffer_flush();
foreach ($buffer as $question) {
    $geo->insert($question);
}
$entities = $geo->get_all();
//action delete
if ($mission == "delete" && $answer && $is_author) {
    $answer->delete();
    $steam->disconnect();
    header("Location: {$config_webserver_ip}/modules/questionary/result.php?object=" . $questionary->get_id());
    exit;
}
//get all input_ids from all questions that are in the results list
$header = array();
foreach ($entities as $id => $entity) {
    if (isset($entity["input_id"]) && $entity["output"]) {
        switch ($entity["type"]) {
            case QUESTIONARY_INPUT_GRADING:
                $grading_question = "
";
                foreach ($entity["grading_options"] as $oid => $value) {
Exemplo n.º 3
0
            case QUESTIONARY_INPUT_TENDENCY:
                $input_id = trim($entity["input_id"]);
                $tendency_elements = $entity["tendency_elements"];
                $isset = false;
                foreach ($tendency_elements as $key => $text) {
                    if (!isset($post[$input_id . "_" . $key])) {
                        $error[] = $text[0] . " - " . $text[1];
                    }
                }
                break;
        }
    }
}
//Action save
if ($direction == "finish" && (isset($error) && count($error) == 0) && $is_editor && !$forbidden && $enabled) {
    $all = $geo->get_all();
    $input = array();
    foreach ($all as $item) {
        if (isset($item["input_id"])) {
            $input_id = trim($item["input_id"]);
            switch ($item["type"]) {
                case QUESTIONARY_INPUT_CHECKBOX:
                    $options = array();
                    foreach ($item["options"] as $key => $option) {
                        if (isset($post[$input_id . "_" . $key])) {
                            $options[] = $key;
                        }
                    }
                    $input[$input_id] = $options;
                    break;
                case QUESTIONARY_INPUT_GRADING:
Exemplo n.º 4
0
}
//******************************************************
//** Display Stuff
//******************************************************
$tpl = new Template("./templates/{$language}", "keep");
$tpl->set_file("content", "edit_sort.ihtml");
$tpl->set_block("content", "button_label_save", "DUMMY");
$tpl->set_block("content", "button_spacer", "DUMMY");
$tpl->set_block("content", "button_mission", "BUTTON_MISSION_ROW");
$tpl->set_block("content", "block_empty_line", "DUMMY");
$tpl->set_block("content", "block_full_line", "DUMMY");
$tpl->set_block("content", "block_new_page", "DUMMY");
$tpl->set_block("content", "select_row", "SELECT_ROW");
$tpl->set_var(array("DUMMY" => "", "QUESTIONARY_ID" => $questionary->get_id(), "QUESTIONARY_NAME" => $questionary->get_name()));
//get all elements in top->bottom, left->right order
$elements = $geo->get_all();
//build sort select box
foreach ($elements as $id => $element) {
    $data = $element;
    $type = $element["type"];
    $question_id = $element["question_id"];
    $tpl->set_var("ELEMENT_ID", $question_id);
    //parse type dependent identifier
    if ($type == QUESTIONARY_EMPTY_LINE) {
        $tpl->parse("ELEMENT_NAME", "block_empty_line");
    } else {
        if ($type == QUESTIONARY_FULL_LINE) {
            $tpl->parse("ELEMENT_NAME", "block_full_line");
        } else {
            if ($type == QUESTIONARY_NEW_PAGE) {
                $tpl->parse("ELEMENT_NAME", "block_new_page");