Ejemplo n.º 1
9
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 */
/**
 *     \file       /reports/report.php
 *     \ingroup    2report
 *     \brief      Page to launch a report
 *     \author	   Juanjo Menent
 */
require "./pre.inc.php";
require_once "./includes/reportico/reportico.php";
$langs->load("reports@reports");
$mode = GETPOST("execute_mode");
$report = GETPOST("xmlin");
$leftmenu = GETPOST("leftmenu");
$helpurl = 'EN:Module_Reports|FR:Module_Reports_FR|ES:M&oacute;dulo_Reports';
llxHeader('', '', $helpurl);
$a = new reportico();
$a->embedded_report = true;
$a->forward_url_get_parameters = "leftmenu=" . $leftmenu . "&execute_mode=" . $mode . "&project=Dolibarr&xmlin=" . $report;
$_SESSION['reportico']['forward_url_get_parameters'] = "leftmenu=" . $leftmenu . "&execute_mode=" . $mode . "&project=Dolibarr&xmlin=" . $report;
$a->execute();
llxFooter();
$db->close();
$atributos["nombreFormulario"] = $nombreFormulario;
$verificarFormulario = "1";
echo $this->miFormulario->formulario("inicio", $atributos);
//-------------Control Mensaje-----------------------
// ------------------Division para los botones-------------------------
require_once 'blocks/docencia/gestorReportes/script/reportico/reportico.php';
// Set the timezone according to system defaults
date_default_timezone_set(@date_default_timezone_get());
// Reserver 100Mb for running
ini_set("memory_limit", "100M");
// Allow a good time for long reports to run. Set to 0 to allow unlimited time
ini_set("max_execution_time", "90");
$conexion = "estructura";
$esteRecursoDB = $this->miConfigurador->fabricaConexiones->getRecursoDB($conexion);
$cadena_sql = $this->sql->cadena_sql("consultarDB", $conexion);
$acceso_bd = $esteRecursoDB->ejecutarAcceso($cadena_sql, "busqueda");
define('SW_FRAMEWORK_DB_DRIVER', 'pdo_mysql');
define('SW_FRAMEWORK_DB_USER', "'" . $acceso_bd[0]["usuario"] . "'");
define('SW_FRAMEWORK_DB_PASSWORD', "'" . $acceso_bd[0]["password"] . "'");
define('SW_FRAMEWORK_DB_HOST', "'" . $acceso_bd[0]["servidor"] . "'");
// Use ip:port to specifiy a non standard port
define('SW_FRAMEWORK_DB_DATABASE', "'" . $acceso_bd[0]["db"] . "'");
$reporte = new reportico();
$reporte->initial_project = "kyron";
$reporte->embedded_report = true;
$reporte->execute();
// Modificamos el archivo swutil.php para obtener el path correctamente, línea 956
//swoutput linea 3216
//Fin del Formulario
echo $this->miFormulario->formulario("fin");
ob_end_flush();
Ejemplo n.º 3
0
 /**
  * Functon: xml2query
  *
  * Analyses XML report definition and builds Reportico report instance from it
  * 
  */
 function xml2query()
 {
     if (array_key_exists("CogModule", $this->data)) {
         $q =& $this->data["CogModule"];
     } else {
         $q =& $this->data["Report"];
     }
     $criteria_links = array();
     // Generate Output Information...
     $ds = false;
     if (!$q) {
         return;
     }
     foreach ($q as $cogquery) {
         // Set Query Attributes
         foreach ($cogquery["Format"] as $att => $val) {
             $this->query->set_attribute($att, $val);
         }
         // Set DataSource
         if (isset($cogquery["Datasource"])) {
             foreach ($cogquery["Datasource"] as $att => $val) {
                 //if ( $att == "SourceType" )
                 //$this->query->source_type = $val;
                 if ($att == "SourceConnection") {
                     // No longer relevant - connections are not supplied in xml files
                 }
             }
         }
         // Set Query Columns
         if (!($ef =& $this->get_array_element($cogquery, "EntryForm"))) {
             $this->ErrorMsg = "No EntryForm tag within Format";
             return false;
         }
         if (!($qu =& $this->get_array_element($ef, "Query"))) {
             $this->ErrorMsg = "No Query tag within EntryForm";
             return false;
         }
         $this->query->table_text = $this->get_array_element($qu, "TableSql");
         $this->query->where_text = $this->get_array_element($qu, "WhereSql");
         $this->query->group_text = $this->get_array_element($qu, "GroupSql");
         $this->query->rowselection = $this->get_array_element($qu, "RowSelection");
         $has_cols = true;
         if ($qc =& $this->get_array_element($qu, "SQL")) {
             $this->query->sql_raw = $this->get_array_element($qc, "SQLRaw");
         }
         if (!($qc =& $this->get_array_element($qu, "QueryColumns"))) {
             $this->ErrorMsg = "No QueryColumns tag within Query";
             $has_cols = false;
         }
         // Generate reportico_query_column for each column found
         if ($has_cols) {
             foreach ($qc as $col) {
                 $in_query = true;
                 if (!$col["ColumnName"]) {
                     $in_query = false;
                 }
                 $this->query->create_criteria_column($col["Name"], $col["TableName"], $col["ColumnName"], $col["ColumnType"], $col["ColumnLength"], "###.##", $in_query);
                 // Set any Attributes
                 if ($fm =& $this->get_array_element($col, "Format")) {
                     foreach ($fm as $att => $val) {
                         $this->query->set_column_attribute($col["Name"], $att, $val);
                     }
                 }
             }
             // Generate Order By List
             if ($oc =& $this->get_array_element($qu, "OrderColumns")) {
                 // Generate reportico_query_column for each column found
                 foreach ($oc as $col) {
                     if (!$col["Name"]) {
                         return;
                     }
                     $this->query->create_order_column($col["Name"], $col["OrderType"]);
                 }
             }
             // Generate Query Assignments
             if ($as =& $this->get_array_element($ef, "Assignments")) {
                 foreach ($as as $col) {
                     if (array_key_exists("AssignName", $col)) {
                         $this->query->add_assignment($col["AssignName"], $col["Expression"], $col["Condition"]);
                     } else {
                         $this->query->add_assignment($col["Name"], $col["Expression"], $col["Condition"]);
                     }
                 }
             }
         }
         // Generate Query Assignments
         if ($pq =& $this->get_array_element($qu, "PreSQLS")) {
             foreach ($pq as $col) {
                 $this->query->add_pre_sql($col["SQLText"]);
             }
         }
         // Generate Output Information...
         if ($op =& $this->get_array_element($ef, "Output")) {
             // Generate Page Headers
             if ($ph = $this->get_array_element($op, "PageHeaders")) {
                 foreach ($ph as $k => $phi) {
                     $this->query->create_page_header($k, $phi["LineNumber"], $phi["HeaderText"]);
                     if ($fm =& $this->get_array_element($phi, "Format")) {
                         foreach ($fm as $att => $val) {
                             $this->query->set_page_header_attribute($k, $att, $val);
                         }
                     }
                 }
             }
             // Generate Page Footers
             if ($ph = $this->get_array_element($op, "PageFooters")) {
                 foreach ($ph as $k => $phi) {
                     $this->query->create_page_footer($k, $phi["LineNumber"], $phi["FooterText"]);
                     if ($fm =& $this->get_array_element($phi, "Format")) {
                         foreach ($fm as $att => $val) {
                             $this->query->set_page_footer_attribute($k, $att, $val);
                         }
                     }
                 }
             }
             // Generate Display Orders
             if ($has_cols && ($ph = $this->get_array_element($op, "DisplayOrders"))) {
                 foreach ($ph as $k => $phi) {
                     $this->query->set_column_order($phi["ColumnName"], $phi["OrderNumber"]);
                 }
             }
             if ($has_cols && ($ph = $this->get_array_element($op, "Groups"))) {
                 foreach ($ph as $k => $phi) {
                     if (array_key_exists("GroupName", $phi)) {
                         $gpname = $phi["GroupName"];
                     } else {
                         $gpname = $phi["Name"];
                     }
                     $grn = $this->query->create_group($gpname);
                     if (array_key_exists("BeforeGroupHeader", $phi)) {
                         $grn->set_attribute("before_header", $phi["BeforeGroupHeader"]);
                         $grn->set_attribute("after_header", $phi["AfterGroupHeader"]);
                         $grn->set_attribute("before_trailer", $phi["BeforeGroupTrailer"]);
                         $grn->set_attribute("after_trailer", $phi["AfterGroupTrailer"]);
                         $grn->set_format("before_header", $phi["BeforeGroupHeader"]);
                         $grn->set_format("after_header", $phi["AfterGroupHeader"]);
                         $grn->set_format("before_trailer", $phi["BeforeGroupTrailer"]);
                         $grn->set_format("after_trailer", $phi["AfterGroupTrailer"]);
                     }
                     if ($gp =& $this->get_array_element($phi, "GroupHeaders")) {
                         foreach ($gp as $att => $val) {
                             if (!isset($val["GroupHeaderCustom"])) {
                                 $val["GroupHeaderCustom"] = false;
                             }
                             $this->query->create_group_header($gpname, $val["GroupHeaderColumn"], $val["GroupHeaderCustom"]);
                         }
                     }
                     if ($gp =& $this->get_array_element($phi, "GroupTrailers")) {
                         foreach ($gp as $att => $val) {
                             if (!isset($val["GroupTrailerCustom"])) {
                                 $val["GroupTrailerCustom"] = false;
                             }
                             $this->query->create_group_trailer($gpname, $val["GroupTrailerDisplayColumn"], $val["GroupTrailerValueColumn"], $val["GroupTrailerCustom"]);
                         }
                     }
                 }
             }
             // Generate Graphs
             if ($has_cols && ($gph = $this->get_array_element($op, "Graphs"))) {
                 foreach ($gph as $k => $gphi) {
                     $ka = array_keys($gphi);
                     $gph =& $this->query->create_graph();
                     $gph->set_graph_column($gphi["GraphColumn"]);
                     $gph->set_title($gphi["Title"]);
                     $gph->set_xtitle($gphi["XTitle"]);
                     $gph->set_xlabel_column($gphi["XLabelColumn"]);
                     $gph->set_ytitle($gphi["YTitle"]);
                     //$gph->set_ylabel_column($gphi["YLabelColumn"]);
                     //////HERE!!!
                     if (array_key_exists("GraphWidth", $gphi)) {
                         $gph->set_width($gphi["GraphWidth"]);
                         $gph->set_height($gphi["GraphHeight"]);
                         $gph->set_width_pdf($gphi["GraphWidthPDF"]);
                         $gph->set_height_pdf($gphi["GraphHeightPDF"]);
                     } else {
                         $gph->set_width($gphi["Width"]);
                         $gph->set_height($gphi["Height"]);
                     }
                     if (array_key_exists("GraphColor", $gphi)) {
                         $gph->set_graph_color($gphi["GraphColor"]);
                         $gph->set_grid($gphi["GridPosition"], $gphi["XGridDisplay"], $gphi["XGridColor"], $gphi["YGridDisplay"], $gphi["YGridColor"]);
                         $gph->set_title_font($gphi["TitleFont"], $gphi["TitleFontStyle"], $gphi["TitleFontSize"], $gphi["TitleColor"]);
                         $gph->set_xtitle_font($gphi["XTitleFont"], $gphi["XTitleFontStyle"], $gphi["XTitleFontSize"], $gphi["XTitleColor"]);
                         $gph->set_ytitle_font($gphi["YTitleFont"], $gphi["YTitleFontStyle"], $gphi["YTitleFontSize"], $gphi["YTitleColor"]);
                         $gph->set_xaxis($gphi["XTickInterval"], $gphi["XTickLabelInterval"], $gphi["XAxisColor"]);
                         $gph->set_yaxis($gphi["YTickInterval"], $gphi["YTickLabelInterval"], $gphi["YAxisColor"]);
                         $gph->set_xaxis_font($gphi["XAxisFont"], $gphi["XAxisFontStyle"], $gphi["XAxisFontSize"], $gphi["XAxisFontColor"]);
                         $gph->set_yaxis_font($gphi["YAxisFont"], $gphi["YAxisFontStyle"], $gphi["YAxisFontSize"], $gphi["YAxisFontColor"]);
                         $gph->set_margin_color($gphi["MarginColor"]);
                         $gph->set_margins($gphi["MarginLeft"], $gphi["MarginRight"], $gphi["MarginTop"], $gphi["MarginBottom"]);
                     }
                     foreach ($gphi["Plots"] as $pltk => $pltv) {
                         $pl =& $gph->create_plot($pltv["PlotColumn"]);
                         $pl["type"] = $pltv["PlotType"];
                         $pl["fillcolor"] = $pltv["FillColor"];
                         $pl["linecolor"] = $pltv["LineColor"];
                         $pl["legend"] = $pltv["Legend"];
                     }
                 }
             }
         }
         // Output
         // Check for Criteria Items ...
         if ($crt =& $this->get_array_element($ef, "Criteria")) {
             foreach ($crt as $ci) {
                 $critnm = $this->get_array_element($ci, "Name");
                 $crittb = $this->get_array_element($ci, "QueryTableName");
                 $critcl = $this->get_array_element($ci, "QueryColumnName");
                 $linked_report = $this->get_array_element($ci, "LinkToReport");
                 $linked_report_item = $this->get_array_element($ci, "LinkToReportItem");
                 // If we are not designing a report then
                 // replace a linked criteria with the criteria
                 // item it links to from another report
                 if ($linked_report && $this->query->execute_mode != "MAINTAIN") {
                     $q = new reportico();
                     global $g_project;
                     $q->reports_path = $q->projects_folder . "/" . $g_project;
                     $reader = new reportico_xml_reader($q, $linked_report, false);
                     $reader->xml2query();
                     foreach ($q->lookup_queries as $k => $v) {
                         $found = false;
                         foreach ($this->query->columns as $querycol) {
                             if ($querycol->query_name == $v->query_name) {
                                 $found = true;
                             }
                         }
                         $qu = new reportico();
                         if ($linked_report_item == $v->query_name) {
                             $this->query->lookup_queries[$v->query_name] = $v;
                         }
                     }
                     continue;
                 }
                 if ($crittb) {
                     $critcl = $crittb . "." . $critcl;
                     $crittb = "";
                 }
                 $crittp = $this->get_array_element($ci, "CriteriaType");
                 $critlt = $this->get_array_element($ci, "CriteriaList");
                 $crituse = $this->get_array_element($ci, "Use");
                 //$crithelp = $this->get_array_element($ci, "CriteriaHelp") ;
                 $critds = $this->get_array_element($ci, "CriteriaDisplay");
                 $critexp = $this->get_array_element($ci, "ExpandDisplay");
                 $critmatch = $this->get_array_element($ci, "MatchColumn");
                 $critdefault = $this->get_array_element($ci, "CriteriaDefaults");
                 $crittitle = $this->get_array_element($ci, "Title");
                 $crit_lookup_return = $this->get_array_element($ci, "ReturnColumn");
                 $crit_lookup_display = $this->get_array_element($ci, "DisplayColumn");
                 $crit_criteria_display = $this->get_array_element($ci, "OverviewColumn");
                 if ($crittp == "ANYCHAR") {
                     $crittp = "TEXTFIELD";
                 }
                 if ($critds == "ANYCHAR") {
                     $critds = "TEXTFIELD";
                 }
                 if ($critexp == "ANYCHAR") {
                     $critexp = "TEXTFIELD";
                 }
                 // Generate criteria lookup info unless its a link to a criteria in a nother report
                 if (!$linked_report && !($ciq =& $this->get_array_element($ci, "Query"))) {
                     continue;
                 }
                 $critquery = new reportico();
                 // Generate Criteria Query Columns
                 if (!$linked_report && ($ciqc =& $this->get_array_element($ciq, "QueryColumns"))) {
                     foreach ($ciqc as $ccol) {
                         $in_query = true;
                         if (!$ccol["ColumnName"]) {
                             $in_query = false;
                         }
                         $critquery->create_criteria_column($ccol["Name"], $ccol["TableName"], $ccol["ColumnName"], $ccol["ColumnType"], $ccol["ColumnLength"], "###.##", $in_query);
                     }
                 }
                 // Generate Order By List
                 if (!$linked_report && ($coc =& $this->get_array_element($ciq, "OrderColumns"))) {
                     // Generate reportico_query_column for each column found
                     foreach ($coc as $col) {
                         $critquery->create_order_column($col["Name"], $col["OrderType"]);
                     }
                 }
                 if (!$linked_report && ($as =& $this->get_array_element($ciq, "Assignments"))) {
                     foreach ($as as $ast) {
                         if (array_key_exists("AssignName", $ast)) {
                             $critquery->add_assignment($ast["AssignName"], $ast["Expression"], $ast["Condition"]);
                         } else {
                             $critquery->add_assignment($ast["Name"], $ast["Expression"], $ast["Condition"]);
                         }
                     }
                 }
                 // Generate Criteria Links  In Array for later use
                 if (!$linked_report && ($cl =& $this->get_array_element($ci, "CriteriaLinks"))) {
                     foreach ($cl as $clitem) {
                         $criteria_links[] = array("LinkFrom" => $clitem["LinkFrom"], "LinkTo" => $clitem["LinkTo"], "LinkClause" => $clitem["LinkClause"]);
                     }
                 }
                 // Set Query SQL Text
                 if (!$linked_report) {
                     $critquery->table_text = $this->get_array_element($ciq, "TableSql");
                     $critquery->where_text = $this->get_array_element($ciq, "WhereSql");
                     $critquery->group_text = $this->get_array_element($ciq, "GroupSql");
                     $critquery->sql_raw = $this->get_array_element($ciq, "SQLRaw");
                     $critquery->rowselection = $this->get_array_element($ciq, "RowSelection");
                 }
                 $critquery->set_lookup_return($crit_lookup_return);
                 $critquery->set_lookup_display($crit_lookup_display, $crit_criteria_display);
                 $critquery->set_lookup_expand_match($critmatch);
                 $this->query->set_criteria_lookup($critnm, $critquery, $crittb, $critcl);
                 $this->query->set_criteria_input($critnm, $crittp, $critds, $critexp, $crituse);
                 $this->query->set_criteria_link_report($critnm, $linked_report, $linked_report_item);
                 $this->query->set_criteria_list($critnm, $critlt);
                 //$this->query->set_criteria_help($critnm, $crithelp);
                 $this->query->set_criteria_attribute($critnm, "column_title", $crittitle);
                 $this->query->set_criteria_defaults($critnm, $critdefault);
             }
             // End Criteria Item
             // Set up any Criteria Links
             foreach ($criteria_links as $cl) {
                 $this->query->set_criteria_link($cl["LinkFrom"], $cl["LinkTo"], $cl["LinkClause"]);
             }
         }
     }
 }
