summaryrefslogtreecommitdiff
path: root/includes/functions/functions_db.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/functions/functions_db.php')
-rw-r--r--includes/functions/functions_db.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/includes/functions/functions_db.php b/includes/functions/functions_db.php
index da4946032a..3c0db9aa07 100644
--- a/includes/functions/functions_db.php
+++ b/includes/functions/functions_db.php
@@ -2425,3 +2425,31 @@ function update_favorites($xref_from, $xref_to, $ged_id=WT_GED_ID) {
->execute(array($xref_to, $xref_from, $ged_name))
->rowCount();
}
+
+/**
+* count changes by today, this week, or this month for administration dashboard
+*
+* @param string $xref
+* @param string $tree
+*/
+function count_changes_today($xref, $tree) {
+ $sql="SELECT count(change_id) FROM `##change` WHERE status='accepted' AND date(change_time)= date(now()) AND xref LIKE ? '%' AND gedcom_id = ? ";
+ return
+ WT_DB::prepare($sql)
+ ->execute(array($xref, $tree))
+ ->fetchOne();
+}
+function count_changes_week($xref, $tree) {
+ $sql="SELECT count(change_id) FROM `##change` WHERE status='accepted' AND week(change_time,2)= week(now(),2) AND xref LIKE ? '%' AND gedcom_id = ? ";
+ return
+ WT_DB::prepare($sql)
+ ->execute(array($xref, $tree))
+ ->fetchOne();
+}
+function count_changes_month($xref, $tree) {
+ $sql="SELECT count(change_id) FROM `##change` WHERE status='accepted' AND month(change_time)= month(now()) AND xref LIKE ? '%' AND gedcom_id = ? ";
+ return
+ WT_DB::prepare($sql)
+ ->execute(array($xref, $tree))
+ ->fetchOne();
+}