-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/justafolk/feedback-sys
- Loading branch information
Showing
34 changed files
with
4,266 additions
and
1,875 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
<?php | ||
$id = $_GET["id"]; | ||
if ($_GET["type"] == "sliderans") { | ||
?> | ||
<div class="question<?php echo $id ?>"> | ||
|
||
<div class="card my-2"> | ||
<div class="card-body"> | ||
<h5 class="card-title"> <input type="text" value="<?php echo $id ?>. " name="main-question main-question<?php echo $id ?>" class="main-question" id="main-question<?php echo $id ?>"> </h5> | ||
<input type="hidden" name="slidercount<?php echo $id ?>" id="slidercount<?php echo $id ?>" value="1"> | ||
<div class="sliders<?php echo $id ?>"> | ||
<input type="text" style="border: 0px; outline:none; background-color:transparent" placeholder="Enter Range Question key" name="slider-title slider-title<?php echo $id ?>-1" id=" | ||
slider-title<?php echo $id ?>-1" class="form-label slider-title"> | ||
<ul> | ||
<li style="text-align:left; align-items:left;">Very Bad </li> | ||
<li style="padding-left:4%;text-align:left; align-items:left;">Bad</li> | ||
<li style="text-align:center; align-items:center;">Neutral </li> | ||
<li style="text-align:right;padding-right:4%; align-items:right;">Good</li> | ||
<li style="text-align:right; align-items:right;">Excellent</li> | ||
</ul> | ||
|
||
<div class="range"> | ||
<input type="range" class="form-range" id="slider-<?php echo $id ?>-1" name="slider-<?php echo $id ?>-1" min="1" max="100" /> | ||
</div> | ||
</div> | ||
<button type="button" class="btn btn-sm btn-dark" name="addoptions<?php echo $id; ?>" onclick="addSlider(<?php echo $id ?>)" id="addoptions<?php echo $id; ?>">Add Another Slider</button> | ||
|
||
</div> | ||
|
||
</div> | ||
</div> | ||
|
||
<?php } elseif ($_GET["type"] == "shortans") { ?> | ||
<div class="question<?php echo $id ?>"> | ||
|
||
<div class="card my-2"> | ||
<div class="card-body"> | ||
<h5 class="card-title"> <input type="text" value="<?php echo $id ?>. " name="main-question main-question<?php echo $id ?>" class="main-question" id="main-question<?php echo $id ?>"> </h5> | ||
<input type="text" name="shortans<?php echo $id ?>" class="form-control" placeholder="Enter Answer in Short" id="shortans<?php echo $id ?>"> | ||
|
||
</div> | ||
|
||
</div> | ||
</div> | ||
|
||
|
||
|
||
|
||
<?php } elseif ($_GET["type"] == "longans") { ?> | ||
<div class="question<?php echo $id ?>"> | ||
|
||
<div class="card my-2"> | ||
<div class="card-body"> | ||
<h5 class="card-title"> <input type="text" value="<?php echo $id ?>. " name="main-question main-question<?php echo $id ?>" class="main-question" id="main-question<?php echo $id ?>"> </h5> | ||
<!-- 5 radio buttons ranging from 5 to 1 --> | ||
<textarea type="text" name="longans<?php echo $id ?>" class="form-control" placeholder="Enter Answer in Long" id="ans<?php echo $id ?>"></textarea> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
|
||
|
||
<?php } elseif ($_GET["type"] == "mcqans") { ?> | ||
<div class="question<?php echo $id ?>"> | ||
|
||
<div class="card my-2"> | ||
<div class="card-body"> | ||
<div class="row"> | ||
<div class="col-10"> | ||
<h5 class="card-title"> <input type="text" value="<?php echo $id ?>. " name="main-question main-question<?php echo $id ?>" class="main-question" id="main-question<?php echo $id ?>"> </h5> | ||
|
||
<input type="hidden" name="optioncount<?php echo $id ?>" id="optioncount<?php echo $id ?>" value="2"> | ||
<div class="options<?php echo $id ?>"> | ||
|
||
<div class="form-check"> | ||
<input class="form-check-input ques-<?php echo $id ?>" type="radio" name="option-<?php echo $id ?>-1" id="option-<?php echo $id ?>-1" value="1" checked> | ||
<input type="text" name="option-<?php echo $id ?>-1-text" id="option-<?php echo $id ?>-1-text" style="background-color: transparent; outline:none; border:0px" placeholder="Enter Option Subtext"> | ||
</div> | ||
<div class="form-check"> | ||
<input class="form-check-input ques-<?php echo $id ?>" type="radio" name="option-<?php echo $id ?>-2" id="option-<?php echo $id ?>-2" value="2"> | ||
<input type="text" name="option-<?php echo $id ?>-2-text" style="background-color: transparent; outline:none; border:0px" placeholder="Enter Option Subtext" id="option-<?php echo $id ?>-2-text"> | ||
</div> | ||
</div> | ||
|
||
<button type="button" class="btn btn-sm btn-dark" name="addoptions" onclick="addOption(<?php echo $id ?>)" id="addoptions">Add Another Option</button> | ||
|
||
|
||
</div> | ||
<div class="col-2"> | ||
<div class="form-check"> | ||
<input class="form-check-input multi-<?php echo $id ?>" type="checkbox" name="multi-<?php echo $id ?>" id="multi-<?php echo $id ?>"> | ||
<label for="multi-<?php echo $id ?>">Allow Multiple Selections</label> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
|
||
|
||
|
||
<script> | ||
if (!$("multi-<?php echo $id ?>").attr("checked")) { | ||
$(".ques-<?php echo $id ?>").change(function() { | ||
$('.ques-<?php echo $id ?>').not(this).prop('checked', false); | ||
}); | ||
} | ||
</script> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<?php } elseif ($_GET["type"] == "option") { | ||
$optioncount = $_GET["optioncount"]; | ||
?> | ||
|
||
<div class="form-check"> | ||
<input class="form-check-input ques-<?php echo $id ?>" type="radio" name="option-<?php echo $id ?>-<?php echo $optioncount ?>" id="option-<?php echo $id ?>-<?php echo $optioncount ?>" value="<?php echo $optioncount ?>"> | ||
<input type="text" name="option-<?php echo $id ?>-<?php echo $optioncount ?>-text" id="option-<?php echo $id ?>-<?php echo $optioncount ?>-text" style="background-color: transparent; outline:none; border:0px" placeholder="Enter Option Subtext"> | ||
</div> | ||
|
||
|
||
<?php } elseif ($_GET["type"] == "slider") { $optioncount = $_GET["optioncount"]; ?> | ||
<input type="text" style="border: 0px; outline:none; background-color:transparent" placeholder="Enter Range Question key" name="slider-title slider-title<?php echo $id ?>-<?php echo $optioncount ?>" id=" | ||
slider-title<?php echo $id ?>-<?php echo $optioncount ?>" class="form-label slider-title"> | ||
<ul> | ||
<li style="text-align:left; align-items:left;">Very Bad </li> | ||
<li style="padding-left:4%;text-align:left; align-items:left;">Bad</li> | ||
<li style="text-align:center; align-items:center;">Neutral </li> | ||
<li style="text-align:right;padding-right:4%; align-items:right;">Good</li> | ||
<li style="text-align:right; align-items:right;">Excellent</li> | ||
</ul> | ||
|
||
<div class="range"> | ||
<input type="range" class="form-range" id="slider-<?php echo $id ?>-<?php echo $optioncount ?>" name="slider-<?php echo $id ?>-<?php echo $optioncount ?>" min="1" max="100" /> | ||
</div> | ||
<?php } ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<?php | ||
|
||
$title = $_POST["form-title"]; | ||
$instructions = $_POST["instructions"]; | ||
$sliders_idk = array(); | ||
foreach ($_POST as $key => $value) { | ||
if (strpos($key, "main-question") !== false) { | ||
$mainquestions[$key] = array($value) ; | ||
} | ||
elseif (strpos($key, "option-") !== false and strpos($key, "-text") !== false) { | ||
array_push($mainquestions["main-question_main-question".explode("-", $key)[1]], $value); | ||
} | ||
elseif (strpos($key, "slider-title") !== false) { | ||
$slidertitle = $value; | ||
$num = explode("title", explode("-", $key)[2]); | ||
$num = end($num); | ||
array_push($mainquestions["main-question_main-question".$num], $value); | ||
# code... | ||
array_push($sliders_idk, $num); | ||
} | ||
|
||
} | ||
|
||
// create table from mainquestions array | ||
$table = "<table class=\"table table-striped\">"; | ||
$table .= "<thead><tr><th>Question</th><th>Options</th><th>Multiple Selections</th></tr></thead>"; | ||
$table .= "<tbody>"; | ||
foreach ($mainquestions as $key => $value) { | ||
$table .= "<tr>"; | ||
$table .= "<td>".$value[0]."</td>"; | ||
$table .= "<td>"; | ||
for ($i=1; $i < count($value); $i++) { | ||
$table .= $value[$i]."<br>"; | ||
} | ||
$table .= "</td>"; | ||
$table .= "<td>"; | ||
if (strpos($key, "multi-") !== false) { | ||
$table .= "Yes"; | ||
} | ||
else { | ||
$table .= "No"; | ||
} | ||
$table .= "</td>"; | ||
$table .= "</tr>"; | ||
} | ||
$table .= "</tbody>"; | ||
$table .= "</table>"; | ||
|
||
echo $table; | ||
|
||
include "./imports/config.php"; | ||
|
||
$sql = "insert into forms (author, ini_date, instructions, status) values('$_SESSION[username]', now(), '$instructions', 'online')"; | ||
$result = mysqli_query($conn, $sql); | ||
if (!$result) { | ||
echo "Error: " . $sql . "<br>" . mysqli_error($conn); | ||
} | ||
$formid = mysqli_insert_id($conn); | ||
echo $formid; | ||
foreach ($mainquestions as $key => $value) { | ||
if (in_array(explode("main-question",$key)[2], $sliders_idk)){ | ||
$sql = "insert into form_ques (form_id, question_title, sub_content, type) values('$formid', '$value[0]', '".json_encode(array_slice($value, 1))."', 'slider')"; | ||
} | ||
elseif (count($value) > 1){ | ||
$sql = "insert into form_ques (form_id, question_title, sub_content, type) values('$formid', '$value[0]', '".json_encode(array_slice($value, 1))."', 'mcq')"; | ||
|
||
} | ||
else{ | ||
|
||
$sql = "insert into form_ques (form_id, question_title, sub_content) values('$formid', '$value[0]', '".json_encode(array_slice($value, 1))."')"; | ||
} | ||
$result = mysqli_query($conn, $sql); | ||
if (!$result) { | ||
echo "Error: " . $sql . "<br>" . mysqli_error($conn); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<?php | ||
session_start(); | ||
|
||
?> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta content="width=device-width, initial-scale=1.0" name="viewport"> | ||
|
||
<title>Feedback Login Form</title> | ||
<meta content="" name="description"> | ||
<meta content="" name="keywords"> | ||
|
||
<!-- Favicons --> | ||
<link href="assets/img/logo.png" rel="icon"> | ||
<link href="assets/img/logo.png" rel="apple-touch-icon"> | ||
|
||
<!-- Google Fonts --> | ||
<link href="https://fonts.gstatic.com" rel="preconnect"> | ||
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i|Nunito:300,300i,400,400i,600,600i,700,700i|Poppins:300,300i,400,400i,500,500i,600,600i,700,700i" rel="stylesheet"> | ||
|
||
<!-- Vendor CSS Files --> | ||
<link href="assets/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet"> | ||
<link href="assets/vendor/bootstrap-icons/bootstrap-icons.css" rel="stylesheet"> | ||
<link href="assets/vendor/boxicons/css/boxicons.min.css" rel="stylesheet"> | ||
<link href="assets/vendor/quill/quill.snow.css" rel="stylesheet"> | ||
<link href="assets/vendor/quill/quill.bubble.css" rel="stylesheet"> | ||
<link href="assets/vendor/remixicon/remixicon.css" rel="stylesheet"> | ||
<link href="assets/vendor/simple-datatables/style.css" rel="stylesheet"> | ||
|
||
<!-- Template Main CSS File --> | ||
<link href="assets/css/style.css" rel="stylesheet"> | ||
|
||
</head> | ||
|
||
<body> | ||
|
||
<main> | ||
<div class="container"> | ||
|
||
<section class="section register min-vh-100 d-flex flex-column align-items-center justify-content-center py-4"> | ||
<div class="container"> | ||
<div class="row justify-content-center"> | ||
<div class="col-lg-4 col-md-6 d-flex flex-column align-items-center justify-content-center"> | ||
|
||
<div class="d-flex justify-content-center py-4"> | ||
<a href="index.html" class="logo d-flex align-items-center w-auto"> | ||
<img src="assets/img/logo.png" alt=""> | ||
<span class="d-none d-lg-block">CWIT Feedback Portal</span> | ||
</a> | ||
</div><!-- End Logo --> | ||
|
||
<div class="card mb-3"> | ||
|
||
<div class="card-body"> | ||
|
||
<div class="pt-4 pb-2"> | ||
<h5 class="card-title text-center pb-0 fs-4">Login</h5> | ||
<p class="text-center small">Enter your credentials to login</p> | ||
</div> | ||
|
||
<form class="row g-3 needs-validation" method="POST" action="logincheck.php"> | ||
|
||
<div class="col-12"> | ||
<label for="yourUsername" class="form-label">Username/Roll number</label> | ||
<div class="input-group has-validation"> | ||
<span class="input-group-text" id="inputGroupPrepend">@</span> | ||
<input type="text" name="uname" class="form-control" id="uname" required> | ||
<div class="invalid-feedback">Please enter your username.</div> | ||
</div> | ||
</div> | ||
|
||
<div class="col-12"> | ||
<label for="yourPassword" class="form-label">Password</label> | ||
<input type="password" name="passwd" class="form-control" id="passwd" required> | ||
<div class="invalid-feedback">Please enter your password!</div> | ||
</div> | ||
<div class="col-12"> | ||
<button class="btn btn-primary w-100" name="login" type="submit">Login</button> | ||
</div> | ||
<div class="col-12"> | ||
<p class="small mb-0">Don't have account? <a href="register.php">Register here</a></p> | ||
</div> | ||
</form> | ||
|
||
</div> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
|
||
</section> | ||
|
||
</div> | ||
</main><!-- End #main --> | ||
|
||
<a href="#" class="back-to-top d-flex align-items-center justify-content-center"><i class="bi bi-arrow-up-short"></i></a> | ||
|
||
<!-- Vendor JS Files --> | ||
<script src="assets/vendor/apexcharts/apexcharts.min.js"></script> | ||
<script src="assets/vendor/bootstrap/js/bootstrap.bundle.min.js"></script> | ||
<script src="assets/vendor/chart.js/chart.min.js"></script> | ||
<script src="assets/vendor/echarts/echarts.min.js"></script> | ||
<script src="assets/vendor/quill/quill.min.js"></script> | ||
<script src="assets/vendor/simple-datatables/simple-datatables.js"></script> | ||
<script src="assets/vendor/tinymce/tinymce.min.js"></script> | ||
<script src="assets/vendor/php-email-form/validate.js"></script> | ||
|
||
<!-- Template Main JS File --> | ||
<script src="assets/js/main.js"></script> | ||
|
||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.