PDOCrud

Advanced PHP CRUD application (Database Management System) using PDO


PDOCrud is an advance PHP based CRUD(Create, Read, Update and Delete) application. It supports Mysql, Pgsql, Sqlite and SQLServer (2012) database.

Download the folder and extract it. Main files that you are going to use in your application, are in the script folder. Demo and documentation folder can be used for reference purpose. They are not required in your application.

Installation instruction:

  1. Copy script folder in your application
  2. Open script/config/config.php file
  3. Enter url till script folder e.g. http://yourdomain.com/path-till-script-folder/
  4. Enter database settings in config. php (hostname, dbname, username and pwd etc) 
                            //Set the host name to connect for data
                            $config["hostname"] =  "localhost";
                            //Set the database name
                            $config["database"] = "dbname";
                            //Set the username for database access
                            $config["username"] = "dbuser";
                            //Set the pwd for the database user
                            $config["password"] = "dbpass";
                            //Set the database type to be used
                            $config["dbtype"] = "mysql";
                            //Set the database type to be used
                            $config["characterset"] = "utf8";”
  5. In your application, include the following file
    require_once “script/ pdocrud.php”;
  6. Now you can create object of pdocrud class and run various function to generate crud table

If all settings done correctly and you have called render function properly then you must be able to see the crud table data correctly. In case of issue, first try to run the demo using the actual file. This will give you idea of how application works. Demo folder contains the demo database sql file. You can create a database with the same name as sql file and if you are checking on localhost with no change in any folder name then no settings needs to be changed and demo will work.

Demo folder contains the demo database sql file. You can create a database with the same name as sql file and if you are checking on localhost with no change in any folder name then no settings needs to be changed to make demo work.

We have created a separate tutorial for installation and configuration. You can check it here.

  1. Very easy syntax and just 2 lines of code for default crud operations
  2. Multiple Skin support
  3. Supports left join operation
  4. Auto generation of insert/update forms directly from database tables
  5. Change label name, hide label
  6. Remove fields, Show particular fields, Change field type, change display order of fields easily
  7. Popup form
  8. Multistep form
  9. Export form data in pdf, xml, csv and excel
  10. Callback functions for PHP and Javascript
  11. Ajax based submission
  12. Addition of static fields like terms & condition, confirm password
  13. PHP and JS Validations
  14. Various settings and customization
  15. Field encryption for frontend
  16. Field addon, field description and tooltips
  17. Different type of template support, by default works with bootstrap
  18. Enqueue js and css
  19. Add plugins easily
  20. Many different types of fields available
  21. Multilanguage support
  22. Data binding of field from another table/ array
  23. Load dependent data on change of some field like on change of country, load states
  24. Normal, horizontal and inline form type available
  25. Add css class and various data attributes
  26. Support for rtl by adding external css
  27. Captcha support
  28. Google map support
  29. Best practices and easy to customized
  30. Login (Select) form validations
  31. Various image functions (crop, resize, thumbnail, watermark, flip)
  32. Import bulk data from csv, xml and excel file
  33. One page template to show Form and Crud Table on single page
  34. Advanced filter option
  35. Send form data on email - various template customization options
  36. Generate graphs/chart directly from database (beta)
  37. Supports sql server(2012 or higher)
  38. Generate portfolio format directly from database
  39. Dynamically format field values before insert/update operation
  40. Generate forms directly from database
  41. Many commanly used plugins integrated

CRUD Table(Grid) functions :

These functions are related to the settings related to the crud table (grid) functionality. You can customize table data and related controls using the many functions available.

To show only specific columns of the database table, you can use crudTableCol() function

   /**
     * Set html curd table display columns
     * @param   string   $columns                        Columns names to be displayed in table format
     * return   object                                   Object of class
     */

    public function crudTableCol($columns) {
        $this->columns = $columns;
        return $this;
    }

If you want to hide/remove specific columns then you can use crudRemoveCol() function, so you can use either of crudTableCol()/crudRemoveCol() functions to hide/show specific columns in grid.

/**
     * Hide/ a specific crud table columns
     * @param   string   $columns                        Columns names to be displayed in table format
     * return   object                                   Object of class
     */

    public function crudRemoveCol($columns) {
        $this->colsRemove = $columns;
        return $this;
    }

To add tooltip for columns in grid, you can use crudColTooltip () function.

 
   /**
     * Tooltip for the column
     * @param   string   $colName                                Name of columns for which tooltip needs to be added
     * @param   string   $tooltip                                Tooltip to be shown
     * @param   string   $tooltipIcon                            Icon for the tooltip
     * return   object                                           Object of class
     */
    public function crudColTooltip($colName, $tooltip, $tooltipIcon = "") {
        $this->crudTooltip[$colName] = array(
            "tooltip" => $tooltip,
            "tooltipIcon" => $tooltipIcon
        );
        return $this;
    }

To add tooltip for columns in grid, you can use crudColTooltip () function.

$pdocrud = new PDOCrud();
$pdocrud->colDataAttr( "customer_name", array("width"=>"70px","colspan"=>2));
echo $pdocrud->dbTable("orders")->render();

To add tooltip for columns in grid, you can use crudColTooltip () function.

$pdocrud = new PDOCrud();
// Change table heading
$pdocrud->tableHeading("Job Application Information");
// Change table subheading
$pdocrud->tableSubHeading("here you can add secondary information about the table");
echo $pdocrud->dbTable("job_application")->render();

To add tooltip for columns in grid, you can use crudColTooltip () function.

$pdocrud = new PDOCrud();  
$pdocrud->tableColFormatting("product_name", "string",array("type" =>"uppercase"));
$pdocrud->tableColFormatting("product_description", "string",array("type" =>"lowercase"));
$pdocrud->tableColFormatting("product_image", "image");
$pdocrud->tableColFormatting("product_description", "readmore", array("length"=>4,"showreadmore"=>true));//not showing read more 
$pdocrud->tableColFormatting("product_rating", "html",array("type" =>"html","str"=>"{col-name}"));
$pdocrud->tableColFormatting("discount", "formula",array("type" =>"percentage"));
$pdocrud->tableColFormatting("qyt_available", "formula",array("type" =>"number_format","decimalpoint"=>2));
$pdocrud->tableColAddition("Total", "sum",array("product_price","product_sell_price"));
$pdocrud->tableColFormatting("qyt_available", "formula",array("type" =>"round","decimalpoint"=>2));
$pdocrud->tableColFormatting("product_price", "formula",array("type" =>"ceil"));
$pdocrud->tableColFormatting("product_sell_price", "formula",array("type" =>"floor"));
$pdocrud->tableDataFormatting("col", "style", array("product_price",">", "200"),array("background:#000","color:#ff0"));
echo $pdocrud->dbTable("producttable")->render();
                

