Misc
// IMPORT BULK DATA - MUST SPECIFY FILENAME AND TABLE NAME ONLY
echo "Records Imported: ". $pdocrud->bulkImport("upload/advertisement.csv", "advertisement");
//
$pdocrud->setQuery("select * from orders");
$pdocrud->subQueryColumn("order_id", "select sum(id) from orders where customer_name = {user_name}");
//
// MULTI INSTANCE
$pdocrud1 = new PDOCrud();
echo $pdocrud1->dbTable("orders")->render();
$pdocrud2 = new PDOCrud(true);
echo $pdocrud2->dbTable("producttable")->render();
//
// PORTFOLIO
$pdocrud->setPortfolioColumn(4);// POSSIBLE NUMBER OF COLUMNS - VALUES = 1,2,3,4,6
$pdocrud->tableColFormatting("product_image", "image");
//
// ADD SIDEBAR (LIKE ADMIN PANELS)
// list of urls to displayed below the sidebar
$urls[] = array("url"=>"#profile","text" => "Profile", "icon" =>"fa fa-user", "data"=>"", "attr" =>array("data-profile"=>"user_id"),"class" => array("parent-sidebar"));
$urls[] = array("url"=>"#recent-activity","text" => "Recent Activity", "icon" =>"fa fa-history", "data"=>"12/12/2017", "attr" =>array(),"class" => array("parent-sidebar"));
*Add sidebar to existing data in edit/view form
*@param string $sidebarImage column name of image or url of image
*@param string $sidebarHeading1 column name for sidebar heading 1 or some text
*@param string $sidebarHeading2 column name for sidebar heading 2 or some text
*@param array $sidebarURLs sidebar urls
*@param string $position Position of the sidebar (either left or right)
*return object Object of class
$pdocrud->addSidebar("parent_profile_img","name","email",$urls,"left");
//
$pdocrud->enqueueJs("googlemap", "http://maps.googleapis.com/maps/api/js");//name of js and path of js
$pdocrud->enqueueCSS("jquery.mobile", "https://ajax.googleapis.com/ajax/libs/jquerymobile/1.4.5/jquery.mobile.min.css");//name of css and path of css
$pdocrud->enqueueJs("googlemap", "https://maps.googleapis.com/maps/api/js?key=AIzaSyAfp6Kg56vpI7GqJsDCTa577NnNDTnQiUw&callback=initMap");
$pdocrud->fieldTypes("address", "GOOGLEMAP");
//
// QUICK DATA VIEW
$pdocrud = new PDOCrud(false, "", "", array("quickView" => true));
//optional - Enable edit button, make sure to hide save and edit button on form next form
Image Operations
$pdocrud->resizeImage(array("100"=>"100")); //WIDTH=>HEIGHT
//
// Add overlay image (watermark) - pass overlay image, position, opacity, x_position, y_position
$pdocrud->watermark("http://localhost/pdoCrud/demo/pages/images/overlay.png","bottom right","0.8");
$pdocrud->thumbnailImage(100, 100);
$pdocrud->crop(5, 20, 100, 400); //CROP IMAGE - X1,Y1,X2,Y2
$pdocrud->flip("x"); // X OR Y
$pdocrud->imageText('Your Text', __DIR__.'/images/delicious.ttf', 32, '#FFFFFF', 'top', 0, 20); // ADD TEXT
Settings
// DYNAMIC JAVASCTIP ACTION
$pdocrud = new PDOCrud();
* Set/Call js actions for the form elements on some js event
* @param string $element Main element, On which element, calculated value should be displayed
* @param string $formula Formula to be applied
* @param string $event Javascript event, this will be applied on formula fields if no event fields passed
* @param string $eventFields Event fields if any
* return object Object of class
$pdocrud->setJsActions("order_total", "{order_sub_total} + {tax} + {shipping} - {discount}","change");
echo $pdocrud->dbTable("x_ordertable")->render("insertform");
// DATE RANGE WISE REPORT
*Add date range report buttons (eg daily ,monthly ,yearly report button)
*@param string $text Name/Text of the button
*@param string $type Type of the report to be generated.
*return object Object of class
$pdocrud->addDateRangeReport("This Year", "calendar_year", "order_date");
$pdocrud->addDateRangeReport("This Month", "calendar_month", "order_date");
$pdocrud->addDateRangeReport("Last 365 days", "year", "order_date");
$pdocrud->addDateRangeReport("Last 30 days", "month", "order_date");
$pdocrud->addDateRangeReport("1 Day", "Last 1 day", "order_date");
$pdocrud->addDateRangeReport("Today", "today", "order_date");
//
// PASSWORD ENCRYPTION
pdocrud = new PDOCrud();
$pdocrud->formFields(array("user_name","password"));
*Sets the type of field
*@param string $fieldName field name for types needs to be set
*@param string $type Field type
*@param string $parameters Field parameters
*return object Object of class
$pdocrud->fieldTypes("password", "password", array("encryption"=>"md5"));
echo $pdocrud->dbTable("users")->render("insertform");
//