MMCT TEAM
Server IP : 2a02:4780:3:1493:0:3736:a38e:7  /  Your IP : 216.73.216.139
Web Server : LiteSpeed
System : Linux sg-nme-web1393.main-hosting.eu 4.18.0-553.40.1.lve.el8.x86_64 #1 SMP Wed Feb 12 18:54:57 UTC 2025 x86_64
User : u926327694 ( 926327694)
PHP Version : 7.4.33
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF
Directory (0755) :  /home/u926327694/domains/smsoft.in/public_html/mda/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/u926327694/domains/smsoft.in/public_html/mda/feedback-bulk-add.php
<?php  
$page_title = 'Bulk Add FeedBack';
include 'header.php';
?>
<div class="content-wrapper">
	<section class="content mt-4">
		<div class="container-fluid">
			<div class="row">
				<div class="col-md-12">
					<?php include('alert-msg.php'); ?>
					<div class="card card-primary">
						<div class="card-header">
							<h3 class="card-title"><?php echo $page_title; ?></h3>
						</div>
						<form action="feedback-bulk-add.php" method="POST" enctype="multipart/form-data">
							<div class="card-body">
							    <div class="row">
							        <div class="col-md-12"><b>Search Student for add feedback</b></div>
									<div class="col-md-4">
										<div class="form-group">
											<label>Class</label>
											<select class="form-control select2" name="class">
												<option value="">--All--</option>
												<?php
												$sel_class=mysqli_query($con,"SELECT DISTINCT Class FROM `DimStudent_Table` Where Class != ''");
												while($row_class=mysqli_fetch_array($sel_class))
												{
												?>
												<option value="<?php echo $row_class['Class']; ?>"><?php echo $row_class['Class']; ?></option>
												<?php
												}
												?>
											</select>
										</div>
									</div>
        									
									<div class="col-md-4">
										<div class="form-group">
											<label>Division</label>
											<select class="form-control select2" name="division">
												<option value="">--All--</option>
												<?php
												$sel_division=mysqli_query($con,"SELECT DISTINCT Division FROM `DimStudent_Table` where Division != ''");
												while($row_division=mysqli_fetch_array($sel_division))
												{
												?>
												<option value="<?php echo $row_division['Division']; ?>"><?php echo $row_division['Division']; ?></option>
												<?php
												}
												?>
											</select>
										</div>
									</div>
									
									<div class="col-md-4">
										<div class="form-group">
											<label>Combination</label>
											<select class="form-control select2" name="combination">
												<option value="">--All--</option>
												<?php
												$sel_class=mysqli_query($con,"SELECT DISTINCT Combination FROM `DimStudent_Table` Where Combination != ''");
												while($row_class=mysqli_fetch_array($sel_class))
												{
												?>
												<option value="<?php echo $row_class['Combination']; ?>"><?php echo $row_class['Combination']; ?></option>
												<?php
												}
												?>
											</select>
										</div>
									</div>
									
									<div class="col-md-4">
										<div class="form-group">
											<label>Course</label>
											<select class="form-control select2" name="course">
												<option value="">--All--</option>
												<?php
												$sel_class=mysqli_query($con,"SELECT DISTINCT Course FROM `DimStudent_Table` Where Course != ''");
												while($row_class=mysqli_fetch_array($sel_class))
												{
												?>
												<option value="<?php echo $row_class['Course']; ?>"><?php echo $row_class['Course']; ?></option>
												<?php
												}
												?>
											</select>
										</div>
									</div>
									
									<div class="col-md-4">
										<div class="form-group">
											<label>Search</label>
											<input type="text" class="form-control" name="search" />
										</div>
									</div>
									<div class="col-md-12">
									    <hr />
									    <b>Select Feedback type and subject</b>
									</div>
									
									<div class="col-md-4">
										<div class="form-group">
											<label>Feedback Type</label>
											<select class="form-control select2" name="feedback_type" required>
												<option value="">--All--</option>
												<?php
												$sel_class=mysqli_query($con,"SELECT Type_ID, Type_Description FROM `DimFeedbackType_Table` where Type_Description != '' group by Type_ID");
												while($row_class=mysqli_fetch_array($sel_class))
												{
												?>
												<option value="<?php echo $row_class['Type_ID']; ?>"><?php echo $row_class['Type_Description']; ?> (<?php echo $row_class['Type_ID']; ?>)</option>
												<?php
												}
												?>
											</select>
										</div>
									</div>
									
									<div class="col-md-4">
										<div class="form-group">
											<label>Subject</label>
											<select class="form-control select2" name="subject">
												<option value="">--All--</option>
												<?php
												$sel_class=mysqli_query($con,"SELECT Subject_ID,Subject_Name FROM `DimSubject_Table` where Subject_Name != ''");
												while($row_class=mysqli_fetch_array($sel_class))
												{
												?>
												<option value="<?php echo $row_class['Subject_ID']; ?>"><?php echo $row_class['Subject_Name']; ?> (<?php echo $row_class['Subject_ID']; ?>)</option>
												<?php
												}
												?>
											</select>
										</div>
									</div>
									
									<div class="col-md-4">
										<div class="form-group">
											<label>Question</label>
											<select class="form-control select2" name="question">
												<option value="">--All--</option>
												<?php
												$sel_question=mysqli_query($con,"SELECT * FROM `DimQuestionType_Table` where Question_Text != ''");
												while($row_question = mysqli_fetch_array($sel_question))
												{
												?>
												<option value="<?php echo $row_question['Question_ID']; ?>"><?php echo $row_question['Question_Text']; ?></option>
												<?php
												}
												?>
											</select>
										</div>
									</div>
									
									<div class="col-md-4">
										<div class="form-group">
											<label>Category</label>
											<select class="form-control select2" name="category">
												<option value="">--All--</option>
												<?php
												$sel_class=mysqli_query($con,"SELECT DISTINCT Category FROM `DimQuestionType_Table` where Category != ''");
												while($row_class=mysqli_fetch_array($sel_class))
												{
												?>
												<option value="<?php echo $row_class['Category']; ?>"><?php echo $row_class['Category']; ?></option>
												<?php
												}
												?>
											</select>
										</div>
									</div>
									
        						</div>
								<button type="submit" class="btn btn-primary" name="btnSubmit">Search</button>
							</div>
						</form>
					</div>
					<?php if(isset($_POST['btnSubmit']))
					{
					    $class = $_POST['class'] ?? '';
                    	$division = $_POST['division'] ?? '';
                    	$combination = $_POST['combination'] ?? '';
                    	$course = $_POST['course'] ?? '';
                    	$search = $_POST['search'] ?? '';
                    	$feedback_type = $_POST['feedback_type'] ?? '';
                    	$subject = $_POST['subject'] ?? '';
                    	$question = $_POST['question'] ?? '';
                    	$category = $_POST['category'] ?? '';
					?>
					<div class="card card-primary">
						<div class="card-header">
						    <h3 class="card-title">Add/Update Feedback</h3>
						</div>
						<div class="card-body">
						    <form action="bulk-assign-subject-submit.php" method="POST">
						        <div class="row">
    								<div class="col-md-12">
    								    <div class="table-responsive mt-4" style="width:100%; clear:both;">
                							<table width="100%" class="table table-striped table-bordered table-hover" id="data_table">
                								<thead>
                									<tr>
                									    <th>Feedback Type ID</th>
                									    <th>Question ID</th>
                										<th>Student ID</th>
                										<th>Name</th>
                										<th>Roll Number</th>
                										<th>Class/Division</th>
                										<th>Combination</th>
                										<th>Course</th>
                										<th>Feedback Type</th>
                										<th>Question</th>
                										<th>Subject</th>
                										<th>Counter</th>
                										<th>Response Value</th>
                										<th>Action</th>
                									</tr> 
                								</thead>
                								<tbody>
                									<?php 
                									$query = "SELECT * FROM `DimStudent_Table` where (`Class`='$class' OR '$class' = '') and (`Division`='$division' OR '$division' = '') and (`Combination`='$combination' OR '$combination' = '') and (`Course`='$course' OR '$course' = '') and (`Student_ID` LIKE '%$search%' OR `Name` LIKE '%$search%' OR `Roll_Number` LIKE '%$search%' OR `Combination` LIKE '%$search%' OR `Course` LIKE '%$search%' OR `Place` LIKE '%$search%' OR '$search' = '')";
                									$result = mysqli_query($con,$query);
                									$count = 1;
                									while($row = mysqli_fetch_array($result) )
                									{
                									    $stud_id = $row['Student_ID'];
                									    $sel_ques = mysqli_query($con, "SELECT ft.Type_Description, ft.Type_ID, q.Question_ID, q.Question_Text, q.Subject_ID, sub.Subject_Name FROM `DimQuestionType_Table` as q inner join DimFeedbackType_Table as ft on ft.Type_ID = q.Type_ID left join DimSubject_Table as sub on sub.Subject_ID = q.Subject_ID where (q.Question_ID = '$question' OR '$question' = '') AND (q.category = '$category' OR '$category' = '') AND (q.Type_ID = '$feedback_type' OR '$feedback_type' = '') AND (q.Subject_ID = '$subject' OR '$subject' = '')");
                									    while($row_qu = mysqli_fetch_array($sel_ques)) {
                										?>
                										<tr class="odd gradeX">
                										    <td><?php echo $row_qu['Type_ID']; ?></td>
                										    <td><?php echo $row_qu['Question_ID']; ?></td>
                											<td><?php echo $stud_id; ?></td>
                											<td><?php echo $row['Name']; ?></td>
                											<td><?php echo $row['Roll_Number']; ?></td>
                											<td><?php echo $row['Class']; ?>/<?php echo $row['Division']; ?></td>
                											<td><?php echo $row['Combination']; ?></td>
                											<td><?php echo $row['Course']; ?></td>
                											<td><?php echo $row_qu['Type_Description']; ?></td>
                											<td><?php echo $row_qu['Question_Text']; ?></td>
                											<td><?php echo $row_qu['Subject_Name']; ?></td>
                											<?php
                											    $cTypeId = $row_qu['Type_ID'];
                											    $cQuestionId = $row_qu['Question_ID'];
                											    $sel_res = mysqli_query($con, "SELECT Response_Value, Counter FROM `FactFeedback_Table` where Student_ID = '$stud_id' AND Type_ID = '$cTypeId' AND Question_ID = '$cQuestionId'");
                											    $row_result = mysqli_fetch_array($sel_res);
                											    $Response_Value = '';
                											    $Counter = 1;
            										            if(!empty($row_result)) {
            										                $Response_Value = $row_result['Response_Value'];
            										                $Counter = $row_result['Counter'];
            										            }
                											?>
                											<td><div contentEditable='true' class='edit' id='<?php echo "Counter~~".$stud_id."~~".$cTypeId."~~".$cQuestionId;  ?>'><?php echo $Counter; ?></div></td>
                											<td><div contentEditable='true' class='edit' id='<?php echo "Response_Value~~".$stud_id."~~".$cTypeId."~~".$cQuestionId;  ?>'><?php echo $Response_Value; ?></div></td>
                											<td>
                												<button type="button" class="btn btn-sm btn-danger btnDelete" data-id='<?php echo $stud_id."~~".$cTypeId."~~".$cQuestionId;  ?>'><i class="fas fa-trash"></i></button>
                											</td>
                										</tr>
                										<?php
                										$count ++;
                									    }
                									}
                									?>  
                								</tbody>
                							</table>
                						</div>
    								</div>
    						    </div>
    						</form>
						</div>
					</div>
					<?php
					}
					?>
				</div>
			</div>
		</div>
	</section>
