Latest JAS v1.1.0
144 plugins online

Modules / My First Module

So you want to create your first module? It's not that hard, honestly! Just create a file called "notes.php" in "project/first/include/modules/" directory and add the following content:
Simple notes module
PHP
require_once($_path["include"]."module.php"); //needed for the main Module class

class Module_notes extends Module //the class name will need to match the filename (without the extension)
{
  function __construct(&$data) //constructor, with a reference to the data object
  {
    parent::__construct($data); //pass the $data object to main constructor, which sets it to $this->data

    $this->data->title="Note"; //give your module a nice title

    $this->data->defaultFields(); //initialize the default fields (nr, category reference, time fields, etc)

    $this->data->addField("title", "text", "all", "title", 1, 25, false, "Title"); //add a text field called "title"
    $this->data->addField("text", "text", "all", "markup", 0, 65536, false, "Note"); //add a bigger text field which contains the note
  }
} //and that's it

So now the next step is to create the table in the database so you can actually start adding notes. Checkout the Database database section in the JAS backend.

Comments (0)