<?php 	if(! function_exists('check_session')){ die(); } ?>
<table>
	<tr>
		<td class="notice" style="text-align: right;padding-right: 5px;font-size: 9pt">
		<strong>إظهار</strong> : 
		<a href="tickets.php?step=control&amp;do=">الكل</a> -
		<a href="tickets.php?step=control&amp;do=unread">الغير مقروء</a> -
		<a href="tickets.php?step=control&amp;do=open">المفتوحة</a> -
		<a href="tickets.php?step=control&amp;do=closed">المغلقة</a>  -
		<a href="tickets.php?step=control&amp;do=hold">تنتظر الرد</a>  -
		<a href="tickets.php?step=control&amp;do=important">المهمة</a> .
		<br />
		<?php $permission	= $GLOBALS['permission'];
		if($permission['top_man'] == 1 OR $permission['allowed_sections'] == 'all'){ ?>
		<strong>إظهار تذاكر قسم محدد</strong> : <br />
		<?php while($srow	= mysql_fetch_array($GLOBALS['sections_query'])){ ?>
		- <a href="tickets.php?step=control&do=section&section_id=<?= $srow['id'] ?>"><?= $srow['title']; ?></a>
		<? } } ?>
		<hr style="border: 1px dotted silver;width: 100%" />
		عدد النتائج : <?= $GLOBALS['num']; ?> // مجموع عدد التذاكر : <?= $GLOBALS['all']['num']; ?>
		</td>
	</tr>
</table>
<table>
	<tr>
		<td class="head">إدارة التذاكر</td>
	</tr>
</table>
		<form action="tickets.php?step=delete_group&to=tickets.php?step=control[and]page=<?= $_GET['page'] ?>[and]do=<?= $_GET['do']; ?>" method="post">
<table>
	<tr>
		<td style="width: 400px" class="rightc_table">عنوان التذكرة و الكاتب</td>
		<td style="width: 200px" class="leftc_table"> الحالة و الأهمية</td>
		<td style="width: 200px" class="leftc_table">القسم</td>
		<td style="width: 60px" class="rightc_table">قراءة</td>
		<td style="width: 60px" class="rightc_table">حذف</td>
	</tr>
	<?php while($rows	= mysql_fetch_array($GLOBALS['query'])){ ?>
	<tr>
		<td style="width: 400px" class="rightcd_table">
		<a href="tickets.php?step=read&id=<?= $rows['id']; ?>&to=tickets.php?step=control[and]page=<?= $_GET['page']?>[and]do=<?= $_GET['do']?>">
		<?= $rows['subject'];?></a><?php if($rows['new'] == 1){ ?><span style="color: red;font-size:8pt"> * غير مقروءة</span><? } ?>
			<br /><?php
				if($rows['user_id'] == 0){
					echo $rows['name'];
				}else{
					get_userinfo($rows['user_id'],'`id`,`username`');
					$memberi	= $GLOBALS['minfo'];
					echo '<a href="members.php?step=edit&id=',$memberi['id'],'&to=tickets.php?step=control[and]page='.$_GET['page'].'[and]do='.$_GET['do'].'">'.$memberi['username'].'</a>';
				}
				?>
		</td>
		<td style="width: 200px;text-align:center" class="leftcd_table">
			<?php 
			switch($rows['level']){
				case 1: echo '<span style="color: red;font-weight:bold">'; break;
				case 2: echo '<span style="color: orange;font-weight:bold">'; break;
				case 3: echo '<span style="color: green;font-weight:bold">'; break;
			}
			echo level_replacer($rows['level']),'</span><br />';
			
			switch($rows['status']){
			case 1: echo '<span style="color: green">'; break;
			case 2: echo '<span style="text-decoration: line-through;">'; break;
			case 3: echo '<span style="color: orange;">'; break;
			}

			echo status_replacer($rows['status']),'</span>';
			?>
		</td>
		<td style="width: 200px" class="leftcd_table" style="text-align: center">
			<?php
			$section	= mysql_fetch_array(mysql_query("SELECT `id`,`title` FROM `section` WHERE `id`='".$rows['section_id']."'"));
			?>
			<a href="sections.php?step=edit&id=<?= $section['id']; ?>&to=tickets.php?step=control[and]page=<?= $_GET['page'] ?>[and]do=<?= $_GET['do']; ?>"><?= $section['title']; ?></a>
		</td>
		<td style="width: 60px" class="rightcd_table" style="text-align: center">
			<a href="tickets.php?step=read&id=<?= $rows['id'] ?>&to=tickets.php?step=control[and]page=<?= $_GET['page'] ?>[and]do=<?= $_GET['do']; ?>">قراءة</a>
		</td>
		<td style="width: 60px" class="rightcd_table" style="text-align: center">
		<input type="checkbox" name="id[]" value="<?= $rows['id']; ?>" /> 
		</td>
	</tr>
	<? } ?>
</table>
		