</div>
<?php include 'footer.php'; ?>
<script>
	$(function () {
		$("#data_table").DataTable({
			"lengthChange": false, 
			"autoWidth": false,
			 "paging": false,
			 "columnDefs": [
                { "targets": [0], "visible": false, "searchable": false },
                { "targets": [1], "visible": false, "searchable": false }
            ],
			"buttons": ["copy", "csv", "excel", "pdf", "print", "colvis"],
			//"pageLength": 10,
		}).buttons().container().appendTo('.dataTables_wrapper .col-md-6:eq(0)');
	});
</script>
<script type="text/javascript">
	$(document).ready(function(){
		$('.edit').click(function(){
			$(this).addClass('editMode');
		});
		$(".edit").focusout(function(){
			$(this).removeClass("editMode");
			var id = this.id;
			var value = $(this).text().trim();
			if(value == '') {
			    return;
			}
			if (!/^\d+(\.\d+)?$/.test(value)) { // Allows integers or decimals
                alert("Please enter a valid numeric value.");
                $(this).text("");
                return;
            }
			$.ajax({
				url: 'update-feedback.php',
				type: 'post',
				data: { Data1:id, value:value},
				success:function(response){
					console.log('Save successfully'); 
				}
			});
		});
	});
</script>
<script>
		    $(".btnDelete").click(function(){
				let tr = $(this).parents("tr");
				if(confirm('Are you sure you want to delete?'))
				{
					let id = $(this).data("id");
					$.ajax({
						type : "POST",
						url : "delete-feedback.php",
						data : {id:id},
						beforeSend : function() {

						},
						success : function(response) {
							let res = JSON.parse(response);
							if(res['code']=='100')
							{
								tr.remove();
							}
							else
							{
							    alert(res['msg']);
							}
						}
					});
				}
				return false;
			});
		</script>

MMCT - 2023