mirror of
https://github.com/fsr/eseeva
synced 2024-11-15 08:53:11 +01:00
add functiion for full automatic creation of eva form
This commit is contained in:
parent
c2a81aa429
commit
ce4a29217b
|
@ -169,7 +169,7 @@
|
||||||
* @param string $value The comment that should be displayed within the comment box.
|
* @param string $value The comment that should be displayed within the comment box.
|
||||||
* The default value is no text.
|
* The default value is no text.
|
||||||
*/
|
*/
|
||||||
function CreateCommentBox($label, $id, $value = "")
|
function CreateCommentBox($label, $id, $value)
|
||||||
{
|
{
|
||||||
CreateRowHeader();
|
CreateRowHeader();
|
||||||
echo " <div class=\"col-sm-8\">\n";
|
echo " <div class=\"col-sm-8\">\n";
|
||||||
|
@ -240,6 +240,64 @@
|
||||||
CreateQuestion($entry[1], $id, $value);
|
CreateQuestion($entry[1], $id, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Echos a range of new divisions with switching row styles for all questions that
|
||||||
|
* the specified questionnaire data contains. Only the questions are created, nothing else.
|
||||||
|
*
|
||||||
|
* @param array $questionnaire The questionnaire data that is used to build the form.
|
||||||
|
* Passed by reference.
|
||||||
|
* @param array $formData The list of all form elements and their values. This should
|
||||||
|
* simply be the $_POST array that was submitted.
|
||||||
|
* Passed by reference.
|
||||||
|
*/
|
||||||
|
function CreateAllCommentElements(&$questionnaire, &$formData)
|
||||||
|
{
|
||||||
|
foreach($questionnaire as $id => $entry)
|
||||||
|
{
|
||||||
|
$type = $entry[0];
|
||||||
|
if ($type != Q_COMMENT)
|
||||||
|
continue;
|
||||||
|
$value = "";
|
||||||
|
if (isset($formData[$id]))
|
||||||
|
$value = $formData[$id];
|
||||||
|
CreateCommentBox($entry[1], $id, $value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Echos a range of new divisions with switching row styles for all questions that
|
||||||
|
* the specified questionnaire data contains. Only the questions are created, nothing else.
|
||||||
|
*
|
||||||
|
* @param array $questionnaire The questionnaire data that is used to build the form.
|
||||||
|
* Passed by reference.
|
||||||
|
* @param array $formData The list of all form elements and their values. This should
|
||||||
|
* simply be the $_POST array that was submitted.
|
||||||
|
* Passed by reference.
|
||||||
|
*/
|
||||||
|
function CreateEvaForm(&$questionnaire, &$formData)
|
||||||
|
{
|
||||||
|
foreach($questionnaire as $id => $entry)
|
||||||
|
{
|
||||||
|
$type = $entry[0];
|
||||||
|
$value = "";
|
||||||
|
if (isset($formData[$id]))
|
||||||
|
$value = $formData[$id];
|
||||||
|
if ($type == Q_HEADLINE)
|
||||||
|
CreateHeadline($entry[1]);
|
||||||
|
if ($type == Q_LEGEND)
|
||||||
|
CreateLegend();
|
||||||
|
else if ($type == Q_TEXTBOX)
|
||||||
|
CreateTextBox($entry[1], $id, $value);
|
||||||
|
else if ($type == Q_QUESTION)
|
||||||
|
CreateQuestion($entry[1], $id, $value);
|
||||||
|
else if ($type == Q_COMMENT)
|
||||||
|
CreateCommentBox($entry[1], $id, $value);
|
||||||
|
else if ($type == Q_DROPDOWN)
|
||||||
|
{
|
||||||
|
$value = $formData;
|
||||||
|
CreateDropDownMenu($entry[1], $id, $value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Echos a new division with switching row styles that represents a message box.
|
* Echos a new division with switching row styles that represents a message box.
|
||||||
*
|
*
|
||||||
|
|
|
@ -69,16 +69,17 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<form action="" method="post">
|
<form action="" method="post">
|
||||||
<?php
|
<?php
|
||||||
CreateQuestionnaireElement("headline", $questionnaire, $_POST);
|
// CreateQuestionnaireElement("headline", $questionnaire, $_POST);
|
||||||
if ($error)
|
// if ($error)
|
||||||
CreateMessageBox(MSG_DANGER, "Achtung:", "Deine Evaluation konnte aufgrund eines internen Fehlers leider nicht erfolgreich bearbeitet werden.<br/>Bitte versuch es später noch einmal oder wende dich an einen der Verantwortlichen.");
|
// CreateMessageBox(MSG_DANGER, "Achtung:", "Deine Evaluation konnte aufgrund eines internen Fehlers leider nicht erfolgreich bearbeitet werden.<br/>Bitte versuch es später noch einmal oder wende dich an einen der Verantwortlichen.");
|
||||||
else
|
// else
|
||||||
CreateKeyMessageBox($keyState);
|
// CreateKeyMessageBox($keyState);
|
||||||
CreateQuestionnaireElement("code", $questionnaire, $_POST);
|
// CreateQuestionnaireElement("code", $questionnaire, $_POST);
|
||||||
CreateQuestionnaireElement("tutorName", $questionnaire, $patrons);
|
// CreateQuestionnaireElement("tutorName", $questionnaire, $patrons);
|
||||||
CreateQuestionnaireElement("legend", $questionnaire, $_POST);
|
// CreateQuestionnaireElement("legend", $questionnaire, $_POST);
|
||||||
CreateAllQuestionElements($questionnaire, $_POST);
|
// CreateAllQuestionElements($questionnaire, $_POST);
|
||||||
CreateQuestionnaireElement("comment", $questionnaire, $_POST);
|
// CreateAllCommentElements($questionnaire, $_POST);
|
||||||
|
CreateEvaForm($questionnaire, $_POST);
|
||||||
?>
|
?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<input class="form-control btn-success" type="submit" name="submit" value="Absenden"/>
|
<input class="form-control btn-success" type="submit" name="submit" value="Absenden"/>
|
||||||
|
|
Loading…
Reference in a new issue