XQTO Table Manager
XQTO Table Manager
- A PHP open source web based table manager
Quick Easy Installation
XQTO Table Manager 3.2
 |
Table Manager Screen Shot |
INSTALLATION
1. Unzip the script files and put them all in a web directory.
2. Start with the tm_customer.php file and change the configuration variables in the top of the
page. You need to provide details of the table name, fields, data types and field relationships for the table you want to manage. For a detailed explanation of the configuration please read below. Use the tm_customer.php file as an example of how to use the script.
WHAT IT DOES
- Add/Edit/Delete records in a database table
- Quick simple configuration and installation
- The ability to deal with different types of fields including dates, tree relationships, many to many relationships
- Some support for image fields
- Neutral colors mean it can be added to any website without clashing.
CONFIGURATION DETAIL
The configuration can be very simple. Most of the configuration is self explanatory but the most important thing to understand is that the $FIELDS array contains one value for each field in the table, and each value is itself an array of properties for that field. i.e. below is the $FIELD value for a field called company_name in a table. It has a type of input. Other types have slightly different configuration options as detailed below.
$FIELDS['company_name']['description'] = 'Company Name';
$FIELDS['company_name']['listdisplay'] = 1;
$FIELDS['company_name']['editdisplay'] = 1;
$FIELDS['company_name']['editable'] = 1;
$FIELDS['company_name']['type'] = 'input';
$FIELDS['company_name']['length'] = 60;
$FIELDS['company_name']['required'] = 0;
$FIELDS['company_name']['explanation'] = '';
A $FIELD value as shown above must exist for each field in the table. Any fields which are not mentioned in the configuration will be ignored by the table manager.
CONFIGURATION OPTIONS FOR DIFFERENT TYPES OF FIELD
The script currently specifies the following field types
- input
- text
- arraylist
- tablelist
- date
- manytomany
- directoryimage
- tree
INPUT FIELD
Most likely to be used for any any short string such as a Varchar or Char. Could also be used for Int types.
$FIELDS['company_name']['description'] = 'Company Name';
$FIELDS['company_name']['listdisplay'] = 1;
$FIELDS['company_name']['editdisplay'] = 1;
$FIELDS['company_name']['editable'] = 1;
$FIELDS['company_name']['type'] = 'input';
$FIELDS['company_name']['length'] = 60;
$FIELDS['company_name']['required'] = 0;
$FIELDS['company_name']['explanation'] = '';
$FIELDS['company_name']['unique'] = 1;
Explanation of field properties:
| description |
this will appear on the editing and adding forms next to the left of the field |
| listdisplay |
if set to 1 this field will appear as a column in the main listing for the table records |
| editdisplay |
if set to 1 this field will appear on the edit and add forms |
| editable |
if set to 1 this field will be editable on the edit and add forms. if set to 0 it may only appear there as plain text |
| type |
what type of field is this. it can be one of input, text, arraylist, tablelist, date, manytomany, directoryimage, tree |
| length |
the maximum number of characters that can be entered in. it will also influence how long the input field is |
| required |
if set to 1 this field must be filled in when editing or adding |
| explanation |
an explanation that will appear next to the field on the editing and adding forms |
| unique |
if set to 1 a check will be made to make sure this field is unique in the table. can be used for username or email fields |
| listdisplaysize |
text is limited to the length set when displayed in the record list |
TEXT FIELD
Most likely to be used for any any long string such as a Mysql Text type. An HTML <textarea> field will be used.
$FIELDS['description']['description'] = 'Description';
$FIELDS['description']['listdisplay'] = 0;
$FIELDS['description']['editdisplay'] = 1;
$FIELDS['description']['editable'] = 1;
$FIELDS['description']['type'] = 'text';
$FIELDS['description']['required'] = 0;
$FIELDS['description']['explanation'] = '';
ARRAY LIST FIELD
Used for fields where you need a <select> list but the options are not stored in a database. Instead you can specifiy them in an array as below.
$FIELDS['status']['description'] = 'Status';
$FIELDS['status']['listdisplay'] = 0;
$FIELDS['status']['editdisplay'] = 1;
$FIELDS['status']['editable'] = 1;
$FIELDS['status']['type'] = 'arraylist';
$FIELDS['status']['required'] = 0;
$FIELDS['status']['explanation'] = '';
$FIELDS['status']['list'] = array('1' => 'Active', '0' => 'Disabled');
TABLE LIST FIELD
Used for fields where you need a <select> list and the options are stored in a database table.
$FIELDS['product_type_id']['description'] = 'Product Type';
$FIELDS['product_type_id']['listdisplay'] = 1;
$FIELDS['product_type_id']['editdisplay'] = 1;
$FIELDS['product_type_id']['editable'] = 1;
$FIELDS['product_type_id']['type'] = 'tablelist';
$FIELDS['product_type_id']['required'] = 1;
$FIELDS['product_type_id']['explanation'] = '';
$FIELDS['product_type_id']['listtable'] = 'product_type';
$FIELDS['product_type_id']['listkeyfield'] = 'product_id';
$FIELDS['product_type_id']['listdescfield'] = 'product_name';
| listtable |
an associated table which contains the options to be included in the list |
| listkeyfield |
the primary key for the associated table |
| listdescfield |
the field in the associated table which contains the descriptive name of the item |
DATE FIELD
Could be used for Date or Datetime types, however be warned that Datetimes are not fully supported and the time component is likely to be reset to 00:00:00
$FIELDS['registration_date']['description'] = 'Registration Date';
$FIELDS['registration_date']['listdisplay'] = 0;
$FIELDS['registration_date']['editdisplay'] = 1;
$FIELDS['registration_date']['editable'] = 1;
$FIELDS['registration_date']['type'] = 'date';
$FIELDS['registration_date']['required'] = 0;
$FIELDS['registration_date']['explanation'] = '';
MANY TO MANY FIELD
Used for many to many relationships. Currently this will display the options as a series of checkboxes.
$FIELDS['locations']['description'] = 'Locations Available';
$FIELDS['locations']['listdisplay'] = 0;
$FIELDS['locations']['editdisplay'] = 1;
$FIELDS['locations']['editable'] = 1;
$FIELDS['locations']['type'] = 'manytomany';
$FIELDS['locations']['required'] = 0;
$FIELDS['locations']['explanation'] = '';
$FIELDS['locations']['optiontable'] = 'myoptions';
$FIELDS['locations']['optiondescfield'] = 'my_option';
$FIELDS['locations']['optionkeyfield'] = 'option_id';
$FIELDS['locations']['bridgetable'] = 'option_bridge';
$FIELDS['locations']['bridgekey'] = 'role_id';
$FIELDS['locations']['bridgeoptionkey'] = 'option_id';
$FIELDS['locations']['columns'] = 3;
| optiontable |
an associated table which contains the options to be included in the list |
| optiondescfield |
the field in the options table which contains the descriptive name of the item |
| optionkeyfield |
the primary key for the option table |
| bridgetable |
a table which links the options table above to the record in question |
| bridgekey |
the key field in the bridge table which refers to the record in question |
| bridgeoptionkey |
the key field in the bridge table which refers to the options record |
| columns |
the number of columns to display the checkboxes in |
DIRECTORY IMAGE FIELD
An image or set of images which can be associated with the record. No reference to the images is stored in the database table. The images are named with the primary key of the record. This field type requires imagemagick to be installed.
$FIELDS['image1']['description'] = 'Image';
$FIELDS['image1']['listdisplay'] = 0;
$FIELDS['image1']['editdisplay'] = 1;
$FIELDS['image1']['editable'] = 1;
$FIELDS['image1']['type'] = 'directoryimage';
$FIELDS['image1']['required'] = 0;
$FIELDS['image1']['explanation'] = '';
$FIELDS['image1']['imagesizes'] = array('150x150','300x300');
$FIELDS['image1']['imagedirectory'] = 'images';
$FIELDS['image1']['maxuploadsize'] = 1000000;
| imagesizes |
a list of sizes, one image will be created for each size. in addition a thumbnail will be created which will be displayed on the edit and add forms |
| imagedirectory |
the directory in which the images will be displayed. the directory must be writable |
| maxuploadsize |
specify a maximum size for the image being uploaded |
TREE FIELD
A recursive tree field that can be used for anything that is a tree structure i.e. categories, locations.
$FIELDS['category_id']['description'] = 'Category';
$FIELDS['category_id']['listdisplay'] = 0;
$FIELDS['category_id']['editdisplay'] = 1;
$FIELDS['category_id']['editable'] = 1;
$FIELDS['category_id']['type'] = 'tree';
$FIELDS['category_id']['required'] = 0;
$FIELDS['category_id']['explanation'] = '';
$FIELDS['category_id']['treetable'] = 'category';
$FIELDS['category_id']['idfield'] = 'category_id';
$FIELDS['category_id']['parentidfield'] = 'parent_category_id';
$FIELDS['category_id']['namefield'] = 'category_name';
$FIELDS['category_id']['idofroot'] = '1';
| treetable |
the associated table which contains the records with a tree structure |
| idfield |
the primary key of the associated table |
| parentidfield |
the field which contains the parent key for the associated table |
| namefield |
the field which contains a descriptive name for the item in the associated table |
| idofroot |
the primary key of the root record in the associated table |
HELP and BUGS
If you find any bugs or you need some help please post your query in the forum
LICENSE
This program is distributed under a GNU General Public License (GPL).
Please read the GNU License file for more information about how
you can distribute the program.
|