These are lines from 3693 which starts execute function..
public function execute($mode = false, $draw = true)
{
$this->initialize();
$sessionClass = ReporticoSession();
if ( method_exists($sessionClass, "switchToRequestedNamespace"))
$this->session_namespace = $sessionClass::switchToRequestedNamespace($this->session_namespace);
if ($this->session_namespace) {
ReporticoApp::set("session_namespace", $this->session_namespace);
}
if (ReporticoApp::get("session_namespace")) {
ReporticoApp::set("session_namespace_key", "reportico_" . ReporticoApp::get("session_namespace"));
}
// If a session namespace doesnt exist create one
if (!$sessionClass::existsReporticoSession() || isset($_REQUEST['clear_session']) || $this->clear_reportico_session) {
$namespace = ReporticoApp::get("session_namespace");
ReporticoApp::set("session_namespace", $namespace);
ReporticoApp::set("session_namespace_key", "reportico_" . ReporticoApp::get("session_namespace"));
$sessionClass::initializeReporticoNamespace(ReporticoApp::get("session_namespace_key"));
}
// Work out the mode (ADMIN, PREPARE, MENU, EXECUTE, MAINTAIN based on all parameters )
if (!$mode) {
$mode = $this->getExecuteMode();
}
$old_error_handler = set_error_handler("Reportico\Engine\ReporticoApp::ErrorHandler");
set_exception_handler("Reportico\Engine\ReporticoApp::ExceptionHandler");
// If new session, we need to use initial project, report etc, otherwise ignore them
$this->handleInitialSettings();
// load plugins
$this->loadPlugins();
// Fetch project config
$this->setProjectEnvironment($this->initial_project, $this->projects_folder, $this->admin_projects_folder);
$this->external_user = $sessionClass::registerSessionParam("external_user", $this->external_user);
$this->external_param1 = $sessionClass::registerSessionParam("external_param1", $this->external_param1);
$this->external_param2 = $sessionClass::registerSessionParam("external_param2", $this->external_param2);
$this->external_param3 = $sessionClass::registerSessionParam("external_param3", $this->external_param3);
$this->theme = $sessionClass::registerSessionParam("theme", $this->theme);
$this->disableThemeCaching = $sessionClass::registerSessionParam("disableThemeCaching", $this->disableThemeCaching);
$this->pdf_engine = $sessionClass::registerSessionParam("pdf_engine", $this->pdf_engine);
$this->pdf_phantomjs_path = $sessionClass::registerSessionParam("pdf_phantomjs_path", $this->pdf_phantomjs_path);
$this->pdf_delivery_mode = $sessionClass::registerSessionParam("pdf_delivery_mode", $this->pdf_delivery_mode);
$this->user_parameters = $sessionClass::registerSessionParam("user_parameters", $this->user_parameters);
$this->dropdown_menu = $sessionClass::registerSessionParam("dropdown_menu", $this->dropdown_menu);
$this->static_menu = $sessionClass::registerSessionParam("static_menu", $this->static_menu);
$this->charting_engine = $sessionClass::registerSessionParam("charting_engine", $this->charting_engine);
$this->charting_engine_html = $sessionClass::registerSessionParam("charting_engine_html", $this->charting_engine_html);
$this->output_template_parameters = $sessionClass::registerSessionParam("output_template_parameters", $this->output_template_parameters);
$this->dynamic_grids = $sessionClass::registerSessionParam("dynamic_grids", $this->dynamic_grids);
$this->dynamic_grids_sortable = $sessionClass::registerSessionParam("dynamic_grids_sortable", $this->dynamic_grids_sortable);
$this->dynamic_grids_searchable = $sessionClass::registerSessionParam("dynamic_grids_searchable", $this->dynamic_grids_searchable);
$this->dynamic_grids_paging = $sessionClass::registerSessionParam("dynamic_grids_paging", $this->dynamic_grids_paging);
$this->dynamic_grids_page_size = $sessionClass::registerSessionParam("dynamic_grids_page_size", $this->dynamic_grids_page_size);
// We are in AJAX mode if it is passed throuh
if (isset($_REQUEST["reportico_ajax_called"])) {
$this->reportico_ajax_called = $_REQUEST["reportico_ajax_called"];
}
//$sessionClass::setReporticoSessionParam("reportico_ajax_called", $_REQUEST["reportico_ajax_called"] );
// Store whether in framework
$sessionClass::setReporticoSessionParam("framework_parent", $this->framework_parent);
// Set access mode to decide whether to allow user to access Design Mode, Menus, Criteria or just run a single report
$this->access_mode = $sessionClass::sessionItem("access_mode", $this->access_mode);
if ($this->access_mode == "DEMO") {
$this->allow_maintain = "DEMO";
}
// Convert input and out charsets into their PHP versions
// for later iconv use
$this->db_charset = ReporticoLocale::dbCharsetToPhpCharset(ReporticoApp::getConfig("db_encoding", "UTF8"));
$this->output_charset = ReporticoLocale::outputCharsetToPhpCharset(ReporticoApp::getConfig("output_encoding", "UTF8"));
ReporticoApp::set("debug_mode", ReporticoUtility::getRequestItem("debug_mode", "0", $this->first_criteria_selection));
if (!$mode) {
$mode = $this->getExecuteMode();
}
// If the project is the ADMIN project then the Main Menu will be the Admin Page
if (ReporticoApp::getConfig("project") == "admin" && $mode == "MENU" ) {
$mode = "ADMIN";
}
// If this is PREPARE mode then we want to identify whether user has entered prepare
// screen for first time so we know whether to set defaults or not
switch ($mode) {
case "PREPARE":
$this->reportProgress("Ready", "READY");
$this->first_criteria_selection = true;
// Must find ALternative to THIs for first time in testing!!!
if (array_key_exists("target_format", $_REQUEST)) {
$this->first_criteria_selection = false;
$sessionClass::setReporticoSessionParam("firstTimeIn", false);
}
if (!$sessionClass::issetReporticoSessionParam("firstTimeIn")) {
$sessionClass::setReporticoSessionParam("firstTimeIn", true);
}
// Default output to HTML in PREPARE mode first time in
if ($sessionClass::getReporticoSessionParam("firstTimeIn") && !isset($_REQUEST["target_format"])) {
$this->target_format = "HTML";
$sessionClass::setReporticoSessionParam("target_format", "HTML");
}
// Default style to TABLE in PREPARE mode first time in
//if ( $sessionClass::getReporticoSessionParam("firstTimeIn") && !isset($_REQUEST["target_style"]))
//{
//$this->target_format = "TABLE";
//$sessionClass::setReporticoSessionParam("target_style","TABLE");
//echo "set table ";
//}
break;
case "EXECUTE":
// If external page has supplied an initial output format then use it
if ($this->initial_output_format) {
$_REQUEST["target_format"] = $this->initial_output_format;
}
// If printable HTML requested force output type to HTML
if (ReporticoUtility::getRequestItem("printable_html")) {
$_REQUEST["target_format"] = "HTML";
}
// Prompt user for report destination if target not already set - default to HTML if not set
if (!array_key_exists("target_format", $_REQUEST) && $mode == "EXECUTE") {
$_REQUEST["target_format"] = "HTML";
}
$this->target_format = strtoupper($_REQUEST["target_format"]);
if (array_key_exists("submit", $_REQUEST)) {
$this->first_criteria_selection = false;
} else {
$this->first_criteria_selection = true;
}
if ($sessionClass::getReporticoSessionParam("awaiting_initial_defaults")) {
$sessionClass::setReporticoSessionParam("firstTimeIn", true);
} else
if ($sessionClass::getReporticoSessionParam("firstTimeIn") && ReporticoUtility::getRequestItem("refreshReport", false)) {
$sessionClass::setReporticoSessionParam("firstTimeIn", true);
} else {
$sessionClass::setReporticoSessionParam("firstTimeIn", false);
}
break;
case "MAINTAIN":
$this->reportProgress("Ready", "READY");
$this->first_criteria_selection = true;
$sessionClass::setReporticoSessionParam("firstTimeIn", true);
break;
default:
//$this->report_progress("Ready", "READY" );
$this->first_criteria_selection = true;
$sessionClass::setReporticoSessionParam("firstTimeIn", true);
break;
}
// If xml file is used to generate the reportico_query, either by the xmlin session variable
// or the xmlin request variable then process this before executing
if ($mode == "EXECUTE") {
$_REQUEST['execute_mode'] = "$mode";
// If executing report then stored the REQUEST parameters unless this
// is a refresh of the report in which case we want to keep the ones already there
$runfromcriteriascreen = ReporticoUtility::getRequestItem("user_criteria_entered", false);
$refreshmode = ReporticoUtility::getRequestItem("refreshReport", false);
// HTML2PDF format is called locally and must pick up criteria from prior request
if ( $this->target_format == "HTML2PDF" && $sessionClass::issetReporticoSessionParam('latestRequest') )
{
$_REQUEST = $sessionClass::getReporticoSessionParam('latestRequest');
$_REQUEST["target_format"] = $this->target_format;
$_REQUEST["new_reportico_window"] = 1;
$_REQUEST["reportico_ajax_called"] = false;
$this->embedded_report = false;
}
else if (!ReporticoUtility::getRequestItem("printable_html") &&
($runfromcriteriascreen ||
(!$sessionClass::issetReporticoSessionParam('latestRequest') ||
!ReporticoSession::getReporticoSessionParam('latestRequest'))))
{
$sessionClass::setReporticoSessionParam('latestRequest', $_REQUEST);
} else {
if (!$runfromcriteriascreen && ( $refreshmode || $this->target_format == "HTML2PDF" )) {
$_REQUEST = $sessionClass::getReporticoSessionParam('latestRequest');
$_REQUEST["target_format"] = $this->target_format;
$_REQUEST["reportico_ajax_called"] = false;
}
}
} else {
if ($mode != "MODIFY" && $sessionClass::issetReporticoSessionParam('latestRequest')) {
if ($sessionClass::getReporticoSessionParam('latestRequest')) {
$OLD_REQUEST = $_REQUEST;
// If a new report is being run dont bother trying to restore previous
// run crtieria
if (!ReporticoUtility::getRequestItem("xmlin") && !ReporticoUtility::getRequestItem("partialMaintain", false)) {
$_REQUEST = $sessionClass::getReporticoSessionParam('latestRequest');
}
foreach ($OLD_REQUEST as $k => $v) {
if ($k == 'partial_template') {
$_REQUEST[$k] = $v;
}
if (preg_match("/^EXPAND_/", $k)) {
$_REQUEST[$k] = $v;
}
}
$_REQUEST['execute_mode'] = "$mode";
}
}
$sessionClass::setReporticoSessionParam('latestRequest', "");
}
// Derive URL call of the calling script so it can be recalled in form actions when not running in AJAX mode
if (!$this->url_path_to_calling_script) {
$this->url_path_to_calling_script = $_SERVER["SCRIPT_NAME"];
}
// Work out we are in AJAX mode
$this->deriveAjaxOperation();
switch ($mode) {
case "CRITERIA":
ReporticoLang::loadModeLanguagePack("languages", $this->output_charset);
$this->initializePanels($mode);
$this->handleXmlQueryInput($mode);
$this->setRequestColumns();
if (!isset($_REQUEST['reportico_criteria'])) {
echo "{ Success: false, Message: \"You must specify a criteria\" }";
} else if (!$criteria = $this->getCriteriaByName($_REQUEST['reportico_criteria'])) {
echo "{ Success: false, Message: \"Criteria {$_REQUEST['reportico_criteria']} unknown in this report\" }";
} else {
echo $criteria->executeCriteriaLookup();
echo $criteria->lookup_ajax(false);
}
die;
case "MODIFY":
require_once "DatabaseEngine.php";
$this->initializePanels($mode);
$engine = new DatabaseEngine($this->datasource->ado_connection->_connectionID);
$status = $engine->performProjectModifications(ReporticoApp::getConfig("project"));
if ($status["errstat"] != 0) {
header("HTTP/1.0 404 Not Found", true);
}
echo json_encode($status);
die;
case "ADMIN":
$this->setRequestColumns();
$txt = "";
$this->handleXmlQueryInput($mode);
$this->buildAdminScreen();
$text = $this->panels["BODY"]->drawTemplate();
$this->panels["MAIN"]->template->debugging = false;
$this->panels["MAIN"]->template->assign('LANGUAGES', ReporticoLang::availableLanguages());
$this->panels["MAIN"]->template->assign('CONTENT', $txt);
$this->panels["MAIN"]->template->assign('REPORTICO_DYNAMIC_GRIDS', $this->dynamic_grids);
$this->panels["MAIN"]->template->assign('REPORTICO_DYNAMIC_GRIDS_SORTABLE', $this->dynamic_grids_sortable);
$this->panels["MAIN"]->template->assign('REPORTICO_DYNAMIC_GRIDS_SEARCHABLE', $this->dynamic_grids_searchable);
$this->panels["MAIN"]->template->assign('REPORTICO_DYNAMIC_GRIDS_PAGING', $this->dynamic_grids_paging);
$this->panels["MAIN"]->template->assign('REPORTICO_DYNAMIC_GRIDS_PAGE_SIZE', $this->dynamic_grids_page_size);
restore_error_handler();
// Some calling frameworks require output to be returned
// for rendering inside web pages .. in this case
// return_output_to_caller will be set to true
$template = $this->getTemplatePath('admin.tpl');
if ($this->return_output_to_caller) {
$txt = $this->panels["MAIN"]->template->fetch($template);
$old_error_handler = set_error_handler("Reportico\Engine\ReporticoApp::ErrorHandler");
return $txt;
} else {
$this->panels["MAIN"]->template->display($template);
$old_error_handler = set_error_handler("Reportico\Engine\ReporticoApp::ErrorHandler");
}
break;
case "MENU":
$this->handleXmlQueryInput($mode);
$this->setRequestColumns();
$this->buildMenu();
ReporticoLang::loadModeLanguagePack("languages", $this->output_charset);
ReporticoLang::loadModeLanguagePack("menu", $this->output_charset);
ReporticoLang::localiseTemplateStrings($this->panels["MAIN"]->template);
$text = $this->panels["BODY"]->drawTemplate();
$this->panels["MAIN"]->template->debugging = false;
$this->panels["MAIN"]->template->assign('CONTENT', $text);
$this->panels["MAIN"]->template->assign('LANGUAGES', ReporticoLang::availableLanguages());
$this->panels["MAIN"]->template->assign('REPORTICO_DYNAMIC_GRIDS', $this->dynamic_grids);
$this->panels["MAIN"]->template->assign('REPORTICO_DYNAMIC_GRIDS_SORTABLE', $this->dynamic_grids_sortable);
$this->panels["MAIN"]->template->assign('REPORTICO_DYNAMIC_GRIDS_SEARCHABLE', $this->dynamic_grids_searchable);
$this->panels["MAIN"]->template->assign('REPORTICO_DYNAMIC_GRIDS_PAGING', $this->dynamic_grids_paging);
$this->panels["MAIN"]->template->assign('REPORTICO_DYNAMIC_GRIDS_PAGE_SIZE', $this->dynamic_grids_page_size);
restore_error_handler();
// Some calling frameworks require output to be returned
// for rendering inside web pages .. in this case
// return_output_to_caller will be set to true
$template = $this->getTemplatePath('menu.tpl');
if ($this->return_output_to_caller) {
$txt = $this->panels["MAIN"]->template->fetch($template);
$old_error_handler = set_error_handler("Reportico\Engine\ReporticoApp::ErrorHandler");
return $txt;
} else {
$this->panels["MAIN"]->template->display($template);
$old_error_handler = set_error_handler("Reportico\Engine\ReporticoApp::ErrorHandler");
}
break;
case "PREPARE":
ReporticoLang::loadModeLanguagePack("languages", $this->output_charset);
$this->initializePanels($mode);
$this->handleXmlQueryInput($mode);
$this->setRequestColumns();
if ($this->xmlinput == "deleteproject.xml" || $this->xmlinput == "configureproject.xml" || $this->xmlinput == "createtutorials.xml" || $this->xmlinput == "createproject.xml" || $this->xmlinput == "generate_tutorial.xml") {
// If configuring project then use project language strings from admin project
// found in projects/admin/lang.php
ReporticoLang::loadProjectLanguagePack("admin", $this->output_charset);
$this->panels["MAIN"]->template->assign('SHOW_MINIMAINTAIN', false);
$this->panels["MAIN"]->template->assign('IS_ADMIN_SCREEN', true);
}
ReporticoLang::loadModeLanguagePack("prepare", $this->output_charset);
ReporticoLang::localiseTemplateStrings($this->panels["MAIN"]->template);
$text = $this->panels["BODY"]->drawTemplate();
$this->panels["MAIN"]->template->debugging = false;
$this->panels["MAIN"]->template->assign('CONTENT', $text);
$this->panels["MAIN"]->template->assign('REPORTICO_DYNAMIC_GRIDS', $this->dynamic_grids);
$this->panels["MAIN"]->template->assign('REPORTICO_DYNAMIC_GRIDS_SORTABLE', $this->dynamic_grids_sortable);
$this->panels["MAIN"]->template->assign('REPORTICO_DYNAMIC_GRIDS_SEARCHABLE', $this->dynamic_grids_searchable);
$this->panels["MAIN"]->template->assign('REPORTICO_DYNAMIC_GRIDS_PAGING', $this->dynamic_grids_paging);
$this->panels["MAIN"]->template->assign('REPORTICO_DYNAMIC_GRIDS_PAGE_SIZE', $this->dynamic_grids_page_size);
if ($this->xmlinput == "deleteproject.xml" || $this->xmlinput == "configureproject.xml" || $this->xmlinput == "createtutorials.xml" || $this->xmlinput == "createproject.xml" || $this->xmlinput == "generate_tutorial.xml") {
$reportfile = "";
} else {
$reportfile = preg_replace("/\.xml/", "", $this->xmloutfile);
}
$this->panels["MAIN"]->template->assign('XMLFILE', $reportfile);
$reportname = preg_replace("/.xml/", "", $this->xmloutfile . '_prepare.tpl');
restore_error_handler();
// Some calling frameworks require output to be returned
// for rendering inside web pages .. in this case
// return_output_to_caller will be set to true
$template = $this->getTemplatePath('prepare.tpl');
if ($this->return_output_to_caller) {
$txt = $this->panels["MAIN"]->template->fetch($template);
$old_error_handler = set_error_handler("Reportico\Engine\ReporticoApp::ErrorHandler");
return $txt;
} else {
$this->panels["MAIN"]->template->display($template);
$old_error_handler = set_error_handler("Reportico\Engine\ReporticoApp::ErrorHandler");
}
break;
case "EXECUTE":
ReporticoLang::loadModeLanguagePack("languages", $this->output_charset);
$this->initializePanels($mode);
$this->handleXmlQueryInput($mode);
// Set Grid display options based on report and session defaults
if ($this->attributes["gridDisplay"] != ".DEFAULT") {
$this->dynamic_grids = ($this->attributes["gridDisplay"] == "show");
}
if ($this->attributes["gridSortable"] != ".DEFAULT") {
$this->dynamic_grids_sortable = ($this->attributes["gridSortable"] == "yes");
}
if ($this->attributes["gridSearchable"] != ".DEFAULT") {
$this->dynamic_grids_searchable = ($this->attributes["gridSearchable"] == "yes");
}
if ($this->attributes["gridPageable"] != ".DEFAULT") {
$this->dynamic_grids_paging = ($this->attributes["gridPageable"] == "yes");
}
if ($this->attributes["gridPageSize"] != ".DEFAULT" && $this->attributes["gridPageSize"]) {
$this->dynamic_grids_page_size = $this->attributes["gridPageSize"];
}
$this->panels["MAIN"]->template->assign('REPORTICO_DYNAMIC_GRIDS', $this->dynamic_grids);
$this->panels["MAIN"]->template->assign('REPORTICO_DYNAMIC_GRIDS_SORTABLE', $this->dynamic_grids_sortable);
$this->panels["MAIN"]->template->assign('REPORTICO_DYNAMIC_GRIDS_SEARCHABLE', $this->dynamic_grids_searchable);
$this->panels["MAIN"]->template->assign('REPORTICO_DYNAMIC_GRIDS_PAGING', $this->dynamic_grids_paging);
$this->panels["MAIN"]->template->assign('REPORTICO_DYNAMIC_GRIDS_PAGE_SIZE', $this->dynamic_grids_page_size);
ReporticoApp::set("code_area", "Main Query");
$this->buildQuery(false, "");
ReporticoApp::set("code_area", false);
ReporticoLang::loadModeLanguagePack("execute", $this->output_charset);
ReporticoLang::localiseTemplateStrings($this->panels["MAIN"]->template);
$this->checkCriteriaValidity();
if ($this->xmlinput == "deleteproject.xml" || $this->xmlinput == "configureproject.xml" || $this->xmlinput == "createtutorials.xml" || $this->xmlinput == "createproject.xml") {
// If configuring project then use project language strings from admin project
// found in projects/admin/lang.php
ReporticoLang::loadProjectLanguagePack("admin", $this->output_charset);
}
// For PDF output via phantom report will have already been executed so dont rerun it here
if ( $_REQUEST["target_format"] == "PDF" && $this->pdf_engine == "phantomjs" ) {
$target = &$this->targets[0];
$target->start($this);
} else {
if (!$sessionClass::getReporticoSessionParam("loggedin", false)) {
$text = "you are not logged in ";
} else
if (!$this->return_to_caller) {
$text = $this->executeQuery(false);
}
}
// Situtations where we dont want to switch results page - no data found, debug mode, not logged in
if ((count(ReporticoApp::getSystemErrors()) > 0 || ReporticoApp::get("debug_mode") || count(ReporticoApp::getSystemDebug()) > 0 || !$sessionClass::getReporticoSessionParam("loggedin"))) {
// If errors and this is an ajax request return json ajax response for first message
$runfromcriteriascreen = ReporticoUtility::getRequestItem("user_criteria_entered", false);
//if ( ReporticoApp::get("no_data") && ReporticoUtility::getRequestItem("new_reportico_window", false ) && !ReporticoApp::get("debug_mode") && $this->target_format == "HTML" && $runfromcriteriascreen && $this->reportico_ajax_mode && count(ReporticoApp::getSystemErrors()) == 1 )
//
//{
//header("HTTP/1.0 404 Not Found", true);
//$response_array = array();
//$response_array["errno"] = (ReporticoApp::getSystemErrors())[0]["errno"];
//$response_array["errmsg"] = (ReporticoApp::getSystemErrors())[0]["errstr"];
//echo json_encode($response_array);
//die;
//}
header("HTTP/1.0 500 Not Found", true);
$this->initializePanels("PREPARE");
//$this->setRequestColumns();
$this->panels["FORM"]->setVisibility(false);
$text = $this->panels["BODY"]->drawTemplate();
$this->panels["MAIN"]->template->debugging = false;
$title = ReporticoLang::translate($this->deriveAttribute("ReportTitle", "Unknown"));
$this->panels["MAIN"]->template->assign('TITLE', $title);
$this->panels["MAIN"]->template->assign('CONTENT', $text);
if ($this->xmlinput == "deleteproject.xml" || $this->xmlinput == "configureproject.xml" || $this->xmlinput == "createtutorials.xml" || $this->xmlinput == "createproject.xml" || $this->xmlinput == "generate_tutorial.xml") {
// If configuring project then use project language strings from admin project
// found in projects/admin/lang.php
ReporticoLang::loadProjectLanguagePack("admin", $this->output_charset);
$this->panels["MAIN"]->template->assign('SHOW_MINIMAINTAIN', false);
$this->panels["MAIN"]->template->assign('IS_ADMIN_SCREEN', true);
}
ReporticoLang::loadModeLanguagePack("languages", $this->output_charset, true);
ReporticoLang::loadModeLanguagePack("prepare", $this->output_charset);
ReporticoLang::localiseTemplateStrings($this->panels["MAIN"]->template);
$reportname = preg_replace("/.xml/", "", $this->xmloutfile . '_execute.tpl');
restore_error_handler();
// Some calling frameworks require output to be returned
// for rendering inside web pages .. in this case
// return_output_to_caller will be set to true
$template = $this->getTemplatePath('error.tpl');
if (false && $this->return_output_to_caller) {
$txt = $this->panels["MAIN"]->template->fetch($template);
$old_error_handler = set_error_handler("Reportico\Engine\ReporticoApp::ErrorHandler");
return $txt;
} else {
$this->panels["MAIN"]->template->display($template);
$old_error_handler = set_error_handler("Reportico\Engine\ReporticoApp::ErrorHandler");
}
} else {
if ($this->target_format != "HTML" && $this->target_format != "HTML2PDF") {
if ($draw) {
echo $text;
}
} else {
$title = ReporticoLang::translate($this->deriveAttribute("ReportTitle", "Unknown"));
$pagestyle = $this->targets[0]->getStyleTags($this->output_reportbody_styles);
$this->panels["MAIN"]->template->assign('PAGE_LAYOUT', strtoupper($this->deriveAttribute("PageLayout", "TABLE")));
$this->panels["MAIN"]->template->assign('REPORT_PAGE_STYLE', $pagestyle);
$this->panels["MAIN"]->template->assign('TITLE', $title);
$this->panels["MAIN"]->template->assign('CONTENT', $text);
// Pass Print formatting options to Template
if ( $this->target_format == "HTML2PDF" ) {
$this->panels["MAIN"]->template->assign('PRINT_FORMAT', "reportico-print-pdf");
if ( preg_match("/PDF/i", $this->getAttribute("AutoPaginate") ) )
$this->panels["MAIN"]->template->assign('AUTOPAGINATE', "autopaginate");
else
$this->panels["MAIN"]->template->assign('AUTOPAGINATE', "");
$this->panels["MAIN"]->template->assign('ZOOM_FACTOR', strtolower($this->getAttribute("PdfZoomFactor")));
}
else {
$this->panels["MAIN"]->template->assign('PRINT_FORMAT', "reportico-print-html");
if ( preg_match("/HTML/i", $this->getAttribute("AutoPaginate") ) ) {
$this->panels["MAIN"]->template->assign('AUTOPAGINATE', "autopaginate");
}
else
$this->panels["MAIN"]->template->assign('AUTOPAGINATE', "");
$this->panels["MAIN"]->template->assign('ZOOM_FACTOR', strtolower($this->getAttribute("HtmlZoomFactor")));
}
$this->panels["MAIN"]->template->assign('PAGE_TITLE_DISPLAY', strtolower($this->getAttribute("PageTitleDisplay")));
$this->panels["MAIN"]->template->assign('EMBEDDED_REPORT', $this->embedded_report);
$this->panels["MAIN"]->template->assign('PAGE_SIZE', $this->getAttribute("PageSize"));
$this->panels["MAIN"]->template->assign('PAGE_ORIENTATION', strtolower($this->getAttribute("PageOrientation")));
$this->panels["MAIN"]->template->assign('PAGE_TOP_MARGIN', strtolower($this->getAttribute("TopMargin")));
$this->panels["MAIN"]->template->assign('PAGE_BOTTOM_MARGIN', strtolower($this->getAttribute("BottomMargin")));
$this->panels["MAIN"]->template->assign('PAGE_LEFT_MARGIN', strtolower($this->getAttribute("LeftMargin")));
$this->panels["MAIN"]->template->assign('PAGE_RIGHT_MARGIN', strtolower($this->getAttribute("RightMargin")));
//$this->panels["MAIN"]->template->assign('PAGE_TOP_MARGIN', "100px");
//$this->panels["MAIN"]->template->assign('PAGE_BOTTOM_MARGIN', "50px");
// When printing in separate html window make sure we dont treat report as embedded
if (ReporticoUtility::getRequestItem("new_reportico_window", false)) {
$this->panels["MAIN"]->template->assign('EMBEDDED_REPORT', false);
}
if ($this->email_recipients) {
$recipients = explode(',', $this->email_recipients);
foreach ($recipients as $rec) {
ReporticoLang::loadModeLanguagePack("languages", $this->output_charset, true);
ReporticoLang::loadModeLanguagePack("execute", $this->output_charset);
ReporticoLang::localiseTemplateStrings($this->panels["MAIN"]->template);
$template = $this->getTemplatePath('execute.tpl');
$mailtext = $this->panels["MAIN"]->template->fetch($template, null, null, false);
//$boundary = '-----=' . md5( uniqid ( rand() ) );
//$message = "Content-Type: text/html; name=\"my attachment\"\n";
//$message .= "Content-Transfer-Encoding: base64\n";
//$message .= "Content-Transfer-Encoding: quoted-printable\n";
//$message .= "Content-Disposition: attachment; filename=\"report.html\"\n\n";
$content_encode = chunk_split(base64_encode($mailtext));
$message = $mailtext . "\n";
//$message .= $boundary . "\n";
$headers = "From: \"Report Admin\"<me@here.com>\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Transfer-Encoding: base64\n";
//$headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"";
$headers = "Content-Type: text/html\n";
mail($rec, "$title", $message, $headers);
}
} else {
ReporticoLang::loadModeLanguagePack("languages", $this->output_charset, true);
ReporticoLang::loadModeLanguagePack("execute", $this->output_charset);
ReporticoLang::localiseTemplateStrings($this->panels["MAIN"]->template);
$reportname = preg_replace("/.xml/", "", $this->xmloutfile . '_execute.tpl');
restore_error_handler();
$template = $this->getTemplatePath('execute.tpl');
if ($this->return_output_to_caller) {
$txt = $this->panels["MAIN"]->template->fetch($template);
$old_error_handler = set_error_handler("Reportico\Engine\ReporticoApp::ErrorHandler");
return $txt;
} else {
//$txt = $this->panels["MAIN"]->template->fetch($template);
//file_put_contents("/tmp/fred1", $txt);
$this->panels["MAIN"]->template->display($template);
$old_error_handler = set_error_handler("Reportico\Engine\ReporticoApp::ErrorHandler");
}
}
}
}
break;
case "MAINTAIN":
// Avoid url manipulation by only allowing maintain mode in design or demo mode
$this->handleXmlQueryInput($mode);
if ($this->top_level_query) {
// Allow read-only access to MAINTAIN is an in-criteria screen edit button was called
if ( ReporticoUtility::getRequestItem("partialMaintain", false)) {
if ( $this->login_type != "DESIGN" ) {
$this->access_mode = "DEMO";
}
}
$this->initializePanels($mode);
if (!($this->login_type == "DESIGN" || $this->access_mode == "DEMO")) {
break;
}
ReporticoLang::loadModeLanguagePack("maintain", $this->output_charset);
ReporticoLang::localiseTemplateStrings($this->panels["MAIN"]->template);
$this->xmlin->handleUserEntry();
$sessionClass::setReporticoSessionParam("xmlintext", $this->xmlintext);
$text = $this->panels["BODY"]->drawTemplate();
$this->panels["MAIN"]->template->assign('PARTIALMAINTAIN', ReporticoUtility::getRequestItem("partialMaintain", false));
$this->panels["MAIN"]->template->assign('CONTENT', $text);
$this->panels["MAIN"]->template->assign('REPORTICO_DYNAMIC_GRIDS', $this->dynamic_grids);
$this->panels["MAIN"]->template->assign('REPORTICO_DYNAMIC_GRIDS_SORTABLE', $this->dynamic_grids_sortable);
$this->panels["MAIN"]->template->assign('REPORTICO_DYNAMIC_GRIDS_SEARCHABLE', $this->dynamic_grids_searchable);
$this->panels["MAIN"]->template->assign('REPORTICO_DYNAMIC_GRIDS_PAGING', $this->dynamic_grids_paging);
$this->panels["MAIN"]->template->assign('REPORTICO_DYNAMIC_GRIDS_PAGE_SIZE', $this->dynamic_grids_page_size);
$template = $this->getTemplatePath('maintain.tpl');
$this->panels["MAIN"]->template->display($template);
} else {
$this->premaintainQuery();
}
break;
case "XMLOUT":
$this->handleXmlQueryInput($mode);
$this->xmlout = new XmlWriter($this);
$this->xmlout->prepareXmlData();
if (array_key_exists("xmlout", $_REQUEST)) {
$this->xmlout->writeFile($_REQUEST["xmlout"]);
} else {
$this->xmlout->write();
}
break;
case "XMLSHOW":
$this->handleXmlQueryInput($mode);
$this->xmlout = new XmlWriter($this);
$this->xmlout->prepareXmlData();
$this->xmlout->write();
break;
case "WSDLSHOW":
$this->handleXmlQueryInput($mode);
$this->xmlout = new XmlWriter($this);
$this->xmlout->prepareWsdlData();
break;
case "SOAPSAVE":
$this->handleXmlQueryInput($mode);
$this->xmlout = new XmlWriter($this);
//$this->xmlout->generateWebService($this->xmloutfile);
break;
}
$this->handledInitialSettings();
if ( !$this->keep_session_open )
$sessionClass::closeReporticoSession();
}