Hide/show various control options of the crud table(Grid). You can call setSettings() functions with control name and boolean value to hide/show controls.

  1. Hide/show Pagination controls //false to hide pagination (default value is true)
     pdocrud->setSettings("pagination", false);”;
  2. Hide/show Search Box controls //false to hide searchbox (default value is true)
     pdocrud->setSettings("searchbox", false);”;
  3. Hide/show Delete Multiple Button controls //false to hide deleteMultipleBtn (default value is true)
     pdocrud->setSettings("deleteMultipleBtn", false);”;
  4. Hide/show Records Per Page Dropdown controls //false to hide recordsPerPageDropdown (default value is true)
     pdocrud->setSettings("recordsPerPageDropdown", false);”;
  5. Hide/show Records Per Page Dropdown Controls //false to hide recordsPerPageDropdown (default value is true)
     pdocrud->setSettings("recordsPerPageDropdown", false);”;
  6. Hide/show Total Records Info Controls //false to hide totalRecordsInfo (default value is true)
     pdocrud->setSettings("totalRecordsInfo", false);”;
  7. Hide/show Add Button Controls //false to hide addbtn (default value is true)
     pdocrud->setSettings("addbtn", false);”;
  8. Hide/show Edit Button Controls //false to hide editbtn (default value is true)
     pdocrud->setSettings("editbtn", false);”;
  9. Hide/show View Button Controls //false to hide viewbtn (default value is true)
     pdocrud->setSettings("viewbtn", false);”;
  10. Hide/show Delete Button Controls //false to hide delbtn (default value is true)
     pdocrud->setSettings("delbtn", false);”;
  11. Hide/show Action Button Controls //false to hide actionbtn (default value is true)
     pdocrud->setSettings("actionbtn", false);”;
  12. Hide/show Checkbox Column Controls //false to hide checkboxCol (default value is true)
     pdocrud->setSettings("checkboxCol", false);”;
  13. Hide/show Number Column Controls //false to hide numberCol (default value is true)
     pdocrud->setSettings("numberCol", false);”;
  14. Hide/show Print Button Controls //false to hide printBtn (default value is true)
     pdocrud->setSettings("printBtn", false);”;
  15. Hide/show Pdf Btn Controls //false to hide pdfBtn (default value is true)
     pdocrud->setSettings("pdfBtn", false);”;
  16. Hide/show Csv Button Controls //false to hide csvBtn (default value is true)
     pdocrud->setSettings("csvBtn", false);”;
  17. Hide/show Excel Button Controls //false to hide excelBtn (default value is true)
     pdocrud->setSettings("excelBtn", false);”;

To being using script, I suggest you to go through the demo as a lots of functionality available there.

Once you done with the settings of database and url etc as mentioned above, include the pdocrud.php . Create object of class and start using the function.

$pdocrud = new PDOCrud();

After this, we need to set table name for which crud operations needs to be performed.

$pdocrud->dbTable("users");

 Most important function is render(). When render function is called without any parameters is generate the default crud table (grid). If some value is passed then it generates the respective form.

echo $pdocrud->render();

 

This will generate the complete crud table (grid). That’s it. Nothing else needs to be done.

PDOcrud supports chaining so you can call it like also below in a single line

echo $pdocrud->dbTable("users")->render();

 

Render function returns the output. You can save it to variable and use this also. Same render function can be used to generate the insertform, editform and view form also.

//insert form

echo $pdocrud->dbTable("producttable")->render("insertform");

//Edit form

echo $pdocrud->dbTable("producttable")->render("EDITFORM",array("id" =>"2"));

//View form

echo $pdocrud->dbTable("producttable")->render("VIEWFORM",array("id" =>"2"));

Please note that inline edit button will not work with the join operations. 

PDOCrud supports left join operation also. In left join, left table may have more than one record per entry in the main table. To define left join operation, you need to define the join condition and main table. Main table is set using the dbTable() function and join condition is set using the joinTable() function. First parameter specify the table to be joined, 2nd parameter is the join condition and third is join type.

$pdocrud->joinTable("user_meta", "users.user_id = user_meta.user_id", "LEFT JOIN");
echo $pdocrud->dbTable("users")->render();

Please note that left join operation currently doesn’t support alias and only two table left join operation is available in this version.

Also, delete operation will delete the data from both the tables. We strongly suggest to take backup of database before using any functions.

PDOCrud support inline edit of records also. To show the inline edit control button, just set its settings to true for inlineEditbtn.

$pdocrud->setSettings("inlineEditbtn", true);

*Please note that inline edit button will not work with the join operations.

PDOCrud has different functions for changing the grid columns related attribute and form fields related attribute. Grid column related functions starts with col prefix and form fields starts with fields prefix.

For example, if you want to rename grid columns, you need to use

$pdocrud->colRename("customer_name", "client name");//rename customer_name to client name in grid
                

and if you want to rename form field, you need to use

$pdocrud->fieldRenameLable("customer_name", "Client name");//Rename label of the field in form
                

Both views are independent that’s why we have added different functions. Some functions are written below that are related to common type of operation used in grid and forms.

Here are few grid column related functions

$pdocrud->crudColTooltip("first_name", "First name of user!"); // Add tooltip in grid
$pdocrud->crudTableCol(array("product_name","product_line","product_image","product_url")); // only specific columns will be shown in the grid
$pdocrud->crudRemoveCol(array("user_id")); //remove a particular grid column
$pdocrud->colDataAttr( "customer_name", array("width"=>"400px")); // set attribute of grid column, you can set any data attribute, style etc to column.

Here are few form fields related functions

