Plugins
File Input
$pdocrud = new PDOCrud();
$pdocrud->addPlugin("bootstrap-fileinput-master");//to add plugin
$pdocrud->fieldTypes("product_image", "image");//change field type
$pdocrud->formFields(array("product_name","product_price","product_image"));
echo $pdocrud->dbTable("producttable")->render("insertform");
echo $pdocrud->loadPluginJsCode("bootstrap-fileinput-master","input[type=file]");//to add plugin call on input[type=file] elements
Color Picker
$pdocrud = new PDOCrud();
$pdocrud->addPlugin("bootstrap-colorpicker");//to add plugin
$pdocrud->formFields(array("product_name"));
echo $pdocrud->dbTable("producttable")->render("insertform");
echo $pdocrud->loadPluginJsCode("bootstrap-colorpicker","input[type=text]");//to add plugin call on input[type=text] elements
Chosen
$pdocrud = new PDOCrud();
$pdocrud->addPlugin("chosen");//to add plugin
$pdocrud->fieldTypes("product_name", "select"); //change donation amount to radio button
$pdocrud->fieldDataBinding("product_name", array("Mobile", "Pendrive", "Harddisk"), "", "", "array"); //add data for radio button
echo $pdocrud->dbTable("producttable")->render("insertform");
echo $pdocrud->loadPluginJsCode("chosen",".pdocrud-select");//to add plugin call on class .pdocrud-select elements
Time Picker
$pdocrud = new PDOCrud();
$pdocrud->addPlugin("timepicker");//to add plugin
$pdocrud->formFields(array("product_name"));
echo $pdocrud->dbTable("producttable")->render("insertform");
`echo $pdocrud->loadPluginJsCode("timepicker","input[type=text]");//to add plugin call on input[type=text] elements
Select2
$pdocrud = new PDOCrud();
$pdocrud->addPlugin("select2");//to add plugin
$pdocrud->fieldTypes("order_status", "multiselect");//change gender to radio button
$pdocrud->fieldDataBinding("order_status", array("Completed","Pending"), "", "","array");//add data binding using array
echo $pdocrud->dbTable("orders")->render("insertform");
echo $pdocrud->loadPluginJsCode("select2","select");//to add plugin call on select elements
Knob
$pdocrud = new PDOCrud();
$pdocrud->addPlugin("knob");//to add plugin
$pdocrud->formFields(array("qty_available"));
echo $pdocrud->dbTable("producttable")->render("insertform");
echo $pdocrud->loadPluginJsCode("knob","input[type=number]");//to add plugin call on input[type=number] elements
Data Table (Added in v2.4)
Notes:
- jQuery based data table plugin is quite useful in term of no. of function it has. With our script, if you want to use the sql and still want search/sorting/pagination etc functions, you can use this plugin. You will have most of the grid/table functionality using this.
$pdocrud = new PDOCrud();
$pdocrud->addPlugin("datatable");//to add plugin
$pdocrud->setQuery("select * from orders");
echo $pdocrud->render("SQL");
echo $pdocrud->loadPluginJsCode("datatable",".pdocrud-table");//to add plugin call on input[type=text] elements
Word and Character Counter
$pdocrud = new PDOCrud();
$pdocrud->addPlugin("jQuery-Word-and-Character-Counter");//to add plugin
$pdocrud->formFields(array("product_name"));
echo $pdocrud->dbTable("producttable")->render("insertform");
echo $pdocrud->loadPluginJsCode("jQuery-Word-and-Character-Counter","input[type=text]");//to add plugin call on input[type=text] elements
Ckeditor (Added in v2.0)
$pdocrud = new PDOCrud();
$pdocrud->addPlugin("ckeditor");//to add plugin
// add css class
$pdocrud->fieldCssClass("product_description", array("ckeditor"));
echo $pdocrud->dbTable("products")->render("insertform");
//echo $pdocrud->loadPluginJsCode("ckeditor","cHJvZHVjdHMjJHByb2R1Y3RfZGVzY3JpcHRpb25AM2RzZnNkZioqOTkzNDMyNA==");//to add plugin call on textarea with Id = cHJvZHVjdHMjJHByb2R1Y3RfZGVzY3JpcHRpb25AM2RzZnNkZioqOTkzNDMyNA
Summernote - WYSIWYG Editor (Added in v3.7)
Notes:
- Summernote is a JavaScript library that helps you create WYSIWYG editors online.
- You can customize the features of summernote similar to other plugin by passing attribute as parameters. You can set $config["preventXSS"] = false to save data in html format.
- Please note that we have removed the image upload feature of summernote to prevent issue related to our image uploading.
$pdocrud = new PDOCrud();
$pdocrud->addPlugin("summernote");//to add plugin
$pdocrud->fieldCssClass("product_description", array("summernote"));
echo $pdocrud->dbTable("products")->render("insertform");
echo $pdocrud->loadPluginJsCode("summernote",".summernote");//to add plugin call on textarea with class .summernote
Calendar (Added in v2.3)
Notes:
- This example also demonstrate how to use plugin that are applied to static html elements like div/span etc instead of form elements.
$pdocrud = new PDOCrud();
$pdocrud->addPlugin("fullcalendar");
$pdomodel = $pdocrud->getPDOModelObj();
$data["events"] = $pdomodel->executeQuery("select event_id as id, event_title as title, event_date_and_time as start,event_end_date_time as end from eventtable");
$html_data = array("");
echo $pdocrud->render("HTML", $html_data);
echo $pdocrud->loadPluginJsCode("fullcalendar","#fullcalendar",$data);//to add plugin call on input[type=text] elements
Bootstrap Tag (Added in v 3.6)
Notes:
- Convert any input type text field to tags field. You can write tags and move focus out of the text area to convert the value in tags.
$pdocrud = new PDOCrud();
$pdocrud->formFields(array("membership_categories"));
$pdocrud->addPlugin("bootstrap-tag-input");//to add plugin
$pdocrud->fieldAttributes("membership_categories", array("data-role"=>"tagsinput"));
$pdocrud->fieldCssClass("membership_categories", array("tagsinput"));// add css classes
echo $pdocrud->dbTable("library_membership")->render();
echo $pdocrud->loadPluginJsCode("bootstrap-tag-input",".tagsinput");//to add plugin call on .tagsinput class
Vertical Timeline (Added in v3.6)
Notes:
- *** IMPORTANT *** Where I put "900" need to make it div. ALSO need to close 2 of the codes "div codes with bracket.
- Creates vertical timeline by passing the required data. You can get data in form of array and use it to create the html block.
$pdocrud = new PDOCrud();
$pdocrud->addPlugin("vertical-timeline-master");//to add plugin
$data = $pdocrud->getPDOModelObj()->orderBy(array("message_date"))->select("message");//get data to be displayed in time line e.g. getting data from message table
//Create html from data
//You can print_r the $data to understand the column name that needs to be used to create the block.
$block = "";
if(count($data)){
foreach($data as $row){
$block .="<900 class="cd-timeline__block js-cd-block">
<900 class="cd-timeline__img cd-timeline__img--picture js-cd-img">
/900> //COMMENT OUT cd-timeline__img -->
<900 class="cd-timeline__content js-cd-content">
(could make header 2)".$row["message_thread_code"]."
(could make header 2)".$row["message"]."
href="".$row["message_url"]."" class="cd-timeline__read-more">Read more//Need to enclose with a in brackets//
class="cd-timeline__date">".$row["message_date"]."//Need to enclose with span in brackets//
/900> //COMMENT OUT cd-timeline__content -->
900>";
}
}
$html_data = array("(section class="cd-timeline js-cd-timeline"><900 class="cd-timeline__container">$block/900>(section)");//Need to add section in brackets
echo $pdocrud->render("HTML", $html_data);
(section)(/section)
Rateit (Added in v3.6)
Notes:
- Add a rating option to display.
$pdocrud = new PDOCrud();
$pdocrud->addPlugin("rateit");//to add plugin
$pdocrud->fieldTypes("product_rating", "rateit");
$pdocrud->formFields(array("product_rating"));
$pdocrud->crudTableCol(array("product_id","product_name", "qty_available", "product_rating"));
$pdocrud->tableColFormatting("product_rating", "rateit");
$pdocrud->viewColFormatting("product_rating", "rateit");
echo $pdocrud->dbTable("producttable")->render();
echo $pdocrud->loadPluginJsCode("rateit",".rateit");//to add plugin call on input[type=text] elements
Password Strength (Added in v3.6)
Notes:
- Adds a password strength bar below the password field indicating the password strength. Please note that it shows only strength of password, it doesn't prevent submission if password is weak.
$pdocrud = new PDOCrud();
$pdocrud->fieldCssClass("password", array("password"));// add css classes to apply plugin later on that css class
$pdocrud->addPlugin("bootstrap-pwstrength");//to add plugin
$pdocrud->formFields(array("first_name","last_name","user_name","password"));
echo $pdocrud->dbTable("users")->render("insertform");
//optional parameters for the bootstrap pwstrength plugin
$params["ui"] = array("showProgressBar"=> "true");
$params["common"] = array("showVerdictsInsideProgressBar"=> "true");
$params["rules"] = array("wordRepetitions"=> "true");
echo $pdocrud->loadPluginJsCode("bootstrap-pwstrength",".password",$params);//to add plugin call on class .password elements
Input Mask (Added in v3.6)
Notes:
- You can define the input mask for element with the help of plugin input mask.
$pdocrud = new PDOCrud();
$pdocrud->addPlugin("bootstrap-inputmask");//to add plugin
$pdocrud->formFields(array("product_name"));
$pdocrud->fieldCssClass("product_name", array("product_name"));
//$pdocrud->fieldDataAttr("product_name", array("placeholder"=>"default format is [9-]AAA-999"));//optional
echo $pdocrud->dbTable("producttable")->render("insertform");
echo $pdocrud->loadPluginJsCode("bootstrap-inputmask",".product_name", array("mask"=> "'[9-]AAA-999'"));//to add plugin call on .product_name elements
Animation (Added in v4.4)
Notes:
- Adds animation to fields. You can find list of animation here https://daneden.github.io/animate.css/
$pdocrud = new PDOCrud();
$pdocrud->addPlugin("animate");//to add plugin animate
echo $pdocrud->dbTable("users")->render("insertform"); // insert form
//lets call animate plugin to all input type text, you can specify .class or
#id also there.
//You can find list of animation here https://daneden.github.io/animate.css/
echo $pdocrud->loadPluginJsCode("animate","input[type=text]", array("rubberBand delay-2s infinite"));
Password Input Type (Added in v4.7)
Notes:
- Something is wrong with the code. It looks the same as file input plugin, but it is suppose to be a password.
- https://crm.myflex.io/demo/pages/plugin-password.php
$pdocrud = new PDOCrud();
$pdocrud->addPlugin("bootstrap-fileinput-master");//to add plugin
$pdocrud->fieldTypes("product_image", "image");//change field type
$pdocrud->formFields(array("product_name","product_price","product_image"));
echo $pdocrud->dbTable("producttable")->render("insertform");
echo $pdocrud->loadPluginJsCode("bootstrap-fileinput-master","input[type=file]");//to add plugin call on input[type=file] elements
Emojion Area (Added in v4.8)
$pdocrud = new PDOCrud();
$pdocrud->addPlugin("emojionearea");//to add plugin
$pdocrud->fieldTypes("product_name", "textarea"); //change product_name to textarea
echo $pdocrud->dbTable("producttable")->render("insertform");
echo $pdocrud->loadPluginJsCode("emojionearea",".pdocrud-textarea");//to add plugin call on class .pdocrud-textarea
Bootstrap Input Spinner (Added in v6.1)
Notes:
- A Bootstrap / jQuery plugin to create input spinner elements for number input.
$pdocrud = new PDOCrud();
$pdocrud->addPlugin("bootstrap-input-spinner");//to add plugin
$pdocrud->formFields(array("product_price"));//only show product_price field
$pdocrud->fieldCssClass("product_price", array("product_price"));
echo $pdocrud->dbTable("producttable")->render("insertform");
echo $pdocrud->loadPluginJsCode("bootstrap-input-spinner",".product_price", array("decrementButton"=> "'−'"));//to add plugin call on .product_name elements