Skip to content

Commit

Permalink
updates | feedback file sql backups madhe ahe
Browse files Browse the repository at this point in the history
  • Loading branch information
justafolk committed Nov 10, 2022
1 parent acdb660 commit 63f28a5
Show file tree
Hide file tree
Showing 7 changed files with 578 additions and 19 deletions.
12 changes: 12 additions & 0 deletions roles/admin/parse_month.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
include "../../imports/config.php";
$year = $_GET["year"];
$sql = "Select month(idate) as m from suggestions where YEAR(idate) = $year";
$res = mysqli_query($conn, $sql);
while ($row = mysqli_fetch_assoc($res)){
$monthNum = $row["m"];
$monthName = date('F', mktime(0, 0, 0, $monthNum, 10));
echo "<option value='$monthNum'> {$monthName}</option>";
}
?>

12 changes: 12 additions & 0 deletions roles/admin/parse_month.php~
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
include "../../imports/config.php";
$year = $_GET["year"];
$sql = "Select month(idate) as m from suggestions where YEAR(idate) = $year";
$res = mysqli_query($conn, $sql);
while ($row = mysqli_fetch_assoc($res)){
$monthNum = $row["m"];
$monthName = date('F', mktime(0, 0, 0, $monthNum, 10));
echo "<option> {$monthName}</option>";
}
?>

2 changes: 2 additions & 0 deletions roles/admin/print_report.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@
echo "</tr>";
$i++;
}
echo "<td colspan='6' align='right'> <strong> Average Score Index </strong></td>";
echo "<td >".$score_index_sum / $i ." </td>";

?>

Expand Down
95 changes: 83 additions & 12 deletions roles/admin/suggestions.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@
<title>Suggestions</title>
<link rel="stylesheet" href="https://cdn.datatables.net/1.12.1/css/jquery.dataTables.min.css">
<script src="https://cdn.datatables.net/1.12.1/js/jquery.dataTables.min.js"></script>

<script src="https://cdn.datatables.net/1.13.1/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.3.2/js/dataTables.buttons.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
<script src="https://cdn.datatables.net/buttons/2.3.2/js/buttons.html5.min.js"></script>

<link href="css/app.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap" rel="stylesheet">
</head>
Expand Down Expand Up @@ -55,29 +63,71 @@
<div class="text-center mt-4">
<h1 class="h2">Suggestions</h1>
<p class="lead">By Academic Year and Department</p>
</div>
<form action="" method="post">
<div class="row">


<div class="col-4">
<select name="Department" id="Deparment" class="form-control">
<option value="">Select Department</option>
<?php

$sql = "SELECT * FROM departments";
$result = mysqli_query($conn, $sql);
while ($row = mysqli_fetch_assoc($result)) {
echo "<option value='" . $row["dept_id"] . "'>" . $row["dept_name"] . "</option>";
}
?>
</select>
</div>
<div class="col-4">
<select name="year" id="year" class="form-control">
<option value="">Select Year</option>
<?php
$sql = "Select YEAR(idate) as m from suggestions ";
$res = mysqli_query($conn, $sql);
while ($row = mysqli_fetch_assoc($res)){

echo "<option> {$row['m']}</option>";
}
?>
</select>

</div>
<div class="col-3">

<select name="month" id="month" class="form-control">
<option value="">Select Month</option>
</select>
</div>
<div class="col-1">

<button class="btn btn-dark btn-ecomm" type="submit" >Submit</button>
</div>
</form>

</div>
<div class="card border shadow-none my-3">
<div class="card-body">
<div class="table-responsive">
<table class="table" id="courses">
<thead>
<th>Course Name</th>
<th>Academic Year</th>
<th>Department</th>
<th>Action</th>
<th>Sr no.</th>
<th>Suggestion</th>
</thead>
<tbody>
<?php
$sql = "Select * from forms, courses where course_name like '%suggest%' and forms.course_code = courses.course_code";
$res = mysqli_query($conn, $sql);
$sql = "select * from suggestions where YEAR(idate) = {$_POST['year']} and MONTH(idate) = {$_POST['month']} and roll like '__{$_POST['Department']}__'";
$res = mysqli_query($conn, $sql);

$i = 1;
while ($row = mysqli_fetch_assoc($res)) {
echo "<tr>";
echo "<td> {$row['course_name']} </td>";
echo "<td> {$row['academic_year']} </td>";
echo "<td> {$row['dept_code']} </td>";
// echo "<td> <button type=\"button\" class='btn btn-md btn-dark btn-ecomm' onclick=\"window.location.href='./final_suggestions.php?academic_year=$row[academic_year]&course_name=$row[course_code]&dept_code=$row[dept_code]'\" >View</button> </td>";
echo "<td> <button type=\"button\" class='btn btn-md btn-dark btn-ecomm' onclick=\"window.location.href='./final_suggestions.php?id=$row[form_id]'\" >View</button> </td>";
echo "<td> {$i} </td>";
echo "<td> {$row['suggestion']} </td>";
echo "</tr>";
$i++;
}
?>
</tbody>
Expand All @@ -96,8 +146,29 @@
</div>
<script>
$(document).ready(function() {
$('#courses').DataTable();
$('#courses').DataTable({
dom: 'Bfrtip',
buttons: [
'copyHtml5',
'excelHtml5',
'csvHtml5',
'pdfHtml5'
]
})

});
</script>
<script>
$('#year').change(function() {
var dept_codes = document.getElementById("year").value;
$.get("./parse_month.php", {
year: dept_codes
}, function(data, status) {

document.getElementById("month").innerHTML = data;
console.log(data);
});
});
</script>
<script src="js/app.js"></script>

