<?php
/*********************************************************************************
 * Gest'Ecole is a school management software developped by
 * DOX Conception Copyright (C) 2012-2013 DOX Conception
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the license published by DOX Conception.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY.  See the Software License for more details.
 * 
 * You should have received a copy of the software license along with
 * this program; if not, see:
 * http://www.doxconception.com/index.php/licence-de-gestecole.html
 ********************************************************************************/

  $id=$_POST['id'];
  $date=$_POST['nouvelle_date'];
  $req=mysql_query("SELECT * FROM `dates_speciales` WHERE date='".Date_Convertir($date,$Format_Date_PHP,'Y-m-d')."' AND (type LIKE '".$gestclasse_config_plus['zone']."' OR type LIKE '".$gestclasse_config_plus['zone']."%' OR type LIKE '%".$gestclasse_config_plus['zone']."' OR type LIKE '%".$gestclasse_config_plus['zone']."%')");
  if (mysql_num_rows($req)=="")
  {
	  if ($id=="")
	  {
		$req=mysql_query("INSERT INTO `dates_speciales` (date,type) VALUES ('".Date_Convertir($date,$Format_Date_PHP,'Y-m-d')."','".$gestclasse_config_plus['zone']."')");
	  }
	  else
	  {
		$req=mysql_query("UPDATE `dates_speciales` SET date='".Date_Convertir($date,$Format_Date_PHP,'Y-m-d')."' WHERE date='".Date_Convertir($id,$Format_Date_PHP,'Y-m-d')."' AND (type LIKE '".$gestclasse_config_plus['zone']."' OR type LIKE '".$gestclasse_config_plus['zone']."%' OR type LIKE '%".$gestclasse_config_plus['zone']."' OR type LIKE '%".$gestclasse_config_plus['zone']."%')");
	  }
  }
?>