/** * Displays the dashlet * * @return string html to display dashlet */ function display() { require_once "modules/Reports/Report.php"; // ini_set('display_errors', 'false'); $chartReport = new SavedReport(); $chartExists = $chartReport->retrieve($this->report_id, false); if (!is_null($chartExists)) { $this->title = $chartReport->name; $reporter = new Report($chartReport->content); $reporter->is_saved_report = true; $reporter->saved_report_id = $chartReport->id; $reporter->get_total_header_row(); $reporter->run_chart_queries(); require_once "modules/Reports/templates/templates_chart.php"; ob_start(); template_chart($reporter, true, true, $this->id); $str = ob_get_contents(); ob_end_clean(); $xmlFile = get_cache_file_name($reporter); $html = parent::display() . "<div align='center'>" . $str . "</div>" . "<br />"; // return parent::display for title and such $ss = new Sugar_Smarty(); $ss->assign('chartName', $this->id); $ss->assign('chartXMLFile', $xmlFile); $script = $ss->fetch('modules/Home/Dashlets/ChartsDashlet/ChartsDashletScript.tpl'); $json = getJSONobj(); return parent::display() . "<div align='center'>" . $str . "</div>" . "<br />"; // return parent::display for title and such } }
/** * Set the Reporter (Report Object) to use * * @param Report $reporter */ public function setReporter(Report $reporter) { $this->reporter = $reporter; // set the default stuff we need on the reporter // and run the queries $this->reporter->is_saved_report = true; // only run if the chart_header_row variable is empty if (empty($this->reporter->chart_header_row)) { $this->reporter->get_total_header_row(); $this->reporter->run_chart_queries(); } // set the chart type $this->chartType = $this->reporter->chart_type; $this->parseReportHeaders(); $this->parseChartTitle(); $this->parseChartRows(); }
/** * Displays the dashlet * * @return string html to display dashlet */ function display() { require_once "modules/Reports/Report.php"; $chartReport = BeanFactory::getBean('Reports', $this->report_id, array('encode' => false, 'strict_retrieve' => true)); if (!empty($chartReport)) { $title = getReportNameTranslation($chartReport->name); $this->title = $title; $reporter = new Report($chartReport->content); $reporter->is_saved_report = true; $reporter->saved_report_id = $chartReport->id; $reporter->get_total_header_row(); $reporter->run_chart_queries(); ob_start(); require_once "include/SugarCharts/ChartDisplay.php"; $chartDisplay = new ChartDisplay(); $chartDisplay->setReporter($reporter); echo $chartDisplay->legacyDisplay($this->id, true); $str = ob_get_contents(); ob_end_clean(); $xmlFile = $chartDisplay->get_cache_file_name($reporter); $html = parent::display() . "<div align='center'>" . $str . "</div>" . "<br />"; // return parent::display for title and such $ss = new Sugar_Smarty(); $ss->assign('chartName', $this->id); $ss->assign('chartXMLFile', $xmlFile); $script = $ss->fetch('modules/Home/Dashlets/ChartsDashlet/ChartsDashletScript.tpl'); $json = getJSONobj(); return parent::display() . "<div align='center'>" . $str . "</div>" . "<br />"; // return parent::display for title and such } }