OSDN Git Service

added: filename customize function
[epgrec/epgrec.git] / customReservation.php
1 <?php
2 include_once('config.php');
3 include_once( INSTALL_PATH . "/DBRecord.class.php" );
4 include_once( INSTALL_PATH . "/reclib.php" );
5 include_once( INSTALL_PATH . "/Reservation.class.php" );
6
7 $program_id = 0;
8 if( isset( $_POST['program_id'] ) ) $program_id = $_POST['program_id'];
9
10 $start_time = @mktime( $_POST['shour'], $_POST['smin'], 0, $_POST['smonth'], $_POST['sday'], $_POST['syear'] );
11 if( ($start_time < 0) || ($start_time === false) ) {
12         if( $program_id ) jdialog( "開始時間が不正です" , "reservation.php?program_id=".$program_id );
13         else jdialog("開始時間が不正です" );
14 }
15
16 $end_time = @mktime( $_POST['ehour'], $_POST['emin'], 0, $_POST['emonth'], $_POST['eday'], $_POST['eyear'] );
17 if( ($end_time < 0) || ($end_time === false) ) {
18         if( $program_id ) jdialog( "終了時間が不正です" , "reservation.php?program_id=".$program_id );
19         else jdialog("終了時間が不正です" );
20 }
21
22 $channel_id = $_POST['channel_id'];
23 $title = $_POST['title'];
24 $description = $_POST['description'];
25 $category_id = $_POST['category_id'];
26 $mode = $_POST['record_mode'];
27
28
29 $rval = 0;
30 try{
31         $rval = Reservation::custom(
32                 toDatetime($start_time),
33                 toDatetime($end_time),
34                 $channel_id,
35                 $title,
36                 $description,
37                 $category_id,
38                 $program_id,
39                 0,              // 自動録画
40                 $mode   // 録画モード
41         );
42 }
43 catch( Exception $e ) {
44         if( $progarm_id ) jdialog( $e->getMessage(), "reservation.php?program_id=".$program_id );
45         else jdialog( $e->getMessage() );
46 }
47
48 jdialog("予約しました:job番号".$rval);
49
50 ?>