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

View File

@ -1,60 +1,23 @@
<?php <?php
class UIEditBox function CreateInputGroup()
{ {
private $type=null; $type =func_get_arg(0);
private $id=null; $id =func_get_arg(1);
private $size=null; $label =func_get_arg(2);
$size =func_get_arg(3);
public function __construct($t,$i,$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.'">';
if(func_num_args()==5)
{ {
$this->type=$t; $right_label=func_get_arg(4);
$this->id=$i; echo '<label class="control-label">'.$right_label.'</label>';
$this->size=$s;
} }
public function echo() echo '</div></div>';
{
echo '<input type="'.$this->type.'" class="form-control" name="'.$this->id.'" size="'.$this->size.'">';
}
};//class UIEditBox
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;
} }
?> ?>

View File

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

View File

@ -34,29 +34,24 @@
<title>'.$title.'</title> <title>'.$title.'</title>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; 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_jquery();
include_font_awesome(); include_font_awesome();
include_bootstrap(); include_bootstrap();
//include_jsgird(); //include_jsgird();
echo ' echo '</head><body>';
</head>
<body>
';
} }
function echo_page_header($header,$subtext) 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() function echo_html_end()
{ {
echo ' echo '</body></html>';
</body></html>';
} }
function echo_div($id) function echo_div($id)