296 lines
7.7 KiB
PHP
296 lines
7.7 KiB
PHP
|
<?php
|
||
|
include('pop_up_top.php');
|
||
|
$TABLENAME='rights_access';
|
||
|
$this_script='rights_access.php';
|
||
|
$this_script1='rights_access_view.php';
|
||
|
?>
|
||
|
<link href="includes/css-js/admin.css" rel="stylesheet" type="text/css" />
|
||
|
<tr>
|
||
|
<td height="350" valign="top" style="padding:10px;"><table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||
|
<tr>
|
||
|
<td><fieldset class="bdr1" >
|
||
|
<?php
|
||
|
if(isset($acn) && $acn=='delete')
|
||
|
|
||
|
{
|
||
|
//if($category)
|
||
|
mysqli_query($conn,"DELETE FROM $TABLENAME WHERE category ='".$category."'");
|
||
|
}
|
||
|
|
||
|
if(isset($hid) && $hid=='1')
|
||
|
{
|
||
|
for($i=1;$i<=$rowhid;$i++)
|
||
|
{
|
||
|
$prefix=$i;
|
||
|
$query_prefix='INSERT INTO ';
|
||
|
$query_suffix="";
|
||
|
$query_additional="";
|
||
|
$query_main= " SET category='".$category."', user_id='".${"user_id$prefix"}."', acc_add='".${"add$prefix"}."', acc_view='".${"view$prefix"}."', acc_edit='".${"edit$prefix"}."', acc_delete='".${"delete$prefix"}."'";
|
||
|
$sql=$query_prefix.$TABLENAME.$query_main.$query_additional.$query_suffix;
|
||
|
$res=@mysqli_query($conn,$sql);
|
||
|
}
|
||
|
$msg="Rights entered successfully.";
|
||
|
}
|
||
|
?>
|
||
|
|
||
|
|
||
|
<center>
|
||
|
|
||
|
|
||
|
|
||
|
<?php if($acn=='add' || $acn=='update'|| $acn=='view') { ?>
|
||
|
|
||
|
<?php
|
||
|
|
||
|
if($acn=='update'|| $acn=='view')
|
||
|
|
||
|
{
|
||
|
|
||
|
$sql=@mysqli_query($conn,"");
|
||
|
|
||
|
$row=@mysqli_fetch_array($sql);
|
||
|
|
||
|
@extract($row);
|
||
|
|
||
|
}
|
||
|
|
||
|
?>
|
||
|
|
||
|
<form name="f1" method="post" action="#">
|
||
|
|
||
|
<table width="100%" border="0" cellspacing="0" cellpadding="4" class="bdr_table">
|
||
|
|
||
|
<tr>
|
||
|
|
||
|
<td colspan="2" align="center">
|
||
|
|
||
|
<span class="txt">
|
||
|
|
||
|
<?php
|
||
|
|
||
|
if($msg)
|
||
|
|
||
|
echo $msg;
|
||
|
|
||
|
?>
|
||
|
</span></td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
|
||
|
<!-- <td align="right" class="bg3">Category</td>-->
|
||
|
|
||
|
|
||
|
|
||
|
<td align="left" class="bdr_td">
|
||
|
<select class="selectbox" id="category" name="category" onchange="checking1(this.value)">
|
||
|
<option value="">-Select CATEGORY-</option>
|
||
|
<option value="T">Tender</option>
|
||
|
<option value="Q">Quotation</option>
|
||
|
<option value="P">Purchase Order</option>
|
||
|
<option value="A">Amendments</option>
|
||
|
<option value="C">Comparison</option>
|
||
|
</select> </td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td align="right" class="bg3"> </td>
|
||
|
<td align="left" class="bdr_td"> </td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td colspan="2" class="bg3">
|
||
|
<table width="100%" border="0" cellspacing="0" cellpadding="4" class="bdr_table">
|
||
|
<tr class="bg2">
|
||
|
<td align="left" ><strong>S.No.</strong></td>
|
||
|
<td align="center"><strong>User Name</strong></td>
|
||
|
<td align="center" ><strong>User Role</strong></td>
|
||
|
<td align="center" ><strong>Add</strong></td>
|
||
|
<td align="center" ><strong>View</strong><input type="checkbox" id="sel" name="sel" onclick="CheckAll(this)"/></td>
|
||
|
<td align="center" ><strong>Edit</strong></td>
|
||
|
<td align="center" ><strong>Delete</strong></td>
|
||
|
</tr>
|
||
|
<?php
|
||
|
$count=1;
|
||
|
$sql="SELECT user_name, user_id, b.role_name as role_name FROM tbl_users a, role_master b where a.role_id=b.role_id ORDER BY a.user_id ";
|
||
|
$res=mysqli_query($conn,$sql);
|
||
|
while($row=@mysqli_fetch_array($res))
|
||
|
{
|
||
|
extract($row);
|
||
|
?>
|
||
|
<tr class="bdr_td">
|
||
|
<td align="left" class="bdr_td"><?php echo $count?></td>
|
||
|
<td align="center" class="bdr_td"><?php echo $user_name?>
|
||
|
<input name="user_id<?php echo $count?>" type="hidden" value="<?php echo $user_id?>" /> </td>
|
||
|
<td align="center" class="bdr_td"><?php echo $role_name?></td>
|
||
|
<td align="center" class="bdr_td"><input name="add<?php echo $count?>" type="checkbox" value="1" /></td>
|
||
|
<td align="center" class="bdr_td"><input name="view<?php echo $count?>" id="view" type="checkbox" value="1" /></td>
|
||
|
<td align="center" class="bdr_td"><input name="edit<?php echo $count?>" type="checkbox" value="1" /></td>
|
||
|
<td align="center" class="bdr_td"><input name="delete<?php echo $count?>" type="checkbox" value="1" /></td>
|
||
|
</tr>
|
||
|
<?php
|
||
|
$count++;
|
||
|
}
|
||
|
$count--;
|
||
|
?>
|
||
|
<input type="hidden" name="rowhid" value="<?php echo $count?>">
|
||
|
</table></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td align="right" class="bg3">
|
||
|
<input type="hidden" name="hid" value="1"> </td>
|
||
|
<td align="left" class="bdr_td">
|
||
|
|
||
|
<?php if($acn=='update') { ?>
|
||
|
|
||
|
<input type="submit" name="frmacn" value="Update" class="submitbutton" style="background-color:#CCFF33;">
|
||
|
|
||
|
<?php } else if($acn=='add') { ?>
|
||
|
|
||
|
<input type="submit" name="frmacn" value="Add" class="submitbutton" style="background-color:#CCFF33;">
|
||
|
<?php } ?>
|
||
|
<input type="button" onClick="window.close();"value="Close" class="submitbutton" style="background-color:#FF5C33;"> </td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
|
||
|
|
||
|
|
||
|
</form>
|
||
|
|
||
|
<?php } else echo "<script>location.href='techsyn_rights_list.php'</script>"; { ?>
|
||
|
|
||
|
<form name="f1" method="post" action="<?php echo $this_script?>">
|
||
|
|
||
|
|
||
|
|
||
|
<table width="100%" border="0" cellspacing="0" cellpadding="4" class="bdr_table"style="display:none">
|
||
|
|
||
|
<tr class="bg2">
|
||
|
|
||
|
<td colspan="7" align="center"><font color="maroon"><?php echo $msg?></font></td>
|
||
|
</tr>
|
||
|
|
||
|
<tr class="bg2">
|
||
|
|
||
|
<td align="left" ><strong>S.No.</strong></td>
|
||
|
|
||
|
<td align="center"><strong>Category</strong></td>
|
||
|
|
||
|
<td align="center"><strong>View</strong></td>
|
||
|
|
||
|
<td align="center"><strong>Edit</strong></td>
|
||
|
|
||
|
<td align="center"><strong>Delete</strong></td>
|
||
|
</tr>
|
||
|
|
||
|
<?php
|
||
|
|
||
|
$sql="SELECT Distinct(category) FROM rights_access ORDER BY category ASC";
|
||
|
|
||
|
$result = mysqli_query($conn,$sql);
|
||
|
|
||
|
$num_rows=@mysqli_num_rows($result);
|
||
|
|
||
|
$page=new Page();
|
||
|
|
||
|
$page->set_page_data($this_script,$num_rows,$records_per_page=100000,$scroll_num=0,$show_prev_next=true,$show_scroll_prev_next=true,$show_first_last=true);
|
||
|
|
||
|
$page->set_qry_string("");
|
||
|
|
||
|
$page_order_result=@mysqli_query($conn,$page->get_limit_query($sql));
|
||
|
|
||
|
$num=@mysqli_num_rows($page_order_result);
|
||
|
|
||
|
if($num>0)
|
||
|
|
||
|
{
|
||
|
|
||
|
$pageon=$_GET['page'];
|
||
|
|
||
|
$pageon=($pageon)*100000;
|
||
|
|
||
|
$count=$pageon+1;
|
||
|
|
||
|
while($row=@mysqli_fetch_array($page_order_result))
|
||
|
|
||
|
{
|
||
|
|
||
|
extract($row);
|
||
|
|
||
|
?>
|
||
|
|
||
|
<tr class="bdr_td">
|
||
|
|
||
|
<td align="left" class="bdr_td"><?php echo $count?></td>
|
||
|
|
||
|
<?php
|
||
|
if($category=='T')
|
||
|
$category_name="Tender";
|
||
|
if($category=='Q')
|
||
|
$category_name="Quotation";
|
||
|
if($category=='P')
|
||
|
$category_name="Purchase Order";
|
||
|
if($category=='A')
|
||
|
$category_name="Amendments";
|
||
|
if($category=='C')
|
||
|
$category_name="Comparison";
|
||
|
?>
|
||
|
<td align="center" class="bdr_td"><?php echo $category_name?> </td>
|
||
|
|
||
|
<td align="center" class="bdr_td"> <a href="javascript:void(0);" onclick="javascript:sendpage('<?php echo $this_script1?>?acn=view&category=<?php echo $category?>');"><img src='images/view.jpg' border="0" /></a></td>
|
||
|
|
||
|
<td align="center" class="bdr_td"> <a href="javascript:void(0);" onclick="javascript:sendpage('<?php echo $this_script1?>?acn=update&category=<?php echo $category?>');"><img src='images/edit.png' border="0" /></a></td>
|
||
|
|
||
|
<td align="center" class="bdr_td"> <a href="javascript:void(0);" onclick="javascript:deleterecord('<?php echo $this_script?>?acn=delete&category=<?php echo $category?>');"><img src='images/drop.png' border="0" /></a></td>
|
||
|
</tr>
|
||
|
|
||
|
<?php
|
||
|
|
||
|
$count++;
|
||
|
|
||
|
} ?>
|
||
|
|
||
|
<tr class='bg2'><td colspan='7'><div style="margin-right:10px; ">Page <?php echo "<br>".$page->get_page_nav();?></div></td></tr>
|
||
|
|
||
|
<?php }
|
||
|
|
||
|
else
|
||
|
|
||
|
{
|
||
|
|
||
|
echo "<tr><td align='center' colspan='13' class='bdr_td'><strong>No Record Found</strong></td></tr>";
|
||
|
|
||
|
}
|
||
|
|
||
|
?>
|
||
|
|
||
|
<tr><td colspan="7" align="right"><input type="button" onclick="window.location.href='rights_access.php?acn=add'" value="Add New" class="submitbutton" style="background-color:#CCFF33;"></td></tr>
|
||
|
</table>
|
||
|
|
||
|
|
||
|
|
||
|
</form>
|
||
|
|
||
|
<?php } ?>
|
||
|
|
||
|
</center>
|
||
|
|
||
|
</fieldset>
|
||
|
|
||
|
</td>
|
||
|
|
||
|
</tr>
|
||
|
|
||
|
</table></td>
|
||
|
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
|
||
|
<script>
|
||
|
function CheckAll(chk)
|
||
|
{for(var i=0;i<document.f1.elements.length;i++)
|
||
|
{var e=document.f1.elements[i];if(e.type=="checkbox" && e.id=="view")
|
||
|
{e.checked=chk.checked;}}}
|
||
|
</script>
|