CMPHP/form/form_button.php

53 lines
1012 B
PHP
Raw Normal View History

2016-08-21 23:06:17 +04:00
<?php
class UIButton
{
private $style='class="btn"';
private $text="";
private $onclick="";
public function SetText($t)
{
$this->text=$t;
}
public function SetGlyph($g)
{
$this->text='<span class="glpyhicon glyphicon-'.$g.'"></span>';
}
public function SetStyle($bs)
{
if($bs==null)
$this->style='class="btn"';
else
$this->style='class="btn btn-'.$bs.'"';
}
public function SetOnClick($js)
{
$this->onclick='onclick="'.$js.'"';
}
public function SetOpenWindow($link)
{
$this->onclick='onclick="javascript:window.open(\''.$link.'\')"';
}
public function SetLocalLink($link)
{
$this->onclick='onclick="javascript:location.href=\''.$link.'\'"';
}
public function echo()
{
echo '<button '.$this->style.' '.$this->onclick.'>'.$this->text.'</button>';
}
};//class UIButton
function create_js_button($text,$js_func)
{
echo '<button type="button" onclick="'.$js_func.'" class="btn btn-primary">'.$text.'</button>';
}
?>