init
This commit is contained in:
84
module/learning/learning_unit_line_cardform.inc.php
Normal file
84
module/learning/learning_unit_line_cardform.inc.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?
|
||||
$formname = "form_line_card";
|
||||
$translation = \DynCom\mysyde\common\classes\Registry::get("translation");
|
||||
$inputname = "input_id";
|
||||
|
||||
?>
|
||||
|
||||
<div id="overlaycrumb">
|
||||
<?php if ($input_line["id"] == "") {
|
||||
echo $translation->get("create_question");
|
||||
} else {
|
||||
echo $translation->get("edit_question");
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<ul class="toolbar_menu">
|
||||
<?php
|
||||
// Zurueck zur uebersicht
|
||||
button("left", $translation->get("back"), $formname, "loadCard('edit', true)");
|
||||
|
||||
// Speichern buttons
|
||||
button("save", $translation->get("save_and_close"), $formname, "jQuery('#save_and_close', jQuery('#" . $formname . "')).val(1);loadCard('save_line_unit', true)");
|
||||
|
||||
if ($input_line["id"] != "") {
|
||||
echo button("delete", $translation->get("delete"), $formname, "loadCard('delete_line_unit', true, '{$translation->get('delete_line_confirm')}')");
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
|
||||
<?php
|
||||
if ($messages !== null) {
|
||||
if (count($messages)) {
|
||||
echo '<div id="overlayMessages">' . join("\r\n", $messages) . '</div>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<form id="<?= $formname ?>" name="<?= $formname ?>" method="post">
|
||||
<input name="input_line_id" type="hidden" value="<?= $input_line["id"] ?>" />
|
||||
<input name="input_id" type="hidden" value="<?= $_REQUEST['input_id'] ?>">
|
||||
<input name="save_and_close" id="save_and_close" type="hidden" value="0" />
|
||||
|
||||
<table class="cardform" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td class="w-100">
|
||||
<?php
|
||||
$types = [
|
||||
'0' => "Multiple-Choice",
|
||||
];
|
||||
$preselect = 0;
|
||||
if(isset($input_question['question_type']) ){
|
||||
$preselect = $input_line['question_type'];
|
||||
}
|
||||
?>
|
||||
<?php input_select($translation->get("question_type"), "input_question_type", $values = array_keys($types), $value_names = array_values($types), $preselect, FALSE, FALSE); ?>
|
||||
<? input($translation->get("question"), "input_description", "text", $input_line["description"], 255) ?>
|
||||
<? //input($translation->get("image"), "input_image", "text", $input_line["image"], 255) ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class='unit_answers'>
|
||||
<?php
|
||||
$count_answers = unit_answers($input_line['id']);
|
||||
?>
|
||||
</div>
|
||||
<div class="new_answer_button">
|
||||
<?= button("new_answer", $translation->get("new_answer"), $formname, "create_answer()");?>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
count = <?= $count_answers ?>;
|
||||
function create_answer(){
|
||||
var svg = "<div class='delete_answer'>X</div>";
|
||||
var newInput = $("<div class='answer_wrapper' data-id='"+count+"'><label for='input_answer_"+count+"'>"+count+".</label><input type='text' class='text' name='input_answer_"+count+"' id='input_answer_"+count+"'><input type='checkbox' class='checkbox' name='input_correct_"+count+"' name='input_correct_"+count+"'>"+svg+"</div>");
|
||||
$('.unit_answers').append(newInput);
|
||||
count++;
|
||||
}
|
||||
$(".delete_answer").click(function(){
|
||||
$(this).parent().remove();
|
||||
count--;
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user