Пример #1
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', SugarThemeRegistry::current()->getCSSURL('chart.css'));
         $ss->assign('chartColorsXML', SugarThemeRegistry::current()->getImageURL('sugarColors.xml'));
         $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;
     }
 }
Пример #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";
         require_once 'include/SugarCharts/SugarChartFactory.php';
         $sugarChart = SugarChartFactory::getInstance();
         $reporter = new Report($chartReport->content);
         $reporter->is_saved_report = true;
         $reporter->saved_report_id = $chartReport->id;
         $xmlFile = get_cache_file_name($reporter);
         $str = $sugarChart->getDashletScript($this->id, $xmlFile);
         return $str;
     }
 }
Пример #3
0
function put_cache_data($key, $data)
{
    if (empty($data) || empty($key)) {
        return null;
    }
    $appfile = get_cache_file_name($key);
    $fhandler = fopen($appfile, 'a');
    if ($fhandler && fwrite($fhandler, trim($data))) {
        fclose($fhandler);
    }
    return $data;
}