$pdocrud->fieldRenameLable("customer_name", "Client name");//Rename label
$pdocrud->fieldHideLable("order_status");// Hide label
$pdocrud->fieldCssClass("first_name", array("class1", "class2"));// add css classes
$pdocrud->fieldAttributes("email", array("data-type"=>"email"));// any attribute name and it's value
$pdocrud->fieldAttributes("billing_address_line_1", array("placeholder"=>"line 1"));//add placeholder attribute
$pdocrud->fieldAttributes("billing_address_line_2", array("placeholder"=>"line 2"));//add placeholder attribute
$pdocrud->fieldDesc("last_name", "Last Name - some dummy description");// Add field description
$pdocrud->fieldTooltip("user_name", "Please enter your user name to be used for login purpose");//tooltip
PDOCrud uses PDOModel

all pdomodel functions. You can refer pdomodel documentation here. If you want to get data in form of array, or you want to perform insert/update/delete operations directly then also PDOCrud provides all necessary functions. You can call getPDOModelObj(). This will return the PDOModel object. You can peform then insert/update/delete/select etc operations.

$pdocrud = new PDOCrud();  
             
//insert operation
//Example 1
$insertData = array("customer_name" => "bob", "email" => "builder@gmail.com", "postal_code" =>99423);
$pdocrud->getPDOModelObj()->insert("customertable", $insertData);

//update operation
//Example 2
$updateData = array("first_name"=>"Jon", "last_name"=>"snow", "email"=>"builder@gmail.com");
$pdomodel = $pdocrud->getPDOModelObj();
$pdomodel->where("id", 1);
$pdomodel->update("feedback", $updateData);

//Example 3
//select operation
$data =  $pdocrud->getPDOModelObj()->select("orders");
print_r($data);

PDOCrud contains many custom javascript events that are triggered at various points. You can add these events to perform various javascript related operations.

To perform custom javascript function after loading of script, use “pdocrud_on_load” event.

jQuery(document).trigger("pdocrud_on_load", [this]);

To perform custom javascript function before ajax actions, use “pdocrud_before_ajax_action” event.

jQuery(document).trigger("pdocrud_before_ajax_action", [obj, data]);

To perform custom javascript function after ajax actions, use “pdocrud_after_ajax_action” event.

jQuery(document).trigger("pdocrud_after_ajax_action", [obj, response]);

To perform custom javascript function after form sumission, use “pdocrud_after_submission” event.

jQuery(document).trigger("pdocrud_after_submission", [obj, responseText]);

All you need to do is to add the required event and associated data in event function. Please note that javascript trigger doesn't return any data but you can use the data to perform required operation. Below is example of using the "pdocrud_before_ajax_action" trigger. You can use console.log to check the data and object

                            jQuery(document).ready(function () {
                               jQuery(document).on("pdocrud_before_ajax_action",function(event,obj,data){
                                   console.log(obj);
                                   console.log(data);
                                });
                            });

                

PDOCrud supports various callback functions at various events that can be used to perform specific operations as required. Callback functions are very useful to perform special operation as per requirement. For example, if you want to change the insert data field e.g. password to md5 encrypted, you can use callback functions. You need to add call back function and needs to include function definition in the script/pdocrud.php file.

    $pdocrud =  new PDOCrud();

    $pdocrud->addCallback("before_select", "beforeloginCallback");

    $pdocrud->addCallback("after_select", "afterLoginCallBack");

    $pdocrud->formFields(array("user_name","password"));

    echo $pdocrud->dbTable("login")->render("selectform"); 
                  
// Available events are


//This 'beforeloginCallback' function must be added on script/pdocrud.php file

// e.g. before data submission encrypt user password

function beforeloginCallback($data, $this) {

    $data["login"]["password"]= md5($data["login"]["password"]);

    return $data;

}
                  
// e.g. after data submission, check for data and


function afterLoginCallBack($data, $this) {

    @session_start();

    $_SESSION["data"] = $data;

}

More examples

//Adding callback functions

 $pdocrud->addCallback("before_insert", "beforeInsertCallBack");


function beforeInsertCallBack($data, $this) {

   // print_r($data); to print complete data, this data can be checked in firebug console.

    $data["login"]["user_name"]= ucfirst(trim($data["login"]["user_name"]));

    return $data;

}


//Adding callback functions

 $pdocrud->addCallback("before_update", " beforeUpdateCallBack ");


function beforeUpdateCallBack($data, $this) {

 // print_r($data); to print complete data, this data can be checked in firebug console.

    $data["login"]["user_name"]= ucfirst(trim($data["login"]["user_name"]));

    return $data;

}
 
// More callback functions example
$pdocrud->addCallback("after_insert", "afterInsertCallBack");  
$pdocrud->addCallback("after_update", "afterUpdateCallBack");
$pdocrud->addCallback("before_table_data", "beforeTableDataCallBack");
$pdocrud->addCallback("format_table_data", "formatTableDataCallBack");
$pdocrud->addCallback("format_table_col", "formatTableColCallBack");
$pdocrud->addCallback("after_table_data", "afterTableDataCallBack");
$pdocrud->addCallback("format_sql_data", "formatSQLDataCallBack");
$pdocrud->addCallback("before_sql_data", "beforeSQLDataCallBack");
$pdocrud->addCallback("before_switch_update", "beforeSwitchUpdateCallBack");
$pdocrud->addCallback("before_insert_form", "beforeInsertForm");
$pdocrud->addCallback("after_insert_form", "afterInsertForm");
$pdocrud->addCallback("before_edit_form", "beforeEditForm");
$pdocrud->addCallback("after_edit_form", "afterEditForm");
$pdocrud->addCallback("before_view_form", "beforeViewForm");
$pdocrud->addCallback("after_view_form", "afterViewForm");
$pdocrud->addCallback("before_select_form", "beforeSelectForm");
$pdocrud->addCallback("after_select_form", "afterSelectForm");
$pdocrud->addCallback("before_email_form", "beforeEmailForm");
$pdocrud->addCallback("after_email_form", "afterEmailForm");
$pdocrud->addCallback("before_select", "beforeSelect");
$pdocrud->addCallback("after_select", "afterSelect");
$pdocrud->addCallback("before_insert", "beforeInsert");
$pdocrud->addCallback("after_insert", "afterInsert");
$pdocrud->addCallback("before_update", "beforeUpdate");
$pdocrud->addCallback("after_update", "afterUpdate");
$pdocrud->addCallback("before_delete", "beforeDelete");
$pdocrud->addCallback("after_delete", "afterDelete");
$pdocrud->addCallback("before_switch_update", "beforeSwitchUpdate");
$pdocrud->addCallback("after_switch_update", "afterSwitchUpdate");

