所有FORM改为horizontal式

This commit is contained in:
hyzboy 2016-09-01 03:26:27 +04:00
parent 65cd826be2
commit 52b889ab97
4 changed files with 52 additions and 100 deletions

View File

@ -7,7 +7,7 @@
private $method;
private $action=null;
private $style_class="form-inline";
private $style_class="form-horizontal";
public function __construct()
{
@ -53,6 +53,7 @@
public function start()
{
echo '<div class="container">';
echo '<form name="'.$this->name.'" method="'.$this->method.'" ';
if($this->action !=null)echo 'action="' .$this->action .'" ';
@ -67,11 +68,13 @@
{
echo '<input type="submit" value="'.$submit_name.'" class="btn btn-primary"/>';
echo '</form>';
echo '</div>';
}
public function end()
{
echo '</form>';
echo '</div>';
}
};//class UIForm

View File

@ -1,60 +1,23 @@
<?php
class UIEditBox
function CreateInputGroup()
{
private $type=null;
private $id=null;
private $size=null;
$type =func_get_arg(0);
$id =func_get_arg(1);
$label =func_get_arg(2);
$size =func_get_arg(3);
public function __construct($t,$i,$s)
{
$this->type=$t;
$this->id=$i;
$this->size=$s;
}
echo '<div class="form-group">
<label class="control-label col-sm-2">'.$label.'</label>
<div class="col-sm-10">
<input type="'.$type.'" class="form-control" id="'.$type.'" size="'.$size.'">';
public function echo()
{
echo '<input type="'.$this->type.'" class="form-control" name="'.$this->id.'" size="'.$this->size.'">';
}
};//class UIEditBox
if(func_num_args()==5)
{
$right_label=func_get_arg(4);
echo '<label class="control-label">'.$right_label.'</label>';
}
class UIInputGroup extends UIEditBox
{
private $addon_front=null;
private $addon_back=null;
public function __construct($t,$i,$s)
{
parent::__construct($t,$i,$s);
}
public function SetAddonFront($text)
{
$this->addon_front='<span class="input-group-addon">'.$text.'</span>';
}
public function SetAddonBack($text)
{
$this->addon_back='<span class="input-group-addon">'.$text.'</span>';
}
public function echo()
{
echo '<div class="input-group">';
echo $this->addon_front;
parent::echo();
echo $this->addon_back;
echo '</div>';
}
};//class UIInputGroup
function CreateInputGroup($type,$id,$label,$size)
{
$but=new UIInputGroup($type,$id,$size);
$but->SetAddonFront($label);
$but->echo();
return $but;
echo '</div></div>';
}
?>

View File

@ -1,44 +1,35 @@
<?php
class UISelect
{
private $name;
private $selected;
private $items;
public function __construct($n,$s,$i)
{
$this->name=$n;
$this->selected=$s;
$this->items=$i;
}
public function SetSelected($s)
{
$this->selected=$s;
}
public function out_html()
{
echo '<select name="'.$this->name.'">';
foreach($this->items as $value=>$text)
{
if($this->selected==$value)
echo '<option value="'.$value.'" selected="selected">'.$text.'</option>';
else
echo '<option value="'.$value.'">'.$text.'</option>';
}
echo '</select>';
}
}
function create_select($n,$s,$i)
function create_select()//$label,$name,$selected,$items)
{
$ui=new UISelect($n,$s,$i);
$label =func_get_arg(0);
$name =func_get_arg(1);
$selected =func_get_arg(2);
$items =func_get_arg(3);
$ui->out_html();
return;
echo '<div class="form-group">
<label class="control-label col-sm-2">'.$label.'</label>
<div class="col-sm-10">';
echo '<select name="'.$name.'">';
foreach($items as $value=>$text)
{
if($selected==$value)
echo '<option value="'.$value.'" selected="selected">'.$text.'</option>';
else
echo '<option value="'.$value.'">'.$text.'</option>';
}
echo '</select>';
if(func_num_args()==5)
{
$right_label=func_get_arg(4);
echo '<label class="control-label">'.$right_label.'</label>';
}
echo '</div>';
echo '</div>';
}
?>

View File

@ -34,29 +34,24 @@
<title>'.$title.'</title>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=yes, minimum-scale=0.25, maximum-scale=5.0, width=device-width" />
';
<meta name="viewport" content="initial-scale=1.0, user-scalable=yes, minimum-scale=0.25, maximum-scale=5.0, width=device-width" />';
include_jquery();
include_font_awesome();
include_bootstrap();
//include_jsgird();
echo '
</head>
<body>
';
echo '</head><body>';
}
function echo_page_header($header,$subtext)
{
echo '<div class="page-header" style="margin-bottom: 0px; padding-bottom: 0px; margin-top: 0px;"><h1>'.$header.'<small> '.$subtext.'</small></h1></div>';
echo '<div class="page-header" style="margin-bottom: 10px; padding-bottom: 0px; margin-top: 0px;"><h1>'.$header.'<small> '.$subtext.'</small></h1></div>';
}
function echo_html_end()
{
echo '
</body></html>';
echo '</body></html>';
}
function echo_div($id)