Module Guide for CitrusDB

If you are making a new module, it should conform to a few functions to 
make sure one can use the major functions of any module without knowing 
all of it's details.

A module is just a folder with an index.php file and other files that make up 
the functions of the module.  Some modules may or may not need all these 
functions.  If they don't need the function, please make an empty file
for that function.

The following files are required, especially the search.php file - since that 
will be used to show the premade search functions for that module

index.php
this is the default file, has code to include the other files when called with 
edit=on or similar it will also provide the view of the data by default

example index.php:
/*----------------------------------------------------------------------------*/
// Check for authorized accesss
/*----------------------------------------------------------------------------*/
if(constant("INDEX_CITRUS") <> 1){
	echo "You must be logged in to run this.  Goodbye.";
	exit;	
}

if (!defined("INDEX_CITRUS")) {
	echo "You must be logged in to run this.  Goodbye.";
        exit;
}

include('include/permissions.inc');
if ($edit)
{
    if ($pallow_modify)
    {
       include('edit.php');
    }  else permission_error();
}
else if ($create)
{
    if ($pallow_create)
    {
       include('create.php');
    } else permission_error();
}
else if ($delete)
{
    if ($pallow_remove)
    {
       include('delete.php');
    } else permission_error();
}

else if ($pallow_view)
{
   //
   // NORMAL VIEW CODE GOES HERE
   //
} else permission_error();

create.php
this will be used to create a new record for that module function.  
for example, with the services module, this would create a new service for 
that customer, called with create=on

edit.php
this will be used to edit a record for that module function.  
for example, with the billing module, this would edit the billing for 
the specified billing id, called with edit=on, often called with an id 
value to specify a billing_id, or user_service_id etc.

delete.php
this will be used to delete a record for that modules function.  
for example, with the services module, this would remove the service
from that customer, called with delete=on

search.php
this will be included in the main search page.  it will not be called through 
the index.php file it will either be empty if your modules doesn't need
search ability, or have form html for 
searching the data that your module deals with

example search.php:
<form ACTION="index.php?load=dosearch&type=fs" METHOD="POST">
Company Name: <input type=text name=s1>
<input type=hidden name=id value=2> <!-- the id of this search in the searches table -->
<input type=submit name=submit value="Search" class=smallbutton>
</form>

