public static function getEditQuestionControls($question_data) { global $db, $HEAD, $PROCESSED, $ENTRADA_USER, $translate; if (isset($question_data["questiontype_id"]) && $question_data["questiontype_id"]) { $query = "SELECT * FROM `evaluations_lu_questiontypes`\n\t\t\t\t\t\tWHERE `questiontype_id` = " . $db->qstr($question_data["questiontype_id"]); $questiontype = $db->GetRow($query); } else { $questiontype = array("questiontype_shortname" => "matrix_single"); } switch ($questiontype["questiontype_shortname"]) { case "rubric": ?> <tr> <td style="vertical-align: top"> <label for="rubric_title" class="form-nrequired">Rubric Title</label> </td> <td> <input type="text" id="rubric_title" name="rubric_title" style="width: 330px;" value="<?php echo isset($question_data["rubric_title"]) ? clean_input($question_data["rubric_title"], "encode") : ""; ?> "> </td> </tr> <tr> <td style="vertical-align: top"> <label for="rubric_description" class="form-nrequired">Rubric Description</label> </td> <td> <textarea id="rubric_description" class="expandable" name="rubric_description" style="width: 98%; height:0"><?php echo isset($question_data["rubric_description"]) ? clean_input($question_data["rubric_description"], "encode") : ""; ?> </textarea> </td> </tr> <tr> <td style="vertical-align: top"> <label for="columns_count" class="form-required">Number of Columns</label> </td> <td> <select name="columns_count" id="columns_count" onchange="updateColumns(this.options[this.selectedIndex].value, $('categories_count').value)"> <option value="2"<?php echo isset($question_data["columns_count"]) && $question_data["columns_count"] == 2 ? " selected=\"selected\"" : ""; ?> >2</option> <option value="3"<?php echo isset($question_data["columns_count"]) && $question_data["columns_count"] == 3 || !isset($question_data["columns_count"]) || !$question_data["columns_count"] ? " selected=\"selected\"" : ""; ?> >3</option> <option value="4"<?php echo isset($question_data["columns_count"]) && $question_data["columns_count"] == 4 ? " selected=\"selected\"" : ""; ?> >4</option> </select> </td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td style="vertical-align: top"> <label for="allow_comments" class="form-required">Allow Comments</label> </td> <td> <input type="checkbox" id="allow_comments" name="allow_comments"<?php echo isset($question_data["allow_comments"]) && $question_data["allow_comments"] ? " checked=\"checked\"" : ""; ?> /> </td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td style="padding-top: 5px; vertical-align: top"> <label for="response_text_0" class="form-required">Column Labels</label> </td> <td> </td> </tr> <tr> <td style="padding-top: 5px; vertical-align: top"> <input type="hidden" value="<?php echo isset($question_data["categories_count"]) && (int) $question_data["categories_count"] ? $question_data["categories_count"] : 1; ?> " name="categories_count" id="categories_count" /> </td> <td style="padding-top: 5px"> <table class="form-question" cellspacing="0" cellpadding="2" border="0" summary="Form Question Responses"> <colgroup> <col style="width: 3%" /> <col style="width: 57%" /> <col style="width: 20%" /> <col style="width: 20%" /> </colgroup> <thead> <tr> <td colspan="2"> </td> <td class="center" style="font-weight: bold; font-size: 11px">Descriptor</td> <td class="center" style="font-weight: bold; font-size: 11px">Minimum Pass</td> </tr> </thead> <tbody id="columns_list"> <?php echo Models_Evaluation::getRubricColumnList($question_data); ?> </tbody> </table> </td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td colspan="2"> <h2>Categories</h2> <a class="btn btn-small btn-success pull-right" style="cursor: pointer; margin-top: -40px;" onclick="loadCategories($('columns_count').options[$('columns_count').selectedIndex].value, (parseInt($('categories_count').value) + 1), 0)"><i class="icon-plus-sign icon-white"></i> Add Additional Category</a> </td> </tr> <tr> <td style="padding-top: 5px" colspan="2"> <table class="form-question" id="category_list" cellspacing="0" cellpadding="2" border="0" summary="Form Question Responses"> <?php echo Models_Evaluation::getRubricCategoryList($question_data); ?> </table> </td> </tr> <?php break; case "free_text": ?> <tr> <td style="vertical-align: top"> <label for="question_code" class="form-nrequired">Question Code</label> </td> <td> <input type="text" id="question_code" name="question_code" value="<?php echo isset($question_data["question_code"]) && $question_data["question_code"] ? clean_input($question_data["question_code"], "encode") : ""; ?> " /> </td> </tr> <tr> <td style="vertical-align: top"> <label for="question_text" class="form-required">Question Text</label> </td> <td> <textarea id="question_text" class="expandable" name="question_text" style="width: 100%; height:0"><?php echo isset($question_data["question_text"]) ? clean_input($question_data["question_text"], "encode") : ""; ?> </textarea> </td> </tr> <tr> <td style="padding-top: 5px; vertical-align: top"> <label class="form-required">Available Responses</label> </td> <td> <?php add_notice("The evaluators will be asked to enter a free text comment as a response to this question."); echo display_notice(); ?> </td> </tr> <tr> <td colspan="2"> <div id="objectives_1_list" class="hidden"> <?php $objective_ids_string = ""; if (isset($question_data["objective_ids"]) && @count($question_data["objective_ids"])) { foreach ($question_data["objective_ids"] as $objective_id) { $objective_ids_string .= ($objective_ids_string ? ", " : "") . (int) $objective_id; ?> <input type="hidden" class="objective_ids_1" id="objective_ids_1_<?php echo $objective_id; ?> " name="objective_ids_1[]" value="<?php echo $objective_id; ?> " /> <?php } } ?> <input type="hidden" name="objective_ids_string_1" id="objective_ids_string_1" value="<?php echo $objective_ids_string ? $objective_ids_string : ""; ?> " /> <input type="hidden" id="qrow" value="1" /> </div> <?php $question_identifier = 1; require_once "api/evaluations-objectives-list.api.php"; ?> </td> </tr> <?php break; case "descriptive_text": ?> <tr> <td style="vertical-align: top"> <label for="question_code" class="form-nrequired">Question Code</label> </td> <td> <input type="text" id="question_code" name="question_code" value="<?php echo isset($question_data["question_code"]) && $question_data["question_code"] ? clean_input($question_data["question_code"], "encode") : ""; ?> " /> </td> </tr> <tr> <td style="vertical-align: top"> <label for="question_text" class="form-required">Question Text</label> </td> <td> <textarea id="question_text" class="expandable" name="question_text" style="width: 100%; height:0"><?php echo isset($question_data["question_text"]) ? clean_input($question_data["question_text"], "encode") : ""; ?> </textarea> </td> </tr> <?php break; case "selectbox": ?> <tr> <td style="vertical-align: top"> <label for="question_text" class="form-required">Question Text</label> </td> <td> <textarea id="question_text" class="expandable" name="question_text" style="width: 98%; height:0"><?php echo isset($question_data["question_text"]) ? clean_input($question_data["question_text"], "encode") : ""; ?> </textarea> </td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td style="vertical-align: top"> <label for="allow_comments" class="form-required">Allow Comments</label> </td> <td> <input type="checkbox" id="allow_comments" name="allow_comments"<?php echo isset($question_data["allow_comments"]) && $question_data["allow_comments"] ? " checked=\"checked\"" : ""; ?> /> </td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td style="padding-top: 5px; vertical-align: top"> <label for="response_text_0" class="form-required">Available Responses</label> </td> <td style="padding-top: 5px"> <table class="form-question" id="response_list" cellspacing="0" cellpadding="2" border="0" summary="Form Question Responses"> <?php echo Models_Evaluation::getQuestionResponseList($question_data, $questiontype["questiontype_shortname"]); ?> </table> </td> </tr> <tr> <td colspan="2"> <div id="objectives_1_list" class="hidden"> <?php $objective_ids_string = ""; if (isset($question_data["objective_ids"]) && @count($question_data["objective_ids"])) { foreach ($question_data["objective_ids"] as $objective_id) { $objective_ids_string .= ($objective_ids_string ? ", " : "") . (int) $objective_id; ?> <input type="hidden" class="objective_ids_1" id="objective_ids_1_<?php echo $objective_id; ?> " name="objective_ids_1[]" value="<?php echo $objective_id; ?> " /> <?php } } ?> <input type="hidden" name="objective_ids_string_1" id="objective_ids_string_1" value="<?php echo $objective_ids_string ? $objective_ids_string : ""; ?> " /> <input type="hidden" id="qrow" value="1" /> </div> <?php $question_identifier = 1; require_once "api/evaluations-objectives-list.api.php"; ?> </td> </tr> <?php break; case "matrix_single": case "vertical_matrix": default: ?> <tr> <td style="vertical-align: top"> <label for="question_code" class="form-nrequired">Question Code</label> </td> <td> <input type="text" id="question_code" name="question_code" value="<?php echo isset($question_data["question_code"]) && $question_data["question_code"] ? clean_input($question_data["question_code"], "encode") : ""; ?> " /> </td> </tr> <tr> <td style="vertical-align: top"> <label for="question_text" class="form-required">Question Text</label> </td> <td> <textarea id="question_text" class="expandable" name="question_text" style="width: 98%; height:0"><?php echo isset($question_data["question_text"]) ? clean_input($question_data["question_text"], "encode") : ""; ?> </textarea> </td> </tr> <tr> <td style="vertical-align: top"> <label for="responses_count" class="form-required">Number of Responses</label> </td> <td> <select name="responses_count" id="responses_count" onchange="updateResponses(this.options[this.selectedIndex].value, jQuery('#questiontype_id').val())"> <?php if ($questiontype["questiontype_shortname"] == "vertical_matrix") { for ($i = 2; $i <= 10; $i++) { ?> <option <?php echo "value=\"" . $i . "\"" . (isset($question_data["responses_count"]) && $question_data["responses_count"] == $i || !isset($question_data["responses_count"]) && $i == 4 ? " selected=\"selected\"" : "") . ">" . $i; ?> </option> <?php } } else { ?> <option value="2"<?php echo isset($question_data["responses_count"]) && $question_data["responses_count"] == 2 ? " selected=\"selected\"" : ""; ?> >2</option> <option value="3"<?php echo isset($question_data["responses_count"]) && $question_data["responses_count"] == 3 ? " selected=\"selected\"" : ""; ?> >3</option> <option value="4"<?php echo isset($question_data["responses_count"]) && $question_data["responses_count"] == 4 || !isset($question_data["responses_count"]) || !$question_data["responses_count"] ? " selected=\"selected\"" : ""; ?> >4</option> <option value="5"<?php echo isset($question_data["responses_count"]) && $question_data["responses_count"] == 5 ? " selected=\"selected\"" : ""; ?> >5</option> <?php } ?> </select> </td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td style="vertical-align: top"> <label for="allow_comments" class="form-required">Allow Comments</label> </td> <td> <input type="checkbox" id="allow_comments" name="allow_comments"<?php echo isset($question_data["allow_comments"]) && $question_data["allow_comments"] ? " checked=\"checked\"" : ""; ?> /> </td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td style="padding-top: 5px; vertical-align: top"> <label for="response_text_0" class="form-required">Available Responses</label> </td> <td style="padding-top: 5px"> <table class="form-question" id="response_list" cellspacing="0" cellpadding="2" border="0" summary="Form Question Responses"> <?php echo Models_Evaluation::getQuestionResponseList($question_data, $questiontype["questiontype_shortname"]); ?> </table> </td> </tr> <tr> <td colspan="2"> <div id="objectives_1_list" class="hidden"> <?php $objective_ids_string = ""; if (isset($question_data["objective_ids"]) && @count($question_data["objective_ids"])) { foreach ($question_data["objective_ids"] as $objective_id) { $objective_ids_string .= ($objective_ids_string ? ", " : "") . (int) $objective_id; ?> <input type="hidden" class="objective_ids_1" id="objective_ids_1_<?php echo $objective_id; ?> " name="objective_ids_1[]" value="<?php echo $objective_id; ?> " /> <?php } } ?> <input type="hidden" name="objective_ids_string_1" id="objective_ids_string_1" value="<?php echo $objective_ids_string ? $objective_ids_string : ""; ?> " /> <input type="hidden" id="qrow" value="1" /> </div> <?php $question_identifier = 1; require_once "api/evaluations-objectives-list.api.php"; ?> </td> </tr> <?php break; } }
<?php /** * Entrada [ http://www.entrada-project.org ] * * Serves the categories list up in a select box. * * @author Organisation: Queen's University * @author Unit: School of Medicine * @author Developer: Matt Simpson <*****@*****.**> * @copyright Copyright 2010 Queen's University. All Rights Reserved. * */ @set_include_path(implode(PATH_SEPARATOR, array(dirname(__FILE__) . "/../core", dirname(__FILE__) . "/../core/includes", dirname(__FILE__) . "/../core/library", get_include_path()))); /** * Include the Entrada init code. */ require_once "init.inc.php"; if (isset($_POST["response_text"]) && $_POST["response_text"]) { $question_data = json_decode($_POST["response_text"], true); } if (isset($_GET["columns"]) && $_GET["columns"]) { $columns = (int) $_GET["columns"]; } if (isset($_GET["categories"]) && $_GET["categories"]) { $categories = (int) $_GET["categories"]; } $question_data["categories_count"] = $categories; $question_data["columns_count"] = $columns; echo Models_Evaluation::getRubricCategoryList($question_data);