<?php
include("cp_header.php");/**************************************************صفحة عرض المستخدمين*********************************************************************/


//تجنب اضافة سجل فى حالة اعادة تحميل الصفحة
$RequestSignature = md5($_SERVER['REQUEST_URI'].$_SERVER['QUERY_STRING'].print_r($_POST, true));
$table='users';

?>

<!-- الصفحة اللى هتعمل الحذف-->
<input type="hidden" id="delete_page" value="delete_user.php">
<input type="hidden" id="active_page" value="active_user.php">
<!-- /////////// -->
<div style="visibility:hidden" id="table_name">user</div>
<div id="load_page" style="display:none">load_users.php</div>
<!-- /////////// -->

<!--// -->

<div id="cp_cont">
<div id="show_user_details"></div>
<div id="cp_title">المستخدمين
<a style='background:url(../img/add_icon.png);float:left;margin:10px 0px 5px 10px;color:var(--white);width:20px;height:20px;' class='las la-plus-circle' href="add_<?php echo $table; ?>.php" ></a> 

</div>
<div id="result_limit">
<div id="news_cont">
<div id="result_view">
<table border='0' cellpadding="0" cellspacing="0" width="988"  dir="rtl"  style="border-left:solid 1px #ccc" >
<tr class='first_table_tr'>
<td width='250'>اسم الدخول</td>
<td width="15" align="center">التنشيط</td>


<?php if(isset($_GET['arrang'])){?><td width="15" align="center">ترتيب</td><?php }?>

<td width="15" align="center">تعديل</td>
<td width="15" align="center">تفاصيل</td>
<td width="15" align="center">حذف</td>		
</tr>	
	
	
<?php
$rows_num=0;
//بداية الاستعلام
$query="SELECT * FROM users ";
//تنفيذ الاستعلام
$result=mysqli_query($conn,$query);
$rows_num=mysqli_num_rows($result);

   /*بداية التكرار */  
 while($fetch = mysqli_fetch_array($result)) {
   		 $fetch = clean_array($fetch);
echo"<tr tr_id='$fetch[id]'  id='tr$fetch[id]' class='table_tr'>";
echo"<td>$fetch[name]</td>";
echo"<td align='center'><a class='priority_multi' alt='$fetch[0]'>";
if($fetch['active']=='1'){
echo"<img loading='lazy' id='active_priority$fetch[0]' class='active_priority' src='../img/priority.png'></td>";	
}else{
echo"<img loading='lazy' id='active_priority$fetch[0]' class='active_priority' src='../img/not_priority.png'></td>";		
}

echo"<td align='center'><a href='edit_users.php?id=$fetch[0]'><img loading='lazy' a src='../img/edit.png'></a></td>";
echo"<td align='center'><a class='";
if($fetch['name']=='Admin'){
echo "no-delete' alt='$fetch[0]'><img loading='lazy' src='../img/delete.png'></a></td>";	
}else{
echo "delete' alt='$fetch[0]'><img loading='lazy' src='../img/delete.png'></a></td>";		
}

}	
?>
</table>
</div>
</div>	
</div>	
<div id="num_container">
<?php
$num=0;
for ($i=1;$i<=$rows_num;$i+=12){
	$num++;
	$num_min=intval($num)-1;
	echo"<div max='12' lang='users'  alt='$num_min' id='num_con$num' class='num_con'>$num</div>";

	
}
?>	
	
</div>
</div>

<?php 
//تحميل الفوتر
include("cp_footer.php"); ?>



