2.09 DB Admin Files - andperry256/my-base-theme-and-dbadmin GitHub Wiki

DB Admin - Overview of Files

This page provides a brief overview of the files that belong to the DB Admin package (i.e. in the dbadmin directory).

base.php

This is the main file for loading and running the DB Admin application. Its main features include the following:-

  • Definition of a number of JavaScript functions for use in the application.
  • Function for generating the sidebar content.
  • Selection of desktop and mobile mode.
  • Selection and running of the appropriate function for the current action.

classes.php

This contains a number of built-in class definitions, including:-

  • db_record.
  • Built-in tables dba_table_info, dba_table_fields and dba_sidebar_config.
  • Table admin_passwords (needs clarification).

common_funct.php

This file contains those functions that are commonly used by DB Admin applications (i.e. outside the core of the DB Admin package). The following functions are included:-

  • encode_record_id, decode_record_id and fully_decode_record_id (see Record IDs and the db_record Class).
  • cur_url_par - Function to return the URL of the current page.

database_sync.php

This contains the code for the Sync Databases action (see Sundry Actions).

functions.php

This file contains a list of file includes for all the other function files, thus facilitating the easy inclusion of them all.

import_export_funct.php

This contains the functions to import/export table data from/to CSV. See Sundry Actions in relation to table export.

load_viewing_mode.php

This is a standalone script that runs outside of WordPress and is invoked when switching between desktop and mobile modes. It loads the application with the required mode selected.

misc_funct.php

This contains all functions that do not specifically belong anywhere else.

record_action.php

This is the action script executed when the form is submitted on a record edit screen. It runs as a standalone script (i.e. outside the WordPress framework). It performs various operations including the actual record save before re-directing back to the edit screen.

One point to note is that a session variable $_SESSION['saved_record_id'] is set up immediately prior to the record save, containing the record ID of the saved record on the basis of the primary key values from the edit screen. This variable is then used as the URL parameter when re-directing back to the record edit screen. This means that if the afterSave function in the table class performs an operation that changes the record ID (e.g. updating a sequence number), the session variable can be updated to reflect the new resulting record ID.

record_funct.php

This file contains all the functions that broadly fall into the category of handling individual records, record fields and the record editing screen. Amongst other things the file contains the functions for saving and deleting a record.

styles.css

This file contains all the style definitions required for correct rendering of the various DB Admin screens.

table_funct.php

This file contains all the functions that broadly fall into the category of handling a table as a whole. This includes the table listing, control of multi-record operations such as delete, update and copy, and also the functions for the Export and Renumber actions (see Sundry Actions).

update_table_data.php

This file contains the code for the Update Table Data action (see Sundry Actions).

view_funct.php

This file contains the functions for the management or view and child table structures (see Tables).