예제 #1
0
 /**
  * Returns a piece of html code that can be used in a form to edit this
  * attribute's value.
  *
  * @param array $record The record that holds the value for this attribute.
  * @param string $fieldprefix The fieldprefix to put in front of the name
  *                            of any html form element for this attribute.
  * @param string $mode The mode we're in ('add' or 'edit')
  *
  * @return string piece of html code with a checkbox
  */
 public function edit($record, $fieldprefix, $mode)
 {
     $id = $this->getHtmlId($fieldprefix);
     $onchange = '';
     if (count($this->m_onchangecode)) {
         $onchange = 'onClick="' . $id . '_onChange(this);" ';
         $this->_renderChangeHandler($fieldprefix);
     }
     $checked = $this->getValue($record) ? 'checked' : '';
     $result = '<input type="checkbox" id="' . $id . '" name="' . $this->getHtmlName($fieldprefix) . '" value="1" ' . $onchange . $checked . ' ' . $this->getCSSClassAttribute('atkcheckbox') . ' />';
     if ($this->hasFlag(self::AF_BOOL_INLINE_LABEL)) {
         $result .= '&nbsp;<label for="' . $id . '">' . $this->text(array($this->fieldName() . '_label', parent::label())) . '</label>';
     }
     return $result;
 }