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 & list_display($in_is_expanding) { $text = ""; if ( $in_is_expanding ) { $tag_pref = "EXPANDED_"; $type = $this->expand_display; } else { $tag_pref = ""; $type = $this->criteria_display; } $value_string = ""; $params = array(); $manual_params = array(); $hidden_params = array(); $expanded_params = array(); if ( !array_key_exists("clearform", $_REQUEST) ) { if ( ! array_key_exists("EXPANDED_".$this->query_name, $_REQUEST) ) if ( array_key_exists($this->query_name, $_REQUEST) ) { $params = $_REQUEST[$this->query_name]; if ( !is_array($params) ) $params = array ( $params ); } $hidden_params = array(); if ( ! array_key_exists("EXPANDED_".$this->query_name, $_REQUEST) ) if ( array_key_exists("HIDDEN_".$this->query_name, $_REQUEST) ) { $hidden_params = $_REQUEST["HIDDEN_".$this->query_name]; if ( !is_array($hidden_params) ) $hidden_params = array ( $hidden_params ); } $manual_params = array(); if ( ! array_key_exists("EXPANDED_".$this->query_name, $_REQUEST) ) if ( array_key_exists("MANUAL_".$this->query_name, $_REQUEST) ) { $manual_params = explode(',',$_REQUEST["MANUAL_".$this->query_name]); if ( $manual_params ) $hidden_params = $manual_params; } // If this is first time into screen and we have defaults then // use these instead if ( !$params && !$hidden_params && get_reportico_session_param("firstTimeIn") ) { $hidden_params = $this->defaults; $manual_params = $this->defaults; } $expanded_params = array(); if ( array_key_exists("EXPANDED_".$this->query_name, $_REQUEST) ) { $expanded_params = $_REQUEST["EXPANDED_".$this->query_name]; if ( !is_array($expanded_params) ) $expanded_params = array ( $expanded_params ); } } else { $hidden_params = $this->defaults; $manual_params = $this->defaults; } switch ( $type ) { case "NOINPUT": case "ANYCHAR": case "TEXTFIELD": $text .= '<SELECT style="display:none" name="'."HIDDEN_".$this->query_name.'[]" size="1" multiple>'; $text .= '<OPTION selected label="ALL" value="(ALL)">ALL</OPTION>'; //break; case "MULTI": $res =& $this->lookup_query->targets[0]->results; $k = key($res); $multisize = 4; if ( $res && count($res[$k]) > 4 ) $multisize = count($res[$k]); if ( isset ( $res[$k] ) ) if ( count($res[$k]) >= 10 ) $multisize = 10; $text .= '<SELECT class="'.$this->lookup_query->getBootstrapStyle('design_dropdown').'swPrpDropSelect" name="'.$tag_pref.$this->query_name.'[]" size="'.$multisize.'" multiple>'; break; case "CHECKBOX": case "RADIO": break; default: $text .= '<SELECT class="'.$this->lookup_query->getBootstrapStyle('design_dropdown').'swPrpDropSelectRegular" name="'.$tag_pref.$this->query_name.'">'; break; } $check_text = ""; switch ( $type ) { case "MULTI": case "DROPDOWN": case "ANYCHAR": case "TEXTFIELD": case "NOINPUT": $check_text = "selected"; break; default: $check_text = "checked"; break; } // If clear has been pressed we dont want any list items selected if ( $this->submitted('EXPANDCLEAR_'.$this->query_name) ) $check_text = ""; // If select all has been pressed we want all highlighted $selectall = false; if ( $this->submitted('EXPANDSELECTALL_'.$this->query_name) ) $selectall = true; $res =& $this->list_values; if ( !$res ) { $res = array(); $k = 0; } else { reset($res); $k = key($res); for ($i = 0; $i < count($res); $i++ ) { $line =&$res[$i]; $lab = $res[$i]["label"]; $ret = $res[$i]["value"]; $checked=""; if ( in_array($ret, $params) ) $checked = $check_text; if ( in_array($ret, $hidden_params) ) $checked = $check_text; if ( in_array($ret, $expanded_params) ) $checked = $check_text; if ( $selectall ) $checked = $check_text; if ( $checked != "" ) if ( !$value_string ) $value_string = $lab; else $value_string .= ",".$lab; switch ( $type ) { case "MULTI": $text .= '<OPTION label="'.$lab.'" value="'.$ret.'" '.$checked.'>'.$lab.'</OPTION>'; break; case "RADIO": $text .= '<INPUT type="radio" name="'.$tag_pref.$this->query_name.'" value="'.$ret.'" '.$checked.'>'.sw_translate($lab).'<BR>'; break; case "CHECKBOX": $text .= '<INPUT type="checkbox" name="'.$tag_pref.$this->query_name.'[]" value="'.$ret.'" '.$checked.'>'.sw_translate($lab).'<BR>'; break; default: $text .= '<OPTION label="'.$lab.'" value="'.$ret.'" '.$checked.'>'.$lab.'</OPTION>'; break; } } } switch ( $type ) { case "MULTI": $text .= '</SELECT>'; break; case "CHECKBOX": case "RADIO": break; default: $text .= '</SELECT>'; break; } if ( !$in_is_expanding ) { if ( array_key_exists("EXPAND_".$this->query_name, $_REQUEST) || array_key_exists("EXPANDCLEAR_".$this->query_name, $_REQUEST) || array_key_exists("EXPANDSELECTALL_".$this->query_name, $_REQUEST) || array_key_exists("EXPANDSEARCH_".$this->query_name, $_REQUEST) || $this->criteria_display == "NOINPUT" ) //if ( $this->criteria_display == "NOINPUT" ) { $tag = $value_string; if ( strlen($tag) > 40 ) $tag = substr($tag, 0, 40)."..."; if ( !$tag ) $tag = "ANY"; $text .= '<br>'.$tag; } else if ( $this->criteria_display == "ANYCHAR" || $this->criteria_display == "TEXTFIELD" ) { $tag = ""; $tag .= '<br><input class="'.$this->lookup_query->getBootstrapStyle('textfield').'swPrpTextField" type="text" name="MANUAL_'.$this->query_name.'"'; $tag .= ' size="50%"'; $tag .= ' value="'.$value_string.'">'; $tag .= '<br>'; $text .= $tag; } else if ( $this->criteria_display == "SQLCOMMAND" ) { $tag = ""; $tag .= '<br><textarea cols="70" rows="20" class="'.$this->lookup_query->getBootstrapStyle('textfield').'swPrpTextField" type="text" name="MANUAL_'.$this->query_name.'">'; $tag .= $value_string; $tag .= "</textarea>"; } } return $text; }
function format_column_trailer(&$trailer_col, &$value_col, $trailer_first = false) { $just = $trailer_col->derive_attribute("justify", false); if ($just && $just != "left") { $this->query->output_group_trailer_styles["text-align"] = $just; } else { $this->query->output_group_trailer_styles["text-align"] = "left"; } if (!get_reportico_session_param("target_show_group_trailers")) { return; } if ($value_col) { $group_label = $value_col->get_attribute("group_trailer_label"); if (!$group_label) { $group_label = $value_col->get_attribute("column_title"); } if (!$group_label) { $group_label = $value_col->query_name; $group_label = str_replace("_", " ", $group_label); $group_label = ucwords(strtolower($group_label)); } $group_label = sw_translate($group_label); $padstring = $value_col->old_column_value; if ($value_col->output_images) { $padstring = $this->format_images($value_col->output_images); } if ($group_label == "BLANK") { $group_label == ""; } if (!isset($this->jar["pages"][$this->page_count]["groups"]["trailers"])) { $this->jar["pages"][$this->page_count]["groups"]["trailers"] = array(); } $hct = count($this->jar["pages"][$this->page_count]["groups"]["trailers"]) - 1; $this->jar["pages"][$this->page_count]["groups"]["trailers"][$trailer_col->query_name][] = array("label" => $group_label, "labelstyle" => $this->query->output_group_trailer_styles, "value" => $value_col->column_value, "valuestyle" => $this->query->output_group_trailer_styles); } //else //$this->jar[""] .= " "; }
function format_column_header(&$column_item) { if (!get_reportico_session_param("target_show_column_headers")) { return; } if (!$this->show_column_header($column_item)) { return; } $k =& $column_item->query_name; $padstring = $column_item->derive_attribute("column_title", $column_item->query_name); $padstring = str_replace("_", " ", $padstring); $padstring = ucwords(strtolower($padstring)); $padstring = sw_translate($padstring); $just = $this->justifys[$column_item->derive_attribute("justify", "left")]; $contenttype = $column_item->derive_attribute("content_type", $column_item->query_name); $tw = $column_item->abs_column_start; $x = $this->document->GetX(); $y = $this->document->GetY(); $this->set_position($tw, $y); $wd = $column_item->abs_column_width; if ($wd - $this->column_spacing > 0) { $wd = $wd - $this->column_spacing; } if (!$wd) { $this->document->Write("{$padstring}"); } else { $this->draw_cell($wd, $this->vsize + 0, $padstring, "PBF", 0, $just, "B"); } }
function format_criteria_selection_set() { $is_criteria = false; foreach ($this->query->lookup_queries as $name => $crit) { $label = ""; $value = ""; if (isset($crit->criteria_summary) && $crit->criteria_summary) { $label = $crit->derive_attribute("column_title", $crit->query_name); $value = $crit->criteria_summary; } else { if (get_request_item($name . "_FROMDATE_DAY", "")) { $label = $crit->derive_attribute("column_title", $crit->query_name); $label = sw_translate($label); $mth = get_request_item($name . "_FROMDATE_MONTH", "") + 1; $value = get_request_item($name . "_FROMDATE_DAY", "") . "/" . $mth . "/" . get_request_item($name . "_FROMDATE_YEAR", ""); if (get_request_item($name . "_TODATE_DAY", "")) { $mth = get_request_item($name . "_TODATE_MONTH", "") + 1; $value .= "-"; $value .= get_request_item($name . "_TODATE_DAY", "") . "/" . $mth . "/" . get_request_item($name . "_TODATE_YEAR", ""); } } else { if (get_request_item("MANUAL_" . $name . "_FROMDATE", "")) { $label = $crit->derive_attribute("column_title", $crit->query_name); $label = sw_translate($label); $value = get_request_item("MANUAL_" . $name . "_FROMDATE", ""); if (get_request_item("MANUAL_" . $name . "_TODATE", "")) { $value .= "-"; $value .= get_request_item("MANUAL_" . $name . "_TODATE"); } } else { if (get_request_item("HIDDEN_" . $name . "_FROMDATE", "")) { $label = $crit->derive_attribute("column_title", $crit->query_name); $label = sw_translate($label); $value = get_request_item("HIDDEN_" . $name . "_FROMDATE", ""); if (get_request_item("HIDDEN_" . $name . "_TODATE", "")) { $value .= "-"; $value .= get_request_item("HIDDEN_" . $name . "_TODATE"); } } else { if (get_request_item("EXPANDED_" . $name, "")) { $label = $crit->derive_attribute("column_title", $crit->query_name); $label = sw_translate($label); $value .= implode(get_request_item("EXPANDED_" . $name, ""), ","); } else { if (get_request_item("MANUAL_" . $name, "")) { $label = $crit->derive_attribute("column_title", $crit->query_name); $label = sw_translate($label); $value .= get_request_item("MANUAL_" . $name, ""); } } } } } } if ($label || $value) { $is_criteria = true; } } if (get_reportico_session_param("target_show_criteria") && $is_criteria) { $this->before_format_criteria_selection(); foreach ($this->query->lookup_queries as $name => $crit) { $label = ""; $value = ""; if (isset($crit->criteria_summary) && $crit->criteria_summary) { $label = $crit->derive_attribute("column_title", $crit->query_name); $value = $crit->criteria_summary; } else { if (get_request_item($name . "_FROMDATE_DAY", "")) { $label = $crit->derive_attribute("column_title", $crit->query_name); $label = sw_translate($label); $mth = get_request_item($name . "_FROMDATE_MONTH", "") + 1; $value = get_request_item($name . "_FROMDATE_DAY", "") . "/" . $mth . "/" . get_request_item($name . "_FROMDATE_YEAR", ""); if (get_request_item($name . "_TODATE_DAY", "")) { $mth = get_request_item($name . "_TODATE_MONTH", "") + 1; $value .= "-"; $value .= get_request_item($name . "_TODATE_DAY", "") . "/" . $mth . "/" . get_request_item($name . "_TODATE_YEAR", ""); } } else { if (get_request_item("MANUAL_" . $name . "_FROMDATE", "")) { $label = $crit->derive_attribute("column_title", $crit->query_name); $label = sw_translate($label); $value = get_request_item("MANUAL_" . $name . "_FROMDATE", ""); if (get_request_item("MANUAL_" . $name . "_TODATE", "")) { $value .= "-"; $value .= get_request_item("MANUAL_" . $name . "_TODATE"); } } else { if (get_request_item("HIDDEN_" . $name . "_FROMDATE", "")) { $label = $crit->derive_attribute("column_title", $crit->query_name); $label = sw_translate($label); $value = get_request_item("HIDDEN_" . $name . "_FROMDATE", ""); if (get_request_item("HIDDEN_" . $name . "_TODATE", "")) { $value .= "-"; $value .= get_request_item("HIDDEN_" . $name . "_TODATE"); } } else { if (get_request_item("EXPANDED_" . $name, "")) { $label = $crit->derive_attribute("column_title", $crit->query_name); $label = sw_translate($label); $value .= implode(get_request_item("EXPANDED_" . $name, ""), ","); } else { if (get_request_item("MANUAL_" . $name, "")) { $label = $crit->derive_attribute("column_title", $crit->query_name); $label = sw_translate($label); $value .= get_request_item("MANUAL_" . $name, ""); } } } } } } if ($label || $value) { $this->format_criteria_selection($label, $value); } } $this->after_format_criteria_selection(); } }
function ErrorHandler($errno, $errstr, $errfile, $errline) { global $g_system_errors; global $g_error_status; global $g_code_area; global $g_code_source; switch ($errno) { case E_ERROR: $errtype = sw_translate("Error"); break; case E_NOTICE: $errtype = sw_translate("Notice"); break; case E_USER_ERROR: $errtype = sw_translate("Error"); break; case E_USER_WARNING: $errtype = sw_translate(""); break; case E_USER_NOTICE: $errtype = sw_translate(""); break; case E_WARNING: $errtype = sw_translate(""); break; default: $errtype = sw_translate("Fatal Error"); } // Avoid adding duplicate errors if (!$g_system_errors) { $g_system_errors = array(); } foreach ($g_system_errors as $k => $val) { if ($val["errstr"] == $errstr) { $g_system_errors[$k]["errct"]++; return; } } $g_system_errors[] = array("errno" => $errno, "errstr" => $errstr, "errfile" => $errfile, "errline" => $errline, "errtype" => $errtype, "errarea" => $g_code_area, "errsource" => $g_code_source, "errct" => 1); //echo "<PRE>"; //var_dump($g_system_errors); //echo "</PRE>"; $g_error_status = 1; }
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; }
function format_column_trailer(&$trailer_col, &$value_col, $trailer_first = false) { if ($value_col) { $group_label = $value_col["GroupTrailerValueColumn"]->get_attribute("group_trailer_label"); if (!$group_label) { $group_label = $value_col["GroupTrailerValueColumn"]->get_attribute("column_title"); } if (!$group_label) { $group_label = $value_col["GroupTrailerValueColumn"]->query_name; $group_label = str_replace("_", " ", $group_label); $group_label = ucwords(strtolower($group_label)); } $group_label = sw_translate($group_label); $padstring = $value_col["GroupTrailerValueColumn"]->old_column_value; echo $group_label . ":" . $padstring; } echo ","; }
function each_line($val) { reportico_report::each_line($val); // Set the values for the fields in the record $this->results["data"][$this->line_ct] = array(); if ($this->line_ct == 0) { $qn = get_query_column("golap", $this->columns); if ($qn) { $arr = explode(",", $qn->column_value); foreach ($arr as $k => $v) { $arr1 = explode("=", $v); $this->results["displaylike"][$arr1[0]] = $arr1[1]; } } } foreach ($this->query->display_order_set["column"] as $col) { $qn = get_query_column($col->query_name, $this->columns); $coltitle = $col->derive_attribute("column_title", $col->query_name); $coltitle = str_replace("_", " ", $coltitle); $coltitle = ucwords(strtolower($coltitle)); $coltitle = sw_translate($coltitle); $disp = $col->derive_attribute("column_display", "show"); if ($disp == "hide") { continue; } $this->results["data"][$this->line_ct][$coltitle] = $qn->column_value; } $this->line_ct++; }
function each_line($val) { reportico_report::each_line($val); //if ( $this->line_ct > 3 ) return; // Set the values for the fields in the record $this->results[] = array("id" => $this->line_ct, "cell" => array()); $this->results[count($this->results) - 1]["cell"][] = "options"; // Excel requires group headers are printed as the first columns in the spreadsheet against // the detail. foreach ($this->query->groups as $name => $group) { if (count($group->headers) > 0) { foreach ($group->headers as $gphk => $col) { $qn = get_query_column($col->query_name, $this->query->columns); $coltitle = $col->derive_attribute("column_title", $col->query_name); $coltitle = str_replace("_", " ", $coltitle); $coltitle = ucwords(strtolower($coltitle)); $coltitle = sw_translate($coltitle); if ($col->query_name == $this->key_column) { $this->results[count($this->results) - 1]["id"][] = $qn->column_value; } $this->results[count($this->results) - 1]["cell"][] = $qn->column_value; if ($this->line_ct == 0) { $this->colmodel[] = array("name" => $col->query_name, "index" => $col->query_name, "editable" => derive_jquerygrid_col_params($this->report_name, $col->query_name, "editable", false), "edittype" => "text", "sorttype" => "text", "jsonmap" => $col->query_name, "width" => derive_jquerygrid_col_params($this->report_name, $col->query_name, "width", "80")); // Map colname to col $this->colmap[$col->query_name] = count($this->colmodel) - 1; if ($v = derive_jquerygrid_col_params($this->report_name, $col->query_name, "edittype", "")) { $this->colmodel[count($this->colmodel) - 1]["edittype"] = $v; } if ($v = derive_jquerygrid_col_params($this->report_name, $col->query_name, "sorttype", "")) { $this->colmodel[count($this->colmodel) - 1]["sorttype"] = $v; } if ($v = derive_jquerygrid_col_params($this->report_name, $col->query_name, "editoptions", "")) { $this->colmodel[count($this->colmodel) - 1]["editoptions"] = $v; } if ($v = derive_jquerygrid_col_params($this->report_name, $col->query_name, "filtertype", "")) { if ($v == "select") { $this->colmodel[count($this->colmodel) - 1]["stype"] = "select"; if (!$this->colmodel[count($this->colmodel) - 1]["editoptions"]) { $this->colmodel[count($this->colmodel) - 1]["editoptions"] = array(); $this->colfilters[$col->query_name] = array(); $this->colmodel[count($this->colmodel) - 1]["editoptions"]["value"] = ":All"; } } } $this->colnames[] = $coltitle; } if ($this->colmodel[$this->colmap[$col->query_name]]["stype"] == "select") { if (!array_key_exists($qn->column_value, $this->colfilters[$col->query_name])) { //$this->colmodel[$this->colmap[$col->query_name]]["editoptions"][$qn->column_value] = $qn->column_value; $this->colfilters[$col->query_name][$qn->column_value] = "1"; $this->colmodel[$this->colmap[$col->query_name]]["editoptions"]["value"] .= ";" . $qn->column_value . ":" . $qn->column_value; } } } } } foreach ($this->query->display_order_set["column"] as $col) { $qn = get_query_column($col->query_name, $this->columns); $coltitle = $col->derive_attribute("column_title", $col->query_name); $coltitle = str_replace("_", " ", $coltitle); $coltitle = ucwords(strtolower($coltitle)); $coltitle = sw_translate($coltitle); if ($col->query_name == $this->key_column) { $this->results[count($this->results) - 1]["id"] = $qn->column_value; } $disp = $col->derive_attribute("column_display", "show"); if ($disp == "hide") { continue; } if ($this->line_ct == 0) { $this->colmodel[] = array("name" => $col->query_name, "index" => $col->query_name, "editable" => derive_jquerygrid_col_params($this->report_name, $col->query_name, "editable", false), "edittype" => "text", "sorttype" => "int", "jsonmap" => $col->query_name, "width" => derive_jquerygrid_col_params($this->report_name, $col->query_name, "width", "80")); // Map colname to col $this->colmap[$col->query_name] = count($this->colmodel) - 1; if ($v = derive_jquerygrid_col_params($this->report_name, $col->query_name, "hidden", "")) { $this->colmodel[count($this->colmodel) - 1]["hidden"] = $v; } if ($v = derive_jquerygrid_col_params($this->report_name, $col->query_name, "edittype", "")) { $this->colmodel[count($this->colmodel) - 1]["edittype"] = $v; } if ($v = derive_jquerygrid_col_params($this->report_name, $col->query_name, "sorttype", "")) { $this->colmodel[count($this->colmodel) - 1]["sorttype"] = $v; } if ($v = derive_jquerygrid_col_params($this->report_name, $col->query_name, "filtertype", "")) { if ($v == "select") { $this->colmodel[count($this->colmodel) - 1]["stype"] = "select"; if (!$this->colmodel[count($this->colmodel) - 1]["editoptions"]) { $this->colmodel[count($this->colmodel) - 1]["editoptions"] = array(); $this->colfilters[$col->query_name] = array(); $this->colmodel[count($this->colmodel) - 1]["editoptions"]["value"] = ":All"; } } } if ($v = derive_jquerygrid_col_params($this->report_name, $col->query_name, "editoptions", "")) { $this->colmodel[count($this->colmodel) - 1]["editoptions"] = $v; } $this->colnames[] = $coltitle; } // Add value to filter options if type is select if ($this->colmodel[$this->colmap[$col->query_name]]["stype"] == "select") { if (!array_key_exists($qn->column_value, $this->colfilters[$col->query_name])) { //$this->colmodel[$this->colmap[$col->query_name]]["editoptions"][$qn->column_value] = $qn->column_value; $this->colfilters[$col->query_name][$qn->column_value] = "1"; $this->colmodel[$this->colmap[$col->query_name]]["editoptions"]["value"] .= ";" . $qn->column_value . ":" . $qn->column_value; } } $this->results[count($this->results) - 1]["cell"][] = $qn->column_value; } // $this->results[] = $cells; $this->line_ct++; }