This commit is contained in:
@@ -37,7 +37,7 @@ class Registry { const
|
||||
DB_PRFX = 'lsio_', // DB table prefix
|
||||
ORGANIZATION = 'Widgets, Inc', // Organization name
|
||||
DEFAULTLANGUAGE = 'en', // Default language - make sure a translation file exists
|
||||
ROWSPERPAGE = '5', // Rows per page on tables (does not include reports)
|
||||
ROWSPERPAGE = '10', // Rows per page on tables (does not include reports)
|
||||
MINPASS = '8', // Minimum password length
|
||||
DEFAULTTZ = 'America/New_York' // DEFAULT TIME ZONE
|
||||
;}
|
||||
|
||||
63
src/Database/SiteInfo.php
Executable file → Normal file
63
src/Database/SiteInfo.php
Executable file → Normal file
@@ -27,29 +27,60 @@ use App\LobbySIO\Config\Registry;
|
||||
*/
|
||||
|
||||
class SiteInfo {
|
||||
public function getSiteInfo ($siteid){
|
||||
|
||||
// Return Site Information array. 0 eliminates argument
|
||||
public function getSite ($sites_id, $users_id, $rowsperpage, $offset) {
|
||||
if ($sites_id == "0") { $c_sites_id = NULL; }
|
||||
else { $c_sites_id = Registry::DB_PRFX . "sites.id LIKE \"$sites_id\""; }
|
||||
if ($users_id == "0") { $c_users_id = NULL; }
|
||||
else { $c_users_id = Registry::DB_PRFX . "users_sites.users_id LIKE \"$users_id\""; }
|
||||
|
||||
if ($c_sites_id === NULL AND $c_users_id === NULL) {
|
||||
$c_where = NULL;
|
||||
} elseif ($c_sites_id !== NULL AND $c_users_id !== NULL) {
|
||||
$c_where = "WHERE " . $c_sites_id . " AND " . $c_users_id;
|
||||
} elseif ($c_sites_id === NULL AND $c_users_id !== NULL) {
|
||||
$c_where = "WHERE " . $c_users_id;
|
||||
} elseif ($c_sites_id !== NULL AND $c_users_id === NULL) {
|
||||
$c_where = "WHERE " . $c_sites_id;
|
||||
}
|
||||
|
||||
if ($rowsperpage == "0") { $c_rowsperpage = NULL; }
|
||||
else { $c_rowsperpage = " LIMIT " . Registry::ROWSPERPAGE; }
|
||||
if ($offset == "0") { $c_offset = NULL; }
|
||||
else { $c_offset = " OFFSET " . $offset; }
|
||||
$query = "
|
||||
SELECT
|
||||
" . Registry::DB_PRFX . "sites.id as sites_id,
|
||||
" . Registry::DB_PRFX . "sites.name as sites_name,
|
||||
" . Registry::DB_PRFX . "sites.timezone as sites_timezone
|
||||
FROM " . Registry::DB_PRFX . "sites
|
||||
WHERE " . Registry::DB_PRFX . "sites.id LIKE \"$siteid\"";
|
||||
SELECT
|
||||
" . Registry::DB_PRFX . "sites.id as sites_id,
|
||||
" . Registry::DB_PRFX . "sites.name as sites_name,
|
||||
" . Registry::DB_PRFX . "sites.region as sites_region,
|
||||
" . Registry::DB_PRFX . "sites.timezone as sites_timezone
|
||||
FROM " . Registry::DB_PRFX . "sites
|
||||
JOIN " . Registry::DB_PRFX . "users_sites ON " . Registry::DB_PRFX . "sites.id=" . Registry::DB_PRFX . "users_sites.sites_id
|
||||
" . $c_where . "
|
||||
ORDER BY " . Registry::DB_PRFX . "sites.name ASC" . $c_rowsperpage . $c_offset;
|
||||
$database = new \App\LobbySIO\Database\Connect();
|
||||
$rows = $database->getQuery($query);
|
||||
return $rows;
|
||||
}
|
||||
|
||||
public function getSiteName ($siteid) {
|
||||
|
||||
public function deleteSite ($siteid) {
|
||||
$query = "
|
||||
SELECT
|
||||
" . Registry::DB_PRFX . "sites.id as sites_id,
|
||||
" . Registry::DB_PRFX . "sites.name as sites_name
|
||||
FROM " . Registry::DB_PRFX . "sites
|
||||
WHERE " . Registry::DB_PRFX . "sites.id LIKE $siteid";
|
||||
DELETE FROM " . Registry::DB_PRFX . "sites WHERE " . Registry::DB_PRFX . "sites.id=\"$siteid\"
|
||||
";
|
||||
$database = new \App\LobbySIO\Database\Connect();
|
||||
$rows = $database->getQuery($query);
|
||||
return $rows[0]["sites_name"];
|
||||
$count = $database->runQuery($query);
|
||||
return $count;
|
||||
}
|
||||
|
||||
public function addSite ($sitename, $timezone, $region) {
|
||||
$query = "
|
||||
INSERT INTO " . Registry::DB_PRFX . "sites (" . Registry::DB_PRFX . "sites.name, " . Registry::DB_PRFX . "sites.timezone, " . Registry::DB_PRFX . "sites.region)
|
||||
VALUES (\"$sitename\", \"$timezone\", \"$region\")
|
||||
";
|
||||
$database = new \App\LobbySIO\Database\Connect();
|
||||
$count = $database->runQuery($query);
|
||||
return $count;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
5
src/Database/Users.php
Executable file → Normal file
5
src/Database/Users.php
Executable file → Normal file
@@ -26,7 +26,7 @@ use App\LobbySIO\Config\Registry;
|
||||
* @author josh.north
|
||||
*/
|
||||
class Users {
|
||||
// Get site info as array by site id. Pass % for all.
|
||||
// Get user info as array by user id. Pass % for all.
|
||||
public function getUserInfo($userid, $rowsperpage, $offset) {
|
||||
if ($rowsperpage == "%") { $cond_rowsperpage = NULL; } else { $cond_rowsperpage = " LIMIT " . Registry::ROWSPERPAGE; };
|
||||
if ($offset == "%") { $cond_offset = NULL; } else { $cond_offset = " OFFSET " . $offset; };
|
||||
@@ -86,6 +86,7 @@ class Users {
|
||||
";
|
||||
$database = new \App\LobbySIO\Database\Connect();
|
||||
$count = $database->runQuery($query);
|
||||
return $count;
|
||||
}
|
||||
|
||||
public function setUserInfo($uid, $firstname, $lastname, $email, $usertypeid, $password) {
|
||||
@@ -102,6 +103,7 @@ class Users {
|
||||
";
|
||||
$database = new \App\LobbySIO\Database\Connect();
|
||||
$count = $database->runQuery($query);
|
||||
return $count;
|
||||
}
|
||||
|
||||
public function getUserType ($usertypeid){
|
||||
@@ -122,6 +124,7 @@ class Users {
|
||||
";
|
||||
$database = new \App\LobbySIO\Database\Connect();
|
||||
$count = $database->runQuery($query);
|
||||
return $count;
|
||||
}
|
||||
|
||||
public function getUserTypeInfo ($usertypeid) {
|
||||
|
||||
2
src/Database/VisitInfo.php
Executable file → Normal file
2
src/Database/VisitInfo.php
Executable file → Normal file
@@ -41,7 +41,7 @@ class VisitInfo {
|
||||
if ($rowsperpage == "%") { $cond_rowsperpage = NULL; } else { $cond_rowsperpage = " LIMIT " . Registry::ROWSPERPAGE; };
|
||||
if ($offset == "%") { $cond_offset = NULL; } else { $cond_offset = " OFFSET " . $offset; };
|
||||
if ($intime == "%") { $cond_intime = NULL; } else { $cond_intime = Registry::DB_PRFX . "visits.intime=\"$intime\" AND "; };
|
||||
if ($siteid == "%") { $cond_siteid = NULL; } else { $cond_siteid = Registry::DB_PRFX . "visits.site_id=\"$siteid\" AND "; };
|
||||
if ($siteid == "%") { $cond_siteid = NULL; } else { $cond_siteid = Registry::DB_PRFX . "visits.site_id IN (\"$siteid\") AND "; };
|
||||
if ($visitid == "%") { $cond_visitid = NULL; } else { $cond_visitid = Registry::DB_PRFX . "visits.id LIKE \"$visitid\" AND "; };
|
||||
if ($starttime == "%") { $cond_intime = NULL; } else { $cond_intime = Registry::DB_PRFX . "visits.intime BETWEEN \"$starttime\" and \"$endtime\" AND "; };
|
||||
$query = "
|
||||
|
||||
@@ -9,6 +9,8 @@ ACTIVEVISITS = 'Aktive Besuche'
|
||||
ADDEQPT = 'Ausrüstung hinzufügen'
|
||||
ADD_USER = 'Benutzer hinzufügen'
|
||||
ADD_USER_DESC = 'Alle Felder sind erforderlich! Benutzername und E-Mail müssen eindeutig sein. Minimale Passwortlänge ist '
|
||||
ADD_SITE = 'Ort hinzufügen'
|
||||
SADMIN = 'Standortadministrator'
|
||||
ADMIN = 'Administrator'
|
||||
ADMINISTRATION = 'Verwaltung'
|
||||
ALL = 'Alles'
|
||||
@@ -74,6 +76,7 @@ NAME = 'Vollständiger Name'
|
||||
NEW = 'Neu'
|
||||
NONEAVA = 'Keiner'
|
||||
NOSIGNIN = 'Keine Anmeldung'
|
||||
NOSITE = 'Kein Standort ausgewählt'
|
||||
NOTES = 'Anmerkungen'
|
||||
NOTES_PLACEHOLDER = 'Geben Sie bei Bedarf Notizen ein'
|
||||
NOT_AUTHORIZED = 'Nicht berechtigt!'
|
||||
@@ -94,6 +97,7 @@ REASON = 'Grund für den Zugang zu Einrichtungen'
|
||||
REASONCOMPANY = 'Firma / Grund'
|
||||
REFERENCE = 'Referenz'
|
||||
REFRESH = 'Aktualisieren'
|
||||
REGION ='Region'
|
||||
REMEQPT = 'Ausrüstung entfernen'
|
||||
REPORTS = 'Berichte'
|
||||
REPORTS_DESC = 'Die Dropdown-Liste kann verwendet werden, um vorkonfigurierte Berichte auszuwählen. Weitere Berichte werden gerade geschrieben.'
|
||||
|
||||
@@ -9,6 +9,8 @@ ACTIVEVISITS = 'Active Visits'
|
||||
ADDEQPT = 'Add Equipment'
|
||||
ADD_USER = 'Add User'
|
||||
ADD_USER_DESC = 'All fields are required! Username and email must be unique. Minimum password length is '
|
||||
ADD_SITE = 'Add Site'
|
||||
SADMIN = 'Site Administrator'
|
||||
ADMIN = 'Administrator'
|
||||
ADMINISTRATION = 'Administration'
|
||||
ALL = 'All'
|
||||
@@ -74,6 +76,7 @@ NAME = 'Name'
|
||||
NEW = 'New'
|
||||
NONEAVA = 'None'
|
||||
NOSIGNIN = 'No sign in'
|
||||
NOSITE = 'No Site Selected'
|
||||
NOTES = 'Notes'
|
||||
NOTES_PLACEHOLDER = 'Enter notes if needed'
|
||||
NOT_AUTHORIZED = 'Not Authorized!'
|
||||
@@ -94,6 +97,7 @@ REASON = 'Reason for Facility Access'
|
||||
REASONCOMPANY = 'Company / Reason'
|
||||
REFERENCE = 'Reference'
|
||||
REFRESH = 'Refresh'
|
||||
REGION ='Region'
|
||||
REMEQPT = 'Remove Equipment'
|
||||
REPORTS = 'Reports'
|
||||
REPORTS_DESC = 'The drop-down below can be used to select pre-configured reports. Other reports are currently being written.'
|
||||
|
||||
@@ -9,6 +9,8 @@ ACTIVEVISITS = 'Visitas activas'
|
||||
ADDEQPT = 'Agregar Equipo'
|
||||
ADD_USER = 'Agregar usuario'
|
||||
ADD_USER_DESC = '¡Todos los campos son obligatorios! El nombre de usuario y el correo electrónico deben ser únicos. La longitud mínima de la contraseña es '
|
||||
ADD_SITE = 'Agregar sitio'
|
||||
SADMIN = 'Administrador de ubicación'
|
||||
ADMIN = 'Administrador'
|
||||
ADMINISTRATION = 'Administración'
|
||||
ALL = 'Todos'
|
||||
@@ -74,6 +76,7 @@ NAME = 'Nombre'
|
||||
NEW = 'Nuevo'
|
||||
NONEAVA = 'Nada'
|
||||
NOSIGNIN = 'No completó'
|
||||
NOSITE = 'Ningún sitio seleccionado'
|
||||
NOTES = 'Notas'
|
||||
NOTES_PLACEHOLDER = 'Introduce notas si es necesario'
|
||||
NOT_AUTHORIZED = '¡No autorizado!'
|
||||
@@ -94,6 +97,7 @@ REASON = 'Razón para el acceso a las instalaciones'
|
||||
REASONCOMPANY = 'Empresa / Razón'
|
||||
REFERENCE = 'Referencia'
|
||||
REFRESH = 'Recargar'
|
||||
REGION ='Región'
|
||||
REMEQPT = 'Llevar Equipo'
|
||||
REPORTS = 'Informes'
|
||||
REPORTS_DESC = 'El menú desplegable a continuación se puede utilizar para seleccionar informes preconfigurados. Otros informes se están escribiendo actualmente.'
|
||||
|
||||
@@ -9,6 +9,8 @@ ACTIVEVISITS = 'Visites actives'
|
||||
ADDEQPT = 'Ajouter un équipement'
|
||||
ADD_USER = 'Ajouter un utilisateur'
|
||||
ADD_USER_DESC = 'Tous les champs sont requis! Le nom d'utilisateur et l'adresse e-mail doivent être uniques. La longueur minimale du mot de passe est '
|
||||
ADD_SITE = 'Ajouter un site'
|
||||
SADMIN = 'Administrateur d'emplacement'
|
||||
ADMIN = 'Administrateur'
|
||||
ADMINISTRATION = 'Administration'
|
||||
ALL = 'Tout'
|
||||
@@ -74,6 +76,7 @@ NAME = 'Nom complet'
|
||||
NEW = 'Nouveau'
|
||||
NONEAVA = 'Aucun'
|
||||
NOSIGNIN = 'Pas de connexion'
|
||||
NOSITE = 'Aucun site sélectionné'
|
||||
NOTES = 'Notes'
|
||||
NOTES_PLACEHOLDER = 'Entrez des notes si nécessaire'
|
||||
NOT_AUTHORIZED = 'Pas autorisé!'
|
||||
@@ -94,6 +97,7 @@ REASON = 'Raison de l’accès aux installations'
|
||||
REASONCOMPANY = 'Organisation / Raison'
|
||||
REFERENCE = 'Reference'
|
||||
REFRESH = 'Actualiser'
|
||||
REGION ='Région'
|
||||
REMEQPT = 'Remove Equipment'
|
||||
REPORTS = 'Rapports'
|
||||
REPORTS_DESC = 'Le menu déroulant ci-dessous peut être utilisé pour sélectionner des rapports préconfigurés. D'autres rapports sont en cours de rédaction.'
|
||||
|
||||
Reference in New Issue
Block a user