<?php
/**
 * Smart Report Maker
 * Version 9.0.0
 * Author : Webuccino
 * All copyrights are preserved to Webuccino
 * URL : http://mysqlreports.com/
 */
/*
 * #################################################################################################
 *  Mofify session after changes due to moving back and forth using the menu 
 * ################################################################################################
 */
require_once("../request.php");
defined ( 'DIRECTACESS' ) or die ( "Error 301: Access denied!" );

function unsetAllSession()
{
	global $_SESSION;
	$_SESSION[Session_wizard_key]["page_key"] = "step_2";
	$_SESSION[Session_wizard_key]["active_pages"] = array("step_2");
	//--------------------------------
	unset(
		$_SESSION[Session_report_Settings_key]["host"],
		$_SESSION[Session_report_Settings_key]["user"],
		$_SESSION[Session_report_Settings_key]["pass"],
		$_SESSION[Session_wizard_key]["validate_key"],
		$_SESSION[Session_report_Settings_key]["db"],
		$_SESSION[Session_report_Settings_key]["datasource"],
		//--------------------------------------
		$_SESSION[Session_report_Settings_key]["sql"],
		//--------------------------------------
		$_SESSION[Session_report_Settings_key]["table"],
		$_SESSION[Session_report_Settings_key]["tables_filters"],
		$_SESSION[Session_report_Settings_key]["relationships"],
		//-----------------------------------
		$_SESSION[Session_report_Settings_key]["fields"],
		$_SESSION[Session_report_Settings_key]["fields2"],
		$_SESSION[Session_report_Settings_key]["labels"],
		$_SESSION[Session_report_Settings_key]["function"],
		$_SESSION[Session_report_Settings_key]["affected_column"],
		$_SESSION[Session_report_Settings_key]["groupby_column"],
		//---------------------------------------
		$_SESSION[Session_report_Settings_key]["group_by"],
		$_SESSION[Session_report_Settings_key]["sort_by"],
                     $_SESSION[Session_report_Settings_key]["sub_totals"],
                      $_SESSION[Session_report_Settings_key]["cells"],
		//----------------------------------
		
		$_SESSION[Session_report_Settings_key]["file_name"]

	
		

	);
}

function unsetSessionStartFromDB()
{
	global $_SESSION;
	$_SESSION[Session_wizard_key]["page_key"] = "step_2";
	$_SESSION[Session_wizard_key]["active_pages"] = array("step_2");
	unset(
		$_SESSION[Session_report_Settings_key]["db"],
		$_SESSION[Session_report_Settings_key]["datasource"],
		//--------------------------------------
		$_SESSION[Session_report_Settings_key]["sql"],
		//--------------------------------------
		$_SESSION[Session_report_Settings_key]["table"],
		$_SESSION[Session_report_Settings_key]["tables_filters"],
		$_SESSION[Session_report_Settings_key]["relationships"],
		//-----------------------------------
		$_SESSION[Session_report_Settings_key]["fields"],
		$_SESSION[Session_report_Settings_key]["fields2"],
		$_SESSION[Session_report_Settings_key]["labels"],
		$_SESSION[Session_report_Settings_key]["function"],
		$_SESSION[Session_report_Settings_key]["affected_column"],
		$_SESSION[Session_report_Settings_key]["groupby_column"],
		//---------------------------------------
		$_SESSION[Session_report_Settings_key]["group_by"],
		$_SESSION[Session_report_Settings_key]["sort_by"],
		//----------------------------------
                    $_SESSION[Session_report_Settings_key]["sub_totals"],
                      $_SESSION[Session_report_Settings_key]["cells"]
		

	);
}

function unsetSessionStartFromDataSource()
{
	global $_SESSION;
	$_SESSION[Session_wizard_key]["page_key"] = "data_source";
	$_SESSION[Session_wizard_key]["active_pages"] = array("data_source");
	unset(
		$_SESSION[Session_report_Settings_key]["sql"],
		//--------------------------------------
		$_SESSION[Session_report_Settings_key]["table"],
		$_SESSION[Session_report_Settings_key]["tables_filters"],
		$_SESSION[Session_report_Settings_key]["relationships"],
		//-----------------------------------
		$_SESSION[Session_report_Settings_key]["fields"],
		$_SESSION[Session_report_Settings_key]["fields2"],
		$_SESSION[Session_report_Settings_key]["labels"],
		$_SESSION[Session_report_Settings_key]["function"],
		$_SESSION[Session_report_Settings_key]["affected_column"],
		$_SESSION[Session_report_Settings_key]["groupby_column"],
		//---------------------------------------
		$_SESSION[Session_report_Settings_key]["group_by"],
		$_SESSION[Session_report_Settings_key]["sort_by"],
                       $_SESSION[Session_report_Settings_key]["sub_totals"],
                      $_SESSION[Session_report_Settings_key]["cells"]
	
		

	);
}

function unsetSessionStartFromColumns()
{
	global $_SESSION;
	$_SESSION[Session_wizard_key]["page_key"] = "step_4";
	$_SESSION[Session_wizard_key]["active_pages"] = array("step_4");
	unset(
		$_SESSION[Session_report_Settings_key]["fields"],
		$_SESSION[Session_report_Settings_key]["fields2"],
		$_SESSION[Session_report_Settings_key]["labels"],
		$_SESSION[Session_report_Settings_key]["function"],
		$_SESSION[Session_report_Settings_key]["affected_column"],
		$_SESSION[Session_report_Settings_key]["groupby_column"],
		//---------------------------------------
		$_SESSION[Session_report_Settings_key]["group_by"],
		$_SESSION[Session_report_Settings_key]["sort_by"],
		//----------------------------------
		  $_SESSION[Session_report_Settings_key]["sub_totals"]
                      

	);
}