diff --git a/code/web/interface/themes/responsive/Summon/usage-graph.tpl b/code/web/interface/themes/responsive/Summon/usage-graph.tpl
new file mode 100644
index 0000000000..2d121f5196
--- /dev/null
+++ b/code/web/interface/themes/responsive/Summon/usage-graph.tpl
@@ -0,0 +1,85 @@
+{strip}
+
+
{translate text=$graphTitle isAdminFacing=true}
+
+
+
+
+
{translate text="Raw Data" isAdminFacing=true}
+
+
+
+
+ {translate text="Date" isAdminFacing=true} |
+ {foreach from=$dataSeries key=seriesLabel item=seriesData}
+ {if !empty($translateDataSeries)}{translate text=$seriesLabel isAdminFacing=true}{else}{$seriesLabel}{/if} |
+ {/foreach}
+
+
+
+ {foreach from=$columnLabels item=label}
+
+ {if !empty($translateColumnLabels)}{translate text=$label isAdminFacing=true}{else}{$label}{/if} |
+ {foreach from=$dataSeries item=seriesData}
+ {if (empty($seriesData.data.$label))}0{else}{$seriesData.data.$label|number_format}{/if} |
+ {/foreach}
+
+ {/foreach}
+
+
+
+
+{/strip}
+{literal}
+
+{/literal}
\ No newline at end of file
diff --git a/code/web/release_notes/24.08.00.MD b/code/web/release_notes/24.08.00.MD
index 2ae8e064f2..a6f3c2b1bc 100644
--- a/code/web/release_notes/24.08.00.MD
+++ b/code/web/release_notes/24.08.00.MD
@@ -135,7 +135,8 @@ To generate the passkey file, the following command should be run (as root):
// chloe
### Other Updates
-- Add usage graphs and raw data tables for ILS Integration. These can be accessed through the ILS Integration Dashboard
+- Add usage graphs and raw data tables for ILS Integration. These can be accessed through the ILS Integration Dashboard (*CZ*)
+- Add usage graphs and raw data tables for Summons. These can be accessed through the Summon Dashboard (*CZ*)
## This release includes code contributions from
- ByWater Solutions
diff --git a/code/web/services/Summon/UsageGraphs.php b/code/web/services/Summon/UsageGraphs.php
new file mode 100644
index 0000000000..d02630a317
--- /dev/null
+++ b/code/web/services/Summon/UsageGraphs.php
@@ -0,0 +1,156 @@
+groupBy('year, month');
+ if (!empty($instanceName)) {
+ $userSummonUsage->instance = $instanceName;
+ }
+ $userSummonUsage->selectAdd();
+ $userSummonUsage->selectAdd('year');
+ $userSummonUsage->selectAdd('month');
+ $userSummonUsage->orderBy('year, month');
+
+ $dataSeries['Active Users'] = [
+ 'borderColor' => 'rgba(255, 99, 132, 1)',
+ 'backgroundColor' => 'rgba(255, 99, 132, 0.2)',
+ 'data' => [],
+ ];
+ $userSummonUsage->selectAdd('COUNT(DISTINCT userId) as activeUsers');
+
+ // Collects results
+ $userSummonUsage->find();
+ while($userSummonUsage->fetch()) {
+ $curPeriod = "{$userSummonUsage->month}-{$userSummonUsage->year}";
+ $columnLabels[] = $curPeriod;
+ /** @noinspection PhpUndefinedFieldInspection */
+ $dataSeries['Active Users']['data'][$curPeriod] = $userSummonUsage->activeUsers;
+ }
+ }
+
+ // gets data from from summon_usage
+ if (
+ $stat == 'numRecordsViewed' ||
+ $stat == 'numRecordsClicked' ||
+ $stat == 'totalClicks'
+ ){
+ $summonRecordUsage = new SummonRecordUsage();
+ $summonRecordUsage->groupBy('year, month');
+ if (!empty($instanceName)) {
+ $summonRecordUsage->instance = $instanceName;
+ }
+ $summonRecordUsage->selectAdd();
+ $summonRecordUsage->selectAdd('year');
+ $summonRecordUsage->selectAdd('month');
+ $summonRecordUsage->orderBy('year, month');
+
+ if ($stat == 'numRecordsViewed') {
+ $dataSeries['Number of Records Viewed'] = [
+ 'borderColor' => 'rgba(255, 99, 132, 1)',
+ 'backgroundColor' => 'rgba(255, 99, 132, 0.2)',
+ 'data' => [],
+ ];
+ $summonRecordUsage ->selectAdd('SUM(IF(timesViewedInSearch>0,1,0)) as numRecordsViewed');
+ }
+ if ($stat == 'numRecordsClicked') {
+ $dataSeries['Number of Records Clicked'] = [
+ 'borderColor' => 'rgba(255, 99, 132, 1)',
+ 'backgroundColor' => 'rgba(255, 99, 132, 0.2)',
+ 'data' => [],
+ ];
+ $summonRecordUsage ->selectAdd('SUM(IF(timesUsed>0,1,0)) as numRecordsUsed');
+ }
+ if ($stat == 'totalClicks') {
+ $dataSeries['Total Clicks'] = [
+ 'borderColor' => 'rgba(255, 99, 132, 1)',
+ 'backgroundColor' => 'rgba(255, 99, 132, 0.2)',
+ 'data' => [],
+ ];
+ $summonRecordUsage ->selectAdd('SUM(timesUsed) as numClicks');
+ }
+ // Collect results
+ $summonRecordUsage->find();
+ while ($summonRecordUsage->fetch()) {
+ $curPeriod = "{$summonRecordUsage->month}-{$summonRecordUsage->year}";
+ $columnLabels[] = $curPeriod;
+ if ($stat == 'numRecordsViewed') {
+ /** @noinspection PhpUndefinedFieldInspection */
+ $dataSeries['Number of Records Viewed']['data'][$curPeriod] = $summonRecordUsage->numRecordsViewed;
+ }
+ if ($stat == 'numRecordsClicked') {
+ /** @noinspection PhpUndefinedFieldInspection */
+ $dataSeries['Number of Records Clicked']['data'][$curPeriod] = $summonRecordUsage->numRecordsUsed;
+ }
+ if ($stat == 'totalClicks') {
+ /** @noinspection PhpUndefinedFieldInspection */
+ $dataSeries['Total Clicks']['data'][$curPeriod] = $summonRecordUsage->numClicks;
+ }
+ }
+ }
+
+ $interface->assign('columnLabels', $columnLabels);
+ $interface->assign('dataSeries', $dataSeries);
+ $interface->assign('translateDataSeries', true);
+ $interface->assign('translateColumnLabels', false);
+
+ $interface->assign('graphTitle', $title);
+ $this->display('usage-graph.tpl', $title);
+ }
+
+ function getActiveAdminSection(): string {
+ return 'summon';
+ }
+
+ function canView(): bool {
+ return UserAccount::userHasPermission([
+ 'View Dashboards',
+ 'View System Reports',
+ ]);
+ }
+
+ function getBreadcrumbs(): array {
+ $breadcrumbs = [];
+ $breadcrumbs[] = new Breadcrumb('/Admin/Home', 'Administration Home');
+ $breadcrumbs[] = new Breadcrumb('/Admin/Home#summon', 'Summon');
+ $breadcrumbs[] = new Breadcrumb('/Summon/SummonDashboard', 'Summon Usage Dashboard');
+ $breadcrumbs[] = new Breadcrumb('', 'Usage Graph');
+ return $breadcrumbs;
+ }
+}
\ No newline at end of file