
PK 
<?php
ob_start();
//error_reporting(E_ALL ^ E_NOTICE);
@session_start();
ini_set('allow_url_include',1);
date_default_timezone_set("Asia/Kolkata");
set_time_limit(600);
ini_set('max_execution_time',600);
require_once '../includes/settings/PDODB.php';
include '../includes/modules/functions.php';
$function = new FUNCTIONS();
if(empty($_SESSION['adminId'])){
header("Location: ../index.php");
exit();
}
$userData = $function->getUsers(NULL,NULL,NULL,1);
$askQuestionlist = $function->getAskQuestion($id=NULL,$uId=NULL,$q_id=NULL,$isActive=1,$orderBy='DESC');
//print_r($categorydata); exit;
//print_r($_POST);
if(!empty($_GET['id']) && ($_GET['action']=='Del')) {
//print_r($_GET['id']); exit;
$id=$_GET['id'];
$pdodb = PDODB::getInstance();
$sql = "UPDATE `tb_askquestion` SET isactive=0 WHERE id = '".$id."'";
//print_r($sql); exit;
$result = $pdodb->query($sql);
PDODB::closeInstance();
if(!empty($result)){
echo '<script type="text/javascript">location.replace("index.php");</script>';
}
}
//end delete
// Assuming $askQuestionlist is an array of questions
if (isset($_POST["selected_questions"]) && isset($_POST["new_status"])) {
$selectedQuestions = $_POST["selected_questions"];
$newStatus = $_POST["new_status"];
// Update the status of selected questions
foreach ($selectedQuestions as $questionId) {
// Assuming there is a function or method to update the status
// $function->updateQuestionStatus($questionId, $newStatus);
$pdodb = PDODB::getInstance();
$sqlinstlmnt = "UPDATE `tb_askquestion` SET `status`='".$newStatus."' WHERE `tb_askquestion`.`id` ='".$questionId."'";
$resultinstlmnt = $pdodb->query($sqlinstlmnt);
}
// Redirect back to the original page or display a success message
$error_msg = "Successfully Update.";
//exit();
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>INSPINIA | Basic Form</title>
<?php include_once '../layout/style.php'; ?>
</head>
<body>
<div id="wrapper">
<?php $currentPage = 'ask-question'; include_once '../layout/side-bar.php'; ?>
<div id="page-wrapper" class="gray-bg">
<?php include_once '../layout/header.php'; ?>
<div class="row wrapper border-bottom white-bg page-heading">
<div class="col-lg-8">
<h2>Ask Question list</h2>
</div>
<div class="col-lg-8">
<?php if (!empty($error_msg)) {
header("Refresh: 2"); ?>
<div class="alert alert-success" role="alert" id="msgdiv">
<button type="button" class="close" data-dismiss="alert">x</button>
<?=$error_msg;?>
</div>
<?php } ?>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="ibox float-e-margins">
<div class="ibox-content">
<div class="table-responsive">
<form method="post" action=""> <!-- Add form tag -->
<table class="table table-striped table-bordered table-hover dataTables-example">
<thead>
<tr>
<th>Select All <input type="checkbox" id="select_all"></th> <!-- Add select all checkbox -->
<th>S.No</th>
<th>Question</th>
<th>Name</th>
<th>Mobile No</th>
<th>Status</th>
<th>Date</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
for ($i = 0; $i < count($askQuestionlist); $i++) {
$userData = $function->getUsers($id = $askQuestionlist[$i]['uId'], $mobile = NULL, $password = NULL, $isactive = 1);
$username = $userData[0]['username'];
$mobile = $userData[0]['mobile'];
?>
<tr>
<td><input type="checkbox" class="question_checkbox" name="selected_questions[]" value="<?=$askQuestionlist[$i]['id'];?>"></td> <!-- Add checkbox -->
<td><?=$i + 1;?></td>
<td class="center"><?=$askQuestionlist[$i]['question'];?></td>
<td class="center"><?=$username;?></td>
<td class="center"><?=$mobile;?></td>
<td class="center"><?=$askQuestionlist[$i]['status'];?></td>
<td class="center"><?=$askQuestionlist[$i]['isDated'];?></td>
<td class="center">
<a class="btn btn-danger btn-xs" href="index.php?id=<?=$askQuestionlist[$i]['id'];?>&action=Del" onclick=" return confirm('Do you really want to delete!')"><i class="fa fa-trash"></i> Delete</a>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<div>
<label for="new_status">Change Status To:</label>
<select name="new_status" id="new_status">
<option value="Pending">Pending</option>
<option value="Answered">Answered</option>
<option value="In Progress">In Progress</option>
<option value="Closed">Closed</option>
</select>
<input type="submit" value="Update Status" name="btnUpdt" class="btn btn-primary">
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php include_once '../layout/script.php'; ?>
<script>
// jQuery script to handle select all checkbox functionality
$("#select_all").change(function () {
$(".question_checkbox").prop('checked', $(this).prop("checked"));
});
</script>
<!-- Page-Level Scripts -->
<script>
$(document).ready(function(){
$('.dataTables-example').DataTable({
dom: '<"html5buttons"B>lTfgitp',
buttons: [
{ extend: 'copy'},
{extend: 'csv'},
/*{extend: 'excel', title: 'ExampleFile'},
{extend: 'pdf', title: 'ExampleFile'},*/
/*{extend: 'print',
customize: function (win){
$(win.document.body).addClass('white-bg');
$(win.document.body).css('font-size', '10px');
$(win.document.body).find('table')
.addClass('compact')
.css('font-size', 'inherit');
}
}*/
]
});
});
</script>
<script type="text/javascript">
setTimeout(function () {
document.getElementById("msgdiv").classList.add('hide');
}, 3000);
</script>
</body>
</html>


PK 99