Ejemplo n.º 4
0
Archivo: run.php Proyecto: GLUD/EcoHack
*/
// set error reporting level
error_reporting(E_ALL);
// Set the timezone according to system defaults
date_default_timezone_set(@date_default_timezone_get());
// Reserver 100Mb for running
ini_set("memory_limit", "100M");
// Allow a good time for long reports to run. Set to 0 to allow unlimited time
ini_set("max_execution_time", "90");
// Include Reportico - for embedding reportico in a script running from outside the Reportico directory,
// just include the full path to the file reportico.php
//require_once('<FULL_PATH_TO_REPORTICO>/reportico.php');
require_once 'reportico.php';
// Only turn on output buffering if necessary, normally leave this uncommented
//ob_start();
$q = new reportico();
// In design mode, allow sql debugging
//$q->allow_debug = true;
// Specify any URL parameters that should be added into any links generated in Reportico.
// Useful when embedding in another application or frameworks where requests need to be channelled
// back though themselves
//$q->forward_url_get_parameters = "";
// Reportico Ajax mode. If set to true will run all reportico requests from buttons and links
// through AJAX, meaning reportico will refresh in its own window and not refresh the whole page
//$q->reportico_ajax_mode = true;
/*
 ** Initial execution states .. allows you to start user and limit user to specfic
 ** report menus, reports or report output
 ** The default behaviour is to show the Administration page on initial startup
 */
