First git push to github

This commit is contained in:
2026-05-29 14:52:16 -04:00
commit 94bc6117f2
1576 changed files with 455304 additions and 0 deletions
+97
View File
@@ -0,0 +1,97 @@
<style>
body {
background-color: #333333;
color: white;
}
</style>
<?php
// Simple Script to create a MySQL View.
define("INITIALIZATION_FILE_NAME", "../xml/settings.xml");
// Retrieve Application Settings
$applicationSettings = simplexml_load_file(INITIALIZATION_FILE_NAME);
if (empty($applicationSettings)) {
echo "Unable to load Application Settings." . PHP_EOL;
exit();
}
// Connect to the Database.
$host = (string) $applicationSettings->DatabaseServer;
$database = (string) $applicationSettings->DatabaseName;
$user = (string) $applicationSettings->DatabaseUser;
$password = (string) $applicationSettings->DatabasePassword;
try {
$connection = new PDO("mysql:host={$host};dbname={$database}", $user, $password);
} catch (PDOException | Exception $e) {
echo "Unable to connect to the database. <br/>";
echo "Error is: {$e->getMessage()}";
exit();
}
// Retrieve the View Names.
$views = array();
$directory = ".";
if (is_dir($directory)) {
if ($handle = opendir($directory)) {
while (false !== ($filename = readdir($handle))) {
if ($filename != "." && $filename != ".." && !is_dir("{$directory}/{$filename}")) {
if (substr($filename, 0, 5) !== "view_") {
continue;
}
$views[] = $filename;
}
}
closedir($handle);
}
}
if (count($views) === 0) {
echo "No views found. Views not created.";
exit();
}
// Create the Views
$created = 0;
$not_created = 0;
foreach ($views as $view) {
if ((include "{$view}") != true) {
echo "{$view} not found. View not created <br/>.";
continue;
}
$view = str_replace(".php", "", $view);
$connection->exec("drop view if exists {$view}");
$connection->exec($SQL);
if ($connection->errorCode() != 0) {
$not_created++;
echo "Error creating view {$view}: <br/>";
echo "<pre>";
print_r($connection->errorInfo());
echo "<br/>";
} else {
$created++;
echo "{$view} was created. <br/>";
}
}
echo "<br/> {$created} Views were created. {$not_created} were not created due to errors.";
?>
+72
View File
@@ -0,0 +1,72 @@
<style>
body {
background-color: #333333;
color: white;
}
</style>
<?php
// Simple Script to create a MySQL View.
define("INITIALIZATION_FILE_NAME", "../xml/settings.xml");
// Retrieve the View Name.
$view = $_GET["view"] ?? "";
if (empty($view)) {
echo "No view name given. View not created.";
exit();
}
if ((include "{$view}.php") != true) {
echo "{$view}.php not found. View not created.";
exit;
}
// Retrieve Application Settings
$applicationSettings = simplexml_load_file(INITIALIZATION_FILE_NAME);
if (empty($applicationSettings)) {
echo "Unable to load Application Settings." . PHP_EOL;
exit();
}
echo $applicationSettings->asXML();
die();
// Connect to the Database.
$host = (string) $applicationSettings->DatabaseServer;
$database = (string) $applicationSettings->DatabaseName;
$user = (string) $applicationSettings->DatabaseUser;
$password = (string) $applicationSettings->DatabasePassword;
try {
$connection = new PDO("mysql:host={$host};dbname={$database}", $user, $password);
} catch (PDOException | Exception $e) {
echo "Unable to connect to the database. <br/>";
echo "Error is: {$e->getMessage()}";
exit();
}
// Create the view.
$connection->exec("drop view if exists {$view}");
try {
$connection->exec($SQL);
} catch (Exception $e) {
echo "Error creating view. <br/>";
echo "Error is: {$e->getMessage()}";
exit();
}
if ($connection->errorCode() != 0) {
echo "Error creating view. <br/>";
echo "<pre>";
print_r($connection->errorInfo());
} else {
echo "View {$view} was created.";
}
?>
+16
View File
@@ -0,0 +1,16 @@
<?php
$SQL = "create view view_alerts as
select alerts.*,
date_format(alert_created, '%c/%e/%Y %l:%i %p') as alert_created_verbose,
date_format(alert_changed, '%c/%e/%Y %l:%i %p') as alert_changed_verbose,
date_format(alert_started, '%c/%e/%Y %l:%i %p') as alert_started_verbose,
date_format(alert_expired, '%c/%e/%Y %l:%i %p') as alert_expires_verbose
from alerts
order by alert_created";
?>
+36
View File
@@ -0,0 +1,36 @@
<?php
$SQL = "create view view_businessfacts as
select businessfacts.*,
date_format(businessfact_created, '%c/%e/%Y %l:%i %p') as businessfact_created_verbose,
date_format(businessfact_changed, '%c/%e/%Y %l:%i %p') as businessfact_changed_verbose,
date_format(businessfact_entry_date, '%c/%e/%Y') as businessfact_entry_date_verbose,
date_format(businessfact_license_date, '%c/%e/%Y') as businessfact_license_date_verbose,
date_format(businessfact_lease_end, '%c/%e/%Y') as businessfact_lease_end_verbose,
counties.county_name as businessfact_county_name_verbose,
businessfactcity.city_name as businessfact_city_verbose,
siccodes.siccode_description as businessfact_siccode_description_verbose,
businessclassifications.dropdown_value as businessfact_business_class_verbose,
actions.dropdown_value as businessfact_action_verbose
from businessfacts
left join counties
on counties.county_serial = businessfacts.businessfact_county
left join cities as businessfactcity
on businessfactcity.city_serial = businessfacts.businessfact_city
left join siccodes
on siccodes.siccode_code = businessfacts.businessfact_sic_code
left join dropdowns as actions
on actions.dropdown_serial = businessfacts.businessfact_action
left join dropdowns as businessclassifications
on businessclassifications.dropdown_serial = businessfacts.businessfact_business_class
";
?>
+12
View File
@@ -0,0 +1,12 @@
<?php
$SQL = "create view view_cities as
select cities.*,
date_format(city_created, '%c/%e/%Y %l:%i %p') as city_created_verbose,
date_format(city_changed, '%c/%e/%Y %l:%i %p') as city_changed_verbose
from cities
order by city_name";
?>
+12
View File
@@ -0,0 +1,12 @@
<?php
$SQL = "create view view_counties as
select counties.*,
date_format(county_created, '%c/%e/%Y %l:%i %p') as county_created_verbose,
date_format(county_changed, '%c/%e/%Y %l:%i %p') as county_changed_verbose
from counties
order by county_name";
?>
+17
View File
@@ -0,0 +1,17 @@
<?php
$SQL = "create view view_dropdowns as
select dropdowns.*,
date_format(dropdowntype_created, '%c/%e/%Y %l:%i %p') as dropdowntype_created_verbose,
date_format(dropdowntype_changed, '%c/%e/%Y %l:%i %p') as dropdowntype_changed_verbose,
dropdowntypes.*
from dropdowns
join dropdowntypes
on dropdowntypes.dropdowntype_serial = dropdowns.dropdown_dropdowntype
order by dropdown_dropdowntype, dropdown_value";
?>
+12
View File
@@ -0,0 +1,12 @@
<?php
$SQL = "create view view_dropdowntypes as
select dropdowntypes.*,
date_format(dropdowntype_created, '%c/%e/%Y %l:%i %p') as dropdowntype_created_verbose,
date_format(dropdowntype_changed, '%c/%e/%Y %l:%i %p') as dropdowntype_changed_verbose
from dropdowntypes
order by dropdowntype_title";
?>
+17
View File
@@ -0,0 +1,17 @@
<?php
$SQL = "create view view_exportjobs as
select exportjobs.*,
date_format(exportjob_created, '%c/%e/%Y %l:%i %p') as exportjob_created_verbose,
date_format(exportjob_completed, '%c/%e/%Y %l:%i %p') as exportjob_completed_verbose,
view_subscriptions.*
from exportjobs
left join view_subscriptions
on subscription_serial = exportjobs.exportjob_subscription";
?>
+10
View File
@@ -0,0 +1,10 @@
<?php
$SQL = "create view view_journal as
select journal.*,
date_format(journal.journal_timestamp, '%m/%d/%Y %l:%i %p') as journal_timestamp_verbose
from journal
order by journal_timestamp desc";
?>
+10
View File
@@ -0,0 +1,10 @@
<?php
$SQL = "create view view_notes as
select notes.*,
date_format(note_timestamp, '%c/%e/%Y %l:%i %p') as note_timestamp_verbose
from notes
order by note_type, note_reference, note_timestamp desc";
?>
+42
View File
@@ -0,0 +1,42 @@
<?php
$SQL = "create view view_permitfacts as
select permitfacts.*,
date_format(permitfact_created, '%c/%e/%Y %l:%i %p') as permitfact_created_verbose,
date_format(permitfact_changed, '%c/%e/%Y %l:%i %p') as permitfact_changed_verbose,
date_format(permitfact_entry_date, '%c/%e/%Y') as permitfact_entry_date_verbose,
date_format(permitfact_permit_date, '%c/%e/%Y') as permitfact_permit_date_verbose,
counties.county_name as permitfact_county_name_verbose,
permitfactcity.city_name as permitfact_city_verbose,
projectcity.city_name as project_city_verbose,
ownercity.city_name as owner_city_verbose,
projecttypes.dropdown_value as permitfact_project_type_verbose,
worktypes.dropdown_value as permitfact_work_type_verbose,
buildingtypes.dropdown_value as permitfact_building_type_verbose
from permitfacts
left join counties
on counties.county_serial = permitfacts.permitfact_county
left join cities as permitfactcity
on permitfactcity.city_serial = permitfacts.permitfact_city
left join cities as projectcity
on projectcity.city_serial = permitfacts.permitfact_project_city
left join cities as ownercity
on ownercity.city_serial = permitfacts.permitfact_owner_city
left join dropdowns as projecttypes
on projecttypes.dropdown_serial = permitfacts.permitfact_project_type
left join dropdowns as worktypes
on worktypes.dropdown_serial = permitfacts.permitfact_work_type
left join dropdowns as buildingtypes
on buildingtypes.dropdown_serial = permitfacts.permitfact_building_type";
?>
+14
View File
@@ -0,0 +1,14 @@
<?php
$SQL = "create view view_popovers as
select popovers.*,
date_format(popover_created, '%c/%e/%Y %l:%i %p') as popover_created_verbose,
date_format(popover_changed, '%c/%e/%Y %l:%i %p') as popover_changed_verbose
from popovers
order by popover_title";
?>
+12
View File
@@ -0,0 +1,12 @@
<?php
$SQL = "create view view_projecttypes as
select projecttypes.*,
date_format(projecttype_created, '%c/%e/%Y %l:%i %p') as projecttype_created_verbose,
date_format(projecttype_changed, '%c/%e/%Y %l:%i %p') as projecttype_changed_verbose
from projecttypes
order by projecttype_name";
?>
+30
View File
@@ -0,0 +1,30 @@
<?php
$SQL = "create view view_pzfacts as
select pzfacts.*,
date_format(pzfact_created, '%c/%e/%Y %l:%i %p') as pzfact_created_verbose,
date_format(pzfact_changed, '%c/%e/%Y %l:%i %p') as pzfact_changed_verbose,
date_format(pzfact_entry_date, '%c/%e/%Y') as pzfact_entry_date_verbose,
date_format(pzfact_action_date, '%c/%e/%Y') as pzfact_action_date_verbose,
counties.county_name as pzfact_county_name_verbose,
projectcity.city_name as project_city_verbose,
projecttypes.dropdown_value as pzfact_project_type_verbose,
actioncodes.dropdown_value as pzfact_action_code_verbose
from pzfacts
left join counties
on counties.county_serial = pzfacts.pzfact_county
left join cities as projectcity
on projectcity.city_serial = pzfacts.pzfact_project_city
left join dropdowns as projecttypes
on projecttypes.dropdown_serial = pzfacts.pzfact_project_type
left join dropdowns as actioncodes
on actioncodes.dropdown_serial = pzfacts.pzfact_action_code";
?>
+14
View File
@@ -0,0 +1,14 @@
<?php
$SQL = "create view view_reports as
select reports.*,
date_format(report_created, '%c/%e/%Y %l:%i %p') as report_created_verbose,
date_format(report_changed, '%c/%e/%Y %l:%i %p') as report_changed_verbose
from reports
order by report_description";
?>
+10
View File
@@ -0,0 +1,10 @@
<?php
$SQL = "create view view_searchhistories as
select searchhistories.*,
date_format(searchhistory_created, '%c/%e/%Y %l:%i %p') as searchhistory_created_verbose,
date_format(searchhistory_changed, '%c/%e/%Y %l:%i %p') as searchhistory_changed_verbose
from searchhistories";
?>
+10
View File
@@ -0,0 +1,10 @@
<?php
$SQL = "create view view_siccodes as
select siccodes.*
from siccodes
order by siccode_code";
?>
+15
View File
@@ -0,0 +1,15 @@
<?php
$SQL = "create view view_subscriptioncities as
select subscriptioncities.*,
date_format(subscriptioncity_created, '%c/%e/%Y %l:%i %p') as subscriptioncity_created_verbose,
date_format(subscriptioncity_changed, '%c/%e/%Y %l:%i %p') as subscriptioncity_changed_verbose,
cities.city_name as subscriptioncities_city_name_verbose
from subscriptioncities
left join cities
on cities.city_serial = subscriptioncities.subscriptioncity_city";
?>
+15
View File
@@ -0,0 +1,15 @@
<?php
$SQL = "create view view_subscriptioncounties as
select subscriptioncounties.*,
date_format(subscriptioncounty_created, '%c/%e/%Y %l:%i %p') as subscriptioncounty_created_verbose,
date_format(subscriptioncounty_changed, '%c/%e/%Y %l:%i %p') as subscriptioncounty_changed_verbose,
counties.county_name as subscriptioncounties_county_name_verbose
from subscriptioncounties
left join counties
on counties.county_serial = subscriptioncounties.subscriptioncounty_county";
?>
+21
View File
@@ -0,0 +1,21 @@
<?php
$SQL = "create view view_subscriptions as
select subscriptions.*,
DATE_FORMAT(subscriptions.subscription_created, '%c/%e/%Y %l:%i %p') AS subscription_created_verbose,
DATE_FORMAT(subscriptions.subscription_changed, '%c/%e/%Y %l:%i %p') AS subscription_changed_verbose,
service_levels.dropdown_value AS subscription_service_level_verbose,
markets.dropdown_value AS subscription_market_verbose,
CONCAT_WS(' ', subscriptions.subscription_title, service_levels.dropdown_value, markets.dropdown_value) AS subscription_full_title
FROM subscriptions
LEFT JOIN dropdowns as service_levels
ON service_levels.dropdown_serial = subscriptions.subscription_service_level
LEFT JOIN dropdowns markets
ON markets.dropdown_serial = subscriptions.subscription_market";
?>
+12
View File
@@ -0,0 +1,12 @@
<?php
$SQL = "create view view_users as
select users.*,
date_format(user_login, '%c/%e/%Y %l:%i %p') as user_login_verbose,
date_format(user_created, '%c/%e/%Y %l:%i %p') as user_created_verbose,
date_format(user_changed, '%c/%e/%Y %l:%i %p') as user_changed_verbose
from users
order by users.user_name";
?>
+26
View File
@@ -0,0 +1,26 @@
<?php
$SQL = "create view view_usersubscriptions as
select usersubscriptions.*,
date_format(usersubscription_created, '%c/%e/%Y %l:%i %p') as usersubscription_created_verbose,
date_format(usersubscription_changed, '%c/%e/%Y %l:%i %p') as usersubscription_changed_verbose,
date_format(usersubscription_start_date, '%c/%e/%Y') as usersubscription_start_date_verbose,
date_format(usersubscription_end_date, '%c/%e/%Y') as usersubscription_end_date_verbose,
subscriptions.subscription_title as usersubscription_title_verbose,
CONCAT_WS(' ', subscriptions.subscription_title, service_levels.dropdown_value, markets.dropdown_value) AS subscription_full_title
from usersubscriptions
left join subscriptions
on subscriptions.subscription_serial = usersubscriptions.usersubscription_subscription
left join dropdowns as service_levels
ON service_levels.dropdown_serial = subscriptions.subscription_service_level
left join dropdowns markets
ON markets.dropdown_serial = subscriptions.subscription_market";
//order by subscription_title or the order of old system
?>