コード例 #1
0
 /**
  * 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();
 }
コード例 #2
0
 /**
  * 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();
 }
コード例 #3
0
ファイル: estados.php プロジェクト: edubress/cake_ptbr
 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);
 }
コード例 #4
0
 /**
  * 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);
 }
コード例 #5
0
 function __construct($id = false, $table = null, $ds = null)
 {
     parent::__construct();
     App::import('Vendor', 'CakePtbr.Estados');
     $this->_estados = Estados::lista();
 }