summaryrefslogtreecommitdiffstats
path: root/app/class
diff options
context:
space:
mode:
authorMalf Furious <m@lfurio.us>2018-07-24 04:59:34 -0400
committerMalf Furious <m@lfurio.us>2018-07-24 04:59:34 -0400
commitfc45eabca659f9e9792ca4c5a82a3cef732cec10 (patch)
tree357b97a8a95313f971cbb183f2eabe218be42410 /app/class
parentd75ede4175eac843994a93a913d445c029a44631 (diff)
downloadscrott-fc45eabca659f9e9792ca4c5a82a3cef732cec10.tar.gz
scrott-fc45eabca659f9e9792ca4c5a82a3cef732cec10.zip
Add $_SCROTT['PAGE_NAME'] variable and getter/setter
The intention is for index.php to set this variable. This is the text (HTML) displayed on the button for the pad select dropdown in the nav bar. Basically the canonical name of the page we're on.
Diffstat (limited to 'app/class')
-rw-r--r--app/class/globals.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/app/class/globals.php b/app/class/globals.php
index c81c9a2..7120aaa 100644
--- a/app/class/globals.php
+++ b/app/class/globals.php
@@ -43,6 +43,13 @@ $_SCROTT[NOTICE] = array();
$_SCROTT['PAGE_OBJECT'] = NULL;
/*
+ * The page name variable is what displays in the pad select dropdown and
+ * is typically set to the "group / pad" of the current page or, "Dashboard",
+ * "Groups", "Pads", etc. on special pages.
+ */
+$_SCROTT['PAGE_NAME'] = "";
+
+/*
* Get the application root path. This is an absolute path on the server.
*/
function ar() : string
@@ -162,6 +169,29 @@ function getPageObj() : ?obj
}
/*
+ * Set the page name string. This can only be called once per
+ * runtime.
+ */
+function setPageName(string $name) : void
+{
+ global $_SCROTT;
+
+ if ($_SCROTT['PAGE_NAME'] !== "")
+ throw new Exception("Tried to configure page name twice");
+
+ $_SCROTT['PAGE_NAME'] = $name;
+}
+
+/*
+ * Get the page name string.
+ */
+function getPageName() : string
+{
+ global $_SCROTT;
+ return $_SCROTT['PAGE_NAME'];
+}
+
+/*
* Save an uploaded file and impose some constraints on supplied
* data. Caller can optionally pass some strings by reference to
* be given the supplied file's original name and mime-type.