JezK
Edit File: notifications_list.php
<?php include_once '../databaseConn.php'; include_once './lib/requestHandler.php'; $DatabaseCo = new DatabaseConn(); include_once '../class/Config.class.php'; $configObj = new Config(); error_reporting(0); $isPostBack = ($_SERVER["REQUEST_METHOD"]==="POST"); if($isPostBack) { $ACTION = isset($_POST['action']) ? $_POST['action'] :"" ; if(isset($_POST['adv_id']) && is_array($_POST['adv_id'])) { $adv_id_arr = $_POST['adv_id']; $adv_id_val = "("; foreach($adv_id_arr as $adv_id) { $adv_id_val .= $adv_id.","; } $adv_id_val = substr($adv_id_val, 0, -1); $adv_id_val .=")"; switch($ACTION) { case 'DELETE': $SQL_STATEMENT = "delete from notification where notifyID in ".$adv_id_val; $exe=$DatabaseCo->dbLink->query($SQL_STATEMENT); break; } $statusObj = handle_post_request("UPDATE",$SQL_STATEMENT,$DatabaseCo); $STATUS_MESSAGE = $statusObj->getstatusMessage(); } else { $statusObj = new status(); $statusObj->setActionSuccess(false); $STATUS_MESSAGE = "Please select value to complete action."; } } ?> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Manage | Notifications</title> <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'> <!-- Bootstrap 3.3.2 --> <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> <!-- Font Awesome Icons --> <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" /> <link href="plugins/datatables/dataTables.bootstrap.css" rel="stylesheet" type="text/css" /> <!-- Theme style --> <link href="dist/css/AdminLTE.min.css" rel="stylesheet" type="text/css" /> <!-- AdminLTE Skins. Choose a skin from the css/skins folder instead of downloading all of them to reduce the load. --> <link href="dist/css/skins/_all-skins.min.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" href="css/all_check.css"/> <link rel="stylesheet" href="css/libs/select2.css"/> <!-- jQuery 2.1.3 --> <script src="plugins/jQuery/jQuery-2.1.3.min.js"></script> <!-- Bootstrap 3.3.2 JS --> <script src="bootstrap/js/bootstrap.min.js" type="text/javascript"></script> <!--jquery for left menu active class--> <script type="text/javascript" src="dist/js/general.js"></script> <script type="text/javascript" src="dist/js/cookieapi.js"></script> <script type="text/javascript"> setPageContext("send-email","email-list"); </script> <!--jquery for left menu active class end--> <!-- DATA TABES SCRIPT --> <script src="plugins/datatables/jquery.dataTables.js" type="text/javascript"></script> <script src="plugins/datatables/dataTables.bootstrap.js" type="text/javascript"></script> <!-- AdminLTE App --> <script src="dist/js/app.min.js" type="text/javascript"></script> <script type="text/javascript" src="js/util/redirection.js"></script> </head> <body class="skin-blue"> <div class="wrapper"> <?php include "page-part/header.php"; ?> <!-- Left side column. contains the logo and sidebar --> <?php include "page-part/left_panel.php"; ?> <!-- Content Wrapper. Contains page content --> <div class="content-wrapper"> <!-- Content Header (Page header) --> <section class="content-header"> <h1> Notifications </h1> <ol class="breadcrumb"> <li><a href="dashboard"><i class="fa fa-dashboard"></i> Home</a></li> <li class="active"> Notifications</li> </ol> </section> <!-- Main content --> <section class="content"> <!-- Small boxes (Stat box) --> <!-- /.row --> <!-- Main row --> <div class="row"> <div class="col-lg-12 col-xs-12 col-sm-12"> <?php if(!empty($STATUS_MESSAGE)) { if($statusObj->getActionSuccess()){ echo "<div class='alert alert-success' id='success_msg'><i class='fa fa-check-circle fa-fw fa-lg'></i> ".$STATUS_MESSAGE."</div>"; }else{ echo "<div class='alert alert-danger' id='validationSummary' style='display:block'><i class='fa fa-times-circle fa-fw fa-lg'></i> Please Correct Following Errors.<ul ><li>".$STATUS_MESSAGE."</li></ul></div>"; } } ?> <?php $success= isset($_GET['success']) ? $_GET['success'] :"" ; if(!empty($success)) { echo "<div class='success-msg cf' id='success_msg'><h3>Record is updated successfully.</h3></div>"; } ?> <?php $main_menu_count = getRowCount("select count(payid) from payments".getWhereClauseForStatus($advertise_status),$DatabaseCo); if($main_menu_count>0) { $SQL_STATEMENT = "SELECT * FROM notification ORDER BY notifyID DESC"; ?> <div class="col-lg-12 col-xs-12 col-sm-12 neMrgATop10"> <div class="box-top clearfix"> <div class="col-lg-2 col-xs-12 col-sm-4"> <a href="javascript:;" class="btn btn-danger btn-lg btn-flat col-xs-12" onclick="submitActionForm('DELETE');"> <i class="fa fa-trash"></i> Delete </a> </div> <div class="col-md-3 col-sm-6"> <a href="notification" class="btn btn-success btn-lg btn-flat col-xs-12"> <i class="fa fa-plus hidden-xs"></i>Add Notification </a> </div> </div> <div class="col-xs-12"> <!-- /.box --> <div class="box"> <div class="box-header"> <h3 class="box-title"><?php echo strtoupper($advertise_status); ?> Notifications List</h3> </div><!-- /.box-header --> <div class="box-body"> <form method="post" action="notifications_list" id="action_form"> <table id="example1" class="table table-bordered table-striped"> <thead> <tr> <th><input type="checkbox" name="check" id="selectall" class="second" /> <label for="selectall" class="label2"> </label> </th> <th>Message </th> <th>Name</th> <th>Date </th> </tr> </thead> <tbody> <?php $DatabaseCo->dbResult=$DatabaseCo->getSelectQueryResult($SQL_STATEMENT); $rowCount=0; $imagetag=''; while($DatabaseCo->dbRow = mysqli_fetch_object($DatabaseCo->dbResult)) { $userData =mysqli_fetch_object($DatabaseCo->dbLink->query("select firstname from register where index_id='".$DatabaseCo->dbRow->user_id."'")); ?> <tr> <td><input type="checkbox" name="adv_id[]" id="Item<?php echo $DatabaseCo->dbRow->notifyID;?>" class="second" value="<?php echo $DatabaseCo->dbRow->notifyID;?>"/> <label for="Item<?php echo $DatabaseCo->dbRow->notifyID;?>" class="label2"> </label> </td> <td><?php echo $DatabaseCo->dbRow->message; ?></td> <td><?php echo $userData->firstname; ?></td> <td><?php echo $DatabaseCo->dbRow->createDate;?></td> </tr> <?php } ?> </tbody> </table> <input type="hidden" name="action" value="" id="action"/> </form> </div><!-- /.box-body --> </div><!-- /.box --> </div> <?php } else { ?> <div class="col-lg-12 col-xs-12 col-sm-12"> <h4>There are no data for <?php echo strtoupper($advertise_status); ?>No orders available.</h4> <br/> <img src="../img/no-data.png" alt="No Data" style="border: 2px solid #ccc;"/> </div> <?php } ?> <!-- /.col --> </div><!-- /.row --> </section><!-- /.content --> </div><!-- /.content-wrapper --> <?php include "page-part/footer.php"; ?> </div><!-- ./wrapper --> <!-- page script --> <script type="text/javascript"> $(function () { var refreshRequired = false; $("input[name=payid]").click(function(){ $("#selectall").prop("checked", false); }); // js for Check/Uncheck all CheckBoxes by Checkbox // $("#selectall").click(function(){ $(".second").prop("checked",$("#selectall").prop("checked")) }) $('#example1').dataTable({ "aaSorting": [ [3,'desc'] ], 'aoColumnDefs': [{ 'bSortable': false, 'info': true, "paging": true, 'aTargets': [0,1,2,], 'pageLength': 10 }] } ); }); </script> </body> </html>