';
$str .= '';
define('EDITOR_INIT', 1);
}
if($toolbar == 'basic') {
$toolbar = defined('IN_ADMIN') ? "['Source'," : '[';
$toolbar .= "'Bold', 'Italic', '|', 'InsertOrderedList', 'InsertUnorderedList', '|', 'Link', 'Unlink' ]";
} elseif($toolbar == 'standard') {
if(defined('IN_ADMIN')) {
$toolbar = "['Source',";
} else {
$toolbar = '[';
}
$toolbar .= "'FullScreen', 'Undo', 'Redo', '|', 'Bold', 'Italic', 'Underline', 'StrikeThrough', 'Superscript', 'Subscript', 'RemoveFormat', 'FormatMatch','AutoTypeSet', '|', 'BlockQuote', '|', 'PastePlain', '|', 'ForeColor', 'BackColor', 'InsertOrderedList', 'InsertUnorderedList','SelectAll', 'ClearDoc', '|', 'CustomStyle', 'Paragraph', '|','RowSpacingTop', 'RowSpacingBottom','LineHeight', '|','FontFamily', 'FontSize', '|', 'DirectionalityLtr', 'DirectionalityRtl', '|', '', 'Indent', '|', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyJustify', '|', 'Link', 'Unlink', 'Anchor', '|', 'ImageNone', 'ImageLeft', 'ImageRight', 'ImageCenter', '|', 'SimpleUpload', 'InsertImage', 'Emotion', 'Scrawl', 'InsertVideo', 'Attachment', 'Map', 'InsertFrame', 'PageBreak', 'HighlightCode', '|', 'Horizontal', 'Date', 'Time', 'Spechars','SnapScreen', 'WordImage', '|', 'InsertTable', 'DeleteTable', 'InsertParagraphBeforeTable', 'InsertRow', 'DeleteRow', 'InsertCol', 'DeleteCol', 'MergeCells', 'MergeRight', 'MergeDown', 'SplittoCells', 'SplittoRows', 'SplittoCols', '|', 'Print', 'Preview', 'SearchReplace','Help']";
} elseif($toolbar == 'desc') {
$toolbar = "['Bold', 'Italic', '|', 'InsertOrderedList', 'InsertUnorderedList', '|', 'Link', 'Unlink', '|', 'SimpleUpload', 'InsertImage', '|','Source']";
} elseif($toolbar == 'full') {
$toolbar = "['Fullscreen', 'Source', '|', 'Undo', 'Redo', '|',
'Bold', 'Italic', 'Underline', 'Fontborder', 'Strikethrough', 'Superscript', 'Subscript', 'Removeformat', 'Formatmatch', 'Autotypeset', 'Blockquote', 'Pasteplain', '|', 'Forecolor', 'Backcolor', 'Insertorderedlist', 'Insertunorderedlist', 'Selectall', 'Cleardoc', '|',
'Rowspacingtop', 'Rowspacingbottom', 'Lineheight', '|',
'Customstyle', 'Paragraph', 'Fontfamily', 'Fontsize', '|',
'Directionalityltr', 'Directionalityrtl', 'Indent', '|',
'Justifyleft', 'Justifycenter', 'Justifyright', 'Justifyjustify', '|', 'Touppercase', 'Tolowercase', '|',
'Link', 'Unlink', 'Anchor', '|', 'Imagenone', 'Imageleft', 'Imageright', 'Imagecenter', '|',
'Simpleupload', 'Insertimage', 'Emotion', 'Scrawl', 'Insertvideo', 'Music', 'Attachment', 'Map', 'Insertframe', 'Insertcode', 'Pagebreak', 'Subtitle', 'Template', 'Background', '|',
'Horizontal', 'Date', 'Time', 'Spechars', 'Snapscreen', 'Wordimage', '|',
'Inserttable', 'Deletetable', 'Insertparagraphbeforetable', 'Insertrow', 'Deleterow', 'Insertcol', 'Deletecol', 'Mergecells', 'Mergeright', 'Mergedown', 'Splittocells', 'Splittorows', 'Splittocols', 'Charts', '|',
'Print', 'Preview', 'Searchreplace', 'Help']";
} else {
$toolbar = "['Fullscreen', 'Source', '|', " . $toolvalue . "]";
}
$str .= "';
$show_page = ($module == 'content' && !$disabled_page) ? 'true' : 'false';
$ext_str = "
";
if(!defined('IMAGES_INIT')) {
$ext_str .= '';
define('IMAGES_INIT', 1);
}
$ext_str .= "";
$ext_str .= "
";
$ext_str .= "
";
/*if(!defined('EDITOR_INIT')) {
$str = '';
define('EDITOR_INIT', 1);
}
if($toolbar == 'basic') {
$toolbar = defined('IN_ADMIN') ? "['Source']," : '';
$toolbar .= "['Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink' ],['Maximize'],\r\n";
} elseif($toolbar == 'full') {
if(defined('IN_ADMIN')) {
$toolbar = "['Source',";
} else {
$toolbar = '[';
}
$toolbar .= "'-','Templates'],
['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print'],
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],['ShowBlocks'],['Image','Capture','Flash','flashplayer','MyVideo'],['Maximize'],
'/',
['Bold','Italic','Underline','Strike','-'],
['Subscript','Superscript','-'],
['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
['Link','Unlink','Anchor'],
['Table','HorizontalRule','Smiley','SpecialChar','PageBreak'],
'/',
['Styles','Format','Font','FontSize'],
['TextColor','BGColor'],
['attachment'],\r\n";
} elseif($toolbar == 'desc') {
$toolbar = "['Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink', '-', 'Image', '-','Source'],['Maximize'],\r\n";
} else {
$toolbar = '';
}
$str .= "';
$ext_str = "";
if(!defined('IMAGES_INIT')) {
$ext_str .= '';
define('IMAGES_INIT', 1);
}
$ext_str .= "
";
$ext_str .= "
";*/
if(is_ie()) $ext_str .= "";
$str .= $ext_str;
return $str;
}
/**
*
* @param string $name 表单名称
* @param int $id 表单id
* @param string $value 表单默认值
* @param string $moudle 模块名称
* @param int $catid 栏目id
* @param int $size 表单大小
* @param string $class 表单风格
* @param string $ext 表单扩展属性 如果 js事件等
* @param string $alowexts 允许图片格式
* @param array $thumb_setting
* @param int $watermark_setting 0或1
*/
public static function images($name, $id = '', $value = '', $moudle='', $catid='', $size = 50, $class = '', $ext = '', $alowexts = '',$thumb_setting = array(),$watermark_setting = 0 ) {
if(!$id) $id = $name;
if(!$size) $size= 50;
if(!empty($thumb_setting) && count($thumb_setting)) $thumb_ext = $thumb_setting[0].','.$thumb_setting[1];
else $thumb_ext = ',';
if(!$alowexts) $alowexts = 'jpg|jpeg|gif|bmp|png';
if(!defined('IMAGES_INIT')) {
$str = '';
define('IMAGES_INIT', 1);
}
$value = new_html_special_chars($value);
$authkey = upload_key("1,$alowexts,1,$thumb_ext,$watermark_setting");
return $str." ";
}
/**
*
* @param string $name 表单名称
* @param int $id 表单id
* @param string $value 表单默认值
* @param string $moudle 模块名称
* @param int $catid 栏目id
* @param int $size 表单大小
* @param string $class 表单风格
* @param string $ext 表单扩展属性 如果 js事件等
* @param string $alowexts 允许上传的文件格式
* @param array $file_setting
*/
public static function upfiles($name, $id = '', $value = '', $moudle='', $catid='', $size = 50, $class = '', $ext = '', $alowexts = '',$file_setting = array() ) {
if(!$id) $id = $name;
if(!$size) $size= 50;
if(!empty($file_setting) && count($file_setting)) $file_ext = $file_setting[0].','.$file_setting[1];
else $file_ext = ',';
if(!$alowexts) $alowexts = 'rar|zip';
if(!defined('IMAGES_INIT')) {
$str = '';
define('IMAGES_INIT', 1);
}
$authkey = upload_key("1,$alowexts,1,$file_ext");
return $str." ";
}
/**
* 日期时间控件
*
* @param $name 控件name,id
* @param $value 选中值
* @param $isdatetime 是否显示时间
* @param $loadjs 是否重复加载js,防止页面程序加载不规则导致的控件无法显示
* @param $showweek 是否显示周,使用,true | false
*/
public static function date($name, $value = '', $isdatetime = 0, $loadjs = 0, $showweek = 'true', $timesystem = 1) {
if($value == '0000-00-00 00:00:00') $value = '';
$id = preg_match("/\[(.*)\]/", $name, $m) ? $m[1] : $name;
if($isdatetime) {
$size = 21;
$format = '%Y-%m-%d %H:%M:%S';
if($timesystem){
$showsTime = 'true';
} else {
$showsTime = '12';
}
} else {
$size = 10;
$format = '%Y-%m-%d';
$showsTime = 'false';
}
$str = '';
if($loadjs || !defined('CALENDAR_INIT')) {
define('CALENDAR_INIT', 1);
$str .= '
';
}
$str .= ' ';
$str .= '';
return $str;
}
/**
* 栏目选择
* @param string $file 栏目缓存文件名
* @param intval/array $catid 别选中的ID,多选是可以是数组
* @param string $str 属性
* @param string $default_option 默认选项
* @param intval $modelid 按所属模型筛选
* @param intval $type 栏目类型
* @param intval $onlysub 只可选择子栏目
* @param intval $siteid 如果设置了siteid 那么则按照siteid取
*/
public static function select_category($file = '',$catid = 0, $str = '', $default_option = '', $modelid = 0, $type = -1, $onlysub = 0,$siteid = 0,$is_push = 0) {
$tree = pc_base::load_sys_class('tree');
if(!$siteid) $siteid = param::get_cookie('siteid');
if (!$file) {
$file = 'category_content_'.$siteid;
}
$result = getcache($file,'commons');
$string = '';
return $string;
}
public static function select_linkage($keyid = 0, $parentid = 0, $name = 'parentid', $id ='', $alt = '', $linkageid = 0, $property = '') {
$tree = pc_base::load_sys_class('tree');
$result = getcache($keyid,'linkage');
$id = $id ? $id : $name;
$string = "';
return $string;
}
/**
* 下拉选择框
*/
public static function select($array = array(), $id = 0, $str = '', $default_option = '') {
$string = '';
return $string;
}
/**
* 复选框
*
* @param $array 选项 二维数组
* @param $id 默认选中值,多个用 '逗号'分割
* @param $str 属性
* @param $defaultvalue 是否增加默认值 默认值为 -99
* @param $width 宽度
*/
public static function checkbox($array = array(), $id = '', $str = '', $defaultvalue = '', $width = 0, $field = '') {
$string = '';
$id = trim($id);
if($id != '') $id = strpos($id, ',') ? explode(',', $id) : array($id);
if($defaultvalue) $string .= '';
$i = 1;
foreach($array as $key=>$value) {
$key = trim($key);
$checked = ($id && in_array($key, $id)) ? 'checked' : '';
if($width) $string .= '';
$i++;
}
return $string;
}
/**
* 单选框
*
* @param $array 选项 二维数组
* @param $id 默认选中值
* @param $str 属性
*/
public static function radio($array = array(), $id = 0, $str = '', $width = 0, $field = '') {
$string = '';
foreach($array as $key=>$value) {
$checked = trim($id)==trim($key) ? 'checked' : '';
if($width) $string .= '';
}
return $string;
}
/**
* 模板选择
*
* @param $style 风格
* @param $module 模块
* @param $id 默认选中值
* @param $str 属性
* @param $pre 模板前缀
*/
public static function select_template($style, $module, $id = '', $str = '', $pre = '') {
$tpl_root = pc_base::load_config('system', 'tpl_root');
$templatedir = PC_PATH.$tpl_root.DIRECTORY_SEPARATOR.$style.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR;
$confing_path = PC_PATH.$tpl_root.DIRECTORY_SEPARATOR.$style.DIRECTORY_SEPARATOR.'config.php';
$localdir = str_replace(array('/', '\\'), '', $tpl_root).'|'.$style.'|'.$module;
$templates = glob($templatedir.$pre.'*.html');
if(empty($templates)) {
$style = 'default';
$templatedir = PC_PATH.$tpl_root.DIRECTORY_SEPARATOR.$style.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR;
$confing_path = PC_PATH.$tpl_root.DIRECTORY_SEPARATOR.$style.DIRECTORY_SEPARATOR.'config.php';
$localdir = str_replace(array('/', '\\'), '', $tpl_root).'|'.$style.'|'.$module;
$templates = glob($templatedir.$pre.'*.html');
}
if(empty($templates)) return false;
$files = @array_map('basename', $templates);
$names = array();
if(file_exists($confing_path)) {
$names = include $confing_path;
}
$templates = array();
if(is_array($files)) {
foreach($files as $file) {
$key = substr($file, 0, -5);
$templates[$key] = isset($names['file_explan'][$localdir][$file]) && !empty($names['file_explan'][$localdir][$file]) ? $names['file_explan'][$localdir][$file].'('.$file.')' : $file;
}
}
ksort($templates);
return self::select($templates, $id, $str,L('please_select'));
}
/**
* 验证码
* @param string $id 生成的验证码ID
* @param integer $code_len 生成多少位验证码
* @param integer $font_size 验证码字体大小
* @param integer $width 验证图片的宽
* @param integer $height 验证码图片的高
* @param string $font 使用什么字体,设置字体的URL
* @param string $font_color 字体使用什么颜色
* @param string $background 背景使用什么颜色
*/
public static function checkcode($id = 'checkcode',$code_len = 4, $font_size = 20, $width = 130, $height = 50, $font = '', $font_color = '', $background = '') {
return "
";
}
/**
* url 规则调用
*
* @param $module 模块
* @param $file 文件名
* @param $ishtml 是否为静态规则
* @param $id 选中值
* @param $str 表单属性
* @param $default_option 默认选项
*/
public static function urlrule($module, $file, $ishtml, $id, $str = '', $default_option = '') {
if(!$module) $module = 'content';
$urlrules = getcache('urlrules_detail','commons');
$array = array();
foreach($urlrules as $roleid=>$rules) {
if($rules['module'] == $module && $rules['file']==$file && $rules['ishtml']==$ishtml) $array[$roleid] = $rules['example'];
}
return form::select($array, $id,$str,$default_option);
}
}
?>