Skip to content

Code Functional Reference

Charles edited this page Nov 10, 2017 · 8 revisions

Functional References

Sometimes you just need a 10,000 foot "birds eye view" of what's going on inside the code. Here's the place.

Environment Variables (dto classes)

Beginning in 2.4.0, we began converting global variables to static classes. This gives us more flexibility and clarity when referring to these necessary variables.

If you find yourself tempted to add to the legacy Include/Functions.php file, please evaluate whether the function would be better placed in a static class.

  • SystemURLs

    • Document Root - The physical path of ChurchCRM on the server. i.e. /var/www/html/ChurchCRM
    • Root Path - The path of ChurchCRM relative to the current domain. i.e. http://www.domain.com**/churchCRM**
  • SystemConfig

    • Read / Write access to all of the system configuration options found in System Settings | General Settings

Object Model / SQL

  • We use PropelORM to provide a PHP object model for database entities.
    * These classes are automatically generated at build time, and are located at src/ChurchCRM/model/*
  • As of 2.4.0, there is still a lot of legacy code that relies on direct calls to SQL. These should all be replaced by ORM calls.

schema.xml is used to automatically generate the base model like this:


/propel/schema.xml ---> (/propel/propel.php) ----|---> /src/ChurchCRM/model/ChurchCRM/Base
                                                 |---> /src/ChurchCRM/model/ChurchCRM/Map

Legacy Code

There is a lot of legacy code that obscures the line between logic and page rendering. Wherever possible, program / business logic shoudl be separate from page rendering.

JavaScript

  • We have a window.CRM object *window.CRM.root represents the $sRootPath path as defined in Include/Config.php
Clone this wiki locally