-
Notifications
You must be signed in to change notification settings - Fork 21
Outline Backend
caywood edited this page Dec 10, 2012
·
2 revisions
The backend is based on Code Igniter (CI). Large fractions of the code are part of the standard CI package. The sections outlined here are custom code.
index.php - top level controller. Sets development, testing or production.
/application/config
config.php - for MAMP, use $config['base_url'] = 'http://localhost:8888/';
database.php - need to set $db['default']['password'] to whatever your postgres password is
the rest is CI
/application/controllers
login.php - controller for login page.
loads: /views/login_form
load user_model
validates user
creates session
redirects to: screen_admin.php
Note: If you wish to handle more sophisticated tasks like password recovery or assigning different users to different access privileges, add the code here.
screen_admin.php - controller for screen adminstrator page.
load screen_model
list screens
edit: builds screen_editor page using views/screen_editor.php
calls get_screen_values to load from DB
save: creates a new screen if one doesn't exist
calls save_screen_values to write to DB
redirect to screen or to screen_admin page
screen.php - controller for transit screen, sets up view
index - loads views/includes/screen_wrapper
inner - for the inner iframe.
loads screen_model
determines sleep or not
sets up correct column template
loads views/includes/screen_template
update.php - creates update data for a screen
version: hashes screen settings to determine if the screen needs a refresh
json: generates the JSON data update for every screen
calls get_bus_predictions, get_rail_predictions, get_cabi_status
combine_agencies
create blocks
_combine_duplicates: combines the same route to make large & small arrival times
_get_agency_type: convert agency name to mode
_update_timestamp: updates the 'last checkin' timestamp on admin page
welcome.php - CI stuff?
/application/errors - default error pages
/application/helpers
render_admin_helper - helper functions for screen admin page
get_field_alias - clean up names of fields on admin page
get_verbose_status - return nice status messages
transit_functions_helper - APIs for transit agencies go here
clean_time - nicely print arrival time
clean_station - nicely print station name; a bunch of special cases for Metro data here
clean_destination - nicely print destination; some rules and some special cases
render_bus
render_trains - these create the div for a train/bus
get_rail_predictions - get Metro predictions
assemble_stop - get all bus predictions.
get_bus_predictions
get_metrobus_predictions
get_nextbus_predictions
get_connexionz_predictions
get_cabi_status - get CaBi station status
combine_agencies - combine bus predictions for one stop (block)
transit_functions - blank
/application/languages/english/tank_auth_lang.php - CI login/authorization errors and messages
/application/models
screen_model - screen model. called by screen_admin and screen controllers.
load_model - load from DB
_assemble_stops - create a block (array of agencies and stops)
get_screens_by_user_id - get all screens belonging to a user. XXX Currently returns all screens.
get_screen_values - get screen configuration values from DB
save_screen_values - save screen configuration values to DB
_add_stop_pairs - add or change stops in a block. XXX this may be buggy
is_asleep - determines whether screen should be asleep or awake
get_num_columns - gets number of columns in screen so it knows how many columns to display XXX may be buggy
update_model - called by update controller.
load_model
get_screen_values - puts configuration values in array
user_model - called by login controller XXX needs filling out
create_user
get_user_by_id -- not used
get_user_by_username -- not used
validate
/application/views
includes/
Screen admin:
template - for screen_admin and screen_editor page
header - for screen_admin and screen_editor page
footer - for screen_admin and screen_editor page
screen_admin_instructions - instructions on screen_editor page for building screen
Screen:
screen_wrapper - creates outer "super page" for screens
screen_template - inner iframe for screens
screen_header - for screen_template
screen_footer - for screen
login_form - creates login form page which calls login/validate_credentials
screen_editor - screen editor view, called by screen_admin edit. Creates $rows
screen_listing - screen_admin view. List of screens.
three_col - default template when screen is asleep (I think)
welcome_message - CI stuff