Skip to content

jfinstrom/helloworld

Repository files navigation

helloworld

FreePBX Hello World with BMO for 15+. Note: Some functionality may work on versions 12-14, though deprecated methods have been removed.

Status

This module is fully functional for managing notes. It installs successfully on FreePBX 13 and utilizes features exclusive to version 15, such as backup and restore.

Scope

This module aims to strike a balance between demonstrating key functionality and avoiding overwhelming complexity. The following tasks are covered:

  • Basic Structure
  • Writing to Database
  • Reading from Database
  • Writing a Configuration File
  • Reading a Configuration File
  • Displaying a Page
  • Displaying a Populated Form
  • Handling Form Submission
  • Writing Dial Plan

The UCP module may have its own scope and readme file, as it's not the primary focus of this example.

TODO:

  • Hook into pages.
  • Implement creation/editing of a configuration file.
  • Comment and clarify code.

Structure

Folder Tree

  • rawname

    • assets
      • js
      • css
    • views
  • UCP (Optional)

    • assets
      • js
      • css
    • views
  • Api

    • Rest
    • Graphql

rawname

  • assets: Contains CSS and JavaScript files.
  • views: HTML page views, devoid of logic.

UCP

Optional module for the user control panel, following the same directory structure as rawname.

API - 15+

Files

  • rawname/Rawname.class.php: Primary module class.
  • rawname/module.xml: Module definition.
  • rawname/rawname.page.php

Rawname.class.php

Follow the convention of capitalizing the first letter.

Required Methods (even if not used)

These methods are mandatory, even if not utilized:

  • public function install() {}
  • public function uninstall() {}
  • public function doConfigPageInit(\$page) {}

install method

Replaces install.php.

uninstall method

Performs cleanup tasks.

backup method (Future)

Generates an array for potential restoration.

restore method (Future)

Accepts the array generated by the backup method for restoring previous configurations.

doConfigPageInit method

Essential for processing $_REQUEST.

Functional Notes

Avoid using ?> followed by an empty newline, as PHP may encounter issues. Only use ?> for inline PHP.

Resources

Support

If you found this code helpful, consider supporting my employer, as it enables me to continue developing such projects.

ClearlyIP

License

AGPLv3+