示例#1
0
 /**
  * Initialize the properties
  * @param array $highchart_sql_query_options
  * @param array $highchart_graph_options
  */
 protected function setVariables(array $highchart_sql_query_options, array $highchart_graph_options)
 {
     if (!empty($highchart_sql_query_options)) {
         $this->highchart_sql_query_options = $highchart_sql_query_options;
     }
     if (empty($this->highchart_sql_query_options['sum'])) {
         $this->highchart_sql_query_options['sum'] = FALSE;
     }
     if (empty($this->highchart_sql_query_options['date_field'])) {
         $this->highchart_sql_query_options['date_field'] = 'date_created';
     }
     if (empty($this->highchart_sql_query_options['condition'])) {
         $this->highchart_sql_query_options['condition'] = '';
     }
     if (empty($this->highchart_sql_query_options['filters']) || !is_array($this->highchart_sql_query_options['filters'])) {
         $this->highchart_sql_query_options['filters'] = array();
     }
     if (!empty($highchart_graph_options)) {
         $this->highchart_graph_options = $highchart_graph_options;
     }
     if (empty($this->highchart_graph_options['title'])) {
         $this->highchart_graph_options['title'] = Lang::t('Reports');
     }
     if (empty($this->highchart_graph_options['y_axis_label'])) {
         $this->highchart_graph_options['y_axis_label'] = $this->highchart_graph_options['title'];
     }
     HighCharts::init();
     if (!empty($this->highchart_graph_options['graph_type'])) {
         HighCharts::setGraphType($this->highchart_graph_options['graph_type']);
     }
     $this->highchart_graph_type = HighCharts::getGraphType();
     if ($this->highchart_graph_type === HighCharts::GRAPH_PIE) {
         $this->highchart_series = $this->getHighChartPieSeries();
     } else {
         $this->highchart_series = $this->getHighChartGraphSeries();
     }
 }