<?php
include_once("../include/main.inc.php");
check_session('MyCpanel','index.php');

################ Paging Starts From Here ##################
@extract($_REQUEST);

$heading="Manage Static Pages";
$record_type="Static Pages";
$script_name="manage-staticpages.php";
$table_name="static_pages";
#################### DELETE Record ##################

if($id=="delete_record") {
	
		
		$categoryRes=getResult($table_name," where pageID='$catID'");
		mysqli_query($dbconn,"delete from $table_name where catID='$catID'");
		$_SESSION['session_message']=$record_type.' has been deleted successfully';
	header("Location: ".SITE_ADMIN_URL."/".$script_name);
	exit;	 
}

########################################################
admin_header("Manage $record_type");	
$qry= db_query("select * from $table_name");
?>
<div class="content-wrapper">
    <div class="page-header">
        <h3 class="page-title">
            <?=$heading;?>
        </h3>
        <nav aria-label="breadcrumb">
		<ol class="breadcrumb">
                <li class="breadcrumb-item"><a href="welcome.php">Admin</a></li>
                <li class="breadcrumb-item active" aria-current="page">Manage Static Pages</li>
                </ol>
        </nav>
    </div>
    <div class="card">
        <div class="card-body">
            <div class="row">
                <div class="col-12">
                    <div class="table-responsive">
                        <table id="order-listing" class="table table-bordered table-hover">
                            <thead>
                                <tr>
                                    <th>S.No.</th>
                                    <th>Page Name</th>
                                    <th>Status</th>
                                    <th>Actions</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php
 $sl=$start+1;
 while($arr=mysqli_fetch_array($qry)) { ?>
                                <tr>
                                    <td><?=$sl?></td>
                                    <td><p class="ordern"><?=$arr['pageTitle'];?></p></td>
									<td><?php if($arr['status']=='Y') { ?><label class="badge badge-success badge-pill">Active</label><?php }
	   									else if($arr['status']=='N') { ?> <label class="badge badge-danger badge-pill">In-Active</label>
                                        <?php } ?>
                                    </td>
                                    <td> <p class="download-dcs">
                                      <a href="<?=admin_url?>page-content.php?cid=<?=$arr['pageID'];?>"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-edit-3"><path d="M12 20h9"></path><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"></path></svg></a>
                                        </p>
                                    </td>
                                </tr>

                                <?php  $sl++; }?>

                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<?php 
admin_footer();
exit;
?>