<?php
require'../config.php';
$align='left';
$title="Календарь";
aut();
head();

 $params = array ('maintabcolumns','weekhorizontalorientation','month1','month2','selectedyear');
 while (list($num,$var) = each($params)) {
  if (!empty($_REQUEST[$var])) $$var = trim(strip_tags($_REQUEST[$var]));
  else $$var = '';
 }
 list($nyear,$nmon,$nday) = explode(".",date('Y.m.d')); 
 if (empty($selectedyear)) $selectedyear=$nyear;
 if (empty($month1)) $month1=1;
 if (empty($month2)) $month2=12;
 if (empty($weekhorizontalorientation)) $weekhorizontalorientation=2;
 if (empty($maintabcolumns)) $maintabcolumns=4;
?>

<div align="center"><form method="post">
<p>Столбцов  в таблице: 
<select size="1" name="maintabcolumns">
<?php for ($i=1;$i<13;$i++) echo '<option value="'.$i.'"'.($maintabcolumns==$i?' selected':'').'>'.$i; ?>
</select>
<p>Положение месяцев:
<input type="radio" name="weekhorizontalorientation" value="2" <?php echo $weekhorizontalorientation=='2'?'checked':''; ?>>Вертикаль
<input type="radio" name="weekhorizontalorientation" value="1" <?php echo $weekhorizontalorientation=='1'?'checked':''; ?>>Горизонталь
<p>Месяц начала: 
<select size="1" name="month1">
<?php for ($i=1;$i<13;$i++) echo '<option value="'.$i.'"'.($month1==$i?' selected':'').'>'.$i; ?>
</select>
<p>Месяц окончания: 
<select size="1" name="month2">
<?php for ($i=1;$i<13;$i++) echo '<option value="'.$i.'"'.($month2==$i?' selected':'').'>'.$i; ?>
</select>
<p>Год: 
<select size="1" name="selectedyear">
<?php for ($i=1917;$i<2999;$i++) echo '<option value="'.$i.'"'.($selectedyear==$i?' selected':'').'>'.$i; ?>
</select>
<input type="submit" name="action" value="Календарь"> 
</form></div>

<?php
 require_once ("calendar.php");
 $cal = new calendar();
 $cal->showform=false;
 if (!empty($maintabcolumns)) foreach ($params as $param) $cal->$param = $$param;
 if ($cal->weekhorizontalorientation==2) $cal->weekhorizontalorientation=0;
 $cal->show();

  echo '<br />';
echo gb.'<a href="'.H.'enter">Прихожая</a>'.div;
foot();
 ?>
