File: /var/www/likoholding/old.liko-holding.com.ua/temp/admin/news_archive.php
<?php
include ("blocks/db.php"); /* соединение с базой */
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<head>
<title>Административная панель</title>
<!-- Скрипты и стили -->
<link href="css/clear_style.css" rel="stylesheet" type="text/css">
<link href="css/style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="js/script.js"></script>
<script src="js/jquery-1.2.1.min.js" type="text/javascript"></script> <!-- =-=-=-=-=-= АККОРДИОН =-=-=-=-=-=-=-= -->
<script src="js/menu.js" type="text/javascript"></script> <!-- =-=-=-=-=-= АККОРДИОН =-=-=-=-=-=-=-= -->
<link rel="stylesheet" type="text/css" href="css/accordion.css" /> <!-- =-=-=-=-=-= АККОРДИОН =-=-=-=-=-=-=-= -->
<!--[if lt IE 8]>
<style type="text/css">
li a {display:inline-block;}
li a {display:block;}
</style>
<![endif]-->
<script type="text/javascript" src="js/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="../ckfinder/ckfinder.js"></script>
<script type="text/javascript">
function BrowseServer() {
var finder=new CKFinder();
finder.basePath='../';
finder.selectActionFunction=SetFileField;
finder.popup();
}
function SetFileField(fileUrl) {
document.getElementById('img').value=fileUrl;
}
</script>
</head>
<body>
<div id="all">
<div id="header">
<a href="../index.php"><img src="images/logo.jpg" width="222" height="50" alt="На сайт" /></a>
<h1>Архив новостей</h1>
<h2><i>Административная панель</i></h2>
</div>
<!-- === МЕНЮ === -->
<?php include ("blocks/menu.php") ?>
<div id="content">
<div id="content_left"><!-- Левая часть страницы -->
<!-- =-=-=-=-=-=-=-=-=-=-=-=-=-=-= -->
<ul id="accordion">
<?php
$year_q=mysql_query("SELECT DISTINCT left(date,4) AS year FROM news ORDER BY year DESC");
$year_r=mysql_fetch_array($year_q);
do {
echo $year_r["year"];
$q=mysql_query("SELECT DISTINCT left(date,7) AS month FROM news WHERE left(date,4)='$year_r[year]' ORDER BY month DESC");
$r=mysql_fetch_array($q);
$month_array=array(
'01'=>'январь',
'02'=>'февраль',
'03'=>'март',
'04'=>'апрель',
'05'=>'май',
'06'=>'июнь',
'07'=>'июль',
'08'=>'август',
'09'=>'сентябрь',
'10'=>'октябрь',
'11'=>'ноябрь',
'12'=>'декабрь',
'101'=>'января',
'102'=>'февраля',
'103'=>'марта',
'104'=>'апреля',
'105'=>'мая',
'106'=>'июня',
'107'=>'июля',
'108'=>'августа',
'109'=>'сентября',
'110'=>'октября',
'111'=>'ноября',
'112'=>'декабря',
);
do {
$date=explode("-", $r["month"]);
echo '<li>';
echo '<a href="#">'.$month_array[$date[1]].'</a>';
echo '<ul>';
$date_begin = $r["month"];
$r["month"]++;
$date_end = $r["month"];
$date_begin = $date_begin."-01";
$date_end = $date_end."-01";
$query_news = mysql_query ("SELECT id, date, title FROM news WHERE date>='$date_begin' AND date<'$date_end' ORDER BY id DESC") or die(mysql_error());
$news = mysql_fetch_array ($query_news);
do {
$format_date=explode("-",$news["date"]);
$y=$format_date[0];
$m=$month_array[$format_date[1]+100];
$d=$format_date[2];
printf("
<li style='height: 25px;'>
<div id='archive_news_date'>%s %s %s</div>
<div id='archive_ref'><a href='news_edit.php?id=%s' id='archive_ref'>%s</a></div>
</li>
", $d, $m, $y, $news["id"], $news["title"]);
} while ($news=mysql_fetch_array($query_news));
echo '</ul>';
echo '</li>';
} while ($r=mysql_fetch_array($q));
} while ($year_r=mysql_fetch_array($year_q));
echo '</ul>';
?>
<!-- =-=-=-=-=-=-=-=-=-=-=-=-=-=-= -->
</div><!-- Конец - Левая часть страницы -->
<div id="content_right"><h3 id="left_header">Панель</h3><br><br>
</div>
</div>
</div>
</body>
</html>