Пример #1
0
 /**
  * 获得元件对应的 UI 控件对象实例
  *
  * @param QContext $context
  *
  * @return QUI_Control_Abstract
  */
 function ctl(QContext $context = null)
 {
     if (is_null($this->_ctl)) {
         $this->_event(self::BEFORE_CREATE_CTL);
         $this->_ctl = QUI::control($context, $this->_type, $this->_id);
         $this->_event(self::AFTER_CREATE_CTL, $this->_ctl);
     }
     return $this->_ctl;
 }
Пример #2
0
 /**
  * 构造一个控件
  *
  * @param string $type
  * @param string $id
  * @param array $attribs
  * @param boolean $return
  *
  * @return string
  */
 function make($type, $id = null, array $attribs = null, $return = false)
 {
     $control = QUI::control($this->adapter->context, $type, $id, $attribs);
     $control->viewdata = array();
     return $control->render($return);
 }
Пример #3
0
 /**
  * 提供对 QeePHP QWebControls 的支持
  */
 function func_control(array $params)
 {
     $type = isset($params['type']) ? $params['type'] : 'textbox';
     unset($params['type']);
     $id = isset($params['id']) ? $params['id'] : null;
     unset($params['id']);
     $control = QUI::control($this->context, $type, $id, $params);
     $control->render();
 }
Пример #4
0
 /**
  * 渲染一个控件
  *
  * @param string $type
  * @param string $id
  * @param array $attribs
  *
  * @return string
  */
 protected function _renderControl($type, $id = null, array $attribs = null)
 {
     return QUI::control($this->context, $type, $id, $attribs)->render(true);
 }
Пример #5
0
 protected function _make($type, $return = false)
 {
     $value_check = $this->extractAttrib('value_check');
     $value = $this->extractAttrib('value');
     if (empty($value)) {
         $value = 1;
     } elseif ($value_check) {
         $this->setAttrib('checked', true);
     }
     $out = "<input type=\"{$type}\" ";
     $out .= QUI::renderIdAndName($this);
     $out .= 'value="' . htmlspecialchars($value) . '" ';
     $out .= QUI::renderAttribs($this);
     $out .= QUI::renderDisabled($this);
     $out .= QUI::renderChecked($this);
     $out .= '/>';
     $caption = $this->extractAttrib('caption');
     if ($caption) {
         $attribs = array('for' => $this->id(), 'caption' => $caption);
         $label = QUI::control($this->context, 'label', $this->id() . '_label', $attribs);
         $out .= "\n" . $label->render(true);
     }
     if ($return) {
         return $out;
     } else {
         echo $out;
         return null;
     }
 }