<?php
ob_start();
session_start();
if (($_SESSION['login']) AND ($_SESSION['level'] == 1))
{
include_once'conn.php';
require_once'calendar.php';
$query = "select news_archive.id, news_archive.title, news_archive.date, news_archive.subject, subjects.subject_code, subjects.subject from subjects inner join news_archive on subjects.subject_code=news_archive.subject where flag='0' order by id desc";
$result=mysql_query($query) or die(mysql_error()) ;
if($_GET['act']=="ok")
{
$msg="The Approvement/Priority set.";
}
list($gyear, $gmonth, $gday ) = preg_split ('/-/', date("Y-m-d"));
list( $jyear, $jmonth, $jday ) = gregorian_to_jalali($gyear, $gmonth, $gday);
$jdate = $jyear."/".$jmonth."/".$jday;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head>
<title>Admin Confirmation</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script>
var form='form1' //Give the form name here
function SetChecked(val,array_activate[]) {
dml=document.forms[form];
len = dml.elements.length;
var i=0;
for( i=0 ; i<len ; i++) {
if (dml.elements[i].name=='array_activate[]') {
dml.elements[i].checked=val;
}
}
}
</script>
<link href="styles.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="777" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<?
include_once'header.php';
?>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="140" rowspan="2" valign="top">
<?
include_once'menu.php';
?>
</td>
<td width="300" valign="middle"><img src="images/admin_confirm_title.gif" width="300" height="46" class="titles">
</td>
<td colspan="2" align="right" valign="top">
<table width="250" border="0" align="right" cellpadding="0" cellspacing="0" class="sublinks_Table">
<tr>
<td align="center"><a href="insert.php" class="sublinks"> Data Entry </a></td>
<td align="center"><img src="images/sublinks_delimiter.gif" width="3" height="25"></td>
<td align="center"><a href="confirm.php" class="sublinks">Confirm</a></td>
<td align="center"><img src="images/sublinks_delimiter.gif" width="3" height="25"></td>
<td align="center"><a href="admin_all.php" class="sublinks">Tables View </a></td>
<td align="center"><img src="images/sublinks_delimiter.gif" width="3" height="25"></td>
<td align="center"><a href="logoff.php" class="sublinks">Log off </a></td>
</tr>
</table></td>
</tr>
<tr><td colspan="3">
<P align=center><b><?= $msg ?></b> </P>
<?
if(mysql_num_rows($result)> 0)
{
?>
<FORM action="confirm_del.php" method="POST" name="form1" >
<TABLE border=1 cellpadding="0" cellspacing="0" class="tables" frame="void" >
<TR class="tables_Titles">
<TD colspan="3" class="select_Checkbox">
<nobr>
<a href="<?print($php_self ."?d_sall=ok") ?>" class="select_Checkbox">Select all</a>
<a href="<?print($php_self ."?d_sall=") ?>" class="select_Checkbox">Clear all</a>
</nobr>
</TD>
<TD>
Title
</TD>
<TD>
Subject
</TD>
<TD>
Date
</TD>
<TD>
Priority
</TD>
</TR>
<?php
while(list($id,$title,$date,$archive_subject_code,$subjects_subject_code,$subjects_subject)=mysql_fetch_row($result))
{
$year=substr($date, 0,4);
$month=substr($date, 4,2);
$day=substr($date, 6,2);
$date=$year."/".$month."/".$day;
$bg++;
if($bg%2==0) $bgcolor="#EFECE9" ; else $bgcolor="#E6E0DB" ;
?>
<TR bgcolor="<?=$bgcolor?>">
<TD>
<A href="update.php?id=<?= $id?>">Update</A>
</TD>
<TD>
<A href="admin_view.php?id=<?= $id?>">View</A>
</TD>
<TD>
<INPUT TYPE="CHECKBOX" <? if($_GET['d_sall']=="ok") echo("checked"); else null;?> name="array_id[]" value="<?= $id?>">
</TD>
<TD>
<?= stripslashes(ucfirst($title))?>
</TD>
<TD>
<?= ucfirst($subjects_subject)?>
</TD>
<TD>
<?= $date?>
</TD>
<TD>
<SELECT name="array_priority[<?= $id ?>]">
<?
$selected_priority_query="select id,priority from news_archive where id='$id'" or die(mysql_error());
$selected_priority_result=mysql_query($selected_priority_query) or die(mysql_error()) ;
list($id,$priority)=mysql_fetch_row($selected_priority_result);
?>
<OPTION value="0" <? if($priority==0) echo("selected");?>>select...</OPTION>
<OPTION value="1" <? if($priority==1) echo("selected");?>>first</OPTION>
<OPTION value="2" <? if($priority==2) echo("selected");?>>second</OPTION>
<OPTION value="3" <? if($priority==3) echo("selected");?>>third</OPTION>
<OPTION value="4" <? if($priority==4) echo("selected");?>>fourth</OPTION>
<OPTION value="5" <? if($priority==5) echo("selected");?>>fifth</OPTION>
</SELECT>
</TD>
</TR>
<?
}
?>
</TABLE> <p align=center>
<INPUT name="delete" TYPE="submit" class="buttons" value="Delete">
<INPUT name="activate" TYPE="submit" class="buttons" value="Make Active/Set Priority">
</p>
</FORM>
<?
}
else
{
echo("No records found.<br>");
}
?>
</td></tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<?
}
else
{
header("location:login.php");
}
?>