Editing of related records in other table (Added in v 2.0)

PDOCrud allows the editing of related records of different table i.e. similar to nested table. Nested Table is a table inside a table. It is not stored in that way but similar concept is used. You can define relation between the two tables data using some binding column value.

                     /**
                    * Multi Table Relation (nested table) - Editing of related records in other table
                    * @param   string   $field1                     field name of object to matched
                    * @param   string   $field2                     field name of 2nd object to be matched
                    * @param   PDOCrud  $obj                        2nd table (object)
                    * @param   string   $renderParam                render type, default is CRUD
                    * return   object                               Object of class
                    */
                   public function multiTableRelation($field1, $field2, $obj, $renderParam = "CRUD") 
                

You can easily add order by asc and desc for columns to show records.

                      $pdocrud = new PDOCrud();
                    $pdocrud->dbOrderBy("id desc");//descending                           
                    echo $pdocrud->dbTable("orders")->render();
                  

How to add javascript plugin using the PDOCrud?

Apart from normal way of applying any javascript plugin, there is special feature in PDOCrud, using which you can easily integrate plugins. A normal javascript plugin consists of css and js files and some code that is called on specific html element. To add a plugin in the pdocrud, you have to follow following steps.

  1. Create a folder of your plugin in “script/plugin” e.g. “ckeditor”
  2. Inside that folder create 2 folder named “css” and “js” and upload plugin’s css and js files inside that folder.(This will automatically include of the plugin css and js files when you call addPlugin function)
  3. To call it on specific html element, you can either call using the javascript code (please check events to be added) or you can create a file inside classes/plugin-helper/plugin-yourpluginname.php. To understand how to add it, check any other plugin file created at the same location. Only thing you need to change is the plugin function name in that file.
$pdocrud = new PDOCrud();
$pdocrud->addPlugin("knob");//to add plugin                                
echo $pdocrud->dbTable("orders")->render();
echo $pdocrud->loadPluginJsCode("knob",".pdocrud-number");//to add plugin
                

Apply different skins

$pdocrud = new PDOCrud();
//You can apply different theme css simply by adding css in the skins folder. By default,
//three css (default, dark and advanced) are present. By default, default.css is applied.
$pdocrud->setSkin("advance");
echo $pdocrud->dbTable("tablename")->render();

Apply different skins

//show pagination links (true = show)
$config["pagination"] = true;

//show pagination links (true = show)
$config["recordsPerPageDropdown"] = true;

//show search box (true = show)
$config["searchbox"] = true;

//show delete mulitiple button (true = show)
$config["deleteMultipleBtn"] = true;

//show total records showing (true = show)
$config["totalRecordsInfo"] = true;

//show add button (true = show)
$config["addbtn"] = true;

//show edit button (true = show)
$config["editbtn"] = true;

//show view button (true = show)
$config["viewbtn"] = true;

//show delete button (true = show)
$config["delbtn"] = true;

//show delete button (false = hide)
$config["inlineEditbtn"] = false;

//show delete button (true = show)
$config["actionbtn"] = true;

//show sorting button (true = show)
$config["sortable"] = true;

//show export button (true = show)
$config["exportOption"] = true;

//show print button (true = show)
$config["printBtn"] = true;

//show print button (true = show)
$config["csvBtn"] = true;

//show print button (true = show)
$config["excelBtn"] = true;

//show print button (true = show)
$config["pdfBtn"] = true;

//show multi select checkbox column (true = show)
$config["checkboxCol"] = true;

//show number column (true = show)
$config["numberCol"] = true;

//show footer row (true = show)
$config["headerRow"] = true;

//show footer row (true = show)
$config["footerRow"] = true;

//show filters (false = hide)
$config["filter"] = false;

//For dropdown, whether to show "Select" as an option or not
$config["selectOption"] = true;

//whether to show "print" button or not in view page
$config["viewPrintButton"] = true;

//whether to show "back" button or not in view page
$config["viewBackButton"] = true;

//whether to show "delete" button or not in view page
$config["viewDelButton"] = false;

//whether to show "edit" button or not in view page
$config["viewEditButton"] = false;

//template
$config["template"] = "bootstrap";

//skin
$config["skin"] = "default";

//by default, whether make fields required or not
$config["required"] = true;

//default langugae
$config["lang"] = "en";

//Upload folder
$config["uploadFolder"] = PDOCrudABSPATH . "uploads/";

//Upload folder URL
$config["uploadURL"] = $config["script_url"] . "script/uploads/";

//download folder
$config["downloadFolder"] = PDOCrudABSPATH . "downloads/";

//Download folder URL
$config["downloadURL"] = $config["script_url"] . "script/downloads/";

//js settings
//date format
$config["dateformat"] = "yy-mm-dd";

//time format
$config["timeformat"] = "HH:mm:ss";

//hide auto increment field
$config["hideAutoIncrement"] = true;

//block css settings
$config["blockClass"] = array("col-xs-10", "col-sm-10", "col-lg-10");

//block label settings
$config["lableClass"] = array("col-xs-2", "col-sm-2", "col-lg-2");

//hide all lables
$config["hideLable"] = false;

//hide lable of field type html
$config["hideHTMLLable"] = true;

//load js initially (this js needs to be present in script/js fodler)
$config["loadJs"] = array("jquery.min.js","jquery-ui.min.js","jquery.form.js","jquery-ui-timepicker-addon.js","validator.js","jquery.stepy.js");

//load css initially (this css needs to be present in script/css fodler)
$config["loadCss"] = array("style.css","jquery-ui.css","jquery-ui-timepicker-addon.css","font-awesome.min.css");

