Ejemplo n.º 1
0
function GetTablesListCustom()
{
    $connection = getWebreportConnection();
    // #9875
    $arr = array();
    $qResult = $connection->query("select * from " . $connection->addTableWrappers("webreport_sql") . " order by " . $connection->addFieldWrappers("sqlname"));
    while ($data = $qResult->fetchAssoc()) {
        $arr[] = array("sqlname" => $data["sqlname"], "isStorProc" => IsStoredProcedure($data["sqlcontent"]));
    }
    return $arr;
}
Ejemplo n.º 2
0
 function Chart(&$ch_array, $param)
 {
     global $field_labels;
     if ($this->webchart) {
         $this->chrt_array = Convert_Old_Chart($ch_array);
     } else {
         $this->chrt_array = $ch_array;
     }
     $this->setConnection();
     $this->pSet = new ProjectSettings($this->chrt_array['tables'][0]);
     $this->showDetails = $param['showDetails'];
     if ($this->showDetails) {
         $this->detailTablesData = $this->pSet->getDetailTablesArr();
     }
     $this->hasFlash = $param["hasFlash"];
     $this->pageId = $param["pageId"];
     $this->chrt_array["appearance"]["autoupdate"] = false;
     $this->numRecordsToShow = $this->chrt_array['appearance']['maxbarscroll'];
     if ($this->numRecordsToShow < 1) {
         $this->numRecordsToShow = 1;
     }
     $this->table_type = $this->chrt_array["table_type"];
     if (!$this->table_type) {
         $this->table_type = "project";
     }
     $this->webchart = $param["webchart"];
     $this->cname = $param["cname"];
     $this->chartPreview = $param["chartPreview"];
     $this->dashChart = $param["dashChart"];
     $this->sessionPrefix = $this->chrt_array['tables'][0];
     if ($this->dashChart) {
         $this->dashTName = $param["dashTName"];
         $this->dashElementName = $param["dashElementName"];
         $this->sessionPrefix = $this->dashTName . "_" . $this->sessionPrefix;
     }
     $this->gstrOrderBy = $param["gstrOrderBy"];
     $TableName = GoodFieldName($this->chrt_array['tables'][0]);
     // #10461, $this->setConnection(); needs to be called after value is assigned to $this->webchart
     $this->setConnection();
     if ($this->isProjectDB()) {
         $this->cipherer = new RunnerCipherer($this->chrt_array['tables'][0]);
     }
     $this->header = $this->chrt_array['appearance']['head'];
     $this->footer = $this->chrt_array['appearance']['foot'];
     $this->y_axis_label = $this->chrt_array['appearance']['y_axis_label'];
     for ($i = 0; $i < count($this->chrt_array['parameters']) - 1; $i++) {
         if (isset($this->chrt_array['parameters'][$i]['currencyFormat'])) {
             $this->arrFormatCurrency[] = $this->chrt_array['parameters'][$i]['currencyFormat'];
         } else {
             if ($this->chrt_array['appearance']['scur'] == "false") {
                 $this->arrFormatCurrency[] = "";
             } else {
                 $this->arrFormatCurrency[] = $this->chrt_array['appearance']['scur'];
             }
         }
         if (isset($this->chrt_array['parameters'][$i]['decimalFormat'])) {
             $this->arrFormatDecimal[] = $this->chrt_array['parameters'][$i]['decimalFormat'];
         } else {
             $this->arrFormatDecimal[] = $this->chrt_array['appearance']['dec'];
         }
         $this->arrFormatCustomer[] = $this->chrt_array['parameters'][$i]['customFormat'];
         $this->arrFormatCustomerStr[] = $this->chrt_array['parameters'][$i]['customFormatStr'];
         if ($this->chrt_array["chart_type"]["type"] == "ohlc" || $this->chrt_array["chart_type"]["type"] == "candlestick") {
             $this->arrOHLC_color[] = "#" . $this->chrt_array['parameters'][$i]['ohlcColor'];
             if ($this->table_type != "db") {
                 $this->arrOHLC_open[] = $this->chrt_array['parameters'][$i]['ohlcOpen'];
                 $this->arrOHLC_high[] = $this->chrt_array['parameters'][$i]['ohlcHigh'];
                 $this->arrOHLC_low[] = $this->chrt_array['parameters'][$i]['ohlcLow'];
                 $this->arrOHLC_close[] = $this->chrt_array['parameters'][$i]['ohlcClose'];
             } else {
                 if ($this->chrt_array['parameters'][$i]['agr_func']) {
                     $this->arrOHLC_open[] = $this->chrt_array['parameters'][$i]['agr_func'] . "_" . $this->chrt_array['parameters'][$i]['table'] . "_" . $this->chrt_array['parameters'][$i]['ohlcOpen'];
                     $this->arrOHLC_high[] = $this->chrt_array['parameters'][$i]['agr_func'] . "_" . $this->chrt_array['parameters'][$i]['table'] . "_" . $this->chrt_array['parameters'][$i]['ohlcHigh'];
                     $this->arrOHLC_low[] = $this->chrt_array['parameters'][$i]['agr_func'] . "_" . $this->chrt_array['parameters'][$i]['table'] . "_" . $this->chrt_array['parameters'][$i]['ohlcLow'];
                     $this->arrOHLC_close[] = $this->chrt_array['parameters'][$i]['agr_func'] . "_" . $this->chrt_array['parameters'][$i]['table'] . "_" . $this->chrt_array['parameters'][$i]['ohlcClose'];
                 } else {
                     $this->arrOHLC_open[] = $this->chrt_array['parameters'][$i]['table'] . "_" . $this->chrt_array['parameters'][$i]['ohlcOpen'];
                     $this->arrOHLC_high[] = $this->chrt_array['parameters'][$i]['table'] . "_" . $this->chrt_array['parameters'][$i]['ohlcHigh'];
                     $this->arrOHLC_low[] = $this->chrt_array['parameters'][$i]['table'] . "_" . $this->chrt_array['parameters'][$i]['ohlcLow'];
                     $this->arrOHLC_close[] = $this->chrt_array['parameters'][$i]['table'] . "_" . $this->chrt_array['parameters'][$i]['ohlcClose'];
                 }
             }
             if ($this->chrt_array["chart_type"]["type"] == "candlestick") {
                 $this->arrOHLC_candle[] = "#" . $this->chrt_array['parameters'][$i]['ohlcCandleColor'];
             }
         } elseif ($this->chrt_array['parameters'][$i]['name'] != "") {
             if ($this->table_type != "db") {
                 $this->arrDataSeries[] = $this->chrt_array['parameters'][$i]['agr_func'] ? $this->chrt_array['parameters'][$i]['label'] : $this->chrt_array['parameters'][$i]['name'];
                 if ($this->chrt_array["chart_type"]["type"] == "bubble") {
                     $this->arrDataSize[] = $this->chrt_array['parameters'][$i]['size'];
                 }
             } else {
                 $this->arrDataSeries[] = $this->chrt_array['parameters'][$i]['agr_func'] ? $this->chrt_array['parameters'][$i]['agr_func'] . "_" . $this->chrt_array['parameters'][$i]['table'] . "_" . $this->chrt_array['parameters'][$i]['name'] : $this->chrt_array['parameters'][$i]['table'] . "_" . $this->chrt_array['parameters'][$i]['name'];
                 if ($this->chrt_array["chart_type"]["type"] == "bubble") {
                     $this->arrDataSize[] = $this->chrt_array['parameters'][$i]['table'] . "_" . $this->chrt_array['parameters'][$i]['size'];
                 }
             }
             if (isset($this->chrt_array['appearance']['scolor' . ($i + 1) . '1'])) {
                 $this->arrDataColor[] = $this->chrt_array['appearance']['scolor' . ($i + 1) . '1'];
             } else {
                 $this->arrDataColor[] = $this->chrt_array['parameters'][$i]['series_color'];
             }
             if ($this->chrt_array["chart_type"]["type"] == "gauge") {
                 for ($k = 0; is_array($this->chrt_array["parameters"][$i]["gaugeColorZone"]) && $k < count($this->chrt_array["parameters"][$i]["gaugeColorZone"]); $k++) {
                     $beginColor = (double) @$this->chrt_array["parameters"][$i]["gaugeColorZone"][$k]["gaugeBeginColor"];
                     $endColor = (double) @$this->chrt_array["parameters"][$i]["gaugeColorZone"][$k]["gaugeEndColor"];
                     $gColor = "#" . @$this->chrt_array["parameters"][$i]["gaugeColorZone"][$k]["gaugeColor"];
                     $this->arrGaugeColor[count($this->arrDataSeries) - 1][] = array($beginColor, $endColor, $gColor);
                 }
             }
         }
         if ($this->table_type == "project" && !$this->webchart) {
             if ($this->chrt_array["chart_type"]["type"] != "candlestick" && $this->chrt_array["chart_type"]["type"] != "ohlc") {
                 $this->arrDataLabels[] = $this->chart_xmlencode(GetFieldLabel(GoodFieldName($TableName), GoodFieldName($this->chrt_array['parameters'][$i]['name'])));
             } else {
                 $this->arrDataLabels[] = $this->chart_xmlencode(GetFieldLabel(GoodFieldName($TableName), GoodFieldName($this->chrt_array['parameters'][$i]['ohlcOpen'])));
             }
         } else {
             if (!$this->chart_xmlencode($this->chrt_array['parameters'][$i]['label'])) {
                 if ($this->chrt_array["chart_type"]["type"] != "candlestick" && $this->chrt_array["chart_type"]["type"] != "ohlc") {
                     $this->arrDataLabels[] = $this->chart_xmlencode($this->chrt_array['parameters'][$i]['name']);
                 } else {
                     $this->arrDataLabels[] = $this->chart_xmlencode($this->chrt_array['parameters'][$i]['ohlcOpen']);
                 }
             } else {
                 $this->arrDataLabels[] = $this->chart_xmlencode($this->chrt_array['parameters'][$i]['label']);
             }
         }
     }
     if ($this->chrt_array["chart_type"]["type"] != "gauge") {
         if ($this->table_type != "db") {
             $this->strLabel = $this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['name'];
         } else {
             $this->strLabel = $this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['agr_func'] ? $this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['agr_func'] . "_" . $this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['table'] . "_" . $this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['name'] : $this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['table'] . "_" . $this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['name'];
         }
         for ($j = 0; $j < count($this->chrt_array['fields']); $j++) {
             if ($this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['name'] == $this->chrt_array['fields'][$j]['name']) {
                 if ($this->table_type == "project") {
                     $this->label2 = $this->chart_xmlencode(GetFieldLabel($TableName, GoodFieldName($this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['name'])));
                 } else {
                     $this->label2 = $this->chart_xmlencode($this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['name']);
                 }
             }
         }
     }
     if ($this->chrt_array["chart_type"]["type"] != "ohlc" && $this->chrt_array["chart_type"]["type"] != "candlestick") {
         foreach ($this->arrDataColor as $ind => $val) {
             if ($ind == 0) {
                 $this->arrAxesColor = "#000000";
             } else {
                 $this->arrAxesColor = "#" . $this->arrDataColor[$ind];
             }
         }
     } else {
         foreach ($this->arrOHLC_color as $ind => $val) {
             if ($ind == 0) {
                 $this->arrAxesColor = "#000000";
             } else {
                 $this->arrAxesColor = "#" . $this->arrOHLC_color[$ind];
             }
         }
     }
     // prepare search params
     $gQuery = $this->pSet->getSQLQuery();
     $masterWhere = "";
     if (!$this->dashChart) {
         $masterTable = $_SESSION[$this->sessionPrefix . "_mastertable"];
         $detailKeysByM = $this->pSet->getDetailKeysByMasterTable($masterTable);
         if (count($detailKeysByM)) {
             for ($i = 0; $i < count($detailKeysByM); $i++) {
                 if ($i != 0) {
                     $masterWhere .= " and ";
                 }
                 if ($this->cipherer && isEncryptionByPHPEnabled()) {
                     $mValue = $this->cipherer->MakeDBValue($detailKeysByM[$i], $_SESSION[$this->sessionPrefix . "_masterkey" . ($i + 1)]);
                 } else {
                     $mValue = make_db_value($detailKeysByM[$i], $_SESSION[$this->sessionPrefix . "_masterkey" . ($i + 1)]);
                 }
                 if (strlen($mValue) != 0) {
                     $masterWhere .= RunnerPage::_getFieldSQLDecrypt($detailKeysByM[$i], $this->connection, $this->pSet, $this->cipherer) . "=" . $mValue;
                 } else {
                     $masterWhere .= "1=0";
                 }
             }
         }
     }
     $strWhereClause = "";
     $searchHavingClause = "";
     $strSearchCriteria = "and";
     global $strTableName;
     // search where for basic charts
     if (!$this->webchart) {
         if (!$this->chartPreview && isset($_SESSION[$this->sessionPrefix . '_advsearch'])) {
             $searchClauseObj = SearchClause::UnserializeObject($_SESSION[$this->sessionPrefix . '_advsearch']);
             include_once getabspath('classes/controls/EditControlsContainer.php');
             $editControls = new EditControlsContainer(null, $this->pSet, PAGE_SEARCH, $this->cipherer);
             $whereComponents = RunnerPage::sGetWhereComponents($gQuery, $this->pSet, $searchClauseObj, $editControls, $this->connection);
             $strWhereClause = $whereComponents["searchWhere"];
             foreach ($whereComponents["filterWhere"] as $fWhere) {
                 $strWhereClause = whereAdd($strWhereClause, $fWhere);
             }
             $searchHavingClause = $whereComponents["searchHaving"];
             foreach ($whereComponents["filterHaving"] as $fHaving) {
                 $searchHavingClause = whereAdd($searchHavingClause, $fHaving);
             }
             $strSearchCriteria = $whereComponents["searchUnionRequired"] ? "or" : "and";
         }
     } else {
         if ($this->table_type != "project") {
             $strTableName = "webchart" . $this->cname;
         }
         $strWhereClause = CalcSearchParam($this->table_type != "project");
     }
     if ($strWhereClause) {
         $this->chrt_array['where'] .= $this->chrt_array['where'] ? " AND (" . $strWhereClause . ")" : " WHERE (" . $strWhereClause . ")";
     }
     if ($this->table_type == "project") {
         if (SecuritySQL("Search", $this->chrt_array['tables'][0])) {
             $strWhereClause = whereAdd($strWhereClause, SecuritySQL("Search", $strTableName));
         }
         $this->strSQL = $gQuery->gSQLWhere($strWhereClause, $searchHavingClause, $strSearchCriteria);
         $strOrderBy = $this->gstrOrderBy;
         $this->strSQL .= " " . $strOrderBy;
         if ($masterWhere) {
             $strWhereClause = whereAdd($strWhereClause, $masterWhere);
         }
         $strSQLbak = $this->strSQL;
         if (tableEventExists("BeforeQueryChart", $strTableName)) {
             $tstrSQL = $this->strSQL;
             $eventObj = getEventObject($strTableName);
             $eventObj->BeforeQueryChart($tstrSQL, $strWhereClause, $strOrderBy);
             $this->strSQL = $tstrSQL;
         }
         if ($strSQLbak == $this->strSQL) {
             $this->strSQL = $gQuery->gSQLWhere($strWhereClause, $searchHavingClause, $strSearchCriteria);
             $this->strSQL .= " " . $strOrderBy;
         }
     }
     if ($this->cname && $this->table_type == "db") {
         $this->strSQL = $this->chrt_array['sql'] . $this->chrt_array['where'] . $this->chrt_array['group_by'] . $this->chrt_array['order_by'];
     } elseif ($this->cname && $this->table_type == "custom") {
         if (!IsStoredProcedure($this->chrt_array['sql'])) {
             $sql_query = $this->chrt_array['sql'];
             if ($this->connection->dbType == nDATABASE_MSSQLServer) {
                 $pos = strrpos(strtoupper($sql_query), "ORDER BY");
                 if ($pos) {
                     $sql_query = substr($sql_query, 0, $pos);
                 }
             }
             if ($this->connection->dbType != nDATABASE_Oracle) {
                 $this->strSQL = "select * from (" . $sql_query . ") as " . $this->connection->addFieldWrappers("custom_query") . $this->chrt_array['where'];
             } else {
                 $this->strSQL = "select * from (" . $sql_query . ")" . $this->chrt_array['where'];
             }
         } else {
             $this->strSQL = $this->chrt_array['sql'];
         }
     }
     if (tableEventExists("UpdateChartSettings", $strTableName)) {
         $eventObj = getEventObject($strTableName);
         $eventObj->UpdateChartSettings($this);
     }
 }
