$data[6][1] = "13"; $data[6][2] = "18"; $data[6][3] = "Task B"; $data[6][4] = "B'"; $data[6][5] = "red"; $data[6][6] = "white"; $data[7][0] = "3"; $data[7][1] = "13"; $data[7][2] = "22"; $data[7][3] = "Task C"; $data[7][4] = "C'"; $data[7][5] = "red"; $data[7][6] = "white"; $data[8][0] = "4"; $data[8][1] = "13"; $data[8][2] = "23"; $data[8][3] = "Task D"; $data[8][4] = "D'"; $data[8][5] = "red"; $data[8][6] = "white"; $rlib = rlib_init(); rlib_add_datasource_array($rlib, "local_array"); rlib_add_query_as($rlib, "local_array", "header_data", "header_data"); rlib_add_query_as($rlib, "local_array", "data", "data"); rlib_set_output_parameter($rlib, "html_image_directory", "/tmp"); rlib_set_output_parameter($rlib, "trim_links", "1"); rlib_add_report($rlib, "gantt.xml"); rlib_set_output_format_from_text($rlib, "html"); rlib_execute($rlib); rlib_spool($rlib); rlib_free($rlib);
<?php $data[0] = array('company', 'region', 'district', 'store', 'sales'); $data[1] = array('Foo, Inc.', 'Region A', 'District X', 'Store #1', 1500.0); $data[2] = array('Foo, Inc.', 'Region A', 'District X', 'Store #2', 1300.0); $data[3] = array('Foo, Inc.', 'Region A', 'District Y', 'Store #3', 2000.0); $data[4] = array('Foo, Inc.', 'Region A', 'District Y', 'Store #4', 1800.0); $data[5] = array('Foo, Inc.', 'Region B', 'District M', 'Store #11', 2500.0); $data[6] = array('Foo, Inc.', 'Region B', 'District M', 'Store #12', 2300.0); $data[7] = array('Foo, Inc.', 'Region B', 'District N', 'Store #13', 3000.0); $data[8] = array('Foo, Inc.', 'Region B', 'District N', 'Store #14', 2800.0); $rlib = rlib_init(); rlib_version(); rlib_add_datasource_array($rlib, "local_array"); rlib_add_query_as($rlib, "local_array", "data", "data"); $output_format = 'xml'; if (isset($argv[1])) { $output_format = $argv[1]; } rlib_add_report($rlib, "breaks.xml"); rlib_set_output_format_from_text($rlib, $output_format); rlib_set_output_parameter($rlib, "debugging", "yes"); rlib_set_output_parameter($rlib, "only_quote_strings", "yes"); rlib_set_locale($rlib, "en_US"); rlib_execute($rlib); // header(rlib_get_content_type($rlib)); rlib_spool($rlib); rlib_free($rlib);
<?php $rlib = rlib_init(); rlib_add_datasource_csv($rlib, "local_csv"); rlib_add_query_as($rlib, "local_csv", "data.csv", "data"); rlib_add_report($rlib, "csv.xml"); rlib_set_output_format_from_text($rlib, "json"); rlib_set_output_parameter($rlib, "debugging", "yes"); rlib_execute($rlib); header(rlib_get_content_type($rlib)); rlib_spool($rlib); rlib_free($rlib);