<?php $relPath = "./../../pinc/"; include_once $relPath . 'base.inc'; include_once $relPath . 'dpsql.inc'; include_once $relPath . 'page_tally.inc'; include_once 'common.inc'; $valid_tally_names = array_keys($page_tally_names); $tally_name = get_enumerated_param($_GET, 'tally_name', null, $valid_tally_names); // Initialize the graph before anything else. // This makes use of the jpgraph cache if enabled. // Argument to init_pages_graph is the cache timeout in minutes. $graph = init_pages_graph(60); /////////////////////////////////////////////////// //Total pages by month since beginning of stats $result = mysql_query(select_from_site_past_tallies_and_goals($tally_name, "SELECT {year_month}, SUM(tally_delta), SUM(goal)", "", "GROUP BY 1", "ORDER BY 1", "")); list($datax, $datay1, $datay2) = dpsql_fetch_columns($result); draw_pages_graph($graph, $datax, $datay1, $datay2, null, null, 'monthly', 'increments', _('Pages Done Each Month Since the Beginning of Statistics Collection')); // vim: sw=4 ts=4 expandtab
function show_months_with_most_days_over($n) { global $tally_name, $curr_year_month; $sub_title = sprintf(_('Months with most days over %s pages'), number_format($n)); echo "<h3>{$sub_title}</h3>\n"; dpsql_dump_themed_query(select_from_site_past_tallies_and_goals($tally_name, "SELECT\n {year_month} as '" . mysql_real_escape_string(_("Month")) . "',\n count(*) as '" . mysql_real_escape_string(_("Number of Days")) . "',\n IF({year_month} = '{$curr_year_month}', '******',' ') as '" . mysql_real_escape_string(_("This Month?")) . "'", "WHERE tally_delta >= {$n}", "GROUP BY 1", "ORDER BY 2 DESC", "LIMIT 10"), 1, DPSQL_SHOW_RANK); echo "<br>\n"; }
break; default: die("bad 'timeframe' value: '{$title_timeframe}'"); } switch ($c_or_i) { case 'increments': $main_title = _('Pages Done Per Day'); break; case 'cumulative': $main_title = _('Cumulative Pages Done'); break; default: die("bad 'cori' value: '{$c_or_i}'"); } // ----------------------------------------------------------------------------- $result = dpsql_query(select_from_site_past_tallies_and_goals($tally_name, "SELECT {date}, tally_delta, goal", $where_clause, "", "ORDER BY timestamp", "")); list($datax, $datay1, $datay2) = dpsql_fetch_columns($result); if ($c_or_i == 'cumulative') { $datay1 = array_accumulate($datay1); $datay2 = array_accumulate($datay2); // The accumulated 'actual' for today and subsequent days is bogus, // so delete it. $date_today = strftime('%Y-%m-%d', $now_timestamp); for ($i = 0; $i < count($datax); $i++) { if ($datax[$i] >= $date_today) { unset($datay1[$i]); } } } if (empty($datay1)) { $datay1[0] = 0;