Ejemplo n.º 3
0
					$("#ExpPDF").hide();
				$(div).appendTo("div.center_div");
			}
		}	
	});
</script>';

if ($_SESSION["back_to_menu"])
    $xt->assign("back_to_menu", true);
else
    $xt->assign("back_to_menu", false);
$xt->assign("wr_pagestylepath", $wr_pagestylepath);
$xt->assign("chart_block", true);
$xt->assign("chart_constructor", $show_dchart);
$xt->assign("load_flash_player", $load_flash_player);
if (!IsStoredProcedure($chrt_array['sql']))
    $xt->assign("testAdvSearch", testAdvSearch($chrt_array['tables'][0]));
else
    $xt->assign("testAdvSearch", false);

$chart_name_js = jsreplace(postvalue('cname'));
$xt->assign("chart_name_js", $chart_name_js);

$xt->assign("chart_title", runner_htmlspecialchars($chrt_array['title']));
$xt->assign("short_table_name", runner_htmlspecialchars($chrt_array['settings']['short_table_name']));
$xt->assign("short_table_name_js", jsreplace($chrt_array['settings']['short_table_name']));
$xt->assign("ext", "php");

$searchType = (!is_wr_project()) ? GetTableLink("dsearch") : GetTableLink(runner_htmlspecialchars($chrt_array['settings']['short_table_name']), "search");
$xt->assign("searchHref", "href='" . $searchType . "?cname=" . $chart_name_js . "'");
Ejemplo n.º 4
0
		$res_body .= '</tr>';
		$flag=false;
	}
	if(!IsStoredProcedure($sql_query_all))
	{
		if(GetDatabaseType()!=1) //Oracle
			$rs=db_query("select count(*) from (".$sql_query_all.") as t",$conn);
		else
			$rs=db_query("select count(*) from (".$sql_query_all.")",$conn);
		$total_rows=0;
		if($data=db_fetch_numarray($rs))
			$total_rows=$data[0];
	}
	if($i>0)
	{
		if(!IsStoredProcedure($sql_query))
		{
			if(postvalue("sql")=="makesql")
			{
				$result="<div><b>".$total_rows."</b> records";
				if($total_rows>50)
					$result.=" (displaying first 50)";
				$result.="</div>";
				$result.="<table class=\"sql_result\" cellpadding=\"1\" cellspacing=\"1\" border=\"0\">";
				$result.="<tr><thead><tr>".$res_head."</tr></thead>";
				$result.="<tbody>".$res_body."</tbody>";
				$result.="</tr></table>";
			}
			else
			{
				$xt->assign("res_head", $res_head);
Ejemplo n.º 5
0
 function Chart(&$ch_array, $param)
 {
     global $field_labels;
     if ($this->webchart) {
         $this->chrt_array = Convert_Old_Chart($ch_array);
     } else {
         $this->chrt_array = $ch_array;
     }
     $this->pSet = new ProjectSettings($this->chrt_array['tables'][0]);
     $this->chrt_array["appearance"]["autoupdate"] = false;
     $this->numRecordsToShow = $this->chrt_array['appearance']['maxbarscroll'];
     if ($this->numRecordsToShow < 1) {
         $this->numRecordsToShow = 1;
     }
     $this->table_type = $this->chrt_array["table_type"];
     if (!$this->table_type) {
         $this->table_type = "project";
     }
     $this->webchart = $param["webchart"];
     $this->cname = $param["cname"];
     $this->sessionPrefix = $this->chrt_array['tables'][0];
     $this->gstrOrderBy = $param["gstrOrderBy"];
     $TableName = GoodFieldName($this->chrt_array['tables'][0]);
     $this->cipherer = new RunnerCipherer($this->chrt_array['tables'][0]);
     $this->header = $this->chrt_array['appearance']['head'];
     $this->footer = $this->chrt_array['appearance']['foot'];
     $this->y_axis_label = $this->chrt_array['appearance']['y_axis_label'];
     for ($i = 0; $i < count($this->chrt_array['parameters']) - 1; $i++) {
         if (isset($this->chrt_array['parameters'][$i]['currencyFormat'])) {
             $this->arrFormatCurrency[] = $this->chrt_array['parameters'][$i]['currencyFormat'];
         } else {
             if ($this->chrt_array['appearance']['scur'] == "false") {
                 $this->arrFormatCurrency[] = "";
             } else {
                 $this->arrFormatCurrency[] = $this->chrt_array['appearance']['scur'];
             }
         }
         if (isset($this->chrt_array['parameters'][$i]['decimalFormat'])) {
             $this->arrFormatDecimal[] = $this->chrt_array['parameters'][$i]['decimalFormat'];
         } else {
             $this->arrFormatDecimal[] = $this->chrt_array['appearance']['dec'];
         }
         $this->arrFormatCustomer[] = $this->chrt_array['parameters'][$i]['customFormat'];
         $this->arrFormatCustomerStr[] = $this->chrt_array['parameters'][$i]['customFormatStr'];
         if ($this->chrt_array["chart_type"]["type"] == "ohlc" || $this->chrt_array["chart_type"]["type"] == "candlestick") {
             $this->arrOHLC_open[] = $this->chrt_array['parameters'][$i]['ohlcOpen'];
             $this->arrOHLC_high[] = $this->chrt_array['parameters'][$i]['ohlcHigh'];
             $this->arrOHLC_low[] = $this->chrt_array['parameters'][$i]['ohlcLow'];
             $this->arrOHLC_close[] = $this->chrt_array['parameters'][$i]['ohlcClose'];
             $this->arrOHLC_color[] = "#" . $this->chrt_array['parameters'][$i]['ohlcColor'];
             if ($this->chrt_array["chart_type"]["type"] == "candlestick") {
                 $this->arrOHLC_candle[] = "#" . $this->chrt_array['parameters'][$i]['ohlcCandleColor'];
             }
         } elseif ($this->chrt_array['parameters'][$i]['name'] != "") {
             if ($this->table_type != "db") {
                 $this->arrDataSeries[] = $this->chrt_array['parameters'][$i]['agr_func'] ? $this->chrt_array['parameters'][$i]['label'] : $this->chrt_array['parameters'][$i]['name'];
             } else {
                 $this->arrDataSeries[] = $this->chrt_array['parameters'][$i]['agr_func'] ? $this->chrt_array['parameters'][$i]['table'] . "_" . $this->chrt_array['parameters'][$i]['label'] : $this->chrt_array['parameters'][$i]['table'] . "_" . $this->chrt_array['parameters'][$i]['name'];
             }
             if (isset($this->chrt_array['appearance']['scolor' . ($i + 1) . '1'])) {
                 $this->arrDataColor[] = $this->chrt_array['appearance']['scolor' . ($i + 1) . '1'];
             } else {
                 $this->arrDataColor[] = $this->chrt_array['parameters'][$i]['series_color'];
             }
             if ($this->chrt_array["chart_type"]["type"] == "bubble") {
                 $this->arrDataSize[] = $this->chrt_array['parameters'][$i]['size'];
             }
             if ($this->chrt_array["chart_type"]["type"] == "gauge") {
                 for ($k = 0; is_array($this->chrt_array["parameters"][$i]["gaugeColorZone"]) && $k < count($this->chrt_array["parameters"][$i]["gaugeColorZone"]); $k++) {
                     $beginColor = (double) @$this->chrt_array["parameters"][$i]["gaugeColorZone"][$k]["gaugeBeginColor"];
                     $endColor = (double) @$this->chrt_array["parameters"][$i]["gaugeColorZone"][$k]["gaugeEndColor"];
                     $gColor = "#" . @$this->chrt_array["parameters"][$i]["gaugeColorZone"][$k]["gaugeColor"];
                     $this->arrGaugeColor[count($this->arrDataSeries) - 1][] = array($beginColor, $endColor, $gColor);
                 }
             }
         }
         if ($this->table_type == "project" && !$this->webchart) {
             $this->arrDataLabels[] = $this->chart_xmlencode(GetFieldLabel(GoodFieldName($TableName), GoodFieldName($this->chrt_array['parameters'][$i]['name'])));
         } else {
             if (!$this->chart_xmlencode($this->chrt_array['parameters'][$i]['label'])) {
                 $this->arrDataLabels[] = $this->chart_xmlencode($this->chrt_array['parameters'][$i]['name']);
             } else {
                 $this->arrDataLabels[] = $this->chart_xmlencode($this->chrt_array['parameters'][$i]['label']);
             }
         }
     }
     if ($this->chrt_array["chart_type"]["type"] != "gauge") {
         if ($this->table_type != "db") {
             $this->strLabel = $this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['name'];
         } else {
             $this->strLabel = $this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['table'] . "_" . $this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['name'];
         }
         for ($j = 0; $j < count($this->chrt_array['fields']); $j++) {
             if ($this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['name'] == $this->chrt_array['fields'][$j]['name']) {
                 if ($this->table_type == "project") {
                     $this->label2 = $this->chart_xmlencode(GetFieldLabel($TableName, GoodFieldName($this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['name'])));
                 } else {
                     $this->label2 = $this->chart_xmlencode($this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['name']);
                 }
             }
         }
     }
     if ($this->chrt_array["chart_type"]["type"] != "ohlc" && $this->chrt_array["chart_type"]["type"] != "candlestick") {
         foreach ($this->arrDataColor as $ind => $val) {
             if ($ind == 0) {
                 $this->arrAxesColor = "#000000";
             } else {
                 $this->arrAxesColor = "#" . $this->arrDataColor[$ind];
             }
         }
     } else {
         foreach ($this->arrOHLC_color as $ind => $val) {
             if ($ind == 0) {
                 $this->arrAxesColor = "#000000";
             } else {
                 $this->arrAxesColor = "#" . $this->arrOHLC_color[$ind];
             }
         }
     }
     // prepare search params
     $gQuery = $this->pSet->getSQLQuery();
     $strWhereClause = "";
     $searchHavingClause = "";
     $strSearchCriteria = "and";
     global $strTableName;
     // search where for basic charts
     if (!$this->webchart) {
         if (isset($_SESSION[$this->sessionPrefix . '_advsearch'])) {
             $searchClauseObj = unserialize($_SESSION[$this->sessionPrefix . '_advsearch']);
             include_once getabspath('classes/controls/EditControlsContainer.php');
             $editControls = new EditControlsContainer(null, $this->pSet, PAGE_REPORT, $this->cipherer);
             $strWhereClause = $searchClauseObj->getWhere($this->pSet->getListOfFieldsByExprType(false), $editControls);
             $searchHavingClause = $searchClauseObj->getWhere($this->pSet->getListOfFieldsByExprType(true), $editControls);
             $strSearchCriteria = @$_SESSION[$strTableName . "_criteria"];
             if ($searchClauseObj->isUsedSearchFor && !$searchClauseObj->isUsedFieldsForSearch) {
                 $strSearchCriteria = "or";
             }
         }
     } else {
         if ($this->table_type != "project") {
             $strTableName = "webchart" . $this->cname;
         }
         $strWhereClause = CalcSearchParam($this->table_type != "project");
     }
     if ($strWhereClause) {
         $this->chrt_array['where'] .= $this->chrt_array['where'] ? " AND (" . $strWhereClause . ")" : " WHERE (" . $strWhereClause . ")";
     }
     if ($this->table_type == "project") {
         if (SecuritySQL("Search")) {
             $strWhereClause = whereAdd($strWhereClause, SecuritySQL("Search"));
         }
         $this->strSQL = $gQuery->gSQLWhere($strWhereClause, $searchHavingClause, $strSearchCriteria);
         $strOrderBy = $this->gstrOrderBy;
         $this->strSQL .= " " . $strOrderBy;
         $strSQLbak = $this->strSQL;
         if (tableEventExists("BeforeQueryChart", $strTableName)) {
             $tstrSQL = $this->strSQL;
             $eventObj = getEventObject($strTableName);
             $eventObj->BeforeQueryChart($tstrSQL, $strWhereClause, $strOrderBy);
             $this->strSQL = $tstrSQL;
         }
         if ($strSQLbak == $this->strSQL) {
             $this->strSQL = $gQuery->gSQLWhere($strWhereClause, $searchHavingClause, $strSearchCriteria);
             $this->strSQL .= " " . $strOrderBy;
         }
     }
     if ($this->cname && $this->table_type == "db") {
         $this->strSQL = $this->chrt_array['sql'] . $this->chrt_array['where'] . $this->chrt_array['group_by'] . $this->chrt_array['order_by'];
     } elseif ($this->cname && $this->table_type == "custom") {
         if (!IsStoredProcedure($this->chrt_array['sql'])) {
             $sql_query = $this->chrt_array['sql'];
             if (GetDatabaseType() == 2) {
                 $pos = strrpos(strtoupper($sql_query), "ORDER BY");
                 if ($pos) {
                     $sql_query = substr($sql_query, 0, $pos);
                 }
             }
             if (GetDatabaseType() != 1) {
                 //Oracle
                 $this->strSQL = "select * from (" . $sql_query . ") as " . AddFieldWrappers("custom_query") . $this->chrt_array['where'];
             } else {
                 $this->strSQL = "select * from (" . $sql_query . ")" . $this->chrt_array['where'];
             }
         } else {
             $this->strSQL = $this->chrt_array['sql'];
         }
     }
     if (tableEventExists("UpdateChartSettings", $strTableName)) {
         $eventObj = getEventObject($strTableName);
         $eventObj->UpdateChartSettings($this);
     }
 }
function GetTablesListCustom()
{
	global $conn;
	$arr=array();
	$rs=db_query("select * from ".AddTableWrappers("webreport_sql")." order by ".AddFieldWrappers("sqlname"),$conn);
	while($data = db_fetch_array($rs)) 
		$arr[]=array("sqlname"=>$data["sqlname"],"isStorProc"=>IsStoredProcedure($data["sqlcontent"]));
	return $arr;
}