Skip to content

Application Design Refactored

Compare
Choose a tag to compare
@ackspony ackspony released this 20 Nov 23:38
· 194 commits to master since this release

With this release; end-user will not experience any changes in their workflow or UI experience (except some very minor ones described below). The goal was to refactor the project design to prepare for significant updates in the future.

Feature Changes

This is the beginning of a set of feature changes that will be made in the future based on end-user feedback. I was able to make a few feature changes that affect end user experience in minor (hopefully positive) ways.

  • customer pages /customer.php?edit={customer-id}
    • Removed ability to email 'customer files', as this feature was require when iOS did not support uploading via Safari. The normal 'file upload' feature works fine on all iOS devices now.
    • Minor UI changes to use icons to denote expanding/collapsing the 'files' area of a customer.
  • schedule entry pages /sentry.php?show={senty-id}
    • Removed option to use Google Maps as it was strange to have users "choose" between Bing and Google.
    • Minor UI changes to use icons to denote expanding/collapsing the 'files' area of a customer.

Project Design Changes

The project design and code have been significantly altered. The purpose of these changes is to prepare for major UI updates to implementing Bootstrap 4 for a mobile friendly experience. The original code was written for earlier versions of php 5; having a project design that left much to be desired. While there are still quite a few deficiencies in the code; but, with this refactoring to a more ideal project design, it is at least on the right track! The following is a summary and description of the design changes.

  • Moved the "include" folder contents to the "lib" folder.

  • Config Files
    Configuration values used to be contained in a set of files in the "include" folder "settings.inc.php", "settings.sentry.inc.php"."settings.balive.inc.php". Functions which needed a configuration setting would perform a require "settings.inc.php" command to obtain the needed configuration values. This has been changed to a system using php files which return associative arrays containing the expected values, but referenced by an associative keys rather than defining variable names. See the "example 5" section regarding includes in the PHP manual.

    • separate 'config' files in app/config/clientcal. These are expected to return an associative array of configuration values, for example...
    /*begin config_file_example.php */
    $config=[];
    $config['setting1']='my_value1';
    $config['setting2'] = 'my_value2';
    return $config;
    /*end of config_file_example.php */
    • 'config' convenience class usage (class defined in src/config.php). For example, to obtain a particular config value through a simple class/method:
    use clientcal\config;
    $setting1 = (new config("config_file_exampl"))->getValue('setting1');
  • php composer integration
    There were many project changes to facilitate use of composer's class and file autoloading.

    • Removed all code logic with require('exmple.php') commands for function definitions, such as...
    require("file-with-function definitions");
    • And, instead of above, made use of composer.json autoloading instead, for example...
    {"autoload": {
          "files": [
              "lib/DAL/customer.php",
              "lib/etc..."
           ]
      }}
  • entry points and controllers
    Web based entry points for the application were previously located in the project root folder, they have now been moved to the web folder. Routing for applying UI and business logic is contained in corresponding controller files in app/Resources/controller. For example, given that the URL "https://example.com/sentry.php" corresponds to the entry point web/sentry.php. The entry points files consist of boilerplate code to prepare the app and activate the corresponding controller, for example, web/sentry, would include the controller app/Resources/controller/sentry.php.

    • sentry.php
      • view schedule entries (jobs) in various formats
        • monthly
        • weekly
        • single entry
      • create/edit/delete schedule entries
    • login.php
      • user authentication via user/pass login
    • _customer.php_
      • view customer information
      • upload files (such as photos) related to a customer ('customer files')
      • view, rename, and delete 'customer files'