{translate text="ILS Usage Dashboard" isAdminFacing=true}
{include file="Admin/selectInterfaceForm.tpl"} - {foreach from=$profiles item=profileName key=profileId}{translate text="Selected Profile" isAdminFacing=true} - {$profileName}
@@ -61,7 +60,7 @@
@@ -87,7 +86,7 @@
@@ -113,7 +112,7 @@
-
@@ -136,11 +135,10 @@
@@ -166,7 +164,7 @@
@@ -192,7 +190,7 @@
@@ -218,7 +216,7 @@
@@ -244,7 +242,7 @@
@@ -270,7 +268,7 @@
diff --git a/code/web/interface/themes/responsive/ILS/usage-graph.tpl b/code/web/interface/themes/responsive/ILS/usage-graph.tpl
new file mode 100644
index 0000000000..2d121f5196
--- /dev/null
+++ b/code/web/interface/themes/responsive/ILS/usage-graph.tpl
@@ -0,0 +1,85 @@
+{strip}
+
+
+{/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 5f26f8054d..ca76749d4e 100644
--- a/code/web/release_notes/24.08.00.MD
+++ b/code/web/release_notes/24.08.00.MD
@@ -57,6 +57,10 @@ To generate the passkey file, the following command should be run (as root):
// other
+// chloe
+### Other Updates
+- Add usage graphs and raw data tables for ILS Integration. These can be accessed through the ILS Integration Dashboard
+
## This release includes code contributions from
- ByWater Solutions
- Mark Noble (MDN)
@@ -71,6 +75,7 @@ To generate the passkey file, the following command should be run (as root):
- Pedro Amorim (PA)
- Alexander Blanchard (AB)
- Jacob O'Mara (JOM)
+ - Chloe Zermatten (CZ)
- Theke Solutions
- Lucas Montoya (LM)
\ No newline at end of file
diff --git a/code/web/services/ILS/UsageGraphs.php b/code/web/services/ILS/UsageGraphs.php
new file mode 100644
index 0000000000..273e26e091
--- /dev/null
+++ b/code/web/services/ILS/UsageGraphs.php
@@ -0,0 +1,274 @@
+groupBy('year, month');
+ if (!empty($instanceName)) {
+ $userILSUsage->instance = $instanceName;
+ }
+ $userILSUsage->selectAdd();
+ $userILSUsage->selectAdd('year');
+ $userILSUsage->selectAdd('month');
+ $userILSUsage->orderBy('year, month');
+ if ($stat == 'userLogins') {
+ $dataSeries['User Logins'] = [
+ 'borderColor' => 'rgba(255, 99, 132, 1)',
+ 'backgroundColor' => 'rgba(255, 99, 132, 0.2)',
+ 'data' => [],
+ ];
+ $userILSUsage->selectAdd('SUM(usageCount) as sumUserLogins');
+ }
+ if ($stat == 'selfRegistrations') {
+ $dataSeries['Self Registration'] = [
+ 'borderColor' => 'rgba(255, 159, 64, 1)',
+ 'backgroundColor' => 'rgba(255, 159, 64, 0.2)',
+ 'data' => [],
+ ];
+ $userILSUsage->selectAdd('SUM(selfRegistrationCount) as sumSelfRegistrations');
+ }
+ if ($stat == 'usersWithPdfDownloads') {
+ $dataSeries['Users Who Downloaded At Least One PDF'] = [
+ 'borderColor' => 'rgba(255, 206, 86, 1)',
+ 'backgroundColor' => 'rgba(255, 206, 86, 0.2)',
+ 'data' => [],
+ ];
+ $userILSUsage->selectAdd('SUM(IF(pdfDownloadCount>0,1,0)) as usersWithPdfDownloads');
+ }
+ if ($stat == 'usersWithPdfViews') {
+ $dataSeries['Users Who Viewed At Least One PDF'] = [
+ 'borderColor' => 'rgba(255, 206, 86, 1)',
+ 'backgroundColor' => 'rgba(255, 206, 86, 0.2)',
+ 'data' => [],
+ ];
+ $userILSUsage->selectAdd('SUM(IF(pdfViewCount>0,1,0)) as usersWithPdfViews');
+ }
+ if ($stat == 'usersWithSupplementalFileDownloads') {
+ $dataSeries['Users Who Downloaded At Least One Supplemental File'] = [
+ 'borderColor' => 'rgba(255, 206, 86, 1)',
+ 'backgroundColor' => 'rgba(255, 206, 86, 0.2)',
+ 'data' => [],
+ ];
+ $userILSUsage->selectAdd('SUM(IF(supplementalFileDownloadCount>0,1,0)) as usersWithSupplementalFileDownloads');
+ }
+ if ($stat == 'usersWithHolds') {
+ $dataSeries['Users Who Placed At Least One Hold'] = [
+ 'borderColor' => 'rgba(0, 255, 55, 1)',
+ 'backgroundColor' => 'rgba(0, 255, 55, 0.2)',
+ 'data' => [],
+ ];
+ $userILSUsage->selectAdd('SUM(IF(usageCount>0,1,0)) as usersWithHolds');
+ }
+
+ //Collect results
+ $userILSUsage->find();
+
+ while ($userILSUsage->fetch()) {
+ $curPeriod = "{$userILSUsage->month}-{$userILSUsage->year}";
+ $columnLabels[] = $curPeriod;
+ if ($stat == 'userLogins' ) {
+ /** @noinspection PhpUndefinedFieldInspection */
+ $dataSeries['User Logins']['data'][$curPeriod] = $userILSUsage->sumUserLogins;
+ }
+ if ($stat == 'selfRegistrations' ) {
+ /** @noinspection PhpUndefinedFieldInspection */
+ $dataSeries['Self Registrations']['data'][$curPeriod] = $userILSUsage->sumSelfRegistrations;
+ }
+ if ($stat == 'usersWithPdfDownloads' ) {
+ /** @noinspection PhpUndefinedFieldInspection */
+ $dataSeries['Users Who Downloaded At Least One PDF']['data'][$curPeriod] = $userILSUsage->usersWithPdfDownloads;
+ }
+ if ($stat == 'usersWithPdfViews') {
+ /** @noinspection PhpUndefinedFieldInspection */
+ $dataSeries['Users Who Viewed At Least One PDF']['data'][$curPeriod] = $userILSUsage->usersWithPdfViews;
+ }
+ if ($stat == 'usersWithHolds') {
+ /** @noinspection PhpUndefinedFieldInspection */
+ $dataSeries['Users Who Placed At Least One Hold']['data'][$curPeriod] = $userILSUsage->usersWithHolds;
+ }
+ if ($stat == 'usersWithSupplementalFileDownloads') {
+ /** @noinspection PhpUndefinedFieldInspection */
+ $dataSeries['Users Who Downloaded At Least One Supplemental File']['data'][$curPeriod] = $userILSUsage->usersWithSupplementalFileDownloads;
+ }
+ }
+ }
+
+ // for graphs displaying data retrieved from the ils_record_usage table
+ if (
+ $stat == 'pdfsDownloaded' ||
+ $stat == 'pdfsViewed' ||
+ $stat == 'supplementalFilesDownloaded' ||
+ $stat == 'recordsHeld' ||
+ $stat == 'totalHolds'
+ ) {
+ $recordILSUsage = new ILSRecordUsage();
+ if (!empty($instanceName)) {
+ $recordILSUsage->instance = $instanceName;
+ }
+ $recordILSUsage->selectAdd();
+ $recordILSUsage->selectAdd('year');
+ $recordILSUsage->selectAdd('month');
+ $recordILSUsage->orderBy('year, month');
+
+ if ($stat == 'pdfsDownloaded') {
+ $dataSeries['PDFs Downloaded'] = [
+ 'borderColor' => 'rgba(255, 206, 86, 1)',
+ 'backgroundColor' => 'rgba(255, 206, 86, 0.2)',
+ 'data' => [],
+ ];
+ $recordILSUsage->selectAdd('SUM(pdfDownloadCount) as sumPdfsDownloaded');
+ }
+ if ($stat == 'pdfsViewed') {
+ $dataSeries['PDFs Viewed'] = [
+ 'borderColor' => 'rgba(255, 206, 86, 1)',
+ 'backgroundColor' => 'rgba(255, 206, 86, 0.2)',
+ 'data' => [],
+ ];
+ $recordILSUsage->selectAdd('SUM(pdfViewCount) as sumPdfsViewed');
+ }
+ if ($stat == 'supplementalFilesDownloaded') {
+ $dataSeries['Supplemental Files Downloaded'] = [
+ 'borderColor' => 'rgba(255, 206, 86, 1)',
+ 'backgroundColor' => 'rgba(255, 206, 86, 0.2)',
+ 'data' => [],
+ ];
+ $recordILSUsage->selectAdd('SUM(supplementalFileDownloadCount) as sumSupplementalFilesDownloaded');
+ }
+ if ($stat == 'recordsHeld') {
+ $dataSeries['Records Held'] = [
+ 'borderColor' => 'rgba(154, 75, 244, 1)',
+ 'backgroundColor' => 'rgba(154, 75, 244, 0.2)',
+ 'data' => [],
+ ];
+ $recordILSUsage->selectAdd('SUM(IF(timesUsed>0,1,0)) as numRecordsUsed');
+ }
+ if ($stat == 'totalHolds') {
+ $dataSeries['Total Holds'] = [
+ 'borderColor' => 'rgba(54, 162, 235, 1)',
+ 'backgroundColor' => 'rgba(54, 162, 235, 0.2)',
+ 'data' => [],
+ ];
+ $recordILSUsage->selectAdd('SUM(timesUsed) as totalHolds');
+ }
+
+ //Collect results
+ $recordILSUsage->find();
+ while ($recordILSUsage->fetch()) {
+ $curPeriod = "{$recordILSUsage->month}-{$recordILSUsage->year}";
+ $columnLabels[] = $curPeriod;
+ if ($stat == 'pdfsDownloaded' ) {
+ /** @noinspection PhpUndefinedFieldInspection */
+ $dataSeries['PDFs Downloaded']['data'][$curPeriod] = $recordILSUsage->sumPdfsDownloaded;
+ }
+ if ($stat == 'pdfsViewed' ) {
+ /** @noinspection PhpUndefinedFieldInspection */
+ $dataSeries['PDFs Viewed']['data'][$curPeriod] = $recordILSUsage->sumPdfsViewed;
+ }
+ if ($stat == 'supplementalFilesDownloaded' ) {
+ /** @noinspection PhpUndefinedFieldInspection */
+ $dataSeries['Supplemental Files Downloaded']['data'][$curPeriod] = $recordILSUsage->sumSupplementalFilesDownloaded;
+ }
+ if ($stat == 'recordsHeld') {
+ /** @noinspection PhpUndefinedFieldInspection */
+ $dataSeries['Total Holds']['data'][$curPeriod] = $recordILSUsage->numRecordsUsed;
+ }
+ if ($stat == 'totalHolds') {
+ /** @noinspection PhpUndefinedFieldInspection */
+ $dataSeries['Total Holds']['data'][$curPeriod] = $recordILSUsage->totalHolds;
+ }
+ }
+ }
+
+ $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 getBreadcrumbs(): array {
+ $breadcrumbs = [];
+ $breadcrumbs[] = new Breadcrumb('/Admin/Home', 'Administration Home');
+ $breadcrumbs[] = new Breadcrumb('/Admin/Home#ils_integration', 'ILS Integration');
+ $breadcrumbs[] = new Breadcrumb('/ILS/Dashboard', 'Usage Dashboard');
+ $breadcrumbs[] = new Breadcrumb('', 'Usage Graph');
+ return $breadcrumbs;
+ }
+
+ function getActiveAdminSection(): string {
+ return 'ils_integration';
+ }
+
+ function canView(): bool {
+ return UserAccount::userHasPermission([
+ 'View Dashboards',
+ 'View System Reports',
+ ]);
+ }
+}
\ No newline at end of file
{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} +
---|---|
{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} +