/**
  * Gives a system applicative snapsot
  */
 public function execute()
 {
     $this->forceSystemAuthentication();
     $chart = $this->getRequestParameter("chart", null);
     if (!$chart) {
         return;
     }
     // draw the default page which is the PHP/SWF chart viewer
     if ($chart == "hour") {
         $period_in_seconds = 3600;
         $date_format = "%d/%m\n%H:%M:%S";
         $limit = 24;
     } else {
         $period_in_seconds = 86400;
         $date_format = "%A\n%d/%m";
         $limit = 31;
     }
     $kuser_stats = $this->getKusersInPeriod($period_in_seconds, "", $limit);
     $kshow_stats = $this->getKshowsInPeriod($period_in_seconds, "", $limit);
     $entry_stats = $this->getEntriesInPeriod($period_in_seconds, "", $limit);
     //		print_r ( $kuser_stats );
     //		echo "<br><br>";
     $chart = array();
     $chart_x = array("");
     // first one empty !!
     $kuser_values = array("Users");
     $kshow_values = array("Shows");
     $entry_values = array("Entries");
     $count = count($kuser_stats);
     for ($i = $count - 1; $i >= 0; $i--) {
         $kuser_row = $kuser_stats[$i];
         $kshow_row = @$kshow_stats[$i];
         $entry_row = @$entry_stats[$i];
         //$chart_x[] = strftime( "%d/%m" , ( $kuser_row[2] * $period_in_seconds  ) ) ; // period
         $chart_x[] = strftime($date_format, $kuser_row[2] * $period_in_seconds);
         // period
         //$chart_x[] = $kuser_row[1];
         $kuser_values[] = $kuser_row[3];
         $kshow_values[] = $kshow_row ? $kshow_row[3] : 0;
         $entry_values[] = $entry_row ? $entry_row[3] : 0;
     }
     /*		
     	foreach ( $stats as $row )
     	{
     		$chart_x[] = strftime( "%d/%m" , ( $row[2] * $period_in_seconds ) ) ; // period 
     		$kuser_values[] = $row[3];
     		$kshow_values[] = $row[3] /3;
     		$entry_values[] = $row[3] /2;
     	}
     */
     $chart['axis_category'] = array('skip' => 0, 'font' => "Arial", 'bold' => true, 'size' => 9, 'color' => "88FF00", 'alpha' => 75, 'orientation' => "diagonal_up");
     $chart['axis_value'] = array('min' => 10, 'font' => "Arial", 'bold' => true, 'size' => 10, 'color' => "88FF00");
     $chart['chart_value'] = array('prefix' => "", 'position' => "outside", 'hide_zero' => false, 'as_percentage' => false, 'font' => "Arial", 'bold' => true, 'size' => 10, 'color' => "FF0000", 'alpha' => 90);
     $chart['chart_data'] = array($chart_x, $kuser_values, $kshow_values, $entry_values);
     //$chart [ 'chart_type' ] = "bar";
     return $this->renderText(charts::SendChartData($chart));
 }
Esempio n. 2
0
<HTML>
<BODY bgcolor="#FFFFFF" style="font-family:arial">

Last 24 hours (per hour)<br>
<?php 
//include charts.php to access the InsertChart function
//include "charts.class.php";
// the swf and charts_library are placed under web/charts
echo charts::InsertChart("/charts/charts.swf", "/charts/charts_library", url_for("system") . "/reports?chart=hour", 1200, 450);
?>
<br><br>
Last 31 days (per day)<br>
<?php 
//include charts.php to access the InsertChart function
//include "charts.class.php";
// the swf and charts_library are placed under web/charts
echo charts::InsertChart("/charts/charts.swf", "/charts/charts_library", url_for("system") . "/reports?chart=day", 1200, 450);
?>

</BODY>
</HTML>


    $xtpl->assign("CURRENCY", $currency->getDefaultISO4217() . ' ' . $currency->getDefaultCurrencySymbol());
}
global $current_user;
if (is_admin($current_user) && $_REQUEST['module'] != 'DynamicLayout' && !empty($_SESSION['editinplace'])) {
    $xtpl->assign("ADMIN_EDIT", "<a href='index.php?action=index&module=DynamicLayout&from_action=" . $_REQUEST['action'] . "&from_module=" . $_REQUEST['module'] . "&record=" . $_REQUEST['record'] . "'>" . get_image($image_path . "EditLayout", "border='0' alt='Edit Layout' align='bottom'") . "</a>");
}
$detailView->processListNavigation($xtpl, "CAMPAIGN", $offset, $focus->is_AuditEnabled());
// adding custom fields:
require_once 'modules/DynamicFields/templates/Files/DetailView.php';
$xtpl->parse("main.open_source");
//add chart
$seps = array("-", "/");
$dates = array(date('Y-m-d'), date('Y-m-d'));
$dateFileNameSafe = str_replace($seps, "_", $dates);
$cache_file_name = $current_user->getUserPrivGuid() . "_campaign_response_by_activity_type_" . $dateFileNameSafe[0] . "_" . $dateFileNameSafe[1] . ".xml";
$chart = new charts();
$xtpl->assign("MY_CHART", $chart->campaign_response_by_activity_type($app_list_strings['campainglog_activity_type_dom'], $app_list_strings['campainglog_target_type_dom'], $focus->id, $sugar_config['tmp_dir'] . $cache_file_name, true));
//end chart
$xtpl->parse("main");
$xtpl->out("main");
require_once 'include/SubPanel/SubPanelTiles.php';
$subpanel = new SubPanelTiles($focus, 'Campaigns');
$alltabs = $subpanel->subpanel_definitions->get_available_tabs();
if (!empty($alltabs)) {
    foreach ($alltabs as $name) {
        if ($name == 'prospectlists' || $name == 'emailmarketing' || $name == 'tracked_urls') {
            $subpanel->subpanel_definitions->exclude_tab($name);
        }
    }
}
echo $subpanel->display();