/**
  * Displays the javascript for the dashlet
  * 
  * @return string javascript to use with this dashlet
  */
 function displayScript()
 {
     global $sugar_config, $current_user, $current_language;
     $xmlFile = $sugar_config['tmp_dir'] . $current_user->id . '_' . $this->id . '.xml';
     $chartStringsXML = 'cache/xml/chart_strings.' . $current_language . '.lang.xml';
     $ss = new Sugar_Smarty();
     $ss->assign('chartName', $this->id);
     $ss->assign('chartXMLFile', $xmlFile);
     $ss->assign('chartStyleCSS', chartStyle());
     $ss->assign('chartColorsXML', chartColors());
     $ss->assign('chartStringsXML', $chartStringsXML);
     $str = $ss->fetch('modules/Charts/Dashlets/PredefinedChartDashletScript.tpl');
     return $str;
 }
Exemplo n.º 2
0
 /**
  * Displays the javascript for the dashlet
  * 
  * @return string javascript to use with this dashlet
  */
 function displayScript()
 {
     require_once "modules/Reports/Report.php";
     $chartReport = new SavedReport();
     $chartExists = $chartReport->retrieve($this->report_id, false);
     if (!is_null($chartExists)) {
         $this->title = $chartReport->name;
         require_once "modules/Reports/templates/templates_chart.php";
         $reporter = new Report($chartReport->content);
         $reporter->is_saved_report = true;
         $reporter->saved_report_id = $chartReport->id;
         $xmlFile = get_cache_file_name($reporter);
         $ss = new Sugar_Smarty();
         $ss->assign('chartName', $this->id);
         $ss->assign('chartXMLFile', $xmlFile);
         $ss->assign('chartStyleCSS', chartStyle());
         $ss->assign('chartColorsXML', chartColors());
         $ss->assign('chartLangFile', $GLOBALS['sugar_config']['tmp_dir'] . 'chart_strings.' . $GLOBALS['current_language'] . '.lang.xml');
         $str = $ss->fetch('modules/Home/Dashlets/ChartsDashlet/ChartsDashletScript.tpl');
         return $str;
     }
 }
Exemplo n.º 3
0
 /**
  * wrapper function to return the html code containing the chart in a div
  * 
  * @param 	string $name 	name of the div
  *			string $xmlFile	location of the XML file
  *			string $style	optional additional styles for the div
  * @return	string returns the html code through smarty
  */
 function display($name, $xmlFile, $width = '320', $height = '480', $resize = false)
 {
     // generate strings for chart if it does not exist
     global $current_language, $theme, $sugar_config, $app_strings;
     $chartStringsXML = $GLOBALS['sugar_config']['tmp_dir'] . 'chart_strings.' . $current_language . '.lang.xml';
     if (!file_exists($chartStringsXML)) {
         $this->generateChartStrings($chartStringsXML);
     }
     $this->ss->assign("chartName", $name);
     $this->ss->assign("chartXMLFile", $xmlFile);
     $this->ss->assign("chartStringsXML", $chartStringsXML);
     // chart styles and color definitions
     $this->ss->assign("chartStyleCSS", chartStyle());
     $this->ss->assign("chartColorsXML", chartColors());
     $this->ss->assign("width", $width);
     $this->ss->assign("height", $height);
     $this->ss->assign("resize", $resize);
     $this->ss->assign("app_strings", $app_strings);
     return $this->ss->fetch('include/SugarCharts/tpls/chart.tpl');
 }
Exemplo n.º 4
0
 /**
  * Displays the javascript for the dashlet
  * 
  * @return string javascript to use with this dashlet
  */
 public function displayScript()
 {
     global $sugar_config, $current_user, $current_language;
     $xmlFile = $sugar_config['tmp_dir'] . $current_user->id . '_' . $this->id . '.xml';
     $chartStringsXML = $GLOBALS['sugar_config']['tmp_dir'] . 'chart_strings.' . $current_language . '.lang.xml';
     $ss = new Sugar_Smarty();
     $ss->assign('chartName', $this->id);
     $ss->assign('chartXMLFile', $xmlFile);
     $ss->assign('chartStyleCSS', chartStyle());
     $ss->assign('chartColorsXML', chartColors());
     $ss->assign('chartStringsXML', $chartStringsXML);
     $str = $ss->fetch('include/Dashlets/DashletGenericChartScript.tpl');
     return $str;
 }