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:
//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";”
require_once “script/ pdocrud.php”;
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.
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.
pdocrud->setSettings("pagination", false);”;
pdocrud->setSettings("searchbox", false);”;
pdocrud->setSettings("deleteMultipleBtn", false);”;
pdocrud->setSettings("recordsPerPageDropdown", false);”;
pdocrud->setSettings("recordsPerPageDropdown", false);”;
pdocrud->setSettings("totalRecordsInfo", false);”;
pdocrud->setSettings("addbtn", false);”;
pdocrud->setSettings("editbtn", false);”;
pdocrud->setSettings("viewbtn", false);”;
pdocrud->setSettings("delbtn", false);”;
pdocrud->setSettings("actionbtn", false);”;
pdocrud->setSettings("checkboxCol", false);”;
pdocrud->setSettings("numberCol", false);”;
pdocrud->setSettings("printBtn", false);”;
pdocrud->setSettings("pdfBtn", false);”;
pdocrud->setSettings("csvBtn", false);”;
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
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.
$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:
function dbTable($tableName)
Parameter Name | Type | Description |
$tableName | string | The name of the table to generate form. |
function formTag($formHeading = "", $formType = "", $class = array(), $attr = array())
Parameter Name | Type | Description |
$formHeading | string | fields |
$formType | string | |
$class | string | |
$attr | string | |
object | return |
function formFields($fields)
Parameter Name | Type | Description |
$fields | array | Form fields to displayed only. |
object | return |
function formRemoveFields($fields = array())
Parameter Name | Type | Description |
$fields | array | Form fields to displayed only. |
object | return |
function formSetPrimarykey($pk, $pkval)
Parameter Name | Type | Description |
$pk | string | From email |
$pkval | string | To email |
object | return |
function formExportData($exportType = "pdf")
Parameter Name | Type | Description |
$exportType | string | From email |
object | return |
function formDisplayInPopup($buttonContent = "", $headerContent = "")
Parameter Name | Type | Description |
$buttonContent | string | From email |
$headerContent | string | To email |
object | return |
function formId($id)
Parameter Name | Type | Description |
$id | string | ID of the form |
object | return |
function fieldDisplayOrder($fields)
Parameter Name | Type | Description |
$fields | array | fields in ascending order to be displayed in form |
object | return |
function fieldCssClass($fieldName, $fieldClass = array())
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 |
public function formStaticFields($fieldName, $fieldType, $fieldValue = "")
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 |
function fieldRenameLable($fieldName, $lableName)
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 |
function fieldHideLable($fieldName, $takeSpace = false)
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 |
function buttonHide($buttonname="cancel")
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 |
function fieldNotMandatory($fieldName)
Parameter Name | Type | Description |
$fieldName | string | field name for which required attribute needs to be removed |
object | return |
function fieldAttributes($fieldName, $attr = array())
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 |
public function fieldTypes($fieldName, $type, $parameters = "")
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 |
function fieldValidationType($fieldName, $validation, $param = "true", $errorMsg = "")
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 |
function fieldDependent($dependent, $dependOn, $colName)
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 |
function fieldDataBinding($fieldName, $dataSource, $key, $val, $bind = "db")
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 |
function fieldAddOnInfo($fieldName, $position, $addOnText)
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 |
function fieldBlockClass($fieldName, $class)
Parameter Name | Type | Description |
$fieldName | string | field name to be bind |
$class | string | data source either tablename or array of data |
object | return |
function fieldGroups($groupName, $fields = array())
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 |
function FormSteps(array $fields, $stepName, $stepType = "stepy", $attr = array())
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 |
function fieldTooltip($fieldName, $tooltip, $tooltipIcon = "")
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 |
function fieldDesc($fieldName, $desc)
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 |
function fieldDesc($fieldName, $desc)
Parameter Name | Type | Description |
$html | string | Any unuique name of group e.g. full_name |
object | return |
function outputHTMLContent($output = true)
Parameter Name | Type | Description |
$output | bool | Any unuique name of group e.g. full_name |
object | return |
function addPlugin($pluginName)
Parameter Name | Type | Description |
$pluginName | string | Name of the plugin to be added, make sure plugins folder is readable |
object | return |
function enqueueJs($jsName, $jsPath)
Parameter Name | Type | Description |
$jsName | string | Name of javascript to be loaded |
$jsPath | string | Path of javascript to be loaded |
object | return |
function applyJS($applyOn, $applyOnVal, $functionName, $action = "on_form_load", $options = array())
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 |
function unsetJs($jsName)
Parameter Name | Type | Description |
$jsName | string | Name of javascript to be removed |
object | return |
function outputJs($output = true)
Parameter Name | Type | Description |
$output | bool | if true output the content else return the content. |
object | return |
function outputApplyJs($output = true)
Parameter Name | Type | Description |
$output | bool | if true output the content else return the content. |
object | return |
function addCallback($eventName, $callback)
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 |
function loadPluginJsCode($pluginName, $elementName, $params = array())
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 |
function enqueueCss($cssName, $cssPath)
Parameter Name | Type | Description |
$cssName | string | Name of plugin |
$cssPath | string | Element name for which plugin needs to be called |
object | return |
function unsetCss($cssName)
Parameter Name | Type | Description |
$cssName | string | Name of plugin |
object | return |
function outputCss($output = true)
Parameter Name | Type | Description |
$output | bool | if true output the content else return the content. |
object | return |
function setCurrentLang($lang)
Parameter Name | Type | Description |
$lang | string | language to be used |
object | return |
function getLangData($param)
Parameter Name | Type | Description |
$param | string | language to be used |
object | return |
function setLangData($param, $val)
Parameter Name | Type | Description |
$key | string | lanuguage key for which data needs to save |
$val | string | Value for the language parameter |
object | return |
function getErrors()
Parameter Name | Type | Description |
return array |
function getSettings($setting)
Parameter Name | Type | Description |
Config Key for which setting needs to be retreived; | Configuaration setting value |
function setSettings($setting, $value)
Parameter Name | Type | Description |
Config key for setting | Value for setting | Object of class |
function joinTable($joinTableName, $joinCondition, $joinType = "INNER JOIN")
Parameter Name | Type | Description |
join condition e.g | string | name of table to be joined |
function crudTableCol($columns)
Parameter Name | Type | return |
join condition e.g | string | Object of class |
function crudRemoveCol($columns)
Parameter Name | Type | return |
join condition e.g | string | Object of class |
function crudAddAction($actionName, $colName, $displayVal = array(), $applyVal = array())
Parameter Name | Type | return |
$actionName | string | Object of class |
function recordsPerPage($val)
Parameter Name | Type | return |
no. of records per page e.g. 10 | string | Object of class |
function currentPage($pageNo)
Parameter Name | Type | return |
$pageNo-page no. e.g. 2 | string | Object of class |
function colTypes($colName, $colType, $parameters = "")
Parameter Name | Type | return |
$pageNo-page no. e.g. 2 | string | Object of class |
function crudColTooltip($colName, $tooltip, $tooltipIcon = "")
Parameter Name | Type | return |
$colName | string | Object of class |
function setPK($columnName)
Parameter Name | Type | return |
sets primary key | string | Object of class |
function setInlineEdit($val = false)
Parameter Name | Type | return |
$setting ,$value | string | Object of class |
function dbOrderBy($orderbyCols)
Parameter Name | Type | return |
columns names for which data needs to be order by | string | Object of class |
function dbLimit($limit)
Parameter Name | Type | return |
$limit -limit of records to be used | string | Object of class |
function setSearchCols($cols)
Parameter Name | Description | return |
$cols | Set columns to be used for search | Object of class |
function formTag($formHeading = "", $formType = "", $class = array(), $attr = array())
Parameter Name | Description | return |
$formHeading ,$cols | Heading of form (fieldset) | Object of class |
function formSendEmail($from, $to, $subject, $message, $saveDb = false)
Parameter Name | Description | return |
$from | Heading of form (fieldset) | Object of class |
function formAddCaptcha($fieldName)
Parameter Name | type | return |
$fieldName | String | Object of class |
function fieldDataAttr($colName, $attr = array())
Parameter Name | Description | return |
$colName | column name for which attribute to be added | Object of class |
function fieldRename($fieldName, $newName)
Parameter Name | Description | return |
$fieldName | field name to renamed | Object of class |
$newName | new field name to be used |
function formFieldValue($fieldName, $value)
Parameter Name | Description | return |
$fieldName | field name to renamed | Object of class |
$value | value of the field |
function formRedirection($redirectionURL)
Parameter Name | Description | return |
$redirectionURL | url to be redirected | Object of class |
function fieldConditionalLogic($fieldname, $condition, $op = "=", $field, $task)
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 |
function fieldConditionalLogic($fieldname, $condition, $op = "=", $field, $task)
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 |
public function addFieldDesc($elementName, $desc, $type = "field")
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 |
function resizeImage($dimensions = array())
Parameter Name | Description | return |
$dimensions | dimensions of image | Object of class |
function thumbnailImage($width, $height = null, $focal = 'center')
Parameter Name | Description | return |
$width | int | Object of class |
$height If omitted - assumed equal to $width | int|null | Object of class |
function crop($x1, $y1, $x2, $y2)
Parameter Name | Description | return |
int | $x1 Left ,$y1 Top ,$x2 Right , $y2 Bottom | SimpleImage |
function flip($direction)
Parameter Name | Description | return |
$direction | $direction x|y | Object of clas |
function watermark($overlay, $position = 'center', $opacity = 1, $xOffset = 0, $yOffset = 0)
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 |
function setQuery($sql)
Parameter Name | Description | return |
$sql | Query to be executed | Object of clas |
function bulkCrudUpdate($colName, $fieldType, $attr = array())
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 |
function tableColFormatting($colName, $formatType, $paramaters = array())
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 |
function tableDataFormatting($applyOn, $formatType, $condition = array(), $apply = array())
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 |
function tableDataFormatting($applyOn, $formatType, $condition = array(), $apply = array())
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 |
function tableColAddition($colName, $type, $paramaters = array())
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 |
function tableHeading($heading)
Parameter Name | Description | return |
$heading | table heading to be changed | Object of clas |
function tableHeading($heading)
Parameter Name | Description | return |
$heading | table heading to be changed | Object of clas |
tableSubHeading($subHeading)
Parameter Name | Description | return |
$heading | table heading to be changed | Object of clas |
function tableColUsingDatasource($colname, $data, $joinColName, $dataCol, $dataSource = "db")
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 |
function colDependent($dependentCol, $tableName, $dependentOn)
Parameter Name | Description | return |
$dependentCol | crud table column name to be replaced | Object of clas |
function colDataAttr($colName, $attr = array())
Parameter Name | Description | return |
$colName | column name for which attribute to be added | Object of clas |
$attr | attribute to be set | Object of clas |
function colSumPerPage($colName)
Parameter Name | Description | return |
$colName | column name for sum to be calculated | Object of clas |
function colSumTotal($colName)
Parameter Name | Description | return |
$colName | column name for sum to be calculated | Object of clas |
function addTooltip($elementName, $toolTip, $type = "field")
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 |
function addTooltip($elementName, $toolTip, $type = "field")
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 |
function setBackOperation($operation = true)
Parameter Name | Description | return |
$operation | true/false, current operation is back button operation or not | Object of clas |
function setSearchOperator($operator = "=")
Parameter Name | Description | return |
$operator | Set search operator 'like', '>', '>=', '<','=<' etc | Object of clas |
function crudCall($show = false)
Parameter Name | Description | return |
$show | true/false, whether current call is direct or called usign CRUD operation | Object of clas |
function addFilter($filterName, $displayText, $matchingCol, $filterType)
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 |
function setFilterSource($filterName, $dataSource, $key, $val, $bind = "db")
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 |
function addAdvSearch($columns)
Parameter Name | Description | return |
$columns | Column names to be searched | Object of clas |
function setAdvSearchParam($columnName, $displayText, $searchType)
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 |
function enqueueActions($action, $type = "switch", $text = "", $colName = "", $attr = array())
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 |
function enqueueBtnActions($actionName, $action, $type = "switch", $text = "", $colName = "", $attr = array())
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 |
function dequeueBtnActions()
Parameter Name | Description | return |
Object of clas |
function enqueueHTMLContent($html)
Parameter Name | Description | return |
$html | html content to be added | Object of clas |
function recaptcha($siteKey, $secret)
Parameter Name | Description | return |
$siteKey | site key | Object of clas |
$secret | secret key | Object of clas |
function outputHTMLContent($output = true)
Parameter Name | Description | return |
$output | if true output the content else return the content. | Object of clas |
function outputHTMLContent($output = true)
Parameter Name | Description | return |
Object of clas |
function setSkin($skin)
Parameter Name | Description | return |
$skin | Name of skin | Object of clas |
function resetFields()
Parameter Name | Description | return |
Object of clas |