/** * setUp * * @retun void * @access public */ public function setUp() { parent::setUp(); $Controller = new ControllerTestController(new CakeRequest(), new CakeResponse()); $View = new View($Controller); $this->Estados = new EstadosHelper($View); $this->Estados->Form = new FormHelper($View); $this->Estados->Form->Html = new HtmlHelper($View); $this->listaEstados = Estados::lista(); }
/** * setUp * * @retun void * * @access public */ function setUp() { parent::setUp(); $this->Estados =& new EstadosHelper(); $this->Estados->Form =& new FormHelper(); $this->Estados->Form->Html =& new HtmlHelper(); $this->Controller =& new ControllerTestController(); $this->View =& new View($this->Controller); $this->listaEstados = Estados::lista(); }
function select($fieldName, $selected = null, $attributes = array(), $showEmpty = false) { App::import('Vendor', 'CakePtbr.Estados'); $options = Estados::lista(); if (isset($attributes['uf']) && $attributes['uf'] === true) { $estados = array_keys($options); $options = array_combine($estados, $estados); unset($attributes['uf']); } return $this->Form->select($fieldName, $options, $selected, $attributes, $showEmpty); }
/** * Retorna a select com a lista dos estados * * @param string $fieldName Nome do campo * @param string $selected Sigla do estado que deve ser selecionado * @param array $attributes Mesmos atributos do Form::select(). Também é possível passar o param * 'uf' para mostrar apenas as siglas, sem os nomes */ public function select($fieldName, $selected = null, $attributes = array()) { App::import('Vendor', 'CakePtbr.Estados'); $options = Estados::lista(); if (isset($attributes['uf']) && $attributes['uf'] === true) { $estados = array_keys($options); $options = array_combine($estados, $estados); unset($attributes['uf']); } if (!isset($attributes['empty'])) { $attributes['empty'] = false; } if ($selected) { $attributes['value'] = $selected; } return $this->Form->select($fieldName, $options, $attributes); }
function __construct($id = false, $table = null, $ds = null) { parent::__construct(); App::import('Vendor', 'CakePtbr.Estados'); $this->_estados = Estados::lista(); }