webCOMAND

webCOMAND Framework

com_webcomand

A package of classes, models and content types that provide a framework for web building apps that leverage or coexist in the webCOMAND user interface.

To get started, see the webCOMAND Apps Tutorial.

App Package

A typical webCOMAND app is created as a package with the following contents.

  • WebCOMAND App - Defines the webCOMAND Apps menu launcher.
  • app.php - Defines the code to run when the app is launched.
  • config/ - Configuration files that define app settings and data.
  • components/ - PHP classes that implement component to provide UI elements.
  • models/ - Models that implement app-specific content type methods.
  • public/ - Any CSS, JavaScript, images, fonts and other support files.

President WebCOMAND AppWebCOMAND App

A WebCOMAND App defines the Title, Summary and Icon to appear in the webCOMAND Apps menu, as well as the Package and Class Name within the package's namespace (typically just "app") used to launch the app.

app.php

The main entry point of a webCOMAND App is typically named app.php, but it can be named anything as long as the WebCOMAND App (see previous section) references the corresponding Class Name.

The code must define a class that extends WebCOMANDApp in the package's namespace with a launch() method that will be called when the app is launched.  The launch() method typically calls add_component() to build out the app's user interface.

A common component is cpath_view, which displays COMAND repository content in an interactive list, form or other view.

Example

<?php
namespace com_presidentsdemo_www;

use com_webcomand\models\WebCOMANDApp;
use com_webcomand\components\cpath_view;

class app extends WebCOMANDApp {
  public function launch($options = []) {

    // populate LeftViewContainer with all presidents
    $this->add_component('\com_webcomand\components\cpath_view', [
      'Container' => 'LeftViewContainer',
      'Identifier' => 'list',
      cpath_view::CPATH => '[:President]'
    ]);

    // populate CenterViewContainer with first president
    $this->add_component('\com_webcomand\components\cpath_view', [
      'Container' => 'CenterViewContainer',
      // link this view to the list above with:
      cpath_view::PARENT_IDENTIFIER => ['list'],
      // display first president initially
      cpath_view::CPATH => '[:President AND Number=1]'
    ]);
  }
}