<?php
  if(!empty($_POST['Change']))
  {
    $UseHorHist      = $_POST['UseHorHist'];
    $UseVertHist     = $_POST['UseVertHist'];
    $UsePie          = $_POST['UsePie'];
    $UsePiePlot3D    = $_POST['UsePiePlot3D'];
    $UseJpGraph_Bar1 = $_POST['UseJpGraph_Bar1'];
    $UseJpGraph_Bar2 = $_POST['UseJpGraph_Bar2'];
    $Use_ScatterPlot = $_POST['UseScatterPlot'];
    //if(($UseHorHist != 'on') && ($UseVertHist != 'on') && ($UsePiePlot3D != 'on') && ($UseJpGraph_Bar1 != 'on'))
    //  $Errors[] = 'Выберите, пожалуйста, хотя бы одну форму. Для того, чтобы запретить пользователям выбирать форму представления результатов голосования воспользуйтесь <a href=index.php?page=settings>этим интерфейсом</a>.';
    //else {
    	$Str = "<?php\n";
	    $Str .= "\$UseHorHist = '{$UseHorHist}';\n";
	    $Str .= "\$UseVertHist = '{$UseVertHist}';\n";
      $Str .= "\$UsePie = '{$UsePie}';\n";
      $Str .= "\$UsePiePlot3D = '{$UsePiePlot3D}';\n";
	    $Str .= "\$UseJpGraph_Bar1 = '{$UseJpGraph_Bar1}';\n";
      $Str .= "\$UseJpGraph_Bar2 = '{$UseJpGraph_Bar2}';\n";
      $Str .= "\$UseScatterPlot = '{$UseScatterPlot}';\n";
      $Str .= "?>";
      SaveStringInFile($Graph_Access, $Str, 'w');
      Refresh('graphic_access');
    //}
  }
  //заполняем checkbox'ы
  include($Graph_Access);
  if($UseHorHist == 'on')
    $UseHorHistChecked = 'checked';
  if($UseVertHist == 'on')
    $UseVertHistChecked = 'checked';
  if($UsePie == 'on')
    $UsePieChecked = 'checked';
  if($UsePiePlot3D == 'on')
    $UsePiePlot3DChecked = 'checked';
  if($UseJpGraph_Bar1 == 'on')
    $UseJpGraph_Bar1Checked = 'checked';
  if($UseJpGraph_Bar2 == 'on')
    $UseJpGraph_Bar2Checked = 'checked';
  if($UseScatterPlot == 'on')
    $UseScatterPlotChecked = 'checked';
  print "<form action='' method='post'>";
  //ShowErrors($Errors, '80%', 'MiniField');
  print "<fieldset align=center class=MiniField>";

    print "<table border=0 align=center class=OrdTable cellspacing=0 cellpadding=0 width=80%>";
      print "<tr><td colspan=3><b>{$Heading_grph_Access}</b></td></tr>";
    print "</table>";

    print "<table border=0 align=center class=OrdTable cellspacing=0 cellpadding=0 width=80%>";
      print "<tr>";
        print "<td>{$Cpt_grphaccess_verthist}</td>";
        print "<td width=25><input type=checkbox name='UseHorHist' {$UseHorHistChecked}></td>";
        print "<td align=center width=70><a href='../exemples/horhist.gif' target=_blank>{$Cpt_Example}</a></td>";
      print "</tr>";
      print "<tr>";
        print "<td>{$Cpt_grphaccess_horhist}</td>";
        print "<td><input type=checkbox name='UseVertHist' {$UseVertHistChecked}></td>";
        print "<td align=center width=70><a href='../exemples/verthist.gif'target=_blank>{$Cpt_Example}</a></td>";
      print "</tr>";
      print "<tr>";
        print "<td>{$Cpt_grphaccess_pie}</td>";
        print "<td><input type=checkbox name='UsePie' {$UsePieChecked}></td>";
        print "<td align=center width=70><a href='../exemples/pie.jpg' target=_blank>{$Cpt_Example}</a></td>";
      print "</tr>";
      print "<tr>";
        print "<td>{$Cpt_grphaccess_pieplot3d}</td>";
        print "<td><input type=checkbox name='UsePiePlot3D' {$UsePiePlot3DChecked}></td>";
        print "<td align=center width=70><a href='../exemples/pieplot3d.jpg' target=_blank>{$Cpt_Example}</a></td>";
      print "</tr>";
      print "<tr>";
        print "<td>{$Cpt_grphaccess_bar1}</td>";
        print "<td><input type=checkbox name='UseJpGraph_Bar1' {$UseJpGraph_Bar1Checked}></td>";
        print "<td align=center width=70><a href='../exemples/jpgraph_bar1.jpg' target=_blank>{$Cpt_Example}</a></td>";
      print "</tr>";
      print "<tr>";
        print "<td>{$Cpt_grphaccess_bar2}</td>";
        print "<td><input type=checkbox name='UseJpGraph_Bar2' {$UseJpGraph_Bar2Checked}></td>";
        print "<td align=center width=70><a href='../exemples/jpgraph_bar2.jpg' target=_blank>{$Cpt_Example}</a></td>";
      print "</tr>";
      print "<tr>";
        print "<td>{$Cpt_grphaccess_scatterplot}</td>";
        print "<td><input type=checkbox name='UseScatterPlot' {$UseScatterPlotChecked}></td>";
        print "<td align=center width=70><a href='../exemples/scatterplot.jpg' target=_blank>{$Cpt_Example}</a></td>";
      print "</tr>";
      print "<tr>";
        print "<td colspan=3 align=center><input class=Button type = Submit name=Change value = '{$Button_Change}'></td>";
      print "</tr>";
    print "</table>";
  print "</fieldset>";
  print "</form>";
?>