Location: PHPKode > projects > Opensheet > opensheet/holydays_conf.php
<?php
#ini_set('display_errors',1);
#error_reporting(E_ALL);
session_start();
require ('functions/base.functions.php');
require ('functions/date_day_chk.php');
require('classes/global.class.php');


	set_lang($_SESSION['lang']);
	$login_type = new Users();
		if ($_SESSION['permissions']['admin'] !== "1"){
		Header("Location: timesheet.php");
					exit();

		}

#Проверяем установки времени

$how_many_days = $_POST['how_many_days'];


#echo $how_many_days;2
$how_many_days++;
if (isset($_POST['timestamp'])) {
	$timestamp = $_POST['timestamp'];
	$month = date("n",$timestamp);
	$year = date("Y",$timestamp);
    } else {
	
	$month = date("n");
	$year = date("Y");
}




for ($d=1; $d < $how_many_days; $d++) 
{
if (isset($_POST[$d]))
	 { 
$day_in = "$year-$month-$d";
#echo $day_in;
#echo "<br>";
add_holyday($day_in,'Y');

	 } else {
$day_in = "$year-$month-$d";	 	
#echo $day_in;
#echo "<br>";
add_holyday($day_in,'N');

	 }


}
?><!-- Headers -->
	
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us">
<head>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="css/jqueryslidemenu.css" />
<link rel="stylesheet" href="js/addons/pager/jquery.tablesorter.pager.css" type="text/css" media="print, projection, screen" />
<link rel="stylesheet" href="css/themes/blue/style.css" type="text/css" media="print, projection, screen" />

<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.7.2.custom.min.js"></script>
<script type="text/javascript" src="js/jqueryslidemenu.js"></script>
<script type="text/javascript" src="js/jquery.tablesorter.js"></script>
<script type="text/javascript" src="js/jquery.tablesorter.pager.js"></script>

<!--[if lte IE 7]>
<style type="text/css">
html .jqueryslidemenu{height: 1%;} /*Holly Hack for IE7 and below*/
</style>
<![endif]-->
<title>Our holidays</title>


</head>
<body>
<?php
include ('include/menu.settings.inc.html');
#echo "<div>";

echo "<p>Мы редактируем $month . $year </p>";















#Шелкаем время назад
echo '<form action="" method="POST" >';
echo '<input type="hidden" name="timestamp" value="'.mktime(01,01,01,$month-1,01,$year).'">';
echo '<input type="submit" value="Prev Month" />';
echo "</form>";
#Шелкаем время вперед
echo '<form action="" method="POST" >';
echo '<input type="hidden" name="timestamp" value="'.mktime(01,01,01,$month+1,01,$year).'">';
echo '<input type="submit" value="Next Month" />';
echo "</form>";
# Рисуем табличку и формочку для редактирования выходных и праздников
echo "<p>Настройка праздников и выходных для месяца</p> ";
$day_in_month = day_in_month($month,$year);
$day_in_month++; #потому что считать будем с 1 дня а не с 0.
echo ' <form Name="holyday_edit" action="" method="POST">';
echo '<TABLE  BORDER=0 BORDERCOLOR="#123456" CELLPADDING=1 CELLSPACING=1>';
echo "        <TR VALIGN=TOP>";
for ($i = 1; $i <  $day_in_month; $i++) {
#echo "        <TR VALIGN=TOP>";
echo '				  <TD align=center valign=middle bgcolor=#EAF5BF WIDTH=220>';
echo                   $i;
echo "                </TD>";


}
echo "</TR>";
echo "<TR VALIGN=TOP>";
for ($i = 1; $i <  $day_in_month; $i++) {
#echo "        <TR VALIGN=TOP>";

	if ( holyday_get("$year-$month-$i") == 'Y' )  {
echo '				  <TD align=center valign=middle bgcolor=456000 WIDTH=220>';
echo '<input name="'.$i.'" type="checkbox" value="Y" checked>';
echo "                </TD>";

}else {
	echo '				  <TD align=center valign=middle bgcolor=#EAF5BF WIDTH=220>';

echo '<input name="'.$i.'" type="checkbox" value="Y">';
echo "                </TD>";
}


}
echo "</TR></TABLE>";

echo '<input type="hidden" name="how_many_days" value="'.day_in_month($month,$year).'" />';
echo '<input type="hidden" name="timestamp" value="'.mktime(01,01,01,$month,01,$year).'">';
echo '<br><center><input type="submit" value="'.gettext('GO').'" /></center>';

echo "</form>";




?>
Return current item: Opensheet