// +----------------------------------------------------------------------
// $Id: TagLibHtml.class.php 2730 2012-02-12 04:45:34Z liu21st $
namespace Think\Template\Driver;
/**
+-------------------------------
* Html标签库驱动
+-------------------------------
*/
class Html extends \Think\TagLib{
// 标签定义
protected $tags = array(
// 标签定义: attr 属性列表 close 是否闭合(0 或者1 默认1) alias 标签别名 level 嵌套层次
'editor' => array('attr'=>'id,name,style,width,height,type','close'=>1),
'select' => array('attr'=>'name,options,values,output,multiple,id,size,first,change,selected,dblclick','close'=>0),
'grid' => array('attr'=>'id,pk,style,action,actionlist,show,datasource','close'=>0),
'list' => array('attr'=>'id,pk,style,action,actionlist,show,datasource,checkbox','close'=>0),
'imagebtn' => array('attr'=>'id,name,value,type,style,click','close'=>0),
'checkbox' => array('attr'=>'name,checkboxes,checked,separator','close'=>0),
'radio' => array('attr'=>'name,radios,checked,separator','close'=>0)
);
/**
+----------------------------------------------------------
* editor标签解析 插入可视化编辑器
* 格式: {$vo.remark}
+----------------------------------------------------------
* @access public
+----------------------------------------------------------
* @param string $attr 标签属性
+----------------------------------------------------------
* @return string|void
+----------------------------------------------------------
*/
public function _editor($tag,$content) {
$id = !empty($tag['id'])?$tag['id']: '_editor';
$name = $tag['name'];
$style = !empty($tag['style'])?$tag['style']:'';
$width = !empty($tag['width'])?$tag['width']: '100%';
$height = !empty($tag['height'])?$tag['height'] :'320px';
// $content = $tag['content'];
$type = $tag['type'] ;
switch(strtoupper($type)) {
case 'FCKEDITOR':
$parseStr = ' ';
break;
case 'FCKMINI':
$parseStr = ' ';
break;
case 'EWEBEDITOR':
$parseStr = "";
break;
case 'NETEASE':
$parseStr = '';
break;
case 'UBB':
$parseStr = '
';
break;
case 'KINDEDITOR':
$parseStr = '';
break;
default :
$parseStr = '';
}
return $parseStr;
}
/**
+----------------------------------------------------------
* imageBtn标签解析
* 格式:
+----------------------------------------------------------
* @access public
+----------------------------------------------------------
* @param string $attr 标签属性
+----------------------------------------------------------
* @return string|void
+----------------------------------------------------------
*/
public function _imageBtn($tag) {
$name = $tag['name']; //名称
$value = $tag['value']; //文字
$id = isset($tag['id'])?$tag['id']:''; //ID
$style = isset($tag['style'])?$tag['style']:''; //样式名
$click = isset($tag['click'])?$tag['click']:''; //点击
$type = empty($tag['type'])?'button':$tag['type']; //按钮类型
if(!empty($name)) {
$parseStr = '';
}else {
$parseStr = '';
}
return $parseStr;
}
/**
+----------------------------------------------------------
* imageLink标签解析
* 格式:
+----------------------------------------------------------
* @access public
+----------------------------------------------------------
* @param string $attr 标签属性
+----------------------------------------------------------
* @return string|void
+----------------------------------------------------------
*/
public function _imgLink($tag) {
$name = $tag['name']; //名称
$alt = $tag['alt']; //文字
$id = $tag['id']; //ID
$style = $tag['style']; //样式名
$click = $tag['click']; //点击
$type = $tag['type']; //点击
if(empty($type)) {
$type = 'button';
}
$parseStr = '';
return $parseStr;
}
/**
+----------------------------------------------------------
* select标签解析
* 格式:
+----------------------------------------------------------
* @access public
+----------------------------------------------------------
* @param string $attr 标签属性
+----------------------------------------------------------
* @return string|void
+----------------------------------------------------------
*/
public function _select($tag) {
$name = $tag['name'];
$options = $tag['options'];
$values = $tag['values'];
$output = $tag['output'];
$multiple = $tag['multiple'];
$id = $tag['id'];
$size = $tag['size'];
$first = $tag['first'];
$selected = $tag['selected'];
$style = $tag['style'];
$ondblclick = $tag['dblclick'];
$onchange = $tag['change'];
if(!empty($multiple)) {
$parseStr = '