//load plugins initially (list of plugins available)
$config["loadJsPlugins"] = array("chosen");

//display errors directly
$config["displayErrors"] = true;

//submit whether using ajax or using simple post
$config["submissionType"] = "ajax";

//enable js validation, if you want to use some plugin for validation set value ="plugin_validator", if you want to use pdocrud validator, 

//set value = "script_validator", if you don't want to use any js validation, set this false.
$config["jsvalidation"] = "plugin_validator";

//enable php validation
$config["phpvalidation"] = true;

//by default single step form
$config["formtype"] = "singlestep";

//whether to encrypt or decrypt fields - version 1.2
$config["encryption"] = true;

/**************** Email Related Settings ******************/

//whether to use phpemail or smtp. For windows hosting, you need SMTP
$config["emailMode"] = "PHPMAIL";

$config["SMTPHost"] = "ajax";

$config["SMTPPort"] = 25; 

$config["SMTPAuth"] = true;

$config["SMTPusername"] = ""; 

$config["SMTPpassword"] = "";

$config["SMTPSecure"] = ""; 

$config["SMTPKeepAlive"] = true; 

Apply different skins

Upgrade instruction:

  1. First take backup of complete old script folder
  2. Replace all files and renter the config settings explained in the initialization instruction

DB Table

function dbTable($tableName)
                

Set table name for which form needs to be generated


Parameter Name Type Description
$tableName string The name of the table to generate form.

 

Form Tag

function formTag($formHeading = "", $formType = "", $class = array(), $attr = array())
                

Set table name for which form needs to be generated


Parameter Name Type Description
$formHeading string fields
$formType string  
$class string  
$attr string  
  object return

 

Form Fields

function formFields($fields)
                

Set table name for which form needs to be generated


Parameter Name Type Description
$fields array Form fields to displayed only.
  object return

 

Form Remove Fields

function formRemoveFields($fields = array())
                

Removes specific fields from from


Parameter Name Type Description
$fields array Form fields to displayed only.
  object return

 

Form Set Primary key

function formSetPrimarykey($pk, $pkval)
                

Set primary key and value for update form


Parameter Name Type Description
$pk string From email
$pkval string To email
  object return

 

Form Export Data

function formExportData($exportType = "pdf")
                

Export related settings, instead of inserting data in database, you can directly export it to PDF, CSV, Excel and XML


Parameter Name Type Description
$exportType string From email
  object return

 

Form Display In Popup

function formDisplayInPopup($buttonContent = "", $headerContent = "")
                

Display form in popup on click on some button


Parameter Name Type Description
$buttonContent string From email
$headerContent string To email
  object return

 

Form Id

function formId($id)
                

Sets ID of Form


Parameter Name Type Description
$id string ID of the form
  object return

 

Field Display Order

function fieldDisplayOrder($fields)
                

Change display order of the fields


Parameter Name Type Description
$fields array fields in ascending order to be displayed in form
  object return

 

Field Css Class

function fieldCssClass($fieldName, $fieldClass = array())
                

Set specific css class to the different fields


Parameter Name Type Description
$fieldName string field name for which css class name needs to be applied
$fieldCssClass array css class name for the field
  object return

 

Form Static Fields

  public function formStaticFields($fieldName, $fieldType, $fieldValue = "")
                

Add static fields to the form


Parameter Name Type Description
$fieldName string name of static field
$fieldType string type of field, e.g. radio, checkbox etc
$fieldValue string Value of the field
  object return

 

Field Rename Lable

function fieldRenameLable($fieldName, $lableName)
                

Rename the field label name


Parameter Name Type Description
$fieldName string field name for which lable name needs to be changed
$lableName string lable name to be set
  object return

 

Field Hide Lable

function fieldHideLable($fieldName, $takeSpace = false)
                

Hide the field label name


Parameter Name Type Description
$fieldName string field name for label needs to be hidden
$takeSpace bool whether hidden lable should take space or not
  object return

 

button Hide

function buttonHide($buttonname="cancel")
                

Hide the cancel button


Parameter Name Type Description
$fieldName string field name for label needs to be hidden
$takeSpace bool whether hidden lable should take space or not
  object return

 

Field Not Mandatory

function fieldNotMandatory($fieldName)
                

Removes required attribute from fields


Parameter Name Type Description
$fieldName string field name for which required attribute needs to be removed
  object return

 

Field Attributes

function fieldAttributes($fieldName, $attr = array())
                

Sets the data attribute of field


Parameter Name Type Description
$fieldName string field name for attribute needs to set
$attr array Array of data attributes with key as attribute name and value as attribute value
  object return

 

Field Types

public function fieldTypes($fieldName, $type, $parameters = "")
                

Sets the type of field


Parameter Name Type Description
$fieldName ,$type ,$parameters string field name for types needs to be set,Field type
$type string Array of data attributes with key as attribute name and value as attribute value
$parameters string Array of data attributes with key as attribute name and value as attribute value
  object return

 

Field Validation Type

 function fieldValidationType($fieldName, $validation, $param = "true", $errorMsg = "")
                

Sets the validation require for the field


Parameter Name Type Description
$fieldName string field name for validation needs to be set
$validation string validation like required, email etc
$param string value of validation, default is true
  object return

 

Field Dependent

function fieldDependent($dependent, $dependOn, $colName)
                

Sets the dependent field to be loaded on change of depend on field


Parameter Name Type Description
$dependent string field name to be changed on onchange operation of dependOn field
$dependOn string field that change will cause trigger change
$colName string name of col, needs to be retrived to change the field value
  object return

 

Field Data Binding

function fieldDataBinding($fieldName, $dataSource, $key, $val, $bind = "db")
                

Sets data binding of the field i.e. load the field data from some datasource


Parameter Name Type Description
$fieldName string field name to be bind
$dataSource string data source either tablename or array of data
$key string name of col, that will serve as data key
$val string name of col, that will serve as field valye
$bind string whether datasource is db table or array, default is db table
  object return

 

Field AddOn Info

          function fieldAddOnInfo($fieldName, $position, $addOnText)
                

Sets input addon information for the bootstrap


Parameter Name Type Description
$fieldName string field name to be bind
$position string data source either tablename or array of data
$addOnText string name of col, that will serve as data key
  object return

 

