How hodardcodeclub/construction-works-management-system- works
Project type and purpose
• This is a full-stack PHP/MySQL web application called CWMS (Construction Works Management System).
• It has three distinct role-based modules:
– admin (user login, registration, basic auth pages)
– cwms (general user interface built on AdminLTE)
– owner (owner-specific interface, similar structure to cwms)
• Uses Apache2 + PHP (5.7+), MySQL, front-end powered by Bootstrap/AdminLTE, jQuery, and a host of JS/CSS plugins.
File structure
Top-level directories:
• admin/ → PHP scripts for authentication and user management, plus SQL import scripts
• cwms/ → primary UI module:
– build/ → source .less files & Grunt asset pipeline
– dist/ → compiled CSS/JS, images
– pages/ → .php/.html views (UI, charts, forms, tables)
– plugins/ → third-party libraries (CKEditor, DataTables, Chart.js, etc.)
– upload/ → file-upload handler + user_images storage
– dbconnect.php, pages/tables/dbconfig.php → database connection
– Gruntfile.js, package.json → build tool config
• owner/ → a near-duplicate of cwms/, but for the “owner” role
• .idea, README.md
a. Client (Browser)
– Fetches HTML/CSS/JS (from dist/, plugins/)
– Sends HTTP(S) requests (GET/POST) to PHP endpoints
b. Web Server (Apache2)
– Serves static assets (dist/, plugins/)
– Routes requests for .php files in admin/, cwms/, owner/
c. Application Modules (PHP)
– Admin module: admin/index.php, register.php, logout.php → handles login/registration
– CWMS module: cwms/index.php + pages/… → dynamic UI, CRUD operations
– Owner module: owner/index.php + pages/… → owner-specific views & CRUD
d. Database (MySQL)
– Single or multiple schemas imported via testdb.sql/hodard.sql
– Accessed through dbconnect.php / dbconfig.php in each module
e. File Storage
– Upload directories: cwms/upload/user_images, owner/upload/user_images
– PHP scripts handle move_uploaded_file and file I/O
f. Build Tool (Grunt)
– Watches build/less → produces dist/css & dist/js bundles
Data flows and interactions
• Browser → HTTP → Apache serves static assets or invokes PHP scripts
• PHP scripts ↔ MySQL (PDO/mysqli calls for CRUD)
• PHP file-upload endpoints ↔ local filesystem (user_images/)
• Grunt → compiles LESS → dist/, which browsers then load
Architectural patterns and principles
• Role-based modularization: separate admin, cwms, and owner modules
• Asset pipeline: source (build/) → compiled (dist/) → served to client
• Shared templating: header.php, aside.php, footer.php includes for layout consistency
• MVC-inspired: pages/… directories act as “views”, direct DB calls within controllers (PHP pages)