public function getHTMLEditable($name, $value, $params, $attr = array()) { $params = $this->normalizeParams($params); $attr = $this->getHTMLAttributes($attr, $params); $enum = $this->getEnum($params); $options = $enum->labels(); if (!getValueFromArray($params, Flag::REQUIRED, false)) { array_unshift($options, getValueFromArray($params, Flag::PLACEHOLHER, 'Escolha uma opção')); } return HTML::select($name, $options, $value, $attr, $name . '_id'); }
public function getHTMLEditable($name, $value, $params, $attr = array()) { $params = $this->normalizeParams($params); if (!$this->_isValid($value)) { $value = getValueFromArray($params, Flag::DEFAULT_VALUE); } $attr = $this->getHTMLAttributes($attr, $params); $options = array('true' => getValueFromArray($params, Flag::TRUE_LABEL, 'Verdadeiro'), 'false' => getValueFromArray($params, Flag::FALSE_LABEL, 'Falso')); if (!getValueFromArray($params, Flag::REQUIRED, false)) { array_unshift($options, ''); } return HTML::select($name, $options, var_export($value, true), $attr, $name . '_id'); }
/** * * @param string $name * @param string $value * @param array $params * @param array $attr * @return string */ public function getHTMLEditable($name, $value, $params, $attr = array()) { $params = $this->normalizeParams($params); $dao = $this->getDAO($params); $dao_label = getValueFromArray($params, Flag::DAO_LABEL, Flag::DAO_LABEL); $dao_value = getValueFromArray($params, Flag::DAO_VALUE, Flag::DAO_VALUE); $gerericItems = $dao->listAll(); $options = array(); if (!getValueFromArray($params, Flag::REQUIRED, false)) { array_unshift($options, ''); } foreach ($gerericItems as $line) { $options[$line[$dao_value]] = $line[$dao_label]; } if (empty($value)) { $value = getValueFromArray($params, Flag::DEFAULT_VALUE, ''); } $attr["value"] = $value; $attr = $this->getHTMLAttributes($attr, $params); return HTML::select($name, $options, $value, $attr, $name . "_id"); }