Field Block Class

                function fieldBlockClass($fieldName, $class)
                

Sets the class of complete input block inside a bootstrap form-group class


Parameter Name Type Description
$fieldName string field name to be bind
$class string data source either tablename or array of data
  object return

 

Field Groups

               function fieldGroups($groupName, $fields = array()) 
                

Sets data binding of the field i.e. load the field data from some datasource


Parameter Name Type Description
$groupName string Any unuique name of group e.g. full_name
$fields array array of fields like array(first_name, last_name)
  object return

 

Form Steps

               function FormSteps(array $fields, $stepName, $stepType = "stepy", $attr = array())
                

Divide form fields into various steps/tabs


Parameter Name Type Description
$fields array Any unuique name of group e.g. full_name
$stepName string array of fields like array(first_name, last_name)
$stepType string array of fields like array(first_name, last_name)
$attr string array of fields like array(first_name, last_name)
  object return

 

Field Tooltip

        function fieldTooltip($fieldName, $tooltip, $tooltipIcon = "")
                

Tooltip for the field


Parameter Name Type Description
$fieldName array Any unuique name of group e.g. full_name
$tooltip string array of fields like array(first_name, last_name)
$tooltipIcon string array of fields like array(first_name, last_name)
  object return

 

Field Desc

                function fieldDesc($fieldName, $desc)
                

Set description of the field


Parameter Name Type Description
$fieldName string Any unuique name of group e.g. full_name
$desc string array of fields like array(first_name, last_name)
  object return

 

Enqueue HTML Content

                function fieldDesc($fieldName, $desc)
                

Description:Add some html content in the form (normally added at the end of form)


Parameter Name Type Description
$html string Any unuique name of group e.g. full_name
  object return

 

Output HTML Content

               function outputHTMLContent($output = true)
                

Description Output html content and clears html content, can be called at specific places to output content


Parameter Name Type Description
$output bool Any unuique name of group e.g. full_name
  object return

 

Add Plugin

                 function addPlugin($pluginName)
                

Add js/css based plugin, plugin needs to be placed inside plugins folder with js files under js folder and css files under css folder


Parameter Name Type Description
$pluginName string Name of the plugin to be added, make sure plugins folder is readable
  object return

 

Enqueue Js

                function enqueueJs($jsName, $jsPath)
                

Add javascript by specify js name and path of js, it will be loaded with other scripts


Parameter Name Type Description
$jsName string Name of javascript to be loaded
$jsPath string Path of javascript to be loaded
  object return

 

Apply JS

                function applyJS($applyOn, $applyOnVal, $functionName, $action = "on_form_load", $options = array())
                

Add directly javascript


Parameter Name Type Description
$applyOn string Name of javascript to be loaded
$applyOnVal string Path of javascript to be loaded
$functionName string Path of javascript to be loaded
$action string Path of javascript to be loaded
$options string Path of javascript to be loaded
  object return

 

Unset Js

               function unsetJs($jsName)
                

Removes already enqueue js, useful for removing js that are already included in your page


Parameter Name Type Description
$jsName string Name of javascript to be removed
  object return

 

Output Js

               function outputJs($output = true)
                

Output js


Parameter Name Type Description
$output bool if true output the content else return the content.
  object return

 

Output Apply Js

               function outputApplyJs($output = true)
                

Output javascript added using the apply js


Parameter Name Type Description
$output bool if true output the content else return the content.
  object return

 

Add Callback

              function addCallback($eventName, $callback)
                

Add callback function to be called on certain event


Parameter Name Type Description
$eventName string if true output the content else return the content.
$callback string if true output the content else return the content.
  object return

 

load Plugin Js Code

         function loadPluginJsCode($pluginName, $elementName, $params = array())
                

Loads plugin js code, must be called after render function


Parameter Name Type Description
$pluginName string Name of plugin
$elementName string Element name for which plugin needs to be called
$params string list of parameters/options for the plugin js code
  string String of js code

 

Enqueue Css

                  function enqueueCss($cssName, $cssPath)
                

Add css by specify css name and path of css, it will be loaded with other css


Parameter Name Type Description
$cssName string Name of plugin
$cssPath string Element name for which plugin needs to be called
  object return

 

Unset Css

                  function unsetCss($cssName)
                

Removes already enqueue css, useful for removing css that are already included in your page


Parameter Name Type Description
$cssName string Name of plugin
  object return

 

Output Css

                  function outputCss($output = true)
                

Output css


Parameter Name Type Description
$output bool if true output the content else return the content.
  object return

 

Set Current Lang

                 function setCurrentLang($lang)
                

Set current language


Parameter Name Type Description
$lang string language to be used
  object return

 

Get Lang Data

                 function getLangData($param)
                

Return language data


Parameter Name Type Description
$param string language to be used
  object return

 

Set Lang Data

                 function setLangData($param, $val)
                

Return language data


Parameter Name Type Description
$key string lanuguage key for which data needs to save
$val string Value for the language parameter
  object return

 

Get Errors

               function getErrors()
                

Return errors


Parameter Name Type Description
    return array

 

Get Settings

               function getSettings($setting)
                

Get particular configuaration setting


Parameter Name Type Description
Config Key for which setting needs to be retreived;   Configuaration setting value

 

Set Settings

               function setSettings($setting, $value)
                

Set particular configuaration setting


Parameter Name Type Description
Config key for setting Value for setting Object of class

 

Join Table

               function joinTable($joinTableName, $joinCondition, $joinType = "INNER JOIN")
                

Add join between tables, supported join condition are "INNER JOIN" & "LEFT JOIN"


Parameter Name Type Description
join condition e.g string name of table to be joined

 

Crud Table Column

               function crudTableCol($columns)
                

Columns names to be displayed in table format


Parameter Name Type return
join condition e.g string Object of class

 

crud Remove Column

               function crudRemoveCol($columns)
                

Columns names to be displayed in table format


Parameter Name Type return
join condition e.g string Object of class

 

crud Add Action

               function crudAddAction($actionName, $colName, $displayVal = array(), $applyVal = array())
                

Add a custom action button in crud


Parameter Name Type return
$actionName string Object of class

 

