|
@@ 543-559 (lines=17) @@
|
| 540 |
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 541 |
|
return $all; |
| 542 |
|
} |
| 543 |
|
public function getSumStats($type,$year) { |
| 544 |
|
global $globalArchiveMonths, $globalDBdriver; |
| 545 |
|
if ($globalDBdriver == 'mysql') { |
| 546 |
|
$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year"; |
| 547 |
|
} else { |
| 548 |
|
$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year"; |
| 549 |
|
} |
| 550 |
|
$query_values = array(':type' => $type, ':year' => $year); |
| 551 |
|
try { |
| 552 |
|
$sth = $this->db->prepare($query); |
| 553 |
|
$sth->execute($query_values); |
| 554 |
|
} catch(PDOException $e) { |
| 555 |
|
echo "error : ".$e->getMessage(); |
| 556 |
|
} |
| 557 |
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 558 |
|
return $all[0]['total']; |
| 559 |
|
} |
| 560 |
|
public function getStatsTotal($type) { |
| 561 |
|
global $globalArchiveMonths, $globalDBdriver; |
| 562 |
|
if ($globalDBdriver == 'mysql') { |
|
@@ 673-689 (lines=17) @@
|
| 670 |
|
return "error : ".$e->getMessage(); |
| 671 |
|
} |
| 672 |
|
} |
| 673 |
|
public function getStatsSource($date,$stats_type = '') { |
| 674 |
|
if ($stats_type == '') { |
| 675 |
|
$query = "SELECT * FROM stats_source WHERE stats_date = :date ORDER BY source_name"; |
| 676 |
|
$query_values = array(':date' => $date); |
| 677 |
|
} else { |
| 678 |
|
$query = "SELECT * FROM stats_source WHERE stats_date = :date AND stats_type = :stats_type ORDER BY source_name"; |
| 679 |
|
$query_values = array(':date' => $date,':stats_type' => $stats_type); |
| 680 |
|
} |
| 681 |
|
try { |
| 682 |
|
$sth = $this->db->prepare($query); |
| 683 |
|
$sth->execute($query_values); |
| 684 |
|
} catch(PDOException $e) { |
| 685 |
|
echo "error : ".$e->getMessage(); |
| 686 |
|
} |
| 687 |
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 688 |
|
return $all; |
| 689 |
|
} |
| 690 |
|
|
| 691 |
|
public function addStatSource($data,$source_name,$stats_type,$date) { |
| 692 |
|
global $globalDBdriver; |