diff customReservation.php @ 23:f3bf1be1a51b

Change: using ajax in custom reservation method
author yoneda <yoneda@recorder.localnet.mda.or.jp>
date Thu, 23 Jul 2009 23:35:43 +0900
parents f5a9f0eb4858
children e5f9aa34d06f
line wrap: on
line diff
--- a/customReservation.php	Fri Jul 17 22:40:41 2009 +0900
+++ b/customReservation.php	Thu Jul 23 23:35:43 2009 +0900
@@ -7,16 +7,36 @@
 $program_id = 0;
 if( isset( $_POST['program_id'] ) ) $program_id = $_POST['program_id'];
 
+
+if(!(
+   isset($_POST['shour'])       && 
+   isset($_POST['smin'])        &&
+   isset($_POST['smonth'])      &&
+   isset($_POST['sday'])        &&
+   isset($_POST['syear'])       &&
+   isset($_POST['ehour'])       &&
+   isset($_POST['emin'])        &&
+   isset($_POST['emonth'])      &&
+   isset($_POST['eday'])        &&
+   isset($_POST['eyear'])       &&
+   isset($_POST['channel_id'])  &&
+   isset($_POST['title'])       &&
+   isset($_POST['description']) &&
+   isset($_POST['category_id']) &&
+   isset($_POST['record_mode']))
+) {
+	exit("Error:予約に必要な値がセットされていません");
+}
+
+
 $start_time = @mktime( $_POST['shour'], $_POST['smin'], 0, $_POST['smonth'], $_POST['sday'], $_POST['syear'] );
 if( ($start_time < 0) || ($start_time === false) ) {
-	if( $program_id ) jdialog( "開始時間が不正です" , "reservation.php?program_id=".$program_id );
-	else jdialog("開始時間が不正です" );
+	exit("Error:開始時間が不正です" );
 }
 
 $end_time = @mktime( $_POST['ehour'], $_POST['emin'], 0, $_POST['emonth'], $_POST['eday'], $_POST['eyear'] );
 if( ($end_time < 0) || ($end_time === false) ) {
-	if( $program_id ) jdialog( "終了時間が不正です" , "reservation.php?program_id=".$program_id );
-	else jdialog("終了時間が不正です" );
+	exit("Error:終了時間が不正です" );
 }
 
 $channel_id = $_POST['channel_id'];
@@ -41,10 +61,7 @@
 	);
 }
 catch( Exception $e ) {
-	if( $progarm_id ) jdialog( $e->getMessage(), "reservation.php?program_id=".$program_id );
-	else jdialog( $e->getMessage() );
+	exit( "Error:".$e->getMessage() );
 }
-
-jdialog("予約しました:job番号".$rval);
-
+exit( "".$program_id );
 ?>
\ No newline at end of file