Records Per Page

               function recordsPerPage($val)
                

Set how many records per page to be displayed in html table


Parameter Name Type return
no. of records per page e.g. 10 string Object of class

 

Current Page

              function currentPage($pageNo)
                

Sets current page in pagination


Parameter Name Type return
$pageNo-page no. e.g. 2 string Object of class

 

Column Types

              function colTypes($colName, $colType, $parameters = "")
                

Sets column type in the crud table


Parameter Name Type return
$pageNo-page no. e.g. 2 string Object of class

 

crud Column Tooltip

              function crudColTooltip($colName, $tooltip, $tooltipIcon = "")
                

Sets column type in the crud table


Parameter Name Type return
$colName string Object of class

 

Set Pk

              function setPK($columnName)
                

Sets primary key


Parameter Name Type return
sets primary key string Object of class

 

Set Inline Edit

              function setInlineEdit($val = false)
                

Set whether current operation is inline edit or not


Parameter Name Type return
$setting ,$value string Object of class

 

DB Order By

              function dbOrderBy($orderbyCols)
                

Sets order by condition for crud html table data


Parameter Name Type return
columns names for which data needs to be order by string Object of class

 

DB Limit

                function dbLimit($limit)
                

Sets limit of records to be displayed


Parameter Name Type return
$limit -limit of records to be used string Object of class

 

set Search Columns

                function setSearchCols($cols)
                

Sets search columns


Parameter Name Description return
$cols Set columns to be used for search Object of class

 

Form Tag

                 function formTag($formHeading = "", $formType = "", $class = array(), $attr = array())
                

Set form related parameters e.g. formHeading, formType="horizontal/inline", form class and attribute etc.


Parameter Name Description return
$formHeading ,$cols Heading of form (fieldset) Object of class

 

Form Send Email

                function formSendEmail($from, $to, $subject, $message, $saveDb = false)
                

Set email related settings if form sends email instead of insert/update operation


Parameter Name Description return
$from Heading of form (fieldset) Object of class

 

Form Add Captcha

                function formAddCaptcha($fieldName)
                

Add captcha in form


Parameter Name type return
$fieldName String Object of class

 

Field Data Attribute

                function fieldDataAttr($colName, $attr = array())
                

set attributes of field


Parameter Name Description return
$colName column name for which attribute to be added Object of class

 

Field Rename

                function fieldRename($fieldName, $newName)
                

Rename a field name


Parameter Name Description return
$fieldName field name to renamed Object of class
$newName new field name to be used

 

Form Field Value

                function formFieldValue($fieldName, $value)
                

Set a value of field


Parameter Name Description return
$fieldName field name to renamed Object of class
$value value of the field

 

Form Redirection

                function formRedirection($redirectionURL)
                

Redirects to some other url after form submission


Parameter Name Description return
$redirectionURL url to be redirected Object of class

 

Field Conditional Logic

                function fieldConditionalLogic($fieldname, $condition, $op = "=", $field, $task)
                

Add conditional logic to the form fields like


Parameter Name Description return
$fieldname field name which trigger event
$condition Conditional logic to be checked
$op Operator to b used
$field field names to be affected
$task Operation(task) to be applied Object of class

 

Field Conditional Logic

                function fieldConditionalLogic($fieldname, $condition, $op = "=", $field, $task)
                

Add conditional logic to the form fields like


Parameter Name Description return
$fieldname field name which trigger event
$condition Conditional logic to be checked
$op Operator to b used
$field field names to be affected
$task Operation(task) to be applied Object of class

 

Add Field Description

                public function addFieldDesc($elementName, $desc, $type = "field")
                

Add field description


Parameter Name Description return
$elementName element for which tooltip needs to be added Object of class
$desc description of the field Object of class
$type type of element whether element or column Object of class

 

Resize Image

                function resizeImage($dimensions = array())
                

Set the resize dimension


Parameter Name Description return
$dimensions dimensions of image Object of class

 

Thumbnail Image

                function thumbnailImage($width, $height = null, $focal = 'center')
                

Trim the image and resize to exactly


Parameter Name Description return
$width int Object of class
$height If omitted - assumed equal to $width int|null Object of class

 

Crop

                function crop($x1, $y1, $x2, $y2)
                

Crop an image


Parameter Name Description return
int $x1 Left ,$y1 Top ,$x2 Right , $y2 Bottom SimpleImage

 

Flip

                 function flip($direction)
                

Flip an image horizontally or vertically


Parameter Name Description return
$direction $direction x|y Object of clas

 

Watermark

                 function watermark($overlay, $position = 'center', $opacity = 1, $xOffset = 0, $yOffset = 0)
                

Set the overlay image (Watermark)


Parameter Name Description return
$overlay An image filename or a SimpleImage object Object of clas
$position center|top|left|bottom|right|top left|top right|bottom left|bottom right Object of clas
$opacity Overlay opacity 0-1 Object of clas
$xOffset Horizontal offset in pixels Object of clas
$yOffset Vertical offset in pixels Object of clas

 

Set Query

                 function setQuery($sql)
                

Set sql


Parameter Name Description return
$sql Query to be executed Object of clas

 

Bulk Crud Update

                function bulkCrudUpdate($colName, $fieldType, $attr = array())
                

Bulk crud table update function to update multiple rows of data simultanously


Parameter Name Description return
$colName Column name to be formatted Object of clas
$fieldType type of field Object of clas
$attr Attributes of field Object of clas

 

Table Column Formatting

                function tableColFormatting($colName, $formatType, $paramaters = array())
                

Format the particular columns of table


Parameter Name Description return
$colName Column name to be formatted Object of clas
$formatType type of format Object of clas
$paramaters parameters based on the formatting type Object of clas

 

Table Data Formatting

               function tableDataFormatting($applyOn, $formatType, $condition = array(), $apply = array())
                

Format the particular entry of column of table


Parameter Name Description return
$applyOn Column name to be formatted Object of clas
$formatType type of format Object of clas
$condition format condition ot be matched Object of clas
$apply rules toe be applied Object of clas

 

Table Data Formatting

               function tableDataFormatting($applyOn, $formatType, $condition = array(), $apply = array())
                