// Start user in specific project
Ejemplo n.º 5
0
* File:        run.php
*
* Reportico runner script
* !!! Note this script will run reports in FULL design mode
* !!! This means that users of the reports will be able to 
* !!! modify reports and save those modifications
*
* @link http://www.reportico.org/
* @copyright 2010-2012 Peter Deed
* @author Peter Deed <*****@*****.**>
* @package Reportico
* @version $Id: run.php,v 1.8 2012-04-11 21:35:04 root Exp $
*/
// set error reporting level
error_reporting(E_ALL);
// Set the timezone according to system defaults
date_default_timezone_set(@date_default_timezone_get());
// Reserver 100Mb for running
ini_set("memory_limit", "100M");
ini_set("max_execution_time", "90");
//header("Content-Type: text/html; charset=utf-8");
//ob_start();
require_once 'reportico.php';
$q = new reportico();
$q->allow_debug = true;
$q->forward_url_get_parameters = "";
$_SESSION["template"] = "dropmenu";
$q->dropdown_menu = array(array("project" => "tutorials", "title" => "Listings", "items" => array(array("reportfile" => "tut1_films.xml"), array("reportfile" => "tut2_loanhistory.xml"))), array("project" => "tutorials", "title" => "Analysis Reports", "items" => array(array("reportfile" => "tut2_1_loanhistory.xml"), array("reportfile" => "tut4_1_lateness.xml"))));
$q->execute($q->get_execute_mode(), true);
//ob_end_flush();