Preview: forms.php
Size: 8.97 KB
/home/jambtst2015/public_html/giraffeng.com/admin/forms.php
<?php include("includes/head.php"); ?>
<?php include("includes/header.php"); ?>
<?php
if(empty($_REQUEST['delete'])){$_REQUEST['delete']='';}
if($_REQUEST['delete']=="del" && $_REQUEST['delete_id']!='')
{
$sql_form_name = getNameTable("form_master","filename","id",$_REQUEST['delete_id']);
$unlink_path = 'upload_file/'.$sql_form_name;
$unlink = unlink($unlink_path);
if($unlink)
{
mysql_query("delete from form_master where id='".$_REQUEST['delete_id']."'");
}
//mysql_query("delete from sat_users_history where user_id='".$_REQUEST['delete_id']."'");
$delmsg="Form deleted successfully";
}
?>
<script type="text/javascript" language="javascript">
<?php /*?>function view(userid)
{
window.open('view_user.php?userid='+userid+'&page=<?php echo $page; ?>&name=<?=$_REQUEST['name']?>&email=<?=$_REQUEST['email']?>&username=<?=$_REQUEST['username']?>&order=<?=$_REQUEST['order']?>&userclass=<?=$_REQUEST['userclass']?>&status=<?=$_REQUEST['status']?>&rcv_reqs_email=<?=$_REQUEST['rcv_reqs_email']?>&submittals_emails=<?=$_REQUEST['submittals_emails']?>&rvc_hotlist_email=<?=$_REQUEST['rvc_hotlist_email']?>&submit2=<?=$_REQUEST['submit2']?>','news view','height=400, width=1000, resizable=yes, scrollbars=yes');
}<?php */?>
function open_src(){
if(document.getElementById("div_src").style.display=='none'){
//document.getElementById("div_src").style.display='block';
$("#div_src").show("slow");
}
else{
//document.getElementById("div_src").style.display='none';
$("#div_src").hide("slow");
}
}
$(document).ready(function(){
setTimeout(function(){
$(".mydiv").fadeOut("slow", function () {
$(".mydiv").remove("slow");
});
}, 4000);
});
</script>
<div class="container_bottom_section">
<?php if($delmsg!=''){ ?>
<p class="mydiv" style="color:#F00; float:left; font-family:Verdana, Geneva, sans-serif; font-size:13px; text-align:left;"><?php echo $delmsg; ?></p>
<?php } ?>
<?php if($_REQUEST['success']=='1'){ ?>
<p class="mydiv" style="color:#090; float:left; font-family:Verdana, Geneva, sans-serif; font-size:13px; text-align:left;">Form Added Successfully</p>
<?php } ?>
<?php if($_REQUEST['success']=='2'){ ?>
<p class="mydiv" style="color:#090; float:left; font-family:Verdana, Geneva, sans-serif; font-size:13px; text-align:left;">Form Updated Successfully</p>
<?php } ?>
<a href="javascript:open_src();" class="require" style="margin-right:5px; margin-bottom:5px;"><i class="fa fa-search"></i> Search</a>
<?php if($level==1){ ?>
<?php /*?><a href="users_export_xls.php" class="require" style="margin-right:5px; margin-bottom:5px;">Export</a><?php */?>
<a href="addform.php" class="require org" style="margin-right:5px; margin-bottom:5px;"><i class="fa fa-plus"></i> Add Form</a>
<?php } ?>
<div class="clear"></div>
<?php
if(empty($_REQUEST['submit2'])){$_REQUEST['submit2']='';}
?>
<div class="search-box" style="padding:5px; <?php if($_REQUEST['submit2']=='') { ?>display:none;<?php } ?> border:1px solid #C4C4C4; margin-bottom:10px;" id="div_src">
<div class="require_add">
<h3 style="font-family:Arial, Helvetica, sans-serif; font-size:18px; float:left; color:#2597C9; padding-bottom:5px;"><i class="fa fa-search"></i> Search By</h3>
<div class="clear"></div>
</div>
<form name="myfrm" action="" method="post">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="table_search">
<tr>
<td colspan="17" height="10"></td>
</tr>
<tr>
<td width="10%" height="25" class="require_table_search">Form Title:</td>
<td align="left">
<input type="text" name="name" class="textfield require_field" value="<?php echo $_REQUEST['name']; ?>" />
</td>
<td>
<span style="float:right;">
<input name="submit2" type="submit" value="Search" class="require sm" style="margin-top:0px !important;" />
<a href="forms.php" class="require org" style="text-decoration:none;"> Show All </a>
</span>
<!-- <span style="float:left;">
<input name="submit2" type="submit" value="Search" class="submit" style="margin-top:0px;" />
<a href="forms.php" style="text-decoration:none;">
<input name="submit3" type="button" value="Show All" class="submit" style="margin-top:0px;" />
</a>
</span> -->
</td>
</tr>
</table>
</form>
</div>
<table width="1100" class="list-table" border="1" cellspacing="0" cellpadding="0" bordercolor="#616161" style="border-collapse:collapse;">
<tr>
<td width="170" class="head_text">Title</td>
<td width="84" class="head_text">Status</td>
<?php //if($level==1){ ?>
<td width="84" class="head_text text-center">Action</td>
<?php //} ?>
</tr>
<?php
if(empty($_REQUEST['order'])){ $_REQUEST['order']=''; }
if($_SESSION['sat_login_id'] != "")
{
$qry_contact = "select * from form_master where 1 ";
}
else
{
$qry_contact = "select * from form_master where status = 'Active' ";
}
if($_REQUEST['name']!=''){
$qry_contact .= " and title like '%".$_REQUEST['name']."%'";
}
if($_REQUEST['order']=="asc"){
$oredr = $_REQUEST['order'];
}
if($_REQUEST['order']=="desc"){
$oredr = $_REQUEST['order'];
}
if($_REQUEST['order']==""){
$oredr = 'desc';
}
$qry_contact .= " order by id ".$oredr;
//echo $qry_contact;exit;
$_SESSION['sqlUser']='';
//$_SESSION['sqlUser'] = $qry_contact;
$sel_events=mysql_query($qry_contact);
////////////////////////////////Start pagination////////////////////////////////////
if(empty($_REQUEST['page'])) { $_REQUEST['page']=''; }
$page=$_REQUEST['page'];
if($page==""){
$page = 1;
}
if($_REQUEST['submit2']!='' && $page!=1){
$page = $page;
}
$max_results = 10;
$prev = ($page - 1);
$next = ($page + 1);
$from = (($page * $max_results) - $max_results);
$total_results = mysql_num_rows($sel_events);
$total_pages = ceil($total_results / $max_results);
$pagination = '';
if($page > 1)
{
$pagination .= "<a href=\"forms.php?page=$prev&name=".$_REQUEST['name']."&order=".$_REQUEST['order']."&submit2=".$_REQUEST['submit2']."\" class=\"more_link_pagination_prev\">Previous</a>";
$pagination.=" ";
}
for($i = 1; $i <=$total_pages; $i++)
{
if(($page) == $i)
{
$pagination .= $i;
$pagination.=' ';
}
else
{
$pagination .= "<a href=\"forms.php?page=$i&name=".$_REQUEST['name']."&order=".$_REQUEST['order']."&submit2=".$_REQUEST['submit2']."\" class=\"more_link_pagination\">$i</a>";
$pagination.=' ';
}
}
if($page < $total_pages)
{
$pagination .= "<a href=\"forms.php?page=$next&name=".$_REQUEST['name']."&order=".$_REQUEST['order']."&submit2=".$_REQUEST['submit2']."\" class=\"more_link_pagination_prev\">Next</a>";
$pagination.=" ";
}
$qry_contact.=" limit $from,$max_results";
//echo $qry_contact;
$result=mysql_query($qry_contact);
////////////////////////////////End pagination////////////////////////////////////
if(mysql_num_rows($result)>0)
{
$inc=1;
while($row_contact_details=mysql_fetch_array($result))
{
$title = $row_contact_details['title'];
$status = $row_contact_details['status'];
$filename = $row_contact_details['filename'];
?>
<tr>
<td class="head_text2">
<?php echo $title; ?>
</td>
<td class="head_text2"><?php echo $status; ?></td>
<td class="head_text2 text-center">
<?php if($level==1){ ?>
<a href="forms.php?delete=del&delete_id=<?php echo $row_contact_details['id'];?>&page=<?=$_REQUEST['page']?>&name=<?=$_REQUEST['name']?>&submit2=<?=$_REQUEST['submit2']?>" onclick="return confirm('Are you sure you want to delete this Holiday?');">
<img src="images/1304761651_DeleteRed.png" alt="Delete" title="Delete" border="0" /></a>
<a href="forms_edit.php?id=<?php echo $row_contact_details['id'];?>&page=<?php echo $_REQUEST['page']; ?>&name=<?=$_REQUEST['name']?>&submit2=<?=$_REQUEST['submit2']?>" id="edit" class="info_link"><img src="images/edit.png" alt="Edit" title="Edit" /></a>
<?php } ?>
<?php if($filename!=''){ ?>
<a href="<?php echo "http://".$_SERVER['HTTP_HOST'].'/timetrack/upload_file/'.$filename; ?>" id="edit" class="info_link"><img src="images/1420662032_Down.png" alt="Download Form" title="Download Form" height="16" width="16" /></a>
<?php } ?>
</td>
</tr>
<?php
}
?>
<tr>
<td colspan="11" class="tbl-footer pagination-nw" style="background-color:;"><?php echo $pagination; ?></td>
</tr>
<?php
}
else
{
?>
<tr>
<td colspan="11" class="head_text" style="background-color:#B2CEFC;">No Forms Found.</td>
</tr>
<?php
}
?>
</table>
<div class="clear"></div>
</div>
<?php include("includes/footer.php"); ?>
Directory Contents
Dirs: 17 × Files: 180