本文整理汇总了PHP中Q::control方法的典型用法代码示例。如果您正苦于以下问题:PHP Q::control方法的具体用法?PHP Q::control怎么用?PHP Q::control使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Q
的用法示例。
在下文中一共展示了Q::control方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
function render($item, $def = false)
{
if (!$this[$item]->value && $def) {
$this[$item]->value = $def;
}
return Q::control($this[$item]->_ui, $this[$item]->id, $this[$item]->attrs());
}
示例2: render
function render()
{
//路径
$baseDir = $this->_context->get('base_dir', $this->_context->baseDir() . 'js/fckeditor/');
$baseDir = h(rtrim($baseDir, '/\\') . '/');
$width = $this->get('width', "100%");
$height = $this->get('height', "250px");
$value = $this->get('value', '');
$class = $this->get('class', '');
//控件的id
$id = $this->id();
$config = $this->get('config');
if (!is_array($config)) {
$config = array();
}
$out = Q::control('memo', $id, array('value' => $value, 'class' => $class))->render();
$out .= <<<EOT
\t<script type="text/javascript" src="{$baseDir}fckeditor.js"></script>
<script type="text/javascript">
var oFCKeditor = new FCKeditor('{$id}');
oFCKeditor.BasePath = "{$baseDir}";
oFCKeditor.Height="{$height}";
oFCKeditor.Width="{$width}";
oFCKeditor.ReplaceTextarea();
</script>\t
EOT;
return $out;
}
示例3: _make
protected function _make($type, $suffix)
{
static $id_index = 1;
$items = (array) $this->_extract('items');
$max = count($items);
if ($max == 0) {
return '';
}
$selected = $this->_extract('value');
$caption_class = $this->_extract('caption_class');
$out = '';
foreach ($items as $value => $caption) {
$checked = false;
if ($type == 'checkbox') {
if (!is_array($selected)) {
$selected = array($selected);
}
if (in_array($value, $selected)) {
$checked = true;
}
} else {
if ($value == $selected && strlen($value) == strlen($selected) && strlen($selected) > 0) {
$checked = true;
}
}
$out .= "<span style=\"white-space: nowrap;\"><input type=\"{$type}\" ";
$name = $this->name() . $suffix;
$id = $this->id() . "_{$id_index}";
$out .= "name=\"{$name}\" ";
$id_index++;
$out .= "id=\"{$id}\" ";
if (strlen($value) == 0) {
$value = 1;
}
$out .= 'value="' . htmlspecialchars($value) . '" ';
$out .= $this->_printAttrs();
$out .= $this->_printChecked();
$out .= $this->_printDisabled();
if ($checked) {
$out .= 'checked="checked" ';
}
$out .= '/> ';
if ($caption) {
$out .= Q::control('label', "{$id}_label", array('for' => $id, 'caption' => $caption, 'class' => $caption_class))->render();
}
$out .= '</span> ';
}
return $out;
}
示例4: _make
protected function _make($type)
{
$caption = $this->_extract('caption');
$caption_class = $this->_extract('caption_class');
$out = "<input type=\"{$type}\" ";
$out .= $this->_printIdAndName();
$out .= $this->_printChecked();
if (empty($this->value)) {
$this->value = 'checked';
}
$out .= $this->_printAttrs('id, name, checked, checked_by_value');
$out .= $this->_printDisabled();
$out .= '/>';
if ($caption) {
$attribs = array('for' => $this->id(), 'caption' => $caption, 'class' => $caption_class);
$label = Q::control('label', $this->id() . '_label', $attribs);
$out .= "\n" . $label->render();
}
return $out;
}
示例5: _make
protected function _make($type, $suffix, $sub_items = false, $is_sub = false)
{
static $id_index = 1;
$items = $sub_items ? $sub_items : $this->_extract('items');
$max = count($items);
if ($max == 0) {
return '';
}
$selected = $this->_extract('value');
$caption_class = $this->_extract('caption_class');
$config = $this->_extract('config');
$hkey = $config['hashMap'][0];
$hval = $config['hashMap'][1];
foreach ($items as $item) {
$value = $item->{$hkey};
$caption = $item->{$hval};
$checked = false;
if ($type == 'checkbox' || $type == 'radio') {
if (!is_array($selected)) {
$selected = array($selected);
}
if (in_array($value, $selected)) {
$checked = true;
}
} else {
if ($value == $selected && strlen($value) == strlen($selected) && strlen($selected) > 0) {
$checked = true;
}
}
$this->checked_by_value = $checked;
$this->out .= "<li style='line-height:18px;'>";
$name = $this->name() . $suffix;
$id = $this->id() . "_{$id_index}";
$id_index++;
$parent = isset($config['parent']) ? $config['parent'] : false;
if ($parent != 'hide' || $sub_items) {
$this->out .= "<input type=\"{$type}\" ";
$this->out .= "id=\"{$id}\" ";
if (strlen($value) == 0) {
$value = 1;
}
if ($parent != 'noName' || $sub_items) {
$this->out .= "name=\"{$name}\" ";
}
$this->out .= 'value="' . htmlspecialchars($value) . '" ';
$this->out .= $this->_printAttrs();
$this->out .= $this->_printChecked();
$this->out .= $this->_printDisabled();
$this->out .= "/> ";
}
if ($caption) {
$this->out .= Q::control('label', "{$id}_label", array('for' => $id, 'caption' => $caption, 'class' => $caption_class))->render();
}
$this->out .= "</li>";
//$item->children();
//dump($item->children());
if ($ch = call_user_func(array($item, $config['nextFunc']))) {
$this->out .= "<li><ul class=\"sub_cat\">";
$this->_make($type, $suffix, $ch, true);
$this->out .= "</ul></li>";
}
}
$this->out = str_replace('<li><ul></ul></li>', '', $this->out);
return $this->out;
}
示例6: h
<tr>
<td width="80"><?php
if ($e->_label) {
?>
<label for="<?php
echo $id;
?>
"><?php
echo h($e->_label);
?>
</label><?php
}
?>
</td>
<td><?php
echo Q::control($e->_ui, $id, $e->attrs());
?>
<?php
if (!$e->isValid()) {
?>
<span class="error"><?php
echo nl2br(h(implode(",", $e->errorMsg())));
?>
</span><?php
}
?>
<?php
if ($id == 'services' && $e->isValid()) {
?>
<span>同意本站<a class="link" href="<?php
示例7: h
class="hidden"<?php
}
?>
>
<?php
if ($element->_label) {
?>
<label for="<?php
echo $id;
?>
"><?php
echo h($element->_label);
?>
:</label><?php
}
echo Q::control($element->_ui, $id, $element->attrs());
if ($element->_req) {
?>
<span class="req">*</span><?php
}
?>
<?php
if ($element->_tips) {
?>
<span class="tips"><?php
echo nl2br(str_replace(array('[b]', '[/b]'), array('<strong>', '</strong>'), h($element->_tips)));
?>
</span><?php
}
?>
<?php
示例8: _control
/**
* 构造一个控件
*
* @param string $control_type
* @param string $id
* @param array $args
*
*
* @access public
*/
protected function _control($control_type, $id = null, $args = array())
{
Q::control($control_type, $id, $args)->display();
// TODO! display($this) 避免多次构造视图解析器实例
// 由于视图解析器实例的继承问题,所以暂时无法利用
}
示例9: testControl
/**
* @dataProvider controlProvider
*/
function testControl($type)
{
Q::import(FIXTURE_DIR . '/core/control');
$control = Q::control($type);
$this->assertType('Control_' . $type, $control);
}
示例10: url
<form name="create_model" action="<?php
echo url('generate/newmodel');
?>
" method="post">
<table class="form-table full">
<tr>
<th valign="top"><label for="model_name">模型名称:</label></th>
<td><input type="text" name="new_model_name" id="new_model_name" class="field" size="40" maxlength="30" />
<br />
模型名称只能使用 26 个英文字母。
</td>
</tr>
<tr>
<th valign="top"><label for="model_name">对应的数据表:</label></th>
<td><?php
echo Q::control('dropdownlist', 'table_name', array('items' => $tables));
?>
<br />
选择模型要使用的数据表。
<br />
选择后,右侧会显示该数据表的字段信息。
</td>
</tr>
</table>
<p>
<input type="submit" class="button" name="Submit" value="创建模型" />
</p>
</form>
</div>
</div>
</div>
示例11: __toString
function __toString()
{
return Q::control($this->_ui, $this->id, $this->attrs())->__toString();
}
示例12: _control
/**
* 构造一个控件
*
* @param string $control_type
* @param string $id
* @param array $args
*
* @access public
*/
protected function _control($control_type, $id = null, array $args = array())
{
Q::control($control_type, $id, $args)->display($this);
}