本文整理汇总了PHP中utils::buildTag方法的典型用法代码示例。如果您正苦于以下问题:PHP utils::buildTag方法的具体用法?PHP utils::buildTag怎么用?PHP utils::buildTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utils
的用法示例。
在下文中一共展示了utils::buildTag方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: input_datepicker
function input_datepicker($params)
{
if (!$params['type']) {
$params['type'] = 'date';
}
if (!$params['vtype']) {
$params['vtype'] = 'date';
} else {
if ($params['vtype'] != 'date') {
$params['vtype'] = $params['vtype'] . '&&date';
}
}
if (is_numeric($params['value'])) {
$params['value'] = date('Y-n-j', $params['value']);
}
if (isset($params['concat'])) {
$params['name'] .= $params['concat'];
unset($params['concat']);
}
// if(!$params['format'] || $params['format']=='timestamp'){
// $prefix = '<input type="hidden" name="_DTYPE_'.strtoupper($params['type']).'[]" value="'.htmlspecialchars($params['name']).'" />';
// }else{
// $prefix = '';
// }
$params['type'] = 'text';
$return = utils::buildTag($params, 'input class="x-input calendar' . ($params['class'] && $params['class'] != 'cal' ? ' ' . $params['class'] : '') . '" maxlength="10" readonly="readonly"');
return $prefix . $return;
}
示例2: uploader
function uploader()
{
$html = '<form action="index.php?ctl=editor&act=save_upload&name=' . $_GET['name'] . '&domid=' . $_GET['domid'] . '" method="post" enctype="multipart/form-data">';
$params = array('type' => 'file', 'name' => 'upload_item');
$html .= '<div class="division" style="border:none; text-align:center;">';
$html .= utils::buildTag($params, 'input');
$html .= '</div>';
$html .= '<div class="table-action" style="border: none;"><input type="submit" value="上传" /></div>';
$html .= '</form>';
echo $html;
}
示例3: input_producttype
function input_producttype($params)
{
if (is_string($params['options'])) {
$ui = new base_component_ui($this);
$params['remote_url'] = $params['options'];
$params['options'] = array($params['value'] => $params['value']);
}
if ($params['rows']) {
foreach ($params['rows'] as $r) {
$step[$r[$params['valueColumn']]] = intval($r['step']);
$options[$r[$params['valueColumn']]] = $r[$params['labelColumn']];
}
unset($params['valueColumn'], $params['labelColumn'], $params['rows']);
} else {
$options = $params['options'];
unset($params['options']);
}
$params['name'] = $params['search'] ? '_' . $params['name'] . '_search' : $params['name'];
$params['class'] .= ' form-control';
$value = $params['value'];
unset($params['value']);
$html = utils::buildTag($params, 'select', false);
if (!$params['required']) {
$html .= '<option></option>';
}
foreach ((array) $options as $k => $item) {
if ($k === '0' || $k === 0) {
$selected = $value === '0' || $value === 0;
} else {
$selected = $value == $k;
}
$t_step = $step[$k] ? str_repeat(' ', ($step[$k] - 1) * 3) : '';
$html .= '<option' . ($params['noselect'] ? ' disabled=true ' : ' ') . ($selected ? ' selected="selected"' : '') . ' value="' . htmlspecialchars($k) . '">' . $t_step . htmlspecialchars($item) . '</option>';
}
$html .= '</select>';
return $html . $script;
}
示例4: input_tinybool
function input_tinybool($params)
{
$params['type'] = 'radio';
$value = $params['value'];
unset($params['value']);
$id = $params['id'];
$params['id'] = $id . '-t';
$return = utils::buildTag($params, 'input value="Y"' . ($value == 'Y' ? ' checked="checked"' : '')) . '<label for="' . $params['id'] . '">' . app::get('base')->_('是') . '</label>';
$params['id'] = $id . '-f';
$return .= '<br />' . utils::buildTag($params, 'input value="N"' . ($value == 'N' ? ' checked="checked"' : '')) . '<label for="' . $params['id'] . '">' . app::get('base')->_('否') . '</label>';
return $return;
}
示例5: button
function button($params)
{
if ($params['class']) {
$params['class'] = 'btn ' . $params['class'];
} else {
$params['class'] = 'btn';
}
if ($params['icon']) {
$icon = '<i class="btn-icon">' . $this->img(array('src' => 'bundle/' . $params['icon'], 'app' => $params['app'])) . '</i>';
$params['class'] .= ' btn-has-icon';
unset($params['icon']);
}
$app = $params['app'] ? app::get($params['app']) : $this->app;
if ($params['label']) {
$label = htmlspecialchars($app->_($params['label']));
unset($params['label']);
}
$type = $params['type'];
if ($type == 'link') {
$element = 'a';
} else {
$element = 'button';
if ($params['href']) {
$params['onclick'] = '"W.page(\'' . $params['href'] . '\')"';
unset($params['href']);
}
if ($type != 'submit') {
$params['type'] = 'button';
}
}
if ($params['dropmenu']) {
if (!$params['id']) {
$params['id'] = $this->new_dom_id();
}
if ($type != 'dropmenu') {
$element = 'span';
$class .= ' btn-drop-menu drop-active';
$drop_handel_id = $params['id'] . '-handel';
$dropmenu = '<img dropfor="' . $params['id'] . '"
id="' . $drop_handel_id . '" dropmenu=' . $params['dropmenu'] . ' src="' . app::get('desktop')->res_url . '/transparent.gif" class="drop-handle drop-handle-stand" />';
unset($params['dropmenu']);
} else {
$drop_handel_id = $params['id'];
$dropmenu = '<img src="' . app::get('desktop')->res_url . '/transparent.gif" class="drop-handle" />';
}
$scripts = '<script>new DropMenu("' . $drop_handel_id . '",{' . $params['dropmenu_opts'] . '});';
$scripts .= '</script>';
}
return utils::buildTag($params, $element, 1) . '<span><span>' . $icon . $label . $dropmenu . '</span></span></' . $element . '>' . $script;
}
示例6: button
public function button($params)
{
$params['class'] = 'btn btn-default ' . $params['class'];
if ($params['icon']) {
$icon = '<i class="' . $params['icon'] . '"></i>';
unset($params['icon']);
}
$app = $params['app'] ? app::get($params['app']) : $this->app;
if ($params['label']) {
$label = htmlspecialchars($app->_($params['label']));
unset($params['label']);
}
$type = $params['type'];
if ($type == 'link') {
$element = 'a';
unset($params['link']);
} else {
$element = 'button';
if ($params['href'] && !strpos($params['href'], 'javascript:')) {
unset($params['href']);
}
if ($type != 'submit') {
$params['type'] = 'button';
}
}
return utils::buildTag($params, $element, 0) . $icon . $label . '</' . $element . '>';
}
示例7: input_textarea
function input_textarea($params)
{
$value = $params['value'];
// $params['style'].=';width:'.($params['width']?$params['width']:'400').'px;';
// $params['style'].=';height:'.($params['height']?$params['height']:'300').'px;';
$params['class'] = 'form-control';
unset($params['width'], $params['height'], $params['value']);
return utils::buildTag($params, 'textarea', false) . htmlspecialchars($value) . '</textarea>';
}
示例8: input_vcode
function input_vcode($params)
{
$class = 'x-input';
$label = $params['label'] ? $params['label'] : app::get('site')->_('看不清楚?换一个');
unset($params['label']);
$vcode_key = $params['key'] ? $params['key'] : 'vcode';
unset($params['key']);
$params['maxlength'] = $params['maxlength'] ? $params['maxlength'] : 4;
$url = kernel::single('site_router')->gen_url(array('app' => 'site', 'ctl' => 'default', 'act' => 'gen_vcode', 'arg0' => $vcode_key, 'arg1' => $params['maxlength']));
if (isset($params['a_class'])) {
$aClass = ' ' . $params['a_class'];
unset($params['a_class']);
}
if (isset($params['img_class'])) {
$imgClass = ' ' . $params['img_class'];
unset($params['img_class']);
}
$img = ' <img src="' . $url . '" alt="验证码" title="点击更换验证码" class="verify-code auto-change-verify-handle' . $imgClass . '">';
$handle = ' <a href="' . $url . '" class="verify-code auto-change-verify-handle' . $aClass . '">' . $label . '</a>';
$vcode_html = $img . $handle;
$params['type'] = 'text';
$params['autocomplete'] = 'off';
if (isset($params['class'])) {
$params['class'] = trim(str_replace('x-input', '', $params['class']));
$class = $class . ' ' . $params['class'];
}
$params['vtype'] = 'required' . ($params['vtype'] ? '&&' . $params['vtype'] : '&&alphaint');
return utils::buildTag($params, 'input class="' . $class . '"') . $vcode_html;
}
示例9: button
function button($params)
{
if ($params['class']) {
$params['class'] = 'btn ' . $params['class'];
} else {
$params['class'] = 'btn';
}
if ($params['icon']) {
if (empty($params['app'])) {
throw new \InvalidArgumentException('button tag if exisiting icon need app argument' . var_export($params, 1));
}
$icon = '<i class="btn-icon">' . $this->img(array('src' => 'bundle/' . $params['icon'], 'app' => $params['app'])) . '</i>';
$params['class'] .= ' btn-has-icon';
unset($params['icon']);
}
if ($params['icon_l']) {
$icon_l = '<q class="icon">' . $params['icon_l'] . '</q>';
// $params['class'] .= ' btn-has-icon';
unset($params['icon_l']);
}
if ($params['icon_r']) {
$icon_r = '<q class="f-icon">' . $params['icon_r'] . '</q>';
// $params['class'] .= ' btn-has-icon';
unset($params['icon_r']);
}
if ($params['label']) {
$label = htmlspecialchars($params['label']);
unset($params['label']);
}
$type = $params['type'];
if ($type == 'link') {
$element = 'a';
unset($params['link']);
} else {
$element = 'button';
if ($params['href'] && !strpos($params['href'], 'javascript:')) {
$params['onclick'] = 'W.page(\'' . $params['href'] . '\')';
unset($params['href']);
}
if ($type != 'submit') {
$params['type'] = 'button';
}
}
if ($params['dropmenu']) {
if (!$params['id']) {
$params['id'] = $this->new_dom_id();
}
if ($type != 'dropmenu') {
$element = 'span';
$class .= ' btn-drop-menu drop-active';
$drop_handel_id = $params['id'] . '-handel';
$dropmenu = '<img dropfor="' . $params['id'] . '"
id="' . $drop_handel_id . '" dropmenu=' . $params['dropmenu'] . ' src="' . app::get('base')->res_url . '/images/transparent.gif" class="drop-handle drop-handle-stand" />';
unset($params['dropmenu']);
} else {
$drop_handel_id = $params['id'];
$dropmenu = '<img src="' . app::get('base')->res_url . '/images/transparent.gif" class="drop-handle" />';
}
$scripts = '<script>new DropMenu("' . $drop_handel_id . '",{' . $params['dropmenu_opts'] . '});';
$scripts .= '</script>';
}
return utils::buildTag($params, $element, 0) . '<span><span>' . $icon . $icon_l . $label . $dropmenu . $icon_r . '</span></span></' . $element . '>' . $scripts;
}