Example #1
0
					(SELECT ' . $selStatType . ' FROM ' . TABLE_CUSTOMERS . ' c ' . $join_clause . ' WHERE SUBSTRING(c.date_lastlogin, 6, 2) = \'11\' AND SUBSTRING(c.date_lastlogin, 1, 4) = ' . (int) $year . ' ' . $where_clause . ') as month11,
					(SELECT ' . $selStatType . ' FROM ' . TABLE_CUSTOMERS . ' c ' . $join_clause . ' WHERE SUBSTRING(c.date_lastlogin, 6, 2) = \'12\' AND SUBSTRING(c.date_lastlogin, 1, 4) = ' . (int) $year . ' ' . $where_clause . ') as month12
					FROM ' . TABLE_CUSTOMERS . '
					GROUP BY month1';
                $result = database_query($sql, DATA_AND_ROWS, FIRST_ROW_ONLY, FETCH_ASSOC);
                $third_tab_content .= $nl . ' data.addRows(12);';
                if ($result[1] >= 0) {
                    $third_tab_content .= draw_set_values($result[0], $chart_type, _LOGINS);
                }
                $third_tab_content .= ' } </script>';
                $third_tab_content .= '<script type="text/javascript">';
                $third_tab_content .= $nl . ' google.load(\'visualization\', \'1\', {packages: [\'' . $chart_type . '\']});';
                $third_tab_content .= $nl . ' google.setOnLoadCallback(drawVisualization);';
                $third_tab_content .= $nl . ' function frmStatistics_Submit() { document.frmStatistics.submit(); }';
                $third_tab_content .= '</script>';
                $third_tab_content .= get_chart_changer('1_3', $chart_type, $year);
                $third_tab_content .= '<div id="div_visualization" style="width:600px;height:310px;">
		<img src="images/loading.gif" style="margin:100px auto;" alt="" /></div>';
            }
        }
    }
    $tabs = new Tabs(1, 'xp', TABS_DIR, '?admin=statistics');
    //$tabs->SetHttpVars(array('admin'));
    $tab1 = $tabs->AddTab(_CUSTOMERS . ' (' . _MAP_OVERLAY . ')', $first_tab_content);
    $tab2 = $tabs->AddTab(_CUSTOMERS . ' (' . _REGISTRATIONS . ')', $second_tab_content);
    $tab3 = $tabs->AddTab(_CUSTOMERS . ' (' . _LOGINS . ')', $third_tab_content);
    ## +---------------------------------------------------------------------------+
    ## | 2. Customizing:                                                           |
    ## +---------------------------------------------------------------------------+
    ## *** set container's width in pixels (px), inches (in) or points (pt)
    $tabs->SetWidth('696px');
				  (SELECT ' . $selStatType . ' FROM ' . TABLE_ORDERS . ' o ' . $join_clause . ' WHERE SUBSTRING(o.payment_date, 6, 2) = \'12\' AND SUBSTRING(o.payment_date, 1, 4) = \'' . $year . '\' ' . $where_clause . ') as month12
				  FROM ' . TABLE_ORDERS . '
				  GROUP BY month1 ';
            $result = database_query($sql, DATA_AND_ROWS, FIRST_ROW_ONLY, FETCH_ASSOC);
            $second_tab_content .= $nl . ' data.addRows(12);';
            if ($result[1] >= 0) {
                $default_currency = Currencies::GetDefaultCurrency();
                $second_tab_content .= draw_set_values($result[0], $chart_type, _INCOME, $default_currency);
            }
            $second_tab_content .= ' } </script>';
            $second_tab_content .= '<script type="text/javascript">';
            $second_tab_content .= $nl . ' google.load(\'visualization\', \'1\', {packages: [\'' . $chart_type . '\']});';
            $second_tab_content .= $nl . ' google.setOnLoadCallback(drawVisualization);';
            $second_tab_content .= $nl . ' function frmStatistics_Submit() { document.frmStatistics.submit(); }';
            $second_tab_content .= '</script>';
            $second_tab_content .= get_chart_changer('1_2', $chart_type, $year, 'mod_payments_statistics');
            $second_tab_content .= '<div id="div_visualization" style="width:600px;height:310px;">
		<img src="images/ajax_loading.gif" style="margin:100px auto;" alt="' . _LOADING . '..."></div>';
        } else {
            $sql = 'SELECT
					COUNT(*) as cnt,
					c.abbrv as country_abbrv,
					c.name as country_name
				FROM ' . TABLE_ORDERS . ' o
					INNER JOIN ' . TABLE_CUSTOMERS . ' u ON o.customer_id = u.id
					INNER JOIN ' . TABLE_COUNTRIES . ' c ON u.b_country = c.abbrv
				GROUP BY c.abbrv';
            $result = database_query($sql, DATA_AND_ROWS, ALL_ROWS);
            $third_tab_content = '			
			<script type="text/javascript">
			 google.load("visualization", "1", {"packages": ["geomap"]});