Location: PHPKode > projects > Freeway > freeway_1_5_Alpha/events_booking_details.php
<?php
/*
  $osCommRes, Services Oline 
  http://www.oscommres.com 
  Copyright (c) 2005 osCommRes 
	
	Freeway eCommerce 
	http://www.openfreeway.org
	Copyright (c) 2007 ZacWare

	Released under the GNU General Public License
*/



// Set flag that this is a parent file
	define( '_FEXEC', 1 );
	
  require('includes/application_top.php');
// check date user setting of this survey.

	$survey_result="";
	$events_id=$FREQUEST->postvalue('events_id','int',0);
	$success=false;
	if ($FSESSION->is_registered('customer_id')) {
		$cuID=$FSESSION->customer_id;
	} else if($FREQUEST->cookievalue($sName)!=""){
		$cuID=$FREQUEST->cookievalue($sName);
	} else if($FREQUEST->getvalue($sName)!=""){
		$cuID=tep_db_prepare_input($FREQUEST->getvalue($sName));
	}

	
	if ($cuID!="" && CUSTOMER_BOOKING_DETAILS=="1") {
		$survey_query=tep_db_query("SELECT * from " . TABLE_EVENTS_SURVEYS . " where events_id='" . tep_db_input($events_id) ."' and survey_type='CD' and survey_visibility_flag=1 and survey_expiration_date>=curdate()");
		$survey_result=tep_db_fetch_array($survey_query);
		$sur_cnt=tep_db_num_rows($survey_query);
		if (tep_db_num_rows($survey_query)>0)
		{
			$question_query = tep_db_query("SELECT * from " . TABLE_EVENTS_SURVEYS_QUESTION . " where survey_id='" . (int)$survey_result['survey_id'] . "' order by sort_order asc");
			$qcount=tep_db_num_rows($question_query);
			if (tep_db_num_rows($question_query)>0){  
				$flag_query=tep_db_query("SELECT date_add(survey_flag_date, interval '" . $survey_result['survey_time_period'] . "' month) as check_date,survey_flag_date from " . TABLE_EVENTS_SURVEYS_FLAG . " where survey_id='" . (int)$survey_result['survey_id'] . "' and survey_flag_email='" . tep_db_input($cuID) . "' order by check_date desc");
				if (tep_db_num_rows($flag_query)<=0){
					$success=true;				
				}  else {
					$flag_result=tep_db_fetch_array($flag_query);
					if ($flag_result['check_date']<=date('Y-m-d'))
						$success=true;
				} //flag query
			} // question query
		} //survey query
	}
	if (!$success){
		$no_attendees=$FREQUEST->postvalue('no_attendees','int',1);
		echo '<html><head><title></title></head><body>';
		$process="cart";
		if ($no_attendees>1){
			if ($cart->get_max_attendees()<=0){
				$process="attendees";
			}
		}
		if ($process=="attendees"){
			echo tep_draw_form("checkout_event",tep_href_link(FILENAME_CHECKOUT_ATTENDEES,tep_get_all_get_params()));
		} else {
			echo tep_draw_form("checkout_event",tep_href_link(FILENAME_CHECKOUT_EVENT,tep_get_all_get_params() . "event_action=buy_product&element_type=E"));
		}
		
		reset($FPOST);
		while(list($key,$value)=each($FPOST)){
			if (is_array($value)){
				for ($icnt=0;$icnt<count($value);$icnt++){
					echo tep_draw_hidden_field($key . "[]",$value[$icnt]);	
				}
			} else {
				echo tep_draw_hidden_field($key,$value);
			}
		}
		echo '</form>';
		echo '<script language="javascript">document.checkout_event.submit();</script>';
		echo '</script>';
		echo '</body></html>';
		exit;
	}
	$content = CONTENT_EVENTS_BOOKING_DETAILS;
	
	require(DIR_WS_LANGUAGES . $FSESSION->language . '/' . FILENAME_EVENTS_BOOKING_DETAILS);
	
	require(DIR_WS_TEMPLATES . TEMPLATE_NAME . '/' . TEMPLATENAME_MAIN_PAGE);
	
	require(DIR_WS_INCLUDES . 'application_bottom.php');
?>
Return current item: Freeway