<commit_before><?php

/**
 *
 * Helper CakePHP pour créer des éléments formulaires du Bootstrap Twitter version 3
 * @author Web&Cow - France
 *
 */


class Bs3FormHelper extends FormHelper {

/**
 * The name of the helper
 *
 * @var string
 */
	public $name = 'Bs3Form';

/**
 * Right and left settings to have 2 columns (label and inputs) with an horizontal form
 * Default values are : left -> 3 ; right -> 9
 *
 * @var int
 */
	private $left = 3;
	private $right = 9;

/**
 * Defines the type of form being created, horizontal form or inline form. Set by Bs3FormHelper::create()
 *
 * @var string
 */
	protected $_typeForm = 'horizontal';

/**
 * Defines the model of form being created. Set by Bs3FormHelper::create()
 *
 * @var string
 */
	protected $_modelForm = null;

/**
 * Return the current value of $left
 */
	public function getLeft(){
		return $this->left;
	}

/**
 * Set the value of $left
 *
 * @var int
 */
	public function setLeft($val){
		$this->left = $val;
	}

/**
 * Return the current value of $right
 */
	public function getRight(){
		return $this->right;
	}

/**
 * Set the value of $right
 *
 * @var int
 */
	public function setRight($val){
		$this->right = $val;
	}

/**
 * Return the current value of $_typeForm
 */
	protected function _getFormType(){
		return $this->_typeForm;
	}

/**
 * Set the value of $_typeForm
 *
 * @var string
 */
	protected function _setFormType($val){
		$this->_typeForm = $val;
	}

/**
 * Return the current value of $_modelForm
 */
	protected function _getModelForm(){
		return $this->_modelForm;
	}

/**
 * Set the value of $_typeForm
 *
 * @var string
 */
	protected function _setModelForm($val){
		$this->_modelForm = $val;
	}


/**
 * Returns an HTML FORM element.
 *
 * Extends of FormHelper::create() so get same options and params
 *
 * Initialize the value of $_typeForm, $_modelForm and give attribute 'role' to the form')`
 *
 * @param mixed $model The model name for which the form is being defined.
 *   If an array is passed and $options argument is empty, the array will be used as options.
 *   If `false` no model is used.
 * @param array $options An array of html attributes and options.
 * @return string An formatted opening FORM tag.
 */

	public function create($model = null, $options = array()){

		if (!isset($options['role'])){
			$options['role'] = 'form';
		}

		if (is_integer(strpos($options['class'], 'form-horizontal'))){
			$this->_setFormType('horizontal');
		}elseif (is_integer(strpos($options['class'], 'form-inline'))) {
			$this->_setFormType('inline');
		}

		$this->_setModelForm($model);

		return parent::create($model, $options);
	}


/**
 * Generates a form input element complete with label and wrapper div
 *
 * Extends of FormHelper::input() so get same options and params
 *
 * ### New Options
 *
 * - `state` - Change the state of the input to 'error', 'warning' or 'success'<commit_msg>Bug fixed<commit_after><?php

/**
 *
 * Helper CakePHP pour créer des éléments formulaires du Bootstrap Twitter version 3
 * @author Web&Cow - France
 *
 */


class Bs3FormHelper extends FormHelper {

/**
 * The name of the helper
 *
 * @var string
 */
	public $name = 'Bs3Form';

/**
 * Right and left settings to have 2 columns (label and inputs) with an horizontal form
 * Default values are : left -> 3 ; right -> 9
 *
 * @var int
 */
	private $left = 3;
	private $right = 9;

/**
 * Defines the type of form being created, horizontal form or inline form. Set by Bs3FormHelper::create()
 *
 * @var string
 */
	protected $_typeForm = 'horizontal';

/**
 * Defines the model of form being created. Set by Bs3FormHelper::create()
 *
 * @var string
 */
	protected $_modelForm = null;

/**
 * Return the current value of $left
 */
	public function getLeft(){
		return $this->left;
	}

/**
 * Set the value of $left
 *
 * @var int
 */
	public function setLeft($val){
		$this->left = $val;
	}

/**
 * Return the current value of $right
 */
	public function getRight(){
		return $this->right;
	}

/**
 * Set the value of $right
 *
 * @var int
 */
	public function setRight($val){
		$this->right = $val;
	}

/**
 * Return the current value of $_typeForm
 */
	protected function _getFormType(){
		return $this->_typeForm;
	}

/**
 * Set the value of $_typeForm
 *
 * @var string
 */
	protected function _setFormType($val){
		$this->_typeForm = $val;
	}

/**
 * Return the current value of $_modelForm
 */
	protected function _getModelForm(){
		return $this->_modelForm;
	}

/**
 * Set the value of $_typeForm
 *
 * @var string
 */
	protected function _setModelForm($val){
		$this->_modelForm = $val;
	}


/**
 * Returns an HTML FORM element.
 *
 * Extends of FormHelper::create() so get same options and params
 *
 * Initialize the value of $_typeForm, $_modelForm and give attribute 'role' to the form')`
 *
 * @param mixed $model The model name for which the form is being defined.
 *   If an array is passed and $options argument is empty, the array will be used as options.
 *   If `false` no model is used.
 * @param array $options An array of html attributes and options.
 * @return string An formatted opening FORM tag.
 */

	public function create($model = null, $options = array()){

		if (!isset($options['role'])){
			$options['role'] = 'form';
		}

		if (isset($options['class'])) {
			if (is_integer(strpos($options['class'], 'form-horizontal'))){
				$this->_setFormType('horizontal');
			}elseif (is_integer(strpos($options['class'], 'form-inline'))) {
				$this->_setFormType('inline');
			}
		}

		$this->_setModelForm($model);

		return parent::create($model, $options);
	}


/**
 * Generates a form input element complete with label and wrapper div
 *
 * Extends of FormHelper::input() so get same options and params
 *
 * ### New Options
 *
 * - `state` - Change the state of the input to 'error', 'warning' or 'success'
{'fraction_non_alphanumeric': 0.140847486704409, 'fraction_numerical': 0.0034311202607651397, 'mean_word_length': 3.467432950191571, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2081064', 'n_tokens_mistral': 1898, 'n_tokens_neox': 1817, 'n_words': 648}