/**
  * 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));
 }