Format the particular entry of column of table


Parameter Name Description return
$applyOn Column name to be formatted Object of clas
$formatType type of format Object of clas
$condition format condition ot be matched Object of clas
$apply rules toe be applied Object of clas

 

Table Column Addition

               function tableColAddition($colName, $type, $paramaters = array()) 
                

Add a new column to the table


Parameter Name Description return
$colName Column name to be added Object of clas
$type type of column Object of clas
$paramaters parameters on basis of which column to be added/td> Object of clas

 

Table Heading

               function tableHeading($heading) 
                

Change table heading


Parameter Name Description return
$heading table heading to be changed Object of clas

 

Table Heading

               function tableHeading($heading) 
                

Change table heading


Parameter Name Description return
$heading table heading to be changed Object of clas

 

Table Sub Heading

               tableSubHeading($subHeading) 
                

Change table sub heading


Parameter Name Description return
$heading table heading to be changed Object of clas

 

Table Col Using Data Source

                function tableColUsingDatasource($colname, $data, $joinColName, $dataCol, $dataSource = "db") 
                

Set content of crud col based on the value from another table or array of data


Parameter Name Description return
$colname crud table column name to be replaced Object of clas
$data Name of table (if datasource = db) or array to get data Object of clas
$joinColName Join column name (if datasource = db) Object of clas
$dataCol Data column name (if datasource = db) Object of clas
$dataSource dataSource = db or datasource = array Object of clas

 

Column Dependent

                function colDependent($dependentCol, $tableName, $dependentOn)
                

Set content of crud col based on the value from another table or array of data


Parameter Name Description return
$dependentCol crud table column name to be replaced Object of clas

 

column Data Attribute

                function colDataAttr($colName, $attr = array())
                

Set attributes of column


Parameter Name Description return
$colName column name for which attribute to be added Object of clas
$attr attribute to be set Object of clas

 

column Sum PerPage

                function colSumPerPage($colName)
                

Get sum per page for column


Parameter Name Description return
$colName column name for sum to be calculated Object of clas

 

column Sum Total

                function colSumTotal($colName)
                

Get total sum for column


Parameter Name Description return
$colName column name for sum to be calculated Object of clas

 

Add Tooltip

                function addTooltip($elementName, $toolTip, $type = "field")
                

Add tool tip


Parameter Name Description return
$elementName element for which tooltip needs to be added Object of clas
$toolTip tooltip to be added Object of clas
$type type of element whether element or column Object of clas

 

Where

                function addTooltip($elementName, $toolTip, $type = "field")
                

Add where condition


Parameter Name Description return
$colName column name for which where condition to be applied Object of clas
$val value of column Object of clas
$operator any operator like =, != Object of clas

 

Set Back Operation

                function setBackOperation($operation = true)
                

Set whether current operation is back button operation or not


Parameter Name Description return
$operation true/false, current operation is back button operation or not Object of clas

 

Set Search Operator

                function setSearchOperator($operator = "=")
                

Set search operator


Parameter Name Description return
$operator Set search operator 'like', '>', '>=', '<','=<' etc Object of clas

 

Crud Call

                function crudCall($show = false)
                

whether current call is direct or called usign CRUD operation


Parameter Name Description return
$show true/false, whether current call is direct or called usign CRUD operation Object of clas

 

Add Filter

                function addFilter($filterName, $displayText, $matchingCol, $filterType)
                

Add advanced filter option


Parameter Name Description return
$filterName unique filter name Object of clas
$displayText display text for filter Object of clas
$matchingCol column to be matched Object of clas
$filterType type of filter , default is radio button Object of clas

 

Set Filte Source

                function setFilterSource($filterName, $dataSource, $key, $val, $bind = "db")
                

Set data source of filter


Parameter Name Description return
$filterName unique filter name Object of clas
$dataSource data source either tablename or array of data Object of clas
$key name of col, that will serve as data key Object of clas
$val name of col, that will serve as field value Object of clas
$bind whether datasource is db table or array, default is db table Object of clas

 

Add Advance Search

                function addAdvSearch($columns)
                

Add advanced search options


Parameter Name Description return
$columns Column names to be searched Object of clas

 

Set Advance Search Param

               function setAdvSearchParam($columnName, $displayText, $searchType) 
                

Add advanced search column parameter


Parameter Name Description return
$columnName unique filter name Object of clas
$displayText display text for filter Object of clas
$searchType type of filter , default is radio button Object of clas

 

enqueue Actions

               function enqueueActions($action, $type = "switch", $text = "", $colName = "", $attr = array()) 
                

enqueue col based actions


Parameter Name Description return
$action action values Object of clas
$type type of action Object of clas
$text text to be used Object of clas
$colName name of column Object of clas
$attr attribute of columns Object of clas

 

enqueue Button Actions

               function enqueueBtnActions($actionName, $action, $type = "switch", $text = "", $colName = "", $attr = array()) 
                

enqueue button actions


Parameter Name Description return
$actionName name of acion Object of clas
$action action values Object of clas
$type type of action Object of clas
$text text to be used Object of clas
$colName name of column Object of clas
$attr attribute of columns Object of clas

 

dequeue Button Actions

               function dequeueBtnActions()
                

denqueue button actions


Parameter Name Description return
Object of clas

 

enqueue HTML Content

              function enqueueHTMLContent($html)
                

Add some html content in the form (normally added at the end of form)


Parameter Name Description return
$html html content to be added Object of clas

 

recaptcha

              function recaptcha($siteKey, $secret)
                

Add recaptcha


Parameter Name Description return
$siteKey site key Object of clas
$secret secret key Object of clas

 

Output HTML Content

             function outputHTMLContent($output = true)
                

Output html content and clears html content, can be called at specific places to output content


Parameter Name Description return
$output if true output the content else return the content. Object of clas

 

initialize Plugins

             function outputHTMLContent($output = true)
                

Initialize plugins to be loaded directly from the config file


Parameter Name Description return
Object of clas

 

set Skin

             function setSkin($skin)
                

Set skin


Parameter Name Description return
$skin Name of skin Object of clas

 

reset Fields

             function resetFields()
                

reset Fields


Parameter Name Description return
Object of clas