t('Statistika'), 'page callback' => 'statistics_view_page', 'page arguments' => array('statistics_view_form', 1), 'access arguments' => array('view statistics'), 'type' => MENU_NORMAL_ITEM, ); return $items; } function statistics_view_page() { //statistics table global $user; $output = ''; $output .= '
'; $range = ''; switch(arg(1)) { case 'all': $res = db_fetch_array(db_query("SELECT date FROM {statistics_view} ORDER BY date ASC LIMIT 0, 1;")); $stime = $res['date']; $etime = mktime(); break; case 'day': $stime = mktime(0,0,0, date('m'),date('d')-1,date('Y')); $etime = mktime(0,0,-1, date('m'), date('d'), date('Y')); $range = "AND date BETWEEN $stime AND $etime"; break; case 'week': $weekday = date('N'); $stime = mktime(); while($weekday != 1) { $stime = mktime(0,0,0,date('m', $stime), date('d', $stime)-1, date('Y', $stime)); $weekday = date('N', $stime); } $etime = mktime(); $range = "AND date BETWEEN $stime AND $etime"; break; case 'month': $stime = mktime(0,0,0,date('m'), 1, date('Y')); $etime = mktime(); $range = "AND date BETWEEN $stime AND $etime"; break; default: if($_SESSION['filter']['start_date']) { $stime = strtotime($_SESSION['filter']['start_date']); $etime = strtotime($_SESSION['filter']['end_date']); $range = "AND date BETWEEN $stime AND $etime"; } } $_SESSION['filter']['start_date'] = date('d.m.Y', $stime); $_SESSION['filter']['end_date'] = date('d.m.Y', $etime); /* //DIFFERENCE if(arg(1) == 'month') { //Month $previous_month_stime = mktime(1,0,0, date('m', mktime())-1, 1, date('Y')); //fetch previous month first day TS $previous_month_etime = mktime(23,59,59, date('m', $etime), 0, date('Y')); //fetch privous month last day TS $output .= "Võrdlus aegaga " . format_date($previous_month_stime, 'long') . " kuni " . format_date($previous_month_etime, 'long') . "Raamatu pealkiri | Kokku | Unikaalseid | Lehitsetud | Kirjastuse e-poele | Apollole | Rahva Raamatule | Raamatukoile | TLBanner | Flash Banner |
---|---|---|---|---|---|---|---|---|---|
" . l($fetch_name['name'], "node/$obj->nid") . " | " . $obj->total; $output .= " | " . $obj->visits; $output .= " | " .$result_lehitsenud['count(source)']. " | " . $result_kirjastus['count(source)'] . " | " . $result_apollo['count(source)'] . " | " . $result_rahva['count(source)'] . " | " . $result_raamatukoja['count(source)'] . " | ". $result_top_right_banner['count(source)'] . " | " . $result_flash_banner['count(source)'] . " |