Expand Down
13 changes: 6 additions & 7 deletions roles/faculty/create_group.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@
</select> -->
</div>

<!--
<div class="form-group">
<input type="checkbox" style="
position: relative;
Expand All @@ -222,13 +221,13 @@
height: auto;
background-color: transparent;
position: relative;
" class="" name="all_dept" id="all_dept" <?php //if (isset($_POST["all_dept"])){ echo "checked = ''"; } ?> >
" class="" name="all_dept" id="all_dept" <?php if (isset($_POST["all_dept"])){ echo "checked = ''"; } ?> >
<label for="all_dept" style=" background-color: transparent;
color: black;
border-color: transparent;
border-width: 0px;
" >Applicable to whole Department. (Office, Library, Suggestions)</label>
</div> -->
</div>
<br>

<div class="form-group" id="alter_dept">
Expand Down Expand Up @@ -336,7 +335,8 @@
foreach (explode(";", $_POST["addrollunit"]) as $key => $value) {
$active_roll[] = $value;
}
$active_roll = array_diff($active_roll, [-4000,4000, "", " "]);
$active_roll = array_diff($active_roll, [-4000,4000, "-1000", " ", ""]);

$allrolls = count($active_roll);
echo "<p class=\' my-0 \' >Total number of students: <strong>" . $allrolls . "</strong> </p>";
$count = 1;
Expand Down Expand Up @@ -451,13 +451,12 @@
$sdr = "SELECT * FROM departments where dept_id";
$resd = mysqli_query($conn, $sdr);
$row = mysqli_fetch_assoc($resd);
/*
if ( strpos($row["dept_name"], "suggest") !== false or strpos($row["dept_name"], "library") !== false or strpos($row["dept_name"], "office") !== false ){
$sugg = 1;
} else{
$sugg = 0;
}
*/

$known_posts = array('deptcode', 'semester', 'subject', 'rollrange', 'addrollrange', 'addrollunit', 'finalroll');
$active_rolls = array();
$remove_rolls = array();
Expand All @@ -482,7 +481,7 @@
echo "<script>window.location.href='create_group.php';</script>";
} else {

$sql = "INSERT INTO groups(year, semester, subject , deptcode, activeRoll, teacher_id, student_count) VALUES ('$year','{$_POST["semester"]}','$subject', '$deptcode', '$active_rolls', '{$_SESSION["id"]}', '$student_count')";
$sql = "INSERT INTO groups(year, semester, subject , deptcode, activeRoll, teacher_id, student_count, sugg) VALUES ('$year','{$_POST["semester"]}','$subject', '$deptcode', '$active_rolls', '{$_SESSION["id"]}', '$student_count', $sugg)";
echo $sql;
$result = mysqli_query($conn, $sql);
if ($result) {
Expand Down
72 changes: 72 additions & 0 deletions roles/student/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,24 @@
<main class="content">
<div class="container-fluid p-0">
<div class="row">
<?php
if (isset($_POST["suggestion"])){

$sdql = "INSERT INTO suggestions (suggestion, idate, roll) VALUES('{$_POST['suggestion']}', now(), $_SESSION[uname]) ";
$res = mysqli_query($conn, $sdql);
if (!$res){
echo mysqli_error($conn);
}else{
?>
<div class="alert alert-primary" role="alert">
Suggestions submitted successfully!!!
</div>
<?php

}

}
?>
<h1 class="h3 mb-3"><strong>Active</strong> Feedback Surveys: </h1>
<div class="row">
<?php
Expand Down Expand Up @@ -132,6 +150,60 @@
<?php }
} ?>

<div class="col-md-3">
<div class="card border shadow-none" style="border-radius:12px">
<div class="card-body">
<h4 class="h4"><strong>
Suggestions
</strong></h4>
<h6>

</h6>
<div class="row">
<div class="col-md-12">


<button type="button" class="btn btn-dark " data-bs-toggle="modal" data-bs-target="#exampleModal">Fill</button>

</div>

</div>
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Fill Suggestions</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<form action="" method="post">

<div class="modal-body">
<div class="row">

<div class="col-md-12 my-1">
<div class="form-group">
<label for="questions">Please enter your suggestions</label>
<textarea name="suggestion" required="" class="form-control" id="suggestion"></textarea>
</div>
</div>


</div>

</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button id="addform" type="submit" class="btn btn-primary">Save changes</button>
</div>
</form>
</div>
</div>
</div>
</div>

</div>
</div>

</div>
<br>

Expand Down
Loading

0 comments on commit 63f28a5

Please sign in to comment.