diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 4db98898c0..1454450c93 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,14 @@ +2012-03-05 Sergio Martin + + * include/functions_graph.php + include/graphs/functions_flot.php + include/graphs/FusionCharts + include/graphs/functions_fsgraph.php + include/graphs/fgraph.php + operation/agentes/estado_generalagente.php + godmode/db/db_info.php: Removed FlashCharts library + and clean graphs code + 2012-03-01 Juan Manuel Ramon * general/logon_ok.php: Fixed users link in welcome page. diff --git a/pandora_console/godmode/db/db_info.php b/pandora_console/godmode/db/db_info.php index 25940d0c6a..da65c06c7c 100644 --- a/pandora_console/godmode/db/db_info.php +++ b/pandora_console/godmode/db/db_info.php @@ -49,7 +49,7 @@ echo ''; echo ''; echo '
'; echo '

'.__('Modules per agent').'

'; -echo graph_db_agentes_modulos2(600, 250); +echo graph_db_agentes_modulos(600, 250); echo '

'; diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 3d391175fd..278f85a903 100755 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -375,10 +375,6 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events, if ($only_image) { $flash_chart = false; } - - if ($flash_chart) { - include_flash_chart_script($homeurl); - } $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", 'url' => $config['homeurl'] . "/images/logo_vertical_water.png"); @@ -772,10 +768,6 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $ $flash_charts = false; } - if ($flash_charts){ - include_flash_chart_script(); - } - $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", 'url' => $config['homeurl'] . "/images/logo_vertical_water.png"); @@ -824,8 +816,6 @@ function graphic_agentaccess ($id_agent, $width, $height, $period = 0) { global $config; global $graphic_type; - include_flash_chart_script(); - $data = array (); $resolution = $config["graph_res"] * ($period * 2 / $width); // Number of "slices" we want in graph @@ -1045,8 +1035,6 @@ function grafico_db_agentes_paquetes($width = 380, $height = 300) { global $config; global $graphic_type; - include_flash_chart_script(); - $data = array (); $legend = array (); @@ -1060,9 +1048,12 @@ function grafico_db_agentes_paquetes($width = 380, $height = 300) { $data[$agents[$agent_id]]['g'] = $value; } + $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", + 'url' => $config['homeurl'] . "/images/logo_vertical_water.png"); + return hbar_graph($config['flash_charts'], $data, $width, $height, array(), $legend, "", "", true, "", - $config['homedir'] . "/images/logo_vertical_water.png", + $water_mark, $config['fontpath'], $config['font_size'], false); } @@ -1072,12 +1063,10 @@ function grafico_db_agentes_paquetes($width = 380, $height = 300) { * @param integer height graph height * @param integer width graph width */ -function graph_db_agentes_modulos2($width, $height) { +function graph_db_agentes_modulos($width, $height) { global $config; global $graphic_type; - include_flash_chart_script(); - $data = array (); switch ($config['dbtype']){ @@ -1415,11 +1404,12 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "") { } $loop++; } - if ($config['flash_charts']){ - include_flash_chart_script(); - } + + $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", + 'url' => $config['homeurl'] . "/images/logo_vertical_water.png"); + return pie3d_graph($config['flash_charts'], $data, $width, $height, - __('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png", + __('Other'), '', $water_mark, $config['fontpath'], $config['font_size']); } @@ -1469,8 +1459,11 @@ function grafico_eventos_total($filter = "") { asort ($data); + $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", + 'url' => $config['homeurl'] . "/images/logo_vertical_water.png"); + return pie3d_graph($config['flash_charts'], $data, 320, 200, - __('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png", + __('Other'), '', $water_mark, $config['fontpath'], $config['font_size']); } @@ -1515,9 +1508,12 @@ function grafico_eventos_usuario ($width, $height) { $data[$event['id_usuario']] = $event['events']; } } + + $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", + 'url' => $config['homeurl'] . "/images/logo_vertical_water.png"); return pie3d_graph($config['flash_charts'], $data, $width, $height, - __('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png", + __('Other'), '', $water_mark, $config['fontpath'], $config['font_size']); } @@ -1565,92 +1561,34 @@ function graph_custom_sql_graph ($id, $width, $height, $type = 'sql_graph_vbar', } $flash_charts = $config['flash_charts']; - - if ($flash_charts){ - include_flash_chart_script(); - } if ($only_image) { $flash_charts = false; } + $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", + 'url' => $config['homeurl'] . "/images/logo_vertical_water.png"); + switch ($type) { case 'sql_graph_vbar': // vertical bar return vbar_graph($flash_charts, $data, $width, $height, array(), array(), "", "", $homeurl, - $config['homedir'] . "/images/logo_vertical_water.png", + $water_mark, $config['fontpath'], $config['font_size'], false, $ttl); break; case 'sql_graph_hbar': // horizontal bar return hbar_graph($flash_charts, $data, $width, $height, array(), array(), "", "", $homeurl, - $config['homedir'] . "/images/logo_vertical_water.png", + $water_mark, $config['fontpath'], $config['font_size'], false, $ttl); break; case 'sql_graph_pie': // Pie return pie3d_graph($flash_charts, $data, $width, $height, __("other"), $homeurl, - $config['homedir'] . "/images/logo_vertical_water.png", $config['fontpath'], '', $ttl); + $water_mark, $config['fontpath'], '', $ttl); break; } } -/** - * Print a graph with event data of agents - * - * @param integer id_agent Agent ID - * @param integer width pie graph width - * @param integer height pie graph height - * @param integer period time period - */ -function graphic_agentevents ($id_agent, $width, $height, $period = 0) { - global $config; - global $graphic_type; - - if ($config['flash_charts']) { - include_flash_chart_script(); - } - - $data = array (); - - $resolution = $config['graph_res'] * ($period * 2 / $width); // Number of "slices" we want in graph - - $interval = (int) ($period / $resolution); - $date = get_system_time (); - $datelimit = $date - $period; - $periodtime = floor ($period / $interval); - $time = array (); - $data = array (); - - for ($i = 0; $i < $interval; $i++) { - $bottom = $datelimit + ($periodtime * $i); - if (! $graphic_type) { - $name = date('H\h', $bottom); - } else { - $name = $bottom; - } - - $top = $datelimit + ($periodtime * ($i + 1)); - $criticity = (int) db_get_value_filter ('criticity', - 'tevento', - array ('id_agente' => $id_agent, - 'utimestamp > '.$bottom, - 'utimestamp < '.$top)); - - switch ($criticity) { - case 3: $data[$name] = 'E5DF63'; - break; - case 4: $data[$name] = 'FF3C4B'; - break; - default: $data[$name] = '9ABD18'; - } - - } - - if (! $graphic_type) { - return fs_agent_event_chart ($data, $width, $height, $resolution / 750); - } -} - /** * Print a static graph with event data of agents * @@ -1659,7 +1597,7 @@ function graphic_agentevents ($id_agent, $width, $height, $period = 0) { * @param integer height pie graph height * @param integer period time period */ -function graph_graphic_agentevents_static($id_agent, $width, $height, $period = 0, $homeurl) { +function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $homeurl) { global $config; global $graphic_type; @@ -1823,8 +1761,6 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events, global $config; global $graphic_type; - include_flash_chart_script($homeurl); - // Set variables if ($date == 0) $date = get_system_time(); $datelimit = $date - $period; @@ -2104,17 +2040,21 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events, $color['max'] = array('border' => '#000000', 'color' => $config['graph_color3'], 'alpha' => 50); $color['min'] = array('border' => '#000000', 'color' => $config['graph_color1'], 'alpha' => 50); $color['baseline'] = array('border' => null, 'color' => '#0097BD', 'alpha' => 10); + ///////////////////////////////////////////////////////////////////////////////////////// - $flash_chart = $config['flash_charts']; + if ($only_image) { $flash_chart = false; } + $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", + 'url' => $config['homeurl'] . "/images/logo_vertical_water.png"); + return area_graph($flash_chart, $chart, $width, $height, $color, $legend, $long_index, "images/image_problem.opaque.png", "", $unit, $homeurl, - $config['homedir'] . "/images/logo_vertical_water.png", + $water_mark, $config['fontpath'], $config['font_size'], $unit); } @@ -2127,8 +2067,6 @@ function graph_netflow_aggregate_area ($data, $period, $width, $height, $only_im global $config; global $graphic_type; - include_flash_chart_script($config['homeurl']); - if (empty ($data)) { echo fs_error_image (); return; @@ -2182,10 +2120,13 @@ function graph_netflow_aggregate_area ($data, $period, $width, $height, $only_im } else { $homeurl = ''; } + + $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", + 'url' => $config['homeurl'] . "/images/logo_vertical_water.png"); return stacked_area_graph($flash_chart, $chart, $width, $height, null, $sources, null, "images/image_problem.opaque.png", "", "", - $config['homedir'] . "/images/logo_vertical_water.png", + $water_mark, $config['fontpath'], $config['font_size'], ""); } @@ -2198,8 +2139,6 @@ function graph_netflow_total_area ($data, $period, $width, $height, $only_image) global $config; global $graphic_type; - include_flash_chart_script($config['homeurl']); - if (empty ($data)) { echo fs_error_image (); return; @@ -2238,9 +2177,12 @@ function graph_netflow_total_area ($data, $period, $width, $height, $only_image) $homeurl = ''; } + $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", + 'url' => $config['homeurl'] . "/images/logo_vertical_water.png"); + return area_graph($flash_chart, $chart, $width, $height, array (), array (), array (), "images/image_problem.opaque.png", "", "", $homeurl, - $config['homedir'] . "/images/logo_vertical_water.png", + $water_mark, $config['fontpath'], $config['font_size'], ""); } @@ -2295,8 +2237,6 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events, global $config; global $graphic_type; - include_flash_chart_script($homeurl); - // Set variables if ($date == 0) $date = get_system_time(); $datelimit = $date - $period; @@ -2485,9 +2425,11 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events, $color['max'] = array('border' => '#000000', 'color' => $config['graph_color3'], 'alpha' => 50); $color['min'] = array('border' => '#000000', 'color' => $config['graph_color1'], 'alpha' => 50); //$color['baseline'] = array('border' => null, 'color' => '#0097BD', 'alpha' => 10); + ///////////////////////////////////////////////////////////////////////////////////////// $flash_chart = $config['flash_charts']; + if ($only_image) { $flash_chart = false; } diff --git a/pandora_console/include/graphs/FusionCharts/FCF_Area2D.swf b/pandora_console/include/graphs/FusionCharts/FCF_Area2D.swf deleted file mode 100755 index 224fb17ebf..0000000000 Binary files a/pandora_console/include/graphs/FusionCharts/FCF_Area2D.swf and /dev/null differ diff --git a/pandora_console/include/graphs/FusionCharts/FCF_Bar2D.swf b/pandora_console/include/graphs/FusionCharts/FCF_Bar2D.swf deleted file mode 100755 index 7b1b09e77e..0000000000 Binary files a/pandora_console/include/graphs/FusionCharts/FCF_Bar2D.swf and /dev/null differ diff --git a/pandora_console/include/graphs/FusionCharts/FCF_Candlestick.swf b/pandora_console/include/graphs/FusionCharts/FCF_Candlestick.swf deleted file mode 100755 index 01ba770d7d..0000000000 Binary files a/pandora_console/include/graphs/FusionCharts/FCF_Candlestick.swf and /dev/null differ diff --git a/pandora_console/include/graphs/FusionCharts/FCF_Column2D.swf b/pandora_console/include/graphs/FusionCharts/FCF_Column2D.swf deleted file mode 100755 index e6913b5fa6..0000000000 Binary files a/pandora_console/include/graphs/FusionCharts/FCF_Column2D.swf and /dev/null differ diff --git a/pandora_console/include/graphs/FusionCharts/FCF_Column3D.swf b/pandora_console/include/graphs/FusionCharts/FCF_Column3D.swf deleted file mode 100755 index a023642920..0000000000 Binary files a/pandora_console/include/graphs/FusionCharts/FCF_Column3D.swf and /dev/null differ diff --git a/pandora_console/include/graphs/FusionCharts/FCF_Doughnut2D.swf b/pandora_console/include/graphs/FusionCharts/FCF_Doughnut2D.swf deleted file mode 100755 index 58d826056d..0000000000 Binary files a/pandora_console/include/graphs/FusionCharts/FCF_Doughnut2D.swf and /dev/null differ diff --git a/pandora_console/include/graphs/FusionCharts/FCF_Funnel.swf b/pandora_console/include/graphs/FusionCharts/FCF_Funnel.swf deleted file mode 100755 index 87d1c663d8..0000000000 Binary files a/pandora_console/include/graphs/FusionCharts/FCF_Funnel.swf and /dev/null differ diff --git a/pandora_console/include/graphs/FusionCharts/FCF_Gantt.swf b/pandora_console/include/graphs/FusionCharts/FCF_Gantt.swf deleted file mode 100755 index de6de3ec64..0000000000 Binary files a/pandora_console/include/graphs/FusionCharts/FCF_Gantt.swf and /dev/null differ diff --git a/pandora_console/include/graphs/FusionCharts/FCF_Line.swf b/pandora_console/include/graphs/FusionCharts/FCF_Line.swf deleted file mode 100755 index 547e54f8ce..0000000000 Binary files a/pandora_console/include/graphs/FusionCharts/FCF_Line.swf and /dev/null differ diff --git a/pandora_console/include/graphs/FusionCharts/FCF_MSArea2D.swf b/pandora_console/include/graphs/FusionCharts/FCF_MSArea2D.swf deleted file mode 100755 index bff3774ae9..0000000000 Binary files a/pandora_console/include/graphs/FusionCharts/FCF_MSArea2D.swf and /dev/null differ diff --git a/pandora_console/include/graphs/FusionCharts/FCF_MSBar2D.swf b/pandora_console/include/graphs/FusionCharts/FCF_MSBar2D.swf deleted file mode 100755 index 476d7b9060..0000000000 Binary files a/pandora_console/include/graphs/FusionCharts/FCF_MSBar2D.swf and /dev/null differ diff --git a/pandora_console/include/graphs/FusionCharts/FCF_MSColumn2D.swf b/pandora_console/include/graphs/FusionCharts/FCF_MSColumn2D.swf deleted file mode 100755 index 0e0cbebc6c..0000000000 Binary files a/pandora_console/include/graphs/FusionCharts/FCF_MSColumn2D.swf and /dev/null differ diff --git a/pandora_console/include/graphs/FusionCharts/FCF_MSColumn2DLineDY.swf b/pandora_console/include/graphs/FusionCharts/FCF_MSColumn2DLineDY.swf deleted file mode 100755 index b79490140b..0000000000 Binary files a/pandora_console/include/graphs/FusionCharts/FCF_MSColumn2DLineDY.swf and /dev/null differ diff --git a/pandora_console/include/graphs/FusionCharts/FCF_MSColumn3D.swf b/pandora_console/include/graphs/FusionCharts/FCF_MSColumn3D.swf deleted file mode 100755 index 5076f580e2..0000000000 Binary files a/pandora_console/include/graphs/FusionCharts/FCF_MSColumn3D.swf and /dev/null differ diff --git a/pandora_console/include/graphs/FusionCharts/FCF_MSColumn3DLineDY.swf b/pandora_console/include/graphs/FusionCharts/FCF_MSColumn3DLineDY.swf deleted file mode 100755 index 501291a94f..0000000000 Binary files a/pandora_console/include/graphs/FusionCharts/FCF_MSColumn3DLineDY.swf and /dev/null differ diff --git a/pandora_console/include/graphs/FusionCharts/FCF_MSLine.swf b/pandora_console/include/graphs/FusionCharts/FCF_MSLine.swf deleted file mode 100755 index 26329e644d..0000000000 Binary files a/pandora_console/include/graphs/FusionCharts/FCF_MSLine.swf and /dev/null differ diff --git a/pandora_console/include/graphs/FusionCharts/FCF_Pie2D.swf b/pandora_console/include/graphs/FusionCharts/FCF_Pie2D.swf deleted file mode 100755 index d0eea35889..0000000000 Binary files a/pandora_console/include/graphs/FusionCharts/FCF_Pie2D.swf and /dev/null differ diff --git a/pandora_console/include/graphs/FusionCharts/FCF_Pie3D.swf b/pandora_console/include/graphs/FusionCharts/FCF_Pie3D.swf deleted file mode 100755 index 1d78f79b03..0000000000 Binary files a/pandora_console/include/graphs/FusionCharts/FCF_Pie3D.swf and /dev/null differ diff --git a/pandora_console/include/graphs/FusionCharts/FCF_StackedArea2D.swf b/pandora_console/include/graphs/FusionCharts/FCF_StackedArea2D.swf deleted file mode 100755 index 5f8d3e7a11..0000000000 Binary files a/pandora_console/include/graphs/FusionCharts/FCF_StackedArea2D.swf and /dev/null differ diff --git a/pandora_console/include/graphs/FusionCharts/FCF_StackedBar2D.swf b/pandora_console/include/graphs/FusionCharts/FCF_StackedBar2D.swf deleted file mode 100755 index b9dfb0baf8..0000000000 Binary files a/pandora_console/include/graphs/FusionCharts/FCF_StackedBar2D.swf and /dev/null differ diff --git a/pandora_console/include/graphs/FusionCharts/FCF_StackedColumn2D.swf b/pandora_console/include/graphs/FusionCharts/FCF_StackedColumn2D.swf deleted file mode 100755 index 7559014b84..0000000000 Binary files a/pandora_console/include/graphs/FusionCharts/FCF_StackedColumn2D.swf and /dev/null differ diff --git a/pandora_console/include/graphs/FusionCharts/FCF_StackedColumn3D.swf b/pandora_console/include/graphs/FusionCharts/FCF_StackedColumn3D.swf deleted file mode 100755 index be1ca1c4b7..0000000000 Binary files a/pandora_console/include/graphs/FusionCharts/FCF_StackedColumn3D.swf and /dev/null differ diff --git a/pandora_console/include/graphs/FusionCharts/FusionCharts.js b/pandora_console/include/graphs/FusionCharts/FusionCharts.js deleted file mode 100755 index 4d6cafddba..0000000000 --- a/pandora_console/include/graphs/FusionCharts/FusionCharts.js +++ /dev/null @@ -1,311 +0,0 @@ -/** - * FusionCharts: Flash Player detection and Chart embedding. - * Version: vFree.1.2 (1st November, 2007) - Added Player detection, New conditional fixes for IE, supports FORM in IE - * - * Morphed from SWFObject (http://blog.deconcept.com/swfobject/) under MIT License: - * http://www.opensource.org/licenses/mit-license.php - * - */ - -if(typeof infosoftglobal == "undefined") var infosoftglobal = new Object(); -if(typeof infosoftglobal.FusionChartsUtil == "undefined") infosoftglobal.FusionChartsUtil = new Object(); -infosoftglobal.FusionCharts = function(swf, id, w, h, debugMode, registerWithJS, c, scaleMode, lang, detectFlashVersion, autoInstallRedirect){ - if (!document.getElementById) { return; } - - //Flag to see whether data has been set initially - this.initialDataSet = false; - - //Create container objects - this.params = new Object(); - this.variables = new Object(); - this.attributes = new Array(); - - //Set attributes for the SWF - if(swf) { this.setAttribute('swf', swf); } - if(id) { this.setAttribute('id', id); } - if(w) { this.setAttribute('width', w); } - if(h) { this.setAttribute('height', h); } - - //Set background color - if(c) { this.addParam('bgcolor', c); } - - //Set Quality - this.addParam('quality', 'high'); - - //Add scripting access parameter - this.addParam('allowScriptAccess', 'always'); - - //Pass width and height to be appended as chartWidth and chartHeight - this.addVariable('chartWidth', w); - this.addVariable('chartHeight', h); - - //Whether in debug mode - debugMode = debugMode ? debugMode : 0; - this.addVariable('debugMode', debugMode); - //Pass DOM ID to Chart - this.addVariable('DOMId', id); - //Whether to registed with JavaScript - registerWithJS = registerWithJS ? registerWithJS : 0; - this.addVariable('registerWithJS', registerWithJS); - - //Scale Mode of chart - scaleMode = scaleMode ? scaleMode : 'noScale'; - this.addVariable('scaleMode', scaleMode); - //Application Message Language - lang = lang ? lang : 'EN'; - this.addVariable('lang', lang); - - //Whether to auto detect and re-direct to Flash Player installation - this.detectFlashVersion = detectFlashVersion?detectFlashVersion:1; - this.autoInstallRedirect = autoInstallRedirect?autoInstallRedirect:1; - - //Ger Flash Player version - this.installedVer = infosoftglobal.FusionChartsUtil.getPlayerVersion(); - - if (!window.opera && document.all && this.installedVer.major > 7) { - // Only add the onunload cleanup if the Flash Player version supports External Interface and we are in IE - infosoftglobal.FusionCharts.doPrepUnload = true; - } -} - -infosoftglobal.FusionCharts.prototype = { - setAttribute: function(name, value){ - this.attributes[name] = value; - }, - getAttribute: function(name){ - return this.attributes[name]; - }, - addParam: function(name, value){ - this.params[name] = value; - }, - getParams: function(){ - return this.params; - }, - addVariable: function(name, value){ - this.variables[name] = value; - }, - getVariable: function(name){ - return this.variables[name]; - }, - getVariables: function(){ - return this.variables; - }, - getVariablePairs: function(){ - var variablePairs = new Array(); - var key; - var variables = this.getVariables(); - for(key in variables){ - variablePairs.push(key +"="+ variables[key]); - } - return variablePairs; - }, - getSWFHTML: function() { - var swfNode = ""; - if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { - // netscape plugin architecture - swfNode = ' 0){ swfNode += 'flashvars="'+ pairs +'"'; } - swfNode += '/>'; - } else { // PC IE - swfNode = ''; - swfNode += ''; - var params = this.getParams(); - for(var key in params) { - swfNode += ''; - } - var pairs = this.getVariablePairs().join("&"); - if(pairs.length > 0) {swfNode += '';} - swfNode += ""; - } - return swfNode; - }, - setDataURL: function(strDataURL){ - //This method sets the data URL for the chart. - //If being set initially - if (this.initialDataSet==false){ - this.addVariable('dataURL',strDataURL); - //Update flag - this.initialDataSet = true; - }else{ - //Else, we update the chart data using External Interface - //Get reference to chart object - var chartObj = infosoftglobal.FusionChartsUtil.getChartObject(this.getAttribute('id')); - chartObj.setDataURL(strDataURL); - } - }, - setDataXML: function(strDataXML){ - //If being set initially - if (this.initialDataSet==false){ - //This method sets the data XML for the chart INITIALLY. - this.addVariable('dataXML',strDataXML); - //Update flag - this.initialDataSet = true; - }else{ - //Else, we update the chart data using External Interface - //Get reference to chart object - var chartObj = infosoftglobal.FusionChartsUtil.getChartObject(this.getAttribute('id')); - chartObj.setDataXML(strDataXML); - } - }, - render: function(elementId){ - //First check for installed version of Flash Player - we need a minimum of 6 - if((this.detectFlashVersion==1) && (this.installedVer.major < 6)){ - if (this.autoInstallRedirect==1){ - //If we can auto redirect to install the player? - var installationConfirm = window.confirm("You need Adobe Flash Player 6 (or above) to view the charts. It is a free and lightweight installation from Adobe.com. Please click on Ok to install the same."); - if (installationConfirm){ - window.location = "http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash"; - }else{ - return false; - } - }else{ - //Else, do not take an action. It means the developer has specified a message in the DIV (and probably a link). - //So, expect the developers to provide a course of way to their end users. - //window.alert("You need Adobe Flash Player 6 (or above) to view the charts. It is a free and lightweight installation from Adobe.com. "); - return false; - } - }else{ - //Render the chart - var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId; - n.innerHTML = this.getSWFHTML(); - - //Added for .NET AJAX and
compatibility - if(!document.embeds[this.getAttribute('id')] && !window[this.getAttribute('id')]) - window[this.getAttribute('id')]=document.getElementById(this.getAttribute('id')); - //or else document.forms[formName/formIndex][chartId] - - return true; - } - } -} - -/* ---- detection functions ---- */ -infosoftglobal.FusionChartsUtil.getPlayerVersion = function(){ - var PlayerVersion = new infosoftglobal.PlayerVersion([0,0,0]); - if(navigator.plugins && navigator.mimeTypes.length){ - var x = navigator.plugins["Shockwave Flash"]; - if(x && x.description) { - PlayerVersion = new infosoftglobal.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split(".")); - } - }else if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0){ - //If Windows CE - var axo = 1; - var counter = 3; - while(axo) { - try { - counter++; - axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+ counter); - PlayerVersion = new infosoftglobal.PlayerVersion([counter,0,0]); - } catch (e) { - axo = null; - } - } - } else { - // Win IE (non mobile) - // Do minor version lookup in IE, but avoid Flash Player 6 crashing issues - try{ - var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"); - }catch(e){ - try { - var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"); - PlayerVersion = new infosoftglobal.PlayerVersion([6,0,21]); - axo.AllowScriptAccess = "always"; // error if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code) - } catch(e) { - if (PlayerVersion.major == 6) { - return PlayerVersion; - } - } - try { - axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); - } catch(e) {} - } - if (axo != null) { - PlayerVersion = new infosoftglobal.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(",")); - } - } - return PlayerVersion; -} -infosoftglobal.PlayerVersion = function(arrVersion){ - this.major = arrVersion[0] != null ? parseInt(arrVersion[0]) : 0; - this.minor = arrVersion[1] != null ? parseInt(arrVersion[1]) : 0; - this.rev = arrVersion[2] != null ? parseInt(arrVersion[2]) : 0; -} -// ------------ Fix for Out of Memory Bug in IE in FP9 ---------------// -/* Fix for video streaming bug */ -infosoftglobal.FusionChartsUtil.cleanupSWFs = function() { - var objects = document.getElementsByTagName("OBJECT"); - for (var i = objects.length - 1; i >= 0; i--) { - objects[i].style.display = 'none'; - for (var x in objects[i]) { - if (typeof objects[i][x] == 'function') { - objects[i][x] = function(){}; - } - } - } -} -// Fixes bug in fp9 -if (infosoftglobal.FusionCharts.doPrepUnload) { - if (!infosoftglobal.unloadSet) { - infosoftglobal.FusionChartsUtil.prepUnload = function() { - __flash_unloadHandler = function(){}; - __flash_savedUnloadHandler = function(){}; - window.attachEvent("onunload", infosoftglobal.FusionChartsUtil.cleanupSWFs); - } - window.attachEvent("onbeforeunload", infosoftglobal.FusionChartsUtil.prepUnload); - infosoftglobal.unloadSet = true; - } -} -/* Add document.getElementById if needed (mobile IE < 5) */ -if (!document.getElementById && document.all) { document.getElementById = function(id) { return document.all[id]; }} -/* Add Array.push if needed (ie5) */ -if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }} - -/* Function to return Flash Object from ID */ -infosoftglobal.FusionChartsUtil.getChartObject = function(id) -{ - // set off to test in .NET AJAX and environment - //if (window.document[id]) { - // return window.document[id]; - //} - var chartRef=null; - if (navigator.appName.indexOf("Microsoft Internet")==-1) { - if (document.embeds && document.embeds[id]) - chartRef = document.embeds[id]; - else - chartRef = window.document[id]; - } - else { - chartRef = window[id]; - } - if (!chartRef) - chartRef = document.getElementById(id); - - return chartRef; -} - - -/* - Function to update chart's data at client side (FOR FusionCharts vFREE and 2.x -*/ -infosoftglobal.FusionChartsUtil.updateChartXML = function(chartId, strXML){ - //Get reference to chart object - var chartObj = infosoftglobal.FusionChartsUtil.getChartObject(chartId); - //Set dataURL to null - chartObj.SetVariable("_root.dataURL",""); - //Set the flag - chartObj.SetVariable("_root.isNewData","1"); - //Set the actual data - chartObj.SetVariable("_root.newData",strXML); - //Go to the required frame - chartObj.TGotoLabel("/", "JavaScriptHandler"); -} - -/* Aliases for easy usage */ -var getChartFromId = infosoftglobal.FusionChartsUtil.getChartObject; -var updateChartXML = infosoftglobal.FusionChartsUtil.updateChartXML; -var FusionCharts = infosoftglobal.FusionCharts; - diff --git a/pandora_console/include/graphs/FusionCharts/FusionCharts.php b/pandora_console/include/graphs/FusionCharts/FusionCharts.php deleted file mode 100755 index aa174c5f50..0000000000 --- a/pandora_console/include/graphs/FusionCharts/FusionCharts.php +++ /dev/null @@ -1,144 +0,0 @@ -0) - $strDataURL .= "&FCCurrTime=" . Date("H_i_s"); - else - $strDataURL .= "?FCCurrTime=" . Date("H_i_s"); - } - // URL Encode it - return urlencode($strDataURL); -} - - -// datePart function converts MySQL database based on requested mask -// Param: $mask - what part of the date to return "m' for month,"d" for day, and "y" for year -// Param: $dateTimeStr - MySQL date/time format (yyyy-mm-dd HH:ii:ss) -function datePart($mask, $dateTimeStr) { - @list($datePt, $timePt) = explode(" ", $dateTimeStr); - $arDatePt = explode("-", $datePt); - $dataStr = ""; - // Ensure we have 3 parameters for the date - if (count($arDatePt) == 3) { - list($year, $month, $day) = $arDatePt; - // determine the request - switch ($mask) { - case "m": return (int)$month; - case "d": return (int)$day; - case "y": return (int)$year; - } - // default to mm/dd/yyyy - return (trim($month . "/" . $day . "/" . $year)); - } - return $dataStr; -} - - -// renderChart renders the JavaScript + HTML code required to embed a chart. -// This function assumes that you've already included the FusionCharts JavaScript class -// in your page. - -// $chartSWF - SWF File Name (and Path) of the chart which you intend to plot -// $strURL - If you intend to use dataURL method for this chart, pass the URL as this parameter. Else, set it to "" (in case of dataXML method) -// $strXML - If you intend to use dataXML method for this chart, pass the XML data as this parameter. Else, set it to "" (in case of dataURL method) -// $chartId - Id for the chart, using which it will be recognized in the HTML page. Each chart on the page needs to have a unique Id. -// $chartWidth - Intended width for the chart (in pixels) -// $chartHeight - Intended height for the chart (in pixels) -function renderChart($chartSWF, $strURL, $strXML, $chartId, $chartWidth, $chartHeight) { - //First we create a new DIV for each chart. We specify the name of DIV as "chartId"Div. - //DIV names are case-sensitive. - - // The Steps in the script block below are: - // - // 1)In the DIV the text "Chart" is shown to users before the chart has started loading - // (if there is a lag in relaying SWF from server). This text is also shown to users - // who do not have Flash Player installed. You can configure it as per your needs. - // - // 2) The chart is rendered using FusionCharts Class. Each chart's instance (JavaScript) Id - // is named as chart_"chartId". - // - // 3) Check whether we've to provide data using dataXML method or dataURL method - // save the data for usage below - if ($strXML=="") - $tempData = "//Set the dataURL of the chart\n\t\tchart_$chartId.setDataURL(\"$strURL\")"; - else - $tempData = "//Provide entire XML data using dataXML method\n\t\tchart_$chartId.setDataXML(\"$strXML\")"; - - // Set up necessary variables for the RENDERCAHRT - $chartIdDiv = $chartId . "Div"; - - // create a string for outputting by the caller - $render_chart = << -
- Chart. -
- - -RENDERCHART; - - return $render_chart; -} - - -//renderChartHTML function renders the HTML code for the JavaScript. This -//method does NOT embed the chart using JavaScript class. Instead, it uses -//direct HTML embedding. So, if you see the charts on IE 6 (or above), you'll -//see the "Click to activate..." message on the chart. -// $chartSWF - SWF File Name (and Path) of the chart which you intend to plot -// $strURL - If you intend to use dataURL method for this chart, pass the URL as this parameter. Else, set it to "" (in case of dataXML method) -// $strXML - If you intend to use dataXML method for this chart, pass the XML data as this parameter. Else, set it to "" (in case of dataURL method) -// $chartId - Id for the chart, using which it will be recognized in the HTML page. Each chart on the page needs to have a unique Id. -// $chartWidth - Intended width for the chart (in pixels) -// $chartHeight - Intended height for the chart (in pixels) -function renderChartHTML($chartSWF, $strURL, $strXML, $chartId, $chartWidth, $chartHeight) { - // Generate the FlashVars string based on whether dataURL has been provided - // or dataXML. - $strFlashVars = "&chartWidth=" . $chartWidth . "&chartHeight=" . $chartHeight ; - if ($strXML=="") - // DataURL Mode - $strFlashVars .= "&dataURL=" . $strURL; - else - //DataXML Mode - $strFlashVars .= "&dataXML=" . $strXML; - -$HTML_chart = << - - - - - - - - -HTMLCHART; - - return $HTML_chart; -} - -// boolToNum function converts boolean values to numeric (1/0) -function boolToNum($bVal) { - return (($bVal==true) ? 1 : 0); -} - -?> \ No newline at end of file diff --git a/pandora_console/include/graphs/FusionCharts/FusionCharts_Gen.php b/pandora_console/include/graphs/FusionCharts/FusionCharts_Gen.php deleted file mode 100755 index e2b67491a4..0000000000 --- a/pandora_console/include/graphs/FusionCharts/FusionCharts_Gen.php +++ /dev/null @@ -1,1879 +0,0 @@ - single series, 2=> multi-series, 5=>Gantt ( - # For Future Use : 3=> scatter and bubble, 4=> MSStacked - var $seriesType; - - # Charts Atribute array - var $chartParams = array(); #List of Chart Parameters - var $chartParamsCounter; #Number of Chart parameters - - var $categoriesParam; # Categories Parameter Setting - var $categoryNames = array(); # Category array for storing Category set - var $categoryNamesCounter; # Category array counter - - var $dataset = array(); # dataset array - var $datasetParam = array(); # dataset parameter setting array - var $datasetCounter; # dataset array counter - var $setCounter; # set array counter - - - # trendLines array - var $trendLines = array(); # trendLines array - var $tLineCounter; # trendLines array counter - - #chart messages - var $chartMSG; - - var $chartSWF = array(); # Charts SWF array - var $arr_FCColors = array(); # Color Set to be applied to dataplots - -#############============ For Gantt Chart ============================ - # Gantt categories - var $GT_categories = array(); - var $GT_categories_Counter; - var $GT_categoriesParam = array(); - - var $GT_subcategories_Counter; - - # Gantt processes - var $GT_processes = array(); - var $GT_processes_Counter; - var $GT_processes_Param; - - # Gantt Tasks - var $GT_Tasks = array(); - var $GT_Tasks_Counter; - var $GT_Tasks_Param; - - # Gantt Connectors - var $GT_Connectors = array(); - var $GT_Connectors_Counter; - var $GT_Connectors_Param; - - # Gantt Milestones - var $GT_Milestones = array(); - var $GT_Milestones_Counter; - var $GT_Milestones_Param; - - # Gantt datatable - var $GT_datatable = array(); - var $GT_datatable_Counter; - var $GT_datatableParam; - var $GT_dataColumnParam = array(); - - var $GT_subdatatable_Counter; - - #------- For Futute Use (start)---------------- - # Gantt legend - var $GT_legend = array(); - var $GT_legend_Counter; - var $GT_legend_Param; - #------- For Futute Use (end)---------------- - - # JS Constrator - var $debugMode; - var $registerWithJS; - var $bgColor; - var $scaleMode; - var $lang; - -#############============ For Future Use (start)============================ - # dataset for MSStackedColumn2D - - var $MSSDataset = array(); # dataset array for MSStackedColumn2D - var $MSSDatasetParams = array(); # MSSDataset parameter setting - - var $MSSDatasetCounter; # MSSDataset array counter - var $MSSSubDatasetCounter; # ms sub dataset array counter - var $MSSSetCounter; # msset array counter - - # lineset - var $lineSet = array(); # lineSet array - var $lineSetParam = array(); # lineSet Parameter setting array - - var $lineCounter; # line array counter - var $lineSetCounter; # lineset array counter - var $lineIDCounter; # lineID counter; - - # vtrendLines array - var $vtrendLines = array(); # vtrendLines array - var $vtLineCounter; # vtrendLines array counter - - # style array - var $styles = array(); # styles array - var $styleDefCounter; # define counter - var $styleAppCounter; # apply counter - - -#############============ For Future Use (end)============================ - - - - # FusionCharts Constructor, its take 4 Parameters. - # when we create object of FusionCharts, then Constructor will auto run and initialize - # chats array parameter like chartType, width, height, chartsID - function FusionCharts($chartType,$width,$height,$chartID=""){ - - # Setting All Charts Array - $this->setChartArrays(); - - #initialise colorList - $this->colorInit(); - - # Setting Chart name - $this->chartType=strtolower($chartType); - # Getting Charts Series Type - $this->getSeriesType(); - - # Setting Charts Width and Height - $this->width=$width; - $this->height=$height; - - # Setting ChartID, Defult is Charts Name - if ($chartID==""){ - $chartCounter=@$_SESSION['chartcount']; - if($chartCounter<=0 || $chartCounter==NULL){ - $chartCounter=1; - } - - $this->chartID=$chartType . $chartCounter; - $_SESSION['chartcount']=++$chartCounter; - - }else{ - $this->chartID=$chartID; - } - - # Setting Defult Parameter Delimiter to ';' - $this->del=";"; - - # Setting Default SWF Path - $this->SWFPath=""; - $this->SWFFile=$this->SWFPath . "FCF_" . $this->chartSWF[$this->chartType][0] . ".swf"; - # Initialize categoriesParam - $this->categoriesParam=""; - $this->categoryNamesCounter=1; - - # Creating Category Array - $this->createCategory($this->categoryNamesCounter); - - # Initialize Dataset Variables - $this->datasetCounter=0; - $this->setCounter= 0; - if($this->seriesType>1){ - $this->setCounter++; - } - - # Initialize MSSDataset Variables - if($this->seriesType==4){ - $this->MSSDatasetCounter=0; - $this->MSSSubDatasetCounter=0; - $this->MSSSetCounter=0; - - $this->lineCounter=0; - $this->lineSetCounter=0; - $this->lineIDCounter=0; - } - - # vTrendLines Array inisialize - if($this->seriesType==3){ - $this->vtLineCounter=1; - $this->createvTrendLines($this->vtLineCounter); - } - - # TrendLines Array inisialize - $this->tLineCounter=1; - $this->createTrendLines($this->tLineCounter); - - # Styles Array inisialize - $this->styleDefCounter=1; - $this->styleAppCounter=1; - $this->createStyles("definition"); - $this->createSubStyles("definition","style"); - $this->createSubStylesParam("definition","style",$this->styleDefCounter); - - $this->GT_categories_Counter=0; - $this->GT_subcategories_Counter=0; - - $this->GT_processes_Counter=0; - $this->GT_processes_Param=""; - - $this->GT_Tasks_Counter=0; - $this->GT_Tasks_Param=""; - - # Gantt Connectors - $this->GT_Connectors_Counter=0; - $this->GT_Connectors_Param=""; - - # Gantt datatable - $this->GT_datatable_Counter=0; - $this->GT_datatableParam=""; - $this->GT_subdatatable_Counter=0; - - # Gantt legend - $this->GT_legend_Counter=0; - $this->GT_legend_Param=""; - - # JS Constractor - $this->debugMode=false; - $this->registerWithJS=false; - $this->bgColor=""; - $this->scaleMode=""; - $this->lang=""; - - $this->chartMSG=""; - # XML store Variables - $this->strXML=""; - } - - -##------------ PUBLIC FUNCTIONS ---------------------------------------------------------------- - - # Setting Parameter Delimiter, Defult Parameter Separator is ";" - function setParamDelimiter($strDel){ - $this->del=$strDel; - } - - - # Setting path of SWF file. file name like FCF_Column3D.swf. where FCF_ is common for all SWF file - function setSWFPath($SWFPath){ - $this->SWFPath=$SWFPath; - $this->SWFFile=$this->SWFPath . "FCF_" . $this->chartSWF[$this->chartType][0] . ".swf"; - } - - # We can add or change single Chart parameter by setChartParam function - # its take Parameter Name and its Value - function setChartParam($paramName, $paramValue){ - $this->chartParams[$paramName]=$this->encodeSpecialChars($paramValue); - } - - # We can add or change Chart parameter sets by setChartParams function - # its take parameterset [ caption=xyz caption;subCaption=abcd abcd abcd;xAxisName=x axis;yAxisName=y's axis;bgColor=f2fec0;animation=1 ] - # Defult Parameter Separator is ";" - function setChartParams($strParam){ - $listArray=explode($this->del,$strParam); - foreach ($listArray as $valueArray) { - $paramValue=explode("=",$valueArray); - if($this->validateParam($paramValue)==true){ - $this->chartParams[$paramValue[0]]=$this->encodeSpecialChars($paramValue[1]); - } - } - } - - - # Setting Categories Parameter into categoriesParam variables - function setCategoriesParams($strParam){ - $listArray=explode($this->del,$strParam); - # Fetching all value and converting into xml attribute - foreach ($listArray as $valueArray) { - $paramValue=explode("=",$valueArray); - if($this->validateParam($paramValue)==true){ - $this->categoriesParam .= $paramValue[0] . "='" . $this->encodeSpecialChars($paramValue[1]) . "' "; - } - } - } - - - # Function addCategoryFromDatabase adding Category from dataset - function addCategoryFromDatabase($query_result, $categoryColumn){ - # fetching recordset till eof - while($row = mysql_fetch_array($query_result)){ - # adding category - $this->addCategory($row[$categoryColumn],"","" ); - } - } - - # Function addCategoryFromArray adding Category from Array - function addCategoryFromArray($categoryArray){ - # convert array to category set - foreach ($categoryArray as $value) { - # adding category - $this->addCategory($value); - } - } - - # Function for create set and catagory, dataset , set from array - function addChartDataFromArray($dataArray, $dataCatArray=""){ - if(is_array($dataArray)){ - if ($this->seriesType==1){ - # Single series Array - # aa[..][..]="name" aa[..][..]="value" - foreach($dataArray as $arrayvalue){ - if(is_array($arrayvalue)){ - $this->addChartData($arrayvalue[1],"name=" . $arrayvalue[0] ); - } - } - }else{ - # Multi series Array - if(is_array($dataCatArray)){ - foreach($dataCatArray as $value){ - $this->addCategory($value); - } - } - foreach($dataArray as $arrayvalue){ - if(is_array($arrayvalue)){ - $i=0; - $aaa[0]="";$aaa[1]=""; - foreach($arrayvalue as $value){ - if($i>=2){ - $this->addChartData($value); - }else{ - $aaa[$i]=$value; - } - if($i==1){ - $this->addDataset($aaa[0],$aaa[1]); - } - $i++; - - } - } - } - } - } - } - - # Function addCategory adding Category and vLine element - function addCategory($label="",$catParam="",$vlineParam = "" ){ - $strCatXML=""; - $strParam=""; - # cheking vlineParam equal blank - if($vlineParam==""){ - # cheking catParam not blank - if($catParam!=""){ - $listArray=explode($this->del,$catParam); - foreach ($listArray as $valueArray) { - $paramValue=explode("=",$valueArray); - if($this->validateParam($paramValue)==true){ - # creating parameter set - $strParam .= $paramValue[0] . "='" . $this->encodeSpecialChars($paramValue[1]) . "' "; - } - } - } - # adding label and parameter set to category - $strCatXML =""; - - }else{ - $listArray=explode($this->del,$vlineParam); - foreach ($listArray as $valueArray) { - $paramValue=explode("=",$valueArray); - if($this->validateParam($paramValue)==true){ - # creating parameter set - $strParam .= $paramValue[0] . "='" . $this->encodeSpecialChars($paramValue[1]) . "' "; - } - } - # adding parameter set to vLine - $strCatXML=""; - } - # storing into categoryNames array - $this->categoryNames[$this->categoryNamesCounter]=$strCatXML; - # Increase Counter - $this->categoryNamesCounter++; - } - - - # adding dataset array element - function addDataset($seriesName, $strParam=""){ - $this->datasetCounter++; - $this->createDataset($this->datasetCounter); - - $this->setCounter++; - $this->createDataValues($this->datasetCounter,"_" . $this->setCounter); - - # creating seriesName and dataset parameter set - $tempParam=""; - $tempParam ="seriesName='" . $seriesName . "' "; - $listArray=explode($this->del,$strParam); - $color=0; - foreach ($listArray as $valueArray) { - - $paramValue=explode("=",$valueArray); - if($this->validateParam($paramValue)==true){ - if(strtolower(trim($paramValue[0]))=="color"){ - $color=1; - } - $tempParam .= $paramValue[0] . "='" . $this->encodeSpecialChars($paramValue[1]) . "' "; - } - } - - # setting datasetParam array - $colorParam=""; - if($color==0){ - $colorParam=" color='" . $this->getColor($this->datasetCounter-1) . "'"; - } - $this->datasetParam[$this->datasetCounter]=$tempParam . $colorParam; - - } - - - # Function addChartData adding set data element - function addChartData($value="",$setParam="",$vlineParam = "" ){ - $strSetXML=""; - - # Choosing dataset depend on seriesType and getting XML set - if($this->seriesType>=1 and $this->seriesType<=2){ - if($this->seriesType>=1){ - if(gettype(strpos($this->chartType,"line"))!="boolean"){ - $colorSet=$this->getColor(0); - $this->setChartParams("lineColor=" . $colorSet ); - } - if(gettype(strpos($this->chartType,"area"))!="boolean"){ - $colorSet=$this->getColor(0); - $this->setChartParams("areaBgColor=" . $colorSet ); - } - } - - $strSetXML=$this->setSSMSDataArray($value,$setParam,$vlineParam); - - }elseif ($this->seriesType==3){ - - $strSetXML=$this->setScatterBubbleDataArray($value,$setParam,$vlineParam); - - }elseif (($this->seriesType==4)){ - - $strSetXML=$this->setSSMSDataArray($value,$setParam,$vlineParam); - - } - - # Adding xml set to dataset array and Increase set counter - if ($this->seriesType==1){ - $this->dataset[$this->setCounter]=$strSetXML; - $this->setCounter++; - }elseif($this->seriesType>1 and $this->seriesType<4){ - $this->dataset[$this->datasetCounter]["_" . $this->setCounter]=$strSetXML; - $this->setCounter++; - }elseif($this->seriesType==4){ - $this->MSSDataset[$this->MSSDatasetCounter][$this->MSSSubDatasetCounter][$this->MSSSetCounter]=$strSetXML; - $this->MSSSetCounter++; - } - } - # Function addDatasetsFromDatabase adding dataset and set element by mysql recordset - function addDatasetsFromDatabase($query_result, $ctrlField, $valueField,$datsetParamArray="",$LinkPlaceHolder=""){ - - # Initialize variables - $paramset=""; - $tempContrl=""; - if(is_array($datsetParamArray)==false){ - $datsetParamArray=array(); - } - - # Calculate total no of array elements in datsetParamArray - $arrLimit=count($datsetParamArray); - $i=1; - $tempParam=""; - # fetching recordset till eof - while($row = mysql_fetch_array($query_result)){ - # Creating Control break depending on ctrlField - # if ctrlField value change then dataset will be Generate - if ($tempContrl!=$row[$ctrlField]){ - if($i<=$arrLimit){ - $tempParam = $datsetParamArray[$i-1]; - }else{ - $tempParam=""; - } - # Adding Dataset - $this->addDataset($row[$ctrlField],$tempParam); - $tempContrl=$row[$ctrlField]; - $i++; - } - # Generating URL link - if($LinkPlaceHolder==""){ - $paramset=""; - }else{ - # Generating URL link from getLinkFromPattern - $paramset="link=" . urlencode($this->getLinkFromPattern($row,$LinkPlaceHolder)); - } - # Adding set into dataset - $this->addChartData($row[$valueField], $paramset, ""); - } - } - - # addDataFromDatabase funcion take 5 parameter like query_result, label field, value field - # and initialize dataset variables and link - function addDataFromDatabase($query_result, $db_field_ChartData,$db_field_CategoryNames="", $strParam="",$LinkPlaceHolder=""){ - - $paramset=""; - # fetching recordset till eof - while($row = mysql_fetch_array($query_result)){ - - if($LinkPlaceHolder==""){ - $paramset=""; - }else{ - # Getting link - $paramset="link=" . urlencode($this->getLinkFromPattern($row,$LinkPlaceHolder)); - } - if ($strParam=""){ - $strParam=$paramset; - }else{ - $strParam .= ";" . $paramset; - } - - # covert to set element and save to $partXML - if($db_field_CategoryNames==""){ - $data=@$row[$db_field_ChartData]; - if($strParam!="") - $this->addChartData($this->encodeSpecialChars($data),$strParam,"" ); - else - $this->addChartData($this->encodeSpecialChars($data)); - } - else{ - $data=@$row[$db_field_ChartData]; - $label=@$row[$db_field_CategoryNames]; - $this->addChartData($this->encodeSpecialChars($data),"name=" . $this->encodeSpecialChars($label) . ";" .$strParam,"" ); - } - - - } - - } - - - # setTLine create TrendLine parameter - function addTrendLine($strParam){ - $listArray=explode($this->del,$strParam); - foreach ($listArray as $valueArray) { - $paramValue=explode("=",$valueArray); - if($this->validateParam($paramValue)==true){ - $this->trendLines[$this->tLineCounter][$paramValue[0]]=$this->encodeSpecialChars($paramValue[1]); - } - } - $this->tLineCounter++; - } - - - #this function sets chart messages - function setChartMessage($strParam){ - $this->chartMSG="?"; - $listArray=explode($this->del,$strParam); - foreach ($listArray as $valueArray) { - $paramValue=explode("=",$valueArray); - if($this->validateParam($paramValue)==true){ - $this->chartMSG.=$paramValue[0] . "=" . $this->encodeSpecialChars($paramValue[1]) . "&"; - } - } - $this->chartMSG=substr($this->chartMSG,0,strlen($this->chartMSG)-1); - } - - #### - This function is mostly for Future USE ----------------------------- - # set JS constructor of FusionCharts.js - function setAddChartParams($debugMode, $registerWithJS=0, $c="", $scaleMode="", $lang=""){ - $this->debugMode=$debugMode; - $this->registerWithJS=$registerWithJS; - $this->bgColor=$c; - $this->scaleMode=$scaleMode; - $this->lang=$lang; - - } - - - - # getXML render all class arrays to XML output - function getXML(){ - - $this->strXML=""; - # calling getChartParamsXML function for chart parameter - $this->strXML = "getChartParamsXML() . " >"; - if ($this->seriesType >= 0 and $this->seriesType <= 4) { - - # calling getCategoriesXML function for Category element - $this->strXML .= $this->getCategoriesXML(); - # calling getDatasetXML function for set element - $this->strXML .= $this->getDatasetXML(); - # calling getvTrendLinesXML function for vTrendLines element - if($this->seriesType==3){ - $this->strXML .= $this->getvTrendLinesXML(); - } - # Calling getLinesetXML - if($this->seriesType==4){ - $this->strXML .= $this->getLinesetXML(); - } - # calling getTrendLinesXML function for TrendLines element - $this->strXML .= $this->getTrendLinesXML(); - # calling getStylesXML function for Styles element - $this->strXML .= $this->getStylesXML(); - - }else if($this->seriesType == 5) { - $this->strXML .= $this->getGanttCategoriesXML(); - $this->strXML .= $this->getProcessesXML(); - $this->strXML .= $this->getGanttDatatableXML(); - $this->strXML .= $this->getTasksXML(); - $this->strXML .= $this->getConnectorsXML(); - $this->strXML .= $this->getMilestonesXML(); - # calling getTrendLinesXML function for TrendLines element - $this->strXML .= $this->getTrendLinesXML(); - # calling getStylesXML function for Styles element - $this->strXML .= $this->getStylesXML(); - $this->strXML .= $this->getLegendXML(); - } - - # Closing Chart element - $this->strXML .= ""; - - # Return XML output - return $this->strXML; - } - - # Function getXML render all class arrays to XML output - function renderChart(){ - - $this->strXML=$this->getXML(); - $this->SWFFile=$this->SWFPath . "FCF_" . $this->chartSWF[$this->chartType][0] . ".swf"; - # print the charts - print renderChart($this->SWFFile . $this->chartMSG,"",$this->strXML,$this->chartID, $this->width, $this->height,$this->debugMode,$this->registerWithJS,$this->bgColor,$this->scaleMode,$this->lang); - - } - - - # Renders Chart form External XML data source - function renderChartFromExtXML($dataXML){ - print renderChart($this->SWFFile,"",$dataXML,$this->chartID, $this->width, $this->height,$this->debugMode,$this->registerWithJS,$this->bgColor,$this->scaleMode,$this->lang); - } - - - -##------------ PRIVATE FUNCTIONS ---------------------------------------------------------------- - - # getDatasetXML create set chart xml - function getDatasetXML(){ - # Calling dataset function depending on seriesType - switch ($this->seriesType){ - case 1 : - return $this->getSSDatasetXML(); - break; - case 2 : - return $this->getMSDatasetXML(); - break; - case 3 : - return $this->getMSDatasetXML(); - break; - case 4 : - return $this->getMSStackedDatasetXML(); - break; - } - } - # By getChartParamsXML, we can fetch charts array and convert into XML - # and return like "caption='xyz' xAxisName='x side' ............ - function getChartParamsXML(){ - $partXML=""; - # feching charts each array and converting into chat parameter - foreach($this->chartParams as $part_type => $part_name){ - if($part_name!=""){ - $partXML .= $part_type . "='" . $this->encodeSpecialChars($part_name) . "' "; - } - } - # Return Chart Parameter - return $partXML; - } - - - # Function getCategoriesXML for getting Category part XML - function getCategoriesXML(){ - if($this->seriesType>1){ - $partXML=""; - # adding categories parameter - $partXML="categoriesParam . " >"; - if($this->categoryNamesCounter>1){ - foreach($this->categoryNames as $part_type => $part_name){ - if($part_name!=""){ - # adding elements - if($part_name!="Array"){ - $partXML .= $part_name; - } - } - } - } - # Closing - $partXML .=""; - return $partXML; - } - } - # creating single set element - # - # - - function getSSDatasetXML(){ - if($this->seriesType==1){ - $partXML=""; - foreach($this->dataset as $part_type => $part_name){ - if($part_name!=""){ - # adding elements - if($part_name!="Array"){ - $partXML .= $part_name; - } - } - } - return $partXML; - } - } - - # getMSDatasetXML for getting datset part XML - # - # - # - # - function getMSDatasetXML(){ - if($this->seriesType>1){ - $partXML=""; - foreach($this->dataset as $part_type => $part_name){ - $partXML .="datasetParam[$part_type] . " >"; - foreach($this->dataset[$part_type] as $part_type1 => $part_name1){ - if($part_name1!=""){ - # Adding elements - if($part_name1!="Array"){ - $partXML .= $part_name1; - } - } - } - $partXML .=""; - } - return $partXML; - } - } - - - # getTrendLinesXML create XML output depending on trendLines array - # - # - # - function getTrendLinesXML(){ - $partXML=""; - $lineXML=""; - # fetching trendLines array - foreach($this->trendLines as $l_type => $l_name){ - # staring line element - $lineXML .="trendLines[$l_type] as $part_type => $part_name){ - if($part_name!=""){ - $lineXML .= $part_type . "='" . $this->encodeSpecialChars($part_name) . "' "; - } - } - # close line element - $lineXML .=" />"; - } - # if line element present then adding $lineXML with in trendLines element - - $pos = strpos($lineXML, "="); - if ($pos!==false){ - $partXML = "" . $lineXML . ""; - }else{ - # return nothing - $partXML=""; - } - # return trendLines xml - return $partXML; - } - - - - # adding set element to dataset element for seriesType 1 and 2 - function setSSMSDataArray($value="",$setParam="",$vlineParam = "" ){ - $strSetXML=""; - $strParam=""; - $color=0; - if($vlineParam==""){ - if($setParam!=""){ - $listArray=explode($this->del,$setParam); - # parameter creating - foreach ($listArray as $valueArray) { - if(trim($valueArray)!=""){ - $paramValue=explode("=",$valueArray); - if($this->validateParam($paramValue)==true){ - $strParam .= $paramValue[0] . "='" . $this->encodeSpecialChars($paramValue[1]) . "' "; - if(strtolower(trim($paramValue[0]))=="color"){ - $color=1; - } - } - } - } - } - - - - $colorSet=""; - if($this->seriesType==1 && (gettype(strpos($this->chartType,"pie"))=="boolean" && gettype(strpos($this->chartType,"line"))=="boolean" && gettype(strpos($this->chartType,"area"))=="boolean")){ - if($color==0){ - $colorSet=" color='" . $this->getColor($this->setCounter) . "' "; - } - } - - # setting set parameter - $strSetXML =""; - - }else{ - $listArray=explode($this->del,$vlineParam); - foreach ($listArray as $valueArray) { - if(trim($valueArray)!=""){ - $paramValue=explode("=",$valueArray); - if($this->validateParam($paramValue)==true){ - $strParam .= $paramValue[0] . "='" . $this->encodeSpecialChars($paramValue[1]) . "' "; - } - } - } - # setting vline parameter - $strSetXML=""; - } - return $strSetXML; - } - - - - - - ## - - - - - - Array Init Functions - - --- - -- - - - - - - -- - - - - - - - # Function createCategory create array element with in Categories - function createCategory($catID){ - $this->categoryNames[$catID]= array(); - } - # createDataset dataset array element - function createDataset($dataID){ - $this->dataset[$dataID]= array(); - } - # creating set dataset array element - function createDataValues($datasetID, $dataID){ - $this->dataset[$datasetID][$dataID]= array(); - } - # createTrendLines create TrendLines array - function createTrendLines($lineID){ - $this->trendLines[$lineID] = array(); - } - # setTLine create TrendLine parameter - function setTLine($lineID,$paramName, $paramValue){ - $this->trendLines[$lineID][$paramName]=$paramValue; - } - - - # ----- ---------- ----- Misc utility functions ---- ------ ----------- - - # converting ' and " to %26apos; and " - function encodeSpecialChars($strValue){ - - $strValue=str_replace("'","%26apos;",$strValue); - $strValue=str_replace("\"",""",$strValue); - $strValue=str_replace("<","<",$strValue); - $strValue=str_replace(">",">",$strValue); - return $strValue; - } - - # Its convert pattern link to original link - # abcd.php?cid=##Field_name_1##&pname=##Field_name_2## - function getLinkFromPattern($row,$tempLink){ - # convert link into array break on '##' - $aa=explode("##",$tempLink); - # Reading array - foreach($aa as $v){ - # Finding '=' into array - $pos = strpos($v, "="); - # not found '=' - if($pos === false){ - if($v!=""){ - $pet="##" . $v . "##"; - $tempLink=str_replace($pet,$row[$v],$tempLink); - } - } - } - return $tempLink; - } - - - function validateParam($paramValue){ - if(count($paramValue)>=2){ - if(trim($paramValue[0])==""){ - return false; - } - if(trim($paramValue[1])==""){ - return false; - } - return true; - }else{ - return false; - } - } - - - - - # Getting Charts series type from charts array. 1 => single series, 2=> multi-series, 3=> scatter and bubble, 4=> MSStacked. defult 1 => single series - function getSeriesType(){ - $sValue=1; - if(is_array($this->chartSWF[$this->chartType])){ - $sValue=$this->chartSWF[$this->chartType][1]; - }else{ - $sValue=1; - } - $this->seriesType=$sValue; - } - - #this function returns a color from a list of colors - function getColor($counter){ - return $this->arr_FCColors[$counter % count($this->arr_FCColors)]; - } - - ### ----- Pupulate Color and Chart SWF array ------ ------- --------------------- - function colorInit(){ - $this->arr_FCColors[] = "AFD8F8"; - $this->arr_FCColors[] = "F6BD0F"; - $this->arr_FCColors[] = "8BBA00"; - $this->arr_FCColors[] = "A66EDD"; - $this->arr_FCColors[] = "F984A1" ; - $this->arr_FCColors[] = "CCCC00" ;//Chrome Yellow+Green - $this->arr_FCColors[] = "999999" ;//Grey - $this->arr_FCColors[] = "0099CC" ;//Blue Shade - $this->arr_FCColors[] = "FF0000" ;//Bright Red - $this->arr_FCColors[] = "006F00" ;//Dark Green - $this->arr_FCColors[] = "0099FF"; //Blue (Light) - $this->arr_FCColors[] = "FF66CC" ;//Dark Pink - $this->arr_FCColors[] = "669966" ;//Dirty green - $this->arr_FCColors[] = "7C7CB4" ;//Violet shade of blue - $this->arr_FCColors[] = "FF9933" ;//Orange - $this->arr_FCColors[] = "9900FF" ;//Violet - $this->arr_FCColors[] = "99FFCC" ;//Blue+Green Light - $this->arr_FCColors[] = "CCCCFF" ;//Light violet - $this->arr_FCColors[] = "669900" ;//Shade of green - $this->arr_FCColors[] = "1941A5" ;//Dark Blue - } - - - - # Setting FusionCharts SWF file array list and series - function setChartArrays(){ - - $this->chartSWF['area2d'][0]="Area2D"; - $this->chartSWF['area2d'][1]=1; - $this->chartSWF['bar2d'][0]="Bar2D"; - $this->chartSWF['bar2d'][1]=1; - $this->chartSWF['column2d'][0]="Column2D"; - $this->chartSWF['column2d'][1]=1; - $this->chartSWF['column3d'][0]="Column3D"; - $this->chartSWF['column3d'][1]=1; - $this->chartSWF['doughnut2d'][0]="Doughnut2D"; - $this->chartSWF['doughnut2d'][1]=1; - $this->chartSWF['doughnut3d'][0]="Doughnut3D"; - $this->chartSWF['doughnut3d'][1]=1; - $this->chartSWF['line'][0]="Line"; - $this->chartSWF['line'][1]=1; - $this->chartSWF['pie2d'][0]="Pie2D"; - $this->chartSWF['pie2d'][1]=1; - $this->chartSWF['pie3d'][0]="Pie3D"; - $this->chartSWF['pie3d'][1]=1; - $this->chartSWF['funnel'][0]="Funnel"; - $this->chartSWF['funnel'][1]=1; - - $this->chartSWF['msarea'][0]="MSArea"; - $this->chartSWF['msarea'][1]=2; - $this->chartSWF['msarea2d'][0]="MSArea2D"; - $this->chartSWF['msarea2d'][1]=2; - $this->chartSWF['msbar2d'][0]="MSBar2D"; - $this->chartSWF['msbar2d'][1]=2; - $this->chartSWF['mscolumn2d'][0]="MSColumn2D"; - $this->chartSWF['mscolumn2d'][1]=2; - $this->chartSWF['mscolumn3d'][0]="MSColumn3D"; - $this->chartSWF['mscolumn3d'][1]=2; - $this->chartSWF['mscolumn3dlinedy'][0]="MSColumn3DLineDY"; - $this->chartSWF['mscolumn3dlinedy'][1]=2; - $this->chartSWF['mscolumnLine3D'][0]="MSColumnLine3D"; - $this->chartSWF['mscolumnLine3D'][1]=2; - $this->chartSWF['mscombi2d'][0]="MSCombi2D"; - $this->chartSWF['mscombi2d'][1]=2; - $this->chartSWF['mscombidy2d'][0]="MSCombiDY2D"; - $this->chartSWF['mscombidy2d'][1]=2; - $this->chartSWF['msline'][0]="MSLine"; - $this->chartSWF['msline'][1]=2; - $this->chartSWF['scrollarea2d'][0]="ScrollArea2D"; - $this->chartSWF['scrollarea2d'][1]=2; - $this->chartSWF['scrollcolumn2d'][0]="ScrollColumn2D"; - $this->chartSWF['scrollcolumn2d'][1]=2; - $this->chartSWF['scrollcombi2d'][0]="ScrollCombi2D"; - $this->chartSWF['scrollcombi2d'][1]=2; - $this->chartSWF['scrollcombidy2d'][0]="ScrollCombiDY2D"; - $this->chartSWF['scrollcombidy2d'][1]=2; - $this->chartSWF['scrollline2d'][0]="ScrollLine2D"; - $this->chartSWF['scrollline2d'][1]=2; - $this->chartSWF['scrollstackedcolumn2d'][0]="ScrollStackedColumn2D"; - $this->chartSWF['scrollstackedcolumn2d'][1]=2; - $this->chartSWF['stackedarea2d'][0]="StackedArea2D"; - $this->chartSWF['stackedarea2d'][1]=2; - $this->chartSWF['stackedbar2d'][0]="StackedBar2D"; - $this->chartSWF['stackedbar2d'][1]=2; - $this->chartSWF['stackedbar3d'][0]="StackedBar3D"; - $this->chartSWF['stackedbar3d'][1]=2; - $this->chartSWF['stackedcolumn2d'][0]="StackedColumn2D"; - $this->chartSWF['stackedcolumn2d'][1]=2; - $this->chartSWF['stackedcolumn3d'][0]="StackedColumn3D"; - $this->chartSWF['stackedcolumn3d'][1]=2; - $this->chartSWF['stackedcolumn3dlinedy'][0]="StackedColumn3DLineDY"; - $this->chartSWF['stackedcolumn3dlinedy'][1]=2; - $this->chartSWF['mscolumn2dlinedy'][0]="MSColumn2DLineDY"; - $this->chartSWF['mscolumn2dlinedy'][1]=2; - - - $this->chartSWF['bubble'][0]="Bubble"; - $this->chartSWF['bubble'][1]=3; - $this->chartSWF['scatter'][0]="Scatter"; - $this->chartSWF['scatter'][1]=3; - - $this->chartSWF['msstackedcolumn2dlinedy'][0]="MSStackedColumn2DLineDY"; - $this->chartSWF['msstackedcolumn2dlinedy'][1]=4; - $this->chartSWF['msstackedcolumn2d'][0]="MSStackedColumn2D"; - $this->chartSWF['msstackedcolumn2d'][1]=2; - - $this->chartSWF['gantt'][0]="Gantt"; - $this->chartSWF['gantt'][1]=5; - } - - ####################### GANTT CHART (start) ###################################### - # ----------- Public Functions ----------------------------------------------- - - # Function addCategory adding Category and vLine element - function addGanttCategorySet($catParam=""){ - $this->GT_categories_Counter++; - $this->GT_categories[$this->GT_categories_Counter]= array(); - $strParam=""; - - # cheking catParam not blank - if($catParam!=""){ - $listArray=explode($this->del,$catParam); - foreach ($listArray as $valueArray) { - $paramValue=explode("=",$valueArray); - if($this->validateParam($paramValue)==true){ - # creating parameter set - $strParam .= $paramValue[0] . "='" . $this->encodeSpecialChars($paramValue[1]) . "' "; - } - } - } - - $this->GT_categoriesParam[$this->GT_categories_Counter]=$strParam; - } - # Function addGanttCategory adding Category - function addGanttCategory($label="",$catParam=""){ - - $strCatXML=""; - $strParam=""; - - # cheking catParam not blank - if($catParam!=""){ - $listArray=explode($this->del,$catParam); - foreach ($listArray as $valueArray) { - $paramValue=explode("=",$valueArray); - if($this->validateParam($paramValue)==true){ - # creating parameter set - $strParam .= $paramValue[0] . "='" . $this->encodeSpecialChars($paramValue[1]) . "' "; - } - } - } - # adding label and parameter set to category - $strCatXML =""; - - # storing into GT_categories array - $this->GT_categories[$this->GT_categories_Counter][$this->GT_subcategories_Counter]=$strCatXML; - # Increase Counter - $this->GT_subcategories_Counter++; - } - - # Setting Process Parameter into categoriesParam variables - function setGanttProcessesParams($strParam){ - $listArray=explode($this->del,$strParam); - # Fetching all value and converting into xml attribute - foreach ($listArray as $valueArray) { - $paramValue=explode("=",$valueArray); - if($this->validateParam($paramValue)==true){ - $this->GT_processes_Param .= $paramValue[0] . "='" . $this->encodeSpecialChars($paramValue[1]) . "' "; - } - } - } - - # Function addGanttProcess adding Process - function addGanttProcess($label="",$catParam=""){ - - $strCatXML=""; - $strParam=""; - - # cheking catParam not blank - if($catParam!=""){ - $listArray=explode($this->del,$catParam); - foreach ($listArray as $valueArray) { - $paramValue=explode("=",$valueArray); - if($this->validateParam($paramValue)==true){ - # creating parameter set - $strParam .= $paramValue[0] . "='" . $this->encodeSpecialChars($paramValue[1]) . "' "; - } - } - } - # adding label and parameter set to category - $strCatXML =""; - - # storing into categoryNames array - $this->GT_processes[$this->GT_processes_Counter]=$strCatXML; - # Increase Counter - $this->GT_processes_Counter++; - } - - - - # Setting Tasks Parameter into TaskParam variables - function setGanttTasksParams($strParam){ - $listArray=explode($this->del,$strParam); - # Fetching all value and converting into xml attribute - foreach ($listArray as $valueArray) { - $paramValue=explode("=",$valueArray); - if($this->validateParam($paramValue)==true){ - - $this->GT_Tasks_Param .= $paramValue[0] . "='" . $this->encodeSpecialChars($paramValue[1]) . "' "; - - - } - } - } - - # Function addGanttTasks adding Tasks - function addGanttTask($label="",$catParam=""){ - - $strCatXML=""; - $strParam=""; - - # cheking catParam not blank - if($catParam!=""){ - $listArray=explode($this->del,$catParam); - foreach ($listArray as $valueArray) { - $paramValue=explode("=",$valueArray); - if($this->validateParam($paramValue)==true){ - # creating parameter set - if(trim(strtolower($paramValue[0]))=="link"){ - $strParam .= $paramValue[0] . "='" . urldecode($paramValue[1]) . "' "; - }else{ - $strParam .= $paramValue[0] . "='" . $this->encodeSpecialChars($paramValue[1]) . "' "; - } - } - } - } - # adding label and parameter set to category - $strCatXML =""; - - # storing into GT_Tasks array - $this->GT_Tasks[$this->GT_Tasks_Counter]=$strCatXML; - # Increase Counter - $this->GT_Tasks_Counter++; - } - - - - # Setting Tasks Parameter into ConnectorsParam variables - function setGanttConnectorsParams($strParam){ - $listArray=explode($this->del,$strParam); - # Fetching all value and converting into xml attribute - foreach ($listArray as $valueArray) { - $paramValue=explode("=",$valueArray); - if($this->validateParam($paramValue)==true){ - $this->GT_Connectors_Param .= $paramValue[0] . "='" . $this->encodeSpecialChars($paramValue[1]) . "' "; - } - } - } - - # Function addGanttConnector adding Connector - function addGanttConnector($From,$To,$catParam=""){ - - $strCatXML=""; - $strParam=""; - - # cheking catParam not blank - if($catParam!=""){ - $listArray=explode($this->del,$catParam); - foreach ($listArray as $valueArray) { - $paramValue=explode("=",$valueArray); - if($this->validateParam($paramValue)==true){ - # creating parameter set - $strParam .= $paramValue[0] . "='" . $this->encodeSpecialChars($paramValue[1]) . "' "; - } - } - } - # adding label and parameter set to category - $strCatXML =""; - - # storing into GT_Connectors array - $this->GT_Connectors[$this->GT_Connectors_Counter]=$strCatXML; - # Increase Counter - $this->GT_Connectors_Counter++; - } - - - - # Setting Milestones Parameter into MilestonesParam variables - function setGanttMilestonesParams($strParam){ - $listArray=explode($this->del,$strParam); - # Fetching all value and converting into xml attribute - foreach ($listArray as $valueArray) { - $paramValue=explode("=",$valueArray); - if($this->validateParam($paramValue)==true){ - $this->GT_Milestones_Param .= $paramValue[0] . "='" . $this->encodeSpecialChars($paramValue[1]) . "' "; - } - } - } - - # Function addGanttMilestones adding Milestones - function addGanttMilestone($taskID,$catParam=""){ - - $strCatXML=""; - $strParam=""; - - # cheking catParam not blank - if($catParam!=""){ - $listArray=explode($this->del,$catParam); - foreach ($listArray as $valueArray) { - $paramValue=explode("=",$valueArray); - if($this->validateParam($paramValue)==true){ - # creating parameter set - $strParam .= $paramValue[0] . "='" . $this->encodeSpecialChars($paramValue[1]) . "' "; - } - } - } - # adding label and parameter set to Milestones - $strCatXML =""; - - # storing into GT_Milestones array - $this->GT_Milestones[$this->GT_Milestones_Counter]=$strCatXML; - # Increase Counter - $this->GT_Milestones_Counter++; - } - - - - # Setting Legend Parameter into LegendParam variables - function setGanttLegendParams($strParam){ - $listArray=explode($this->del,$strParam); - # Fetching all value and converting into xml attribute - foreach ($listArray as $valueArray) { - $paramValue=explode("=",$valueArray); - if($this->validateParam($paramValue)==true){ - $this->GT_legend_Param .= $paramValue[0] . "='" . $this->encodeSpecialChars($paramValue[1]) . "' "; - } - } - } - - # Function addGanttLegendItem adding LegendItem - function addGanttLegendItem($label,$catParam=""){ - - $strCatXML=""; - $strParam=""; - - # cheking catParam not blank - if($catParam!=""){ - $listArray=explode($this->del,$catParam); - foreach ($listArray as $valueArray) { - $paramValue=explode("=",$valueArray); - if($this->validateParam($paramValue)==true){ - # creating parameter set - $strParam .= $paramValue[0] . "='" . $this->encodeSpecialChars($paramValue[1]) . "' "; - } - } - } - # adding label and parameter set to LegendItem - $strCatXML =""; - - # storing into GT_legend array - $this->GT_legend[$this->GT_legend_Counter]=$strCatXML; - # Increase Counter - $this->GT_legend_Counter++; - } - - - - - - # Setting Datatable Parameter into DatatableParam variables - function setGanttDatatableParams($strParam){ - $listArray=explode($this->del,$strParam); - # Fetching all value and converting into xml attribute - foreach ($listArray as $valueArray) { - $paramValue=explode("=",$valueArray); - if($this->validateParam($paramValue)==true){ - $this->GT_datatableParam .= $paramValue[0] . "='" . $this->encodeSpecialChars($paramValue[1]) . "' "; - } - } - } - # Function addGanttDatacolumn adding Datacolumn - function addGanttDatacolumn($catParam=""){ - $this->GT_datatable_Counter++; - $this->GT_datatable[$this->GT_datatable_Counter]= array(); - $strParam=""; - - # cheking catParam not blank - if($catParam!=""){ - $listArray=explode($this->del,$catParam); - foreach ($listArray as $valueArray) { - $paramValue=explode("=",$valueArray); - if($this->validateParam($paramValue)==true){ - # creating parameter set - $strParam .= $paramValue[0] . "='" . $this->encodeSpecialChars($paramValue[1]) . "' "; - } - } - } - - $this->GT_dataColumnParam[$this->GT_datatable_Counter]=$strParam; - } - # Function addGanttColumnText adding ColumnText - function addGanttColumnText($label="",$catParam=""){ - - $strCatXML=""; - $strParam=""; - - # cheking catParam not blank - if($catParam!=""){ - $listArray=explode($this->del,$catParam); - foreach ($listArray as $valueArray) { - $paramValue=explode("=",$valueArray); - if($this->validateParam($paramValue)==true){ - # creating parameter set - $strParam .= $paramValue[0] . "='" . $this->encodeSpecialChars($paramValue[1]) . "' "; - } - } - } - # adding label and parameter set to category - $strCatXML =""; - - # storing into GT_datatable array - $this->GT_datatable[$this->GT_datatable_Counter][$this->GT_subdatatable_Counter]=$strCatXML; - # Increase Counter - $this->GT_subdatatable_Counter++; - } - - ### ------------- Gantt Private Functoins ---------------------------------------------------------------------- - - #-- Gantt array init ------------------------------------------------ - # Function createCategory create array element with in Categories - function createGanttCategory($catID){ - $this->GT_categories[$catID]= array(); - } - # Function createGanttDatatable create array element with in Datatable - function createGanttDatatable($catID){ - $this->GT_datatable[$catID]= array(); - } - - - #-- GANTT XML genetators ------------------------------------------- - - # Function getCategoriesXML for getting Category part XML - function getGanttCategoriesXML(){ - $partXML=""; - foreach($this->GT_categories as $part_type => $part_name){ - # adding categories parameter - $partXML .="GT_categoriesParam[$part_type] . " >"; - foreach($this->GT_categories[$part_type] as $part_type1 => $part_name1){ - if($part_name1!=""){ - # adding elements - $partXML .= $part_name1; - } - } - # Closing - $partXML .=""; - } - - return $partXML; - } - - # Function getProcessesXML for getting Processes part XML - function getProcessesXML(){ - - $partXML=""; - # adding processes parameter - $partXML="GT_processes_Param . " >"; - foreach($this->GT_processes as $part_type => $part_name){ - if($part_name!=""){ - # adding elements - - $partXML .= $part_name; - - } - } - - # Closing - $partXML .=""; - return $partXML; - } - - - # Function getProcessesXML for getting Processes part XML - function getTasksXML(){ - - $partXML=""; - # adding processes parameter - $partXML="GT_Tasks_Param . " >"; - foreach($this->GT_Tasks as $part_type => $part_name){ - if($part_name!=""){ - # adding elements - - $partXML .= $part_name; - - } - } - - # Closing - $partXML .=""; - return $partXML; - } - - - # Function getConnectorsXML for getting Connectors part XML - function getConnectorsXML(){ - $c=0; - $partXML=""; - # adding connectors parameter - $partXML="GT_Connectors_Param . " >"; - foreach($this->GT_Connectors as $part_type => $part_name){ - if($part_name!=""){ - # adding elements - - $partXML .= $part_name; - $c++; - } - } - - # Closing - $partXML .=""; - if ($c>0){ - return $partXML; - }else{ - return ""; - } - } - - # Function getMilestonesXML for getting Milestones part XML - function getMilestonesXML(){ - $c=0; - $partXML=""; - # adding Milestones parameter - $partXML="GT_Milestones_Param . " >"; - foreach($this->GT_Milestones as $part_type => $part_name){ - if($part_name!=""){ - # adding elements - $partXML .= $part_name; - $c++; - } - } - - # Closing - $partXML .=""; - if ($c>0) { - return $partXML; - }else{ - return ""; - } - } - - - # Function getLegendXML for getting Legend part XML - function getLegendXML(){ - $c=0; - $partXML=""; - # adding Legend parameter - $partXML="GT_legend_Param . " >"; - foreach($this->GT_legend as $part_type => $part_name){ - if($part_name!=""){ - # adding elements - $partXML .= $part_name; - $c++; - } - } - - # Closing - $partXML .=""; - if ($c>0) { - return $partXML; - }else{ - return ""; - } - } - - - # Function getGanttDatatableXML for getting Category part XML - function getGanttDatatableXML(){ - $partXML=""; - foreach($this->GT_datatable as $part_type => $part_name){ - # adding dataColumn parameter - $partXML .="GT_dataColumnParam[$part_type] . " >"; - foreach($this->GT_datatable[$part_type] as $part_type1 => $part_name1){ - if($part_name1!=""){ - # adding elements - $partXML .= $part_name1; - } - } - # Closing - $partXML .=""; - } - $allPart="GT_datatableParam . " >" . $partXML . ""; - return $allPart; - } - - - - ####################### GANTT CHART (end) ###################################### - - - - #====================== For Future Use (start) ===================================== - - ##---------PUBLIC functions ---------------------------------------------------- - # adding Lineset array and parameter to it - function addLineset($seriesName, $strParam){ - $this->createLineset(); - $this->lineSetCounter++; - $this->lineSet[$this->lineCounter][$this->lineSetCounter]= array(); - - $tempParam=""; - $tempParam ="seriesName='" . $seriesName . "' "; - $listArray=explode($this->del,$strParam); - foreach ($listArray as $valueArray) { - $paramValue=explode("=",$valueArray); - if($this->validateParam($paramValue)==true){ - # adding parameter - $tempParam .= $paramValue[0] . "='" . $this->encodeSpecialChars($paramValue[1]) . "' "; - } - } - - $this->lineIDCounter++; - # setting lineSetParam array with Parameter set - $this->lineSetParam [$this->lineSetCounter]=$tempParam; - - - } - - # adding Line's Set data - function addLinesetData($value="",$setParam="",$vlineParam = "" ){ - $strSetXML=""; - # getting parameter set - $strSetXML=$this->setSSMSDataArray($value,$setParam,$vlineParam); - - # setting paramter to lineSet array - $this->lineSet[$this->lineCounter][$this->lineSetCounter][$this->lineIDCounter]=$strSetXML; - - # Increase lineIDCounter - $this->lineIDCounter++; - } - - - # adding ms dataset and parameter - function addMSSSubDataset($seriesName, $strParam){ - $this->MSSSubDatasetCounter++; - $this->MSSDataset[$this->MSSDatasetCounter][$this->MSSSubDatasetCounter]= array(); - - $tempParam=""; - # creating seriesName - $tempParam ="seriesName='" . $seriesName . "' "; - $listArray=explode($this->del,$strParam); - foreach ($listArray as $valueArray) { - $paramValue=explode("=",$valueArray); - if($this->validateParam($paramValue)==true){ - # creatting MSSDataset parameter set - $tempParam .= $paramValue[0] . "='" . $this->encodeSpecialChars($paramValue[1]) . "' "; - } - } - - $this->MSSSetCounter++; - - # adding Parameter to MSSDatasetParams array - $this->MSSDatasetParams[$this->MSSDatasetCounter][$this->MSSSubDatasetCounter]=$tempParam; - - // $this->createMSSSetData(); - - } - - # adding set element to dataset element for seriesType 3 - function setScatterBubbleDataArray($value="",$setParam="",$vlineParam = "" ){ - $strSetXML=""; - $strParam=""; - if($vlineParam==""){ - if($setParam!=""){ - # parameter for set - $listArray=explode($this->del,$setParam); - foreach ($listArray as $valueArray) { - $paramValue=explode("=",$valueArray); - # creating parameter sets - $strParam .= $paramValue[0] . "='" . $this->encodeSpecialChars($paramValue[1]) . "' "; - } - } - # adding Parameter into set elements - $strSetXML =""; - - }else{ - # Parameter for vLine - $listArray=explode($this->del,$vlineParam); - foreach ($listArray as $valueArray) { - $paramValue=explode("=",$valueArray); - if($this->validateParam($paramValue)==true){ - $strParam .= $paramValue[0] . "='" . $this->encodeSpecialChars($paramValue[1]) . "' "; - } - } - - # adding vLine element - $strSetXML=""; - } - return $strSetXML; - } - - - # setvTLine create TrendLine parameter - function setVTrendLines($strParam){ - $listArray=explode($this->del,$strParam); - foreach ($listArray as $valueArray) { - $paramValue=explode("=",$valueArray); - if($this->validateParam($paramValue)==true){ - $this->vtrendLines[$this->vtLineCounter][$paramValue[0]]=$this->encodeSpecialChars($paramValue[1]); - } - } - $this->vtLineCounter++; - } - - - # setSubStylesParam create sub styles array to store parameters - function addStyleDef($styleName,$styleType,$strParam){ - $this->styles["definition"]["style"][$this->styleDefCounter]["name"]= $styleName; - $this->styles["definition"]["style"][$this->styleDefCounter]["type"]= $styleType; - - $listArray=explode($this->del,$strParam); - foreach ($listArray as $valueArray) { - $paramValue=explode("=",$valueArray); - if($this->validateParam($paramValue)==true){ - $this->styles["definition"]["style"][$this->styleDefCounter][$paramValue[0]]= $this->encodeSpecialChars($paramValue[1]); - } - } - $this->styleDefCounter++; - - } - # apply styles - function addStyleApp($toObject,$styles){ - $this->styles["application"]["apply"][$this->styleAppCounter]["toObject"]= $toObject; - $this->styles["application"]["apply"][$this->styleAppCounter]["styles"]= $styles; - - $this->styleAppCounter++; - } - - - ##---------PRIVATE functions ---------------------------------------------------- - - ## - -- - - XML generators - - - - ---- - -- - - - - - # Function getLinesetXML for getting Lineset XML - function getLinesetXML(){ - # if seriesType MSStackedColumn2DLineDY (4) then linset element will be Generate - if($this->seriesType==4){ - $partXML=""; - # Fetching lineSet array and Generating lineset xml element - foreach($this->lineSet as $part_type => $part_name){ - $partXML .= "lineSetParam[$part_type] . " >"; - foreach($this->lineSet[$part_type] as $part_type1 => $part_name1){ - foreach($this->lineSet[$part_type][$part_type1] as $part_type2 => $part_name2){ - if ($part_type2!=""){ - $partXML .= $part_name2; - } - } - } - $partXML .= ""; - } - return $partXML; - } - } - - # Function getMSStackedDatasetXML for getting datset part XML from ms stacked chart dataset array - # - # - # - # - # - # - - function getMSStackedDatasetXML(){ - if($this->seriesType==4){ - $partXML=""; - - foreach($this->MSSDataset as $part_type => $part_name){ - $partXML .= ""; - foreach($this->MSSDataset[$part_type] as $part_type1 => $part_name1){ - $partXML .= "MSSDatasetParams[$part_type][$part_type1] . " >"; - foreach($this->MSSDataset[$part_type][$part_type1] as $part_type2 => $part_name2){ - if ($part_type2!=""){ - $partXML .= $part_name2; - } - } - $partXML .= ""; - } - $partXML .= ""; - } - - return $partXML; - } - } - - - - - # getvTrendLinesXML create XML output depending on trendLines array - # - # - # - function getvTrendLinesXML(){ - $partXML=""; - $lineXML=""; - # fetching vtrendLines array - foreach($this->vtrendLines as $l_type => $l_name){ - # staring line element - $lineXML .="vtrendLines[$l_type] as $part_type => $part_name){ - if($part_name!=""){ - $lineXML .= $part_type . "='" . $this->encodeSpecialChars($part_name) . "' "; - } - } - # close line element - $lineXML .=" />"; - } - # if line element present then adding $lineXML with in vtrendLines element - $pos = strpos($lineXML, "="); - if ($pos !== false) { - $partXML = "" . $lineXML . ""; - }else{ - # return nothing - $partXML=""; - } - # return vtrendLines xml - return $partXML; - } - # getStylesXML create the styles XML from styles array - /* - - -