function begin_page() { reportico_report::begin_page(); $this->debug("HTML Begin Page\n"); // Page Headers reportico_report::page_headers(); $title = $this->query->derive_attribute("ReportTitle", "Unknown"); if ($this->query->output_template_parameters["show_hide_report_output_title"] != "hide") { $this->text .= '<H1 class="swRepTitle">' . sw_translate($title) . '</H1>'; } $forward = session_request_item('forward_url_get_parameters', ''); if ($forward) { $forward .= "&"; } if (!get_request_item("printable_html")) { if (!$this->query->access_mode || $this->query->access_mode != "REPORTOUTPUT") { $this->text .= '<div class="swRepBackBox"><a class="swLinkMenu" href="' . $this->query->get_action_url() . '?' . $forward . 'execute_mode=PREPARE&reportico_session_name=' . reportico_session_name() . '" title="' . template_xlate("GO_BACK") . '"> </a></div>'; } if (get_reportico_session_param("show_refresh_button")) { $this->text .= '<div class="swRepRefreshBox"><a class="swLinkMenu" href="' . $this->query->get_action_url() . '?' . $forward . 'refreshReport=1&execute_mode=EXECUTE&reportico_session_name=' . reportico_session_name() . '" title="' . template_xlate("GO_REFRESH") . '"> </a></div>'; } } else { $this->text .= '<div class="swRepPrintBox"><a class="swLinkMenu" href="' . $this->query->get_action_url() . '?' . $forward . 'printReport=1&execute_mode=EXECUTE&reportico_session_name=' . reportico_session_name() . '" title="' . template_xlate("GO_PRINT") . '">' . ' ' . '</a></div>'; } }
function setup_report_attributes() { $title = $this->query->derive_attribute("ReportTitle", "Unknown"); $this->jar["title"] .= sw_translate($title); if ($this->query->output_template_parameters["show_hide_report_output_title"] == "hide") { $this->jar["attributes"]["hide_title"] = true; } $forward = session_request_item('forward_url_get_parameters', ''); if ($forward) { $forward .= "&"; } // In printable rjson mode dont show back box if (!get_request_item("printable_rjson")) { // Show Go Back Button ( if user is not in "SINGLE REPORT RUN " ) if (!$this->query->access_mode || $this->query->access_mode != "REPORTOUTPUT") { $this->jar["attributes"]["show_prepare_button"] .= $this->query->get_action_url() . '?' . $forward . 'execute_mode=PREPARE&reportico_session_name=' . reportico_session_name(); } if (get_reportico_session_param("show_refresh_button")) { $this->jar["attributes"]["show_refresh_button"] .= $this->query->get_action_url() . '?' . $forward . 'refreshReport=1&execute_mode=EXECUTE&reportico_session_name=' . reportico_session_name(); } } else { $this->jar["attributes"]["show_print_button"] .= $this->query->get_action_url() . '?' . $forward . 'printReport=1&execute_mode=EXECUTE&reportico_session_name=' . reportico_session_name(); } $this->jar["attributes"]["column_header_styles"] = $this->query->output_header_styles; $this->jar["attributes"]["column_page_styles"] = $this->query->output_page_styles; $this->jar["attributes"]["page_style"] = session_request_item("target_style", "TABLE"); $this->setup_columns(); }
function generate_url_params($target_format, $session_placeholder = false) { $this->apply_defaults(); $result = ""; $url = ""; $url .= "title=" . $this->convert_special_chars($this->title_actual); $url .= "&xtitle=" . $this->convert_special_chars($this->xtitle_actual); $url .= "&ytitle=" . $this->convert_special_chars($this->ytitle_actual); if ($target_format == "PDF") { $url .= "&width=" . $this->width_pdf_actual; $url .= "&height=" . $this->height_pdf_actual; } else { $url .= "&width=" . $this->width_actual; $url .= "&height=" . $this->height_actual; } $url .= "&graphcolor=" . $this->graphcolor_actual; $url .= "&gridposition=" . $this->gridpos_actual; $url .= "&xgriddisplay=" . $this->xgriddisplay_actual; $url .= "&xgridcolor=" . $this->xgridcolor_actual; $url .= "&ygriddisplay=" . $this->ygriddisplay_actual; $url .= "&ygridcolor=" . $this->ygridcolor_actual; $url .= "&titlefont=" . $this->titlefont_actual; $url .= "&titlefontstyle=" . $this->titlefontstyle_actual; $url .= "&titlefontsize=" . $this->titlefontsize_actual; $url .= "&titlecolor=" . $this->titlecolor_actual; $url .= "&xaxiscolor=" . $this->xaxiscolor_actual; $url .= "&xaxisfont=" . $this->xaxisfont_actual; $url .= "&xaxisfontstyle=" . $this->xaxisfontstyle_actual; $url .= "&xaxisfontsize=" . $this->xaxisfontsize_actual; $url .= "&xaxisfontcolor=" . $this->xaxisfontcolor_actual; $url .= "&yaxiscolor=" . $this->yaxiscolor_actual; $url .= "&yaxisfont=" . $this->yaxisfont_actual; $url .= "&yaxisfontstyle=" . $this->yaxisfontstyle_actual; $url .= "&yaxisfontsize=" . $this->yaxisfontsize_actual; $url .= "&yaxisfontcolor=" . $this->yaxisfontcolor_actual; $url .= "&xtitlefont=" . $this->xtitlefont_actual; $url .= "&xtitlefontstyle=" . $this->xtitlefontstyle_actual; $url .= "&xtitlefontsize=" . $this->xtitlefontsize_actual; $url .= "&xtitlecolor=" . $this->xtitlecolor_actual; $url .= "&xtickint=" . $this->xtickinterval_actual; $url .= "&xticklabint=" . $this->xticklabelinterval_actual; $url .= "&ytitlefont=" . $this->ytitlefont_actual; $url .= "&ytitlefontstyle=" . $this->ytitlefontstyle_actual; $url .= "&ytitlefontsize=" . $this->ytitlefontsize_actual; $url .= "&ytitlecolor=" . $this->ytitlecolor_actual; $url .= "&ytickint=" . $this->ytickinterval_actual; $url .= "&yticklabint=" . $this->yticklabelinterval_actual; $url .= "&margincolor=" . $this->margincolor_actual; $url .= "&marginleft=" . $this->marginleft_actual; $url .= "&marginright=" . $this->marginright_actual; $url .= "&margintop=" . $this->margintop_actual; $url .= "&marginbottom=" . $this->marginbottom_actual; $url .= "&xlabels=" . implode(",", $this->xlabels); foreach ($this->plot as $k => $v) { $str = implode(",", $v["data"]); $url .= "&plotname{$k}=" . $v["name"]; $url .= "&plotdata{$k}={$str}"; $url .= "&plottype{$k}=" . $v["type"]; $url .= "&plotlinecolor{$k}=" . $v["linecolor"]; if ($v["legend"]) { $url .= "&plotlegend{$k}=" . $v["legend"]; } if ($v["fillcolor"]) { $url .= "&plotfillcolor{$k}=" . $v["fillcolor"]; } } if ($session_placeholder) { $ses = "graph_" . $session_placeholder; set_reportico_session_param($ses, $url); $url = "graphid=" . $ses . "&time=" . time(); } // Select the appropriate reporting engine $dyngraph = "dyngraph.php"; if (defined("SW_GRAPH_ENGINE") && SW_GRAPH_ENGINE == "PCHART") { $dyngraph = "dyngraph_pchart.php"; } $dr = get_reportico_url_path(); $dyngraph = $dr . "/" . find_best_url_in_include_path($dyngraph); if ($this->reportico->framework_parent) { $dyngraph = ""; if ($this->reportico->reportico_ajax_mode == "2") { $dyngraph = preg_replace("/ajax/", "graph", $this->reportico->reportico_ajax_script_url); } } $forward_url_params = session_request_item('forward_url_get_parameters_graph'); if (!$forward_url_params) { $forward_url_params = session_request_item('forward_url_get_parameters', $this->reportico->forward_url_get_parameters); } if ($forward_url_params) { $url .= "&" . $forward_url_params; } $url .= "&reportico_call_mode=graph_pchart"; $url .= "&reportico_session_name=" . reportico_session_name(); $result = '<img class="swRepGraph" src=\'' . $dyngraph . '?' . $url . '\'>'; return $result; }
function imagequery($imagesql, $width=200) { $conn =& $this->datasource; //$imagesql = str_replace($imagesql, '"', "'"); $imagesql = preg_replace("/'/", "\"", $imagesql); //$params="driver=".$conn->driver."&dbname=".$conn->database."&hostname=".$conn->host_name; $params="dummy=xxx"; // Link to db image depaends on the framework used. For straight reportico, its a call to the imageget.php // file, for Joomla it must go through the Joomla index file $imagegetpath = dirname($this->url_path_to_reportico_runner)."/".find_best_url_in_include_path( "imageget.php" ); if ( $this->framework_parent ) { $imagegetpath = ""; if ( $this->reportico_ajax_mode == "2" ) $imagegetpath = preg_replace("/ajax/", "dbimage", $this->reportico_ajax_script_url); } $forward_url_params = session_request_item('forward_url_get_parameters_dbimage' ); if ( !$forward_url_params ) $forward_url_params = session_request_item('forward_url_get_parameters', $this->forward_url_get_parameters); if ( $forward_url_params ) $params .= "&".$forward_url_params; $params .= "&reportico_session_name=".reportico_session_name(); $result = '<img width="'.$width.'" src=\''.$imagegetpath.'?'.$params.'&reportico_call_mode=dbimage&imagesql='.$imagesql.'\'>'; return $result; }
function pre_draw_smarty() { $text = ""; switch ($this->panel_type) { case "LOGIN": $this->smarty->assign('SHOW_LOGIN', true); break; case "LOGOUT": if (!SW_DB_CONNECT_FROM_CONFIG) { $this->smarty->assign('SHOW_LOGOUT', true); } break; case "MAINTAIN": $text .= $this->query->xmlin->xml2html($this->query->xmlin->data); break; case "BODY": $this->smarty->assign('EMBEDDED_REPORT', $this->query->embedded_report); break; case "MAIN": break; case "TITLE": $reporttitle = sw_translate($this->query->derive_attribute("ReportTitle", "Set Report Title")); // For Admin options title should be translatable // Also for configureproject.xml global $g_project; if ($this->query->xmlinput == "configureproject.xml" || $g_project == "admin") { $this->smarty->assign('TITLE', template_xlate($reporttitle)); } else { $this->smarty->assign('TITLE', $reporttitle); } $submit_self = $this->query->get_action_url(); $forward = session_request_item('forward_url_get_parameters', ''); if ($forward) { $submit_self .= "?" . $forward; } $this->smarty->assign('SCRIPT_SELF', $submit_self); break; case "CRITERIA": $this->smarty->assign('SHOW_CRITERIA', true); break; case "CRITERIA_FORM": $dispcrit = array(); $ct = 0; // Build Select Column List $this->query->expand_col = false; foreach ($this->query->lookup_queries as $k => $col) { if ($col->criteria_type) { if (array_key_exists("EXPAND_" . $col->query_name, $_REQUEST)) { $this->query->expand_col =& $this->query->lookup_queries[$col->query_name]; } if (array_key_exists("EXPANDCLEAR_" . $col->query_name, $_REQUEST)) { $this->query->expand_col =& $this->query->lookup_queries[$col->query_name]; } if (array_key_exists("EXPANDSELECTALL_" . $col->query_name, $_REQUEST)) { $this->query->expand_col =& $this->query->lookup_queries[$col->query_name]; } if (array_key_exists("EXPANDSEARCH_" . $col->query_name, $_REQUEST)) { $this->query->expand_col =& $this->query->lookup_queries[$col->query_name]; } $crititle = ""; if ($tooltip = $col->derive_attribute("tooltip", false)) { $title = $col->derive_attribute("column_title", $col->query_name); $crittitle = '<a HREF="" onMouseOver="return overlib(\'' . $tooltip . '\',STICKY,CAPTION,\'' . $title . '\',DELAY,400);" onMouseOut="nd();" onclick="return false;">' . $title . '</A>'; } else { $crittitle = $col->derive_attribute("column_title", $col->query_name); } $critsel = $col->format_form_column(); $critexp = false; if ($col->expand_display && $col->expand_display != "NOINPUT") { $critexp = true; } $dispcrit[] = array("name" => $col->query_name, "title" => sw_translate($crittitle), "entry" => $critsel, "expand" => $critexp); } $this->smarty->assign("CRITERIA_ITEMS", $dispcrit); } break; case "CRITERIA_EXPAND": // Expand Cell Table $this->smarty->assign("SHOW_EXPANDED", false); if ($this->query->expand_col) { $this->smarty->assign("SHOW_EXPANDED", true); $this->smarty->assign("EXPANDED_ITEM", $this->query->expand_col->query_name); $this->smarty->assign("EXPANDED_SEARCH_VALUE", false); $title = $this->query->expand_col->derive_attribute("column_title", $this->query->expand_col->query_name); $this->smarty->assign("EXPANDED_TITLE", sw_translate($title)); // Only use then expand value if Search was press $expval = ""; if ($this->query->expand_col->submitted('MANUAL_' . $this->query->expand_col->query_name)) { $tmpval = $_REQUEST['MANUAL_' . $this->query->expand_col->query_name]; if (strlen($tmpval) > 1 && substr($tmpval, 0, 1) == "?") { $expval = substr($tmpval, 1); } } if ($this->query->expand_col->submitted('EXPANDSEARCH_' . $this->query->expand_col->query_name)) { if (array_key_exists("expand_value", $_REQUEST)) { $expval = $_REQUEST["expand_value"]; } } $this->smarty->assign("EXPANDED_SEARCH_VALUE", $expval); $text .= $this->query->expand_col->expand_template(); } else { if (!($desc = sw_translate_report_desc($this->query->xmloutfile))) { $desc = $this->query->derive_attribute("ReportDescription", false); } $this->smarty->debug = true; $this->smarty->assign("REPORT_DESCRIPTION", $desc); } break; case "USERINFO": $this->smarty->assign('DB_LOGGEDON', true); if (!SW_DB_CONNECT_FROM_CONFIG) { $this->smarty->assign('DBUSER', $this->query->datasource->user_name); } else { $this->smarty->assign('DBUSER', false); } break; case "RUNMODE": if ($this->query->execute_mode == "MAINTAIN") { $this->smarty->assign('SHOW_MODE_MAINTAIN_BOX', true); } else { // In demo mode for reporitco web site allow design if ($this->query->allow_maintain == "DEMO") { $this->smarty->assign('SHOW_DESIGN_BUTTON', true); } // Dont allow design option when configuring project if ($this->query->xmlinput != "configureproject.xml" && $this->query->xmlinput != "deleteproject.xml") { $this->smarty->assign('SHOW_DESIGN_BUTTON', true); } if ($this->query->xmlinput == "deleteproject.xml") { $this->smarty->assign('SHOW_ADMIN_BUTTON', true); $this->smarty->assign('SHOW_PROJECT_MENU_BUTTON', false); } else { if ($this->query->xmlinput == "configureproject.xml") { $this->smarty->assign('SHOW_ADMIN_BUTTON', true); } } } $create_report_url = $this->query->create_report_url; $configure_project_url = $this->query->configure_project_url; $forward = session_request_item('forward_url_get_parameters', ''); if ($forward) { $configure_project_url .= "&" . $forward; $create_report_url .= "&" . $forward; } $this->smarty->assign('CONFIGURE_PROJECT_URL', $configure_project_url); $this->smarty->assign('CREATE_REPORT_URL', $create_report_url); break; case "MENUBUTTON": $prepare_url = $this->query->prepare_url; $menu_url = $this->query->menu_url; $forward = session_request_item('forward_url_get_parameters', ''); if ($forward) { $menu_url .= "&" . $forward; $prepare_url .= "&" . $forward; } $this->smarty->assign('MAIN_MENU_URL', $menu_url); $this->smarty->assign('RUN_REPORT_URL', $prepare_url); $admin_menu_url = $this->query->admin_menu_url; $forward = session_request_item('forward_url_get_parameters', ''); if ($forward) { $admin_menu_url .= "&" . $forward; } $this->smarty->assign('ADMIN_MENU_URL', $admin_menu_url); break; case "MENU": break; case "PROJECTITEM": if ($this->text != ".." && $this->text != "admin") { $forward = session_request_item('forward_url_get_parameters', ''); if ($forward) { $forward .= "&"; } $this->query->projectitems[] = array("label" => $this->text, "url" => $this->query->get_action_url() . "?" . $forward . "execute_mode=MENU&project=" . $this->program . "&reportico_session_name=" . reportico_session_name()); } break; case "MENUITEM": $forward = session_request_item('forward_url_get_parameters', ''); if ($forward) { $forward .= "&"; } $this->query->menuitems[] = array("label" => $this->text, "url" => $this->query->get_action_url() . "?" . $forward . "execute_mode=PREPARE&xmlin=" . $this->program . "&reportico_session_name=" . reportico_session_name()); break; case "TOPMENU": $this->smarty->assign('SHOW_TOPMENU', true); break; case "DESTINATION": $this->smarty->assign('SHOW_OUTPUT', true); if (defined("SW_ALLOW_OUTPUT") && !SW_ALLOW_OUTPUT) { $this->smarty->assign('SHOW_OUTPUT', false); } $op = session_request_item("target_format", "HTML"); $output_types = array("HTML" => "", "PDF" => "", "CSV" => "", "XML" => "", "JSON" => "", "GRID" => ""); $output_types[$op] = "checked"; $noutput_types = array(); foreach ($output_types as $val) { $noutput_types[] = $val; } $this->smarty->assign('OUTPUT_TYPES', $noutput_types); $op = session_request_item("target_style", "TABLE"); $output_styles = array("TABLE" => "", "FORM" => ""); $output_styles[$op] = "checked"; $noutput_styles = array(); foreach ($output_styles as $val) { $noutput_styles[] = $val; } $this->smarty->assign('OUTPUT_STYLES', $noutput_styles); $attach = get_request_item("target_attachment", "1", $this->query->first_criteria_selection); if ($attach) { $attach = "checked"; } $this->smarty->assign("OUTPUT_ATTACH", $attach); $this->smarty->assign("OUTPUT_SHOWGRAPH", get_reportico_session_param("target_show_graph") ? "checked" : ""); $this->smarty->assign("OUTPUT_SHOWCRITERIA", get_reportico_session_param("target_show_criteria") ? "checked" : ""); $this->smarty->assign("OUTPUT_SHOWDETAIL", get_reportico_session_param("target_show_detail") ? "checked" : ""); $this->smarty->assign("OUTPUT_SHOWGROUPHEADERS", get_reportico_session_param("target_show_group_headers") ? "checked" : ""); $this->smarty->assign("OUTPUT_SHOWGROUPTRAILERS", get_reportico_session_param("target_show_group_trailers") ? "checked" : ""); $this->smarty->assign("OUTPUT_SHOWCOLHEADERS", get_reportico_session_param("target_show_column_headers") ? "checked" : ""); if ($this->query->allow_debug && SW_ALLOW_DEBUG) { $this->smarty->assign("OUTPUT_SHOW_DEBUG", true); $debug_mode = get_request_item("debug_mode", "0", $this->query->first_criteria_selection); $this->smarty->assign("DEBUG_NONE", ""); $this->smarty->assign("DEBUG_LOW", ""); $this->smarty->assign("DEBUG_MEDIUM", ""); $this->smarty->assign("DEBUG_HIGH", ""); switch ($debug_mode) { case 1: $this->smarty->assign("DEBUG_LOW", "selected"); break; case 2: $this->smarty->assign("DEBUG_MEDIUM", "selected"); break; case 3: $this->smarty->assign("DEBUG_HIGH", "selected"); break; default: $this->smarty->assign("DEBUG_NONE", "selected"); } if ($debug_mode) { $debug_mode = "checked"; } $this->smarty->assign("OUTPUT_DEBUG", $debug_mode); } $checked = ""; $this->smarty->assign("OUTPUT_SHOW_SHOWGRAPH", false); if (count($this->query->graphs) > 0) { $checked = ""; if ($this->query->get_attribute("graphDisplay")) { $checked = "checked"; } if (!get_request_item("target_show_graph") && !$this->query->first_criteria_selection) { $checked = ""; } $this->smarty->assign("OUTPUT_SHOW_SHOWGRAPH", true); $this->smarty->assign("OUTPUT_SHOWDET", $checked); } break; case "STATUS": $msg = ""; if ($this->query->status_message) { $this->smarty->assign('STATUSMSG', $this->query->status_message); } global $g_system_debug; if (!$g_system_debug) { $g_system_debug = array(); } foreach ($g_system_debug as $val) { $msg .= "<hr>" . $val["dbgarea"] . " - " . $val["dbgstr"] . "\n"; } if ($msg) { $msg = "<BR><B>" . template_xlate("INFORMATION") . "</B>" . $msg; } $this->smarty->assign('STATUSMSG', $msg); break; case "ERROR": $msg = ""; global $g_system_errors; $lastval = false; $duptypect = 0; if (!$g_system_errors) { $g_system_errors = array(); } foreach ($g_system_errors as $val) { if ($val["errno"] == E_USER_ERROR || $val["errno"] == E_USER_WARNING) { $msg .= "<HR>"; if ($val["errarea"]) { $msg .= $val["errarea"] . " - "; } if ($val["errtype"]) { $msg .= $val["errtype"] . ": "; } $msg .= $val["errstr"]; $msg .= $val["errsource"]; $msg .= "\n"; } else { // Dont keep repeating Assignment errors $msg .= "<HR>"; //if ( $val["errct"] > 1 ) $msg .= $val["errct"]." occurrences of "; // PPP Change $msg .= $val["errarea"]." - ".$val["errtype"].": ".$val["errstr"]. //" at line ".$val["errline"]." in ".$val["errfile"].$val["errsource"]; //"\n"; if ($val["errarea"]) { $msg .= $val["errarea"] . " - "; } if ($val["errtype"]) { $msg .= $val["errtype"] . ": "; } $msg .= $val["errstr"]; //$msg .= " at line ".$val["errline"]." in ".$val["errfile"].$val["errsource"]; "\n"; $duptypect = 0; } $lastval = $val; } if ($duptypect > 0) { $msg .= "<BR>{$duptypect} more errors like this<BR>"; } if ($msg) { $msg = "<B>" . template_xlate("UNABLE_TO_CONTINUE") . ":</B>" . $msg; } $this->smarty->assign('ERRORMSG', $msg); set_reportico_session_param('latestRequest', ""); break; } return $text; }