<?php require_once('includes/requirecompere.inc.php'); require_once('includes/requirepost.inc.php'); require_once('includes/message.inc.php'); $lctr_id=TPOST('lctr_id'); $mb_id=TPOST('mb_id'); $st_id=TPOST('st_id'); $action_accept=TPOST('action_accept'); $action_deny=TPOST('action_deny'); $mb_id_owner=current_mb_id(); $timezone_bias_seconds=get_user_time_zone()*60; $DBConn->connect(); $DBConn->begin(true); $reservation=db_load_reservation($DBConn,$lctr_id,$st_id,$mb_id); $lecture=db_load_lecture_by_id($DBConn,$lctr_id); $course=db_load_course_by_id($DBConn,$lecture['cs_id']); if (!$reservation || !$course || $course['mb_id_owner']!=$mb_id_owner) { $DBConn->rollback(); redirect("./"); return; } $compere=db_load_compere($DBConn,$mb_id_owner); if ($action_accept) { if ($course['cs_autoconfirm']=='ALLBUTONE') { $id_participants=db_load_lecture_participant_ids($DBConn,$lctr_id,'UNCONFIRMED'); db_confirm_lecture_reservations($DBConn,$lctr_id); } else { $id_participants=array($mb_id); db_confirm_reservation($DBConn,$lctr_id,$st_id,$mb_id); } $msg_type='RESERVE'; $redirect_target="qx-cmd-course.lecture.detail-lctr_id-".$lctr_id."-op-confirmed"; } else if ($action_deny) { if ($course['cs_autoconfirm']=='ALLBUTONE') { $id_participants=db_load_lecture_participant_ids($DBConn,$lctr_id); db_cancel_lecture($DBConn,$lctr_id,$mb_id_owner); db_delete_lecture_unit_income($DBConn,$lctr_id); } else { $id_participants=array($mb_id); db_confirm_reservation($DBConn,$lctr_id,$st_id,$mb_id); } $msg_type='CANCEL'; $redirect_target="qx-cmd-course.lecture.detail-lctr_id-".$lctr_id."-op-denied"; } $maildataset=array( 'sender.name'=>$compere['cp_name'], 'server.domain'=>$Config->SERVER_DOMAIN, 'ROOT-URL'=>$dataset['ROOT-URL'] ); $mail=prepare_email_from_templates('reservationaccept.email.subject','reservationaccept.email.content',$maildataset); send_message( $DBConn, $msg_type, $mb_id_owner, 'COMPERE', $id_participants, 'MEMBER', $mail['body'], $mail['subject'], array( 'msg_cs_id'=>$msg['msg_cs_id'], 'msg_lctr_id'=>$msg['msg_lctr_id'] ) ); $DBConn->commit(); redirect($redirect_target); ?>