Documentation for class BpForm



/**
 *  @package:   bpl - brain pies library
 * 	Class: 		BpForm
 * 
 *  @author:    BrainPies Team
 *  @copyright: BrainPies Team
 *  @link:		https://brainpies.com
 * 
 *  @license:   GNU/GPL v.3.0 or any later version
 *  @link:		https://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
 * 
 *  @version:   1.0.0
 * 
 * 
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the Free
 * Software Foundation; either version 3 of the License, or (at your option)
 * any later version.

 * This program is distributed 'as is', in the hope that it will be useful, 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.

 * You should have received a copy of the GNU General Public License along
 * with this program (COPYING); if not, go to http://www.fsf.org/ or write
 * to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

	/**
	 * @method	admAddItemButtons
	 * Method to add action buttons to item edit view in admin side
	 *
	 * @param	int		$isNew		the item id
	 * @param	array	$options	options to manage buttons
	 *
	 * @uses	Class	Bp
	 *
	 * @return	void
	 *
	 * @since	1.0.0
	 * 
	 * @todo 	to be completed with all buttons available
	 */

	/**
	 * @method	adminEdit
	 * Method to parse and print the $form in admin side, edit layout
	 *
	 * @param	object	$form		The form object
	 * @param	array	$options	The options to include/exclude into the layout
	 * @param	string	$sidebar	Html string sidebar
	 *	
	 * @uses	Class	Bp
	 *
	 * @return	string	html admin fieldset(s) tab(s) form page, side bar included (if any)
	 *
	 * @since	1.0.0
	 */

	/**
	 * @method	adminList
	 * Method to printout the dbObjectList in admin side
	 *
	 * @param	string	$sidebar	mandatory	the sidebar html code
	 * @param	array	$items		mandatory	the database items list array
	 * @param	object	$pagination	optional	The pagination object
	 * @param	array	$options	optional	The options to include/exclude into the layout
	 *
	 * @uses	Class	Bp
	 *
	 * @return	string	html admin list form page, side bar included (if any)
	 *
	 * @since	1.0.0
	 */

	/**
	 * @method	admAddListButtons
	 * Method to add action buttons to item edit view in admin side
	 *
	 * @param	int		$isNew		the item id
	 * @param	array	$options	options to manage buttons
	 *
	 * @uses	Class	Bp
	 *
	 * @return	void
	 *
	 * @since	1.0.0
	 * 
	 * @todo 	to be completed with all buttons available
	 */

	/**
	 * @method	clean
	 * Method to sanitize data
	 *
	 * @param	mixed	$field		mandatory	Input string/array-of-string to be 'cleaned'
	 * @param	string	$type		mandatory	the filter to use
	 * 
	 * @return	mixed	sanitized field value
	 *
	 * @since	1.0.0
	 * 
	 * 
	 * NOTE:
	 * 		source: Joomla.Platform class JFilterInput
	 * 	$type can be
	 * 		ALNUM:     	A string containing A-Z or 0-9 only (not case sensitive),
	 * 		ARRAY:     	An array,
	 * 		BASE64:    	A string containing A-Z, 0-9, forward slashes, plus or equals (not case sensitive),
	 * 		BOOLEAN:   	A boolean value,
	 * 		CMD:       	A string containing A-Z, 0-9, underscores, periods or hyphens (not case sensitive),
	 * 		FLOAT:     	A floating point number, or an array of floating point numbers,
	 * 		HTML:      	A sanitised string,
	 * 		INT:       	An integer, or an array of integers,
	 * 		INTEGER:    An integer, or an array of integers,
	 * 		PATH:      	A sanitised file path, or an array of sanitised file paths,
	 * 		RAW:       	The raw string is returned with no filtering,
	 * 		STRING:    	A fully decoded and sanitised string (default),
	 * 		TRIM:      	A string trimmed from normal, non-breaking and multibyte spaces
	 * 		UINT:      	An unsigned integer, or an array of unsigned integers,
	 * 		USERNAME:  	Do not use (use an application specific filter),
	 * 		WORD:     	A string containing A-Z or underscores only (not case sensitive),
	 * 		unknown:   	An unknown filter will act like STRING. If the input is an array it will return an array of fully decoded and sanitised strings.
	 */

	/**
	 * @method	cleanDbfield
	 * Method to sanitize a db field name string
	 *
	 * @param	string	$text		mandatory	string to be 'cleaned'
	 * 
	 * @return	string	filtered string
	 *
	 * @since	1.0.0
	 */

	/**
	 * @method	cleanLanguagetag
	 * Method to sanitize a language tag string
	 *
	 * @param	string	$text		mandatory	string to be 'cleaned'
	 * 
	 * @return	string	filtered string
	 *
	 * @since	1.0.0
	 */

	/**
	 * @method	cleanSlug
	 * Method to sanitize a slug string
	 *
	 * @param	string	$text		mandatory	string to be 'cleaned'
	 * 
	 * @return	string	filtered string
	 *
	 * @since	1.0.0
	 */

	/**
	 * @method	getActions
	 * Get a list of the actions that can be performed (from JAccess).
	 *
	 * @return  JObject
	 *
	 * @since   1.0
	 */

	/**
	 * @method	getEditorInstance
	 * Method to get a the default editor instance
	 * 
	 * @param	string	$content		optional
	 * @param	string	$editorName		optional	the editor name
	 * @param	mixed	$width			optional	the editor width
	 * @param	mixed	$height			optional	the editor height
	 * @param	int		$columns		optional	the editor columns
	 * @param	int		$rows			optional	the editor rows
	 * @param	bool	$bottomButtons	optional	whether to show the bottom buttons
	 * @param	string	$id				optional	the id of the item
	 * @param	string	$asset			optional	asset
	 * @param	string	$author			optional	author's name
	 *
	 * @return  JObject
	 *
	 * @since   1.0
	 */

	/**
	 * @method	getJform
	 * Method to retrieve the post jform
	 *
	 * @return	array	JForm fields array
	 *
	 * @since	1.0.0
	 */

	/**
	 * @method	getJformField
	 * Method to retrieve a specific field value of the posted jform
	 * 
	 * @param	string	$field		mandatory	the field to search for
	 * @param	string	$type		mandatory	the field type to cast/sanitize
	 * @param	mixed	$default	optional	the default value to return if fails
	 *
	 * @return	array	JForm fields array
	 *
	 * @since	1.0.0
	 */

	/**
	 * @method	getOptions
	 * Method to get a form field options list
	 * 
	 * @param	array	$optArrays	array of options
	 * @param	mixed	$value		the current value to set the option to selected
	 *
	 * @return	string	the html options string 
	 *
	 * @since	1.0.0
	 */

	/**
	 * @method	parseForm
	 * Method to parse form fields, output label and field in different rows
	 *
	 * @param	object	$form		mandatory	the form object
	 * @param	string	$name		mandatory	the form fieldset to parse	
	 * @param	string	$labelWidth	optional	the width of label			default 300px
	 * 
	 * @return	string	html input fields and labels
	 *
	 * @since	1.0.0
	 * 
	 * NOTE: to be used in site side
	 */

	/**
	 * @method	parseFormInline
	 * Method to parse form fields, label and field in the same row
	 *
	 * @param	object	$form		mandatory	the form object
	 * @param	string	$name		mandatory	the form fieldset to parse
	 * @param	string	$labelWidth	optional	the width of label
	 * 											default: 300px
	 * @param	bool	$showLabel	optional	whether to print label and field or only input field
	 * 											default: 0
	 * @param	bool	$sendButton	optional	wehther to print the send button
	 * 											default: 0
	 * 
	 * @return	string	html input fields and labels
	 *
	 * @since	1.0.0
	 * 
	 * NOTE: to be used in site side
	 */

	/**
	 * @method	parseFormUk
	 * Method to parse form fields, label and field in the same row, using CSS 'uk' style class
	 *
	 * @param	object	$form		mandatory	the form object
	 * @param	string	$name		mandatory	the form fieldset to parse
	 * 
	 * @return	string	html input fields and labels
	 *
	 * @since	1.0.0
	 * 
	 * NOTE: as uikit is a template standard de-facto you may want to take advantage of it
	 */

	/**
	 * @method	removeField
	 * Method to remove a single field from form object
	 *
	 * @param	object	$form		mandatory	the form object
	 * @param	string	$field		mandatory	The name of the form field for which remove
	 * 
	 * @return	object	the purged form object
	 *
	 * @since	1.0.0
	 */

	/**
	 * @method	removeFieldset
	 * Method to remove a whole fieldset from form object
	 *
	 * @param	object	$form		mandatory	the form object
	 * @param	string	$fieldset	mandatory	the form fieldset to parse
	 * 
	 * @return	object	the purged form object
	 *
	 * @since	1.0.0
	 */

	/**
	 * @method	secureText
	 * Method to check if a text contains a link to an external site
	 *
	 * @param	string	$text		mandatory	the text to check
	 * 
	 * @return	bool	true if secure, false if unsecure
	 *
	 * @since	1.0.0
	 */

	/**
	 * @method	setAttribute
	 * Method to set an attribute value for a field XML element
	 *
	 * @param	object	$form		mandatory	the form object
	 * @param	string	$field		mandatory	The name of the form field for which to set the attribute value
	 * @param	mixed	$value		mandatory	The value to set for the attribute
	 * @param	string	$group		optional	The optional dot-separated form group path on which to find the field
	 * 
	 * @return	object	the form object
	 *
	 * @since	1.0.0
	 */