$scene, ); $option = json_encode($option); $s = ' '; define('TPL_INIT_TINY_FANS', true); } $s .= '
'; return $s; } function itpl_form_field_daterange($name, $value = array(), $time = false) { global $_GPC; $placeholder = ((isset($value['placeholder']) ? $value['placeholder'] : '')); $s = ''; if (empty($time) && !defined('TPL_INIT_TINY_DATERANGE_DATE')) { $s = ' '; define('TPL_INIT_TINY_DATERANGE_DATE', true); } if (!empty($time) && !defined('TPL_INIT_TINY_DATERANGE_TIME')) { $s = ' '; define('TPL_INIT_TINY_DATERANGE_TIME', true); } $str = $placeholder; $value['starttime'] = ((isset($value['starttime']) ? $value['starttime'] : (($_GPC[$name]['start'] ? $_GPC[$name]['start'] : '')))); $value['endtime'] = ((isset($value['endtime']) ? $value['endtime'] : (($_GPC[$name]['end'] ? $_GPC[$name]['end'] : '')))); if ($value['starttime'] && $value['endtime']) { if (empty($time)) { $str = date('Y-m-d', strtotime($value['starttime'])) . '至 ' . date('Y-m-d', strtotime($value['endtime'])); } else { $str = date('Y-m-d H:i', strtotime($value['starttime'])) . ' 至 ' . date('Y-m-d H:i', strtotime($value['endtime'])); } } $s .= '
'; return $s; } function tpl_form_field_tiny_link($name, $value = '', $options = array()) { global $_GPC; $s = ''; if (!defined('TPL_INIT_TINY_LINK')) { $s = ' '; define('TPL_INIT_TINY_LINK', true); } $s .= '
'; return $s; } function tpl_form_field_tiny_wxapp_link($name, $value = '', $options = array()) { global $_GPC; $s = ''; if (!defined('TPL_INIT_TINY_WXAPP_LINK')) { $s = ' '; define('TPL_INIT_TINY_WXAPP_LINK', true); } $s .= '
'; return $s; } function tpl_form_field_tiny_coordinate($field, $value = array(), $required = false) { global $_W; $s = ''; if (!defined('TPL_INIT_TINY_COORDINATE')) { $s .= ''; define('TPL_INIT_TINY_COORDINATE', true); } $s .= '
'; return $s; } function tpl_select2($name, $data, $value = 0, $filter = array('id', 'title'), $default = '请选择') { $element_id = "select2-{$name}"; $json_data = array(); foreach ($data as $da) { $json_data[] = array( 'id' => $da[$filter[0]], 'text' => $da[$filter[1]], ); } $json_data = json_encode($json_data); $html = ''; $html .= ''; return $html; } function tpl_form_field_tiny_image($name, $value = '') { global $_W; $default = ''; $val = $default; if (!empty($value)) { $val = tomedia($value); } if (!empty($options['global'])) { $options['global'] = true; } else { $options['global'] = false; } if (empty($options['class_extra'])) { $options['class_extra'] = ''; } if (isset($options['dest_dir']) && !empty($options['dest_dir'])) { if (!preg_match('/^\w+([\/]\w+)?$/i', $options['dest_dir'])) { exit('图片上传目录错误,只能指定最多两级目录,如: "we7_store","we7_store/d1"'); } } $options['direct'] = true; $options['multiple'] = false; if (isset($options['thumb'])) { $options['thumb'] = !empty($options['thumb']); } $s = ''; if (!defined('TPL_INIT_TINY_IMAGE')) { $s = ' '; define('TPL_INIT_TINY_IMAGE', true); } $s .= '
'; return $s; } function tpl_form_field_store($name, $value = '', $option = array('mutil' => 0)) { global $_W; if (empty($default)) { $default = './resource/images/nopic.jpg'; } if (!is_array($value)) { $value = intval($value); $value = array($value); } $value_ids = implode(',', $value); $stores_temp = pdo_fetchall('select id, title, logo from ' . tablename('tiny_wmall_store') . " where uniacid = :uniacid and id in ({$value_ids})", array(':uniacid' => $_W['uniacid'])); $stores = array(); if (!empty($stores_temp)) { foreach ($stores_temp as $row) { $row['logo'] = tomedia($row['logo']); $stores[] = $row; } } $definevar = 'TPL_INIT_TINY_STORE'; $function = 'showStoreDialog'; if (!empty($option['mutil'])) { $definevar = 'TPL_INIT_TINY_MUTIL_STORE'; $function = 'showMutilStoreDialog'; } $s = ''; if (!defined($definevar)) { $option_json = json_encode($option); $s = ' '; define($definevar, true); } $s .= '
'; if (empty($option['mutil'])) { $s .= '
'; if (empty($stores[0]['title'])) { $s .= ''; } else { $s .= '' . $stores[0]['title'] . ''; } $s .= '
'; } else { $s .= '
'; foreach ($stores as $store) { $s .= '
× ' . $store['title'] . '
'; } $s .= '
'; } return $s; } function tpl_form_field_mutil_store($name, $value = '') { return tpl_form_field_store($name, $value, $option = array('mutil' => 1)); } function tpl_form_field_goods($name, $value = '', $option = array('mutil' => 0, 'sid' => 0, 'ignore' => array())) { global $_W; if (!isset($option['mutil'])) { $option['mutil'] = 0; } if (empty($default)) { $default = './resource/images/nopic.jpg'; } if (!is_array($value)) { $value = intval($value); $value = array($value); } $condition = ' where uniacid = :uniacid'; $params = array(':uniacid' => $_W['uniacid']); $value_ids = implode(',', $value); $condition .= " and id in ({$value_ids})"; $goods_temp = pdo_fetchall('select id, title, thumb from ' . tablename('tiny_wmall_goods') . "{$condition}", $params); $goods = array(); if (!empty($goods_temp)) { foreach ($goods_temp as $row) { $row['thumb'] = tomedia($row['thumb']); $goods[] = $row; } } $definevar = 'TPL_INIT_TINY_GOODS'; $function = 'showGoodsDialog'; if (!empty($option['mutil'])) { $definevar = 'TPL_INIT_TINY_MUTIL_GOODS'; $function = 'showMutilGoodsDialog'; } $s = ''; if (!defined($definevar)) { $option_json = json_encode($option); $s = ' '; define($definevar, true); } $s .= '
'; if (empty($option['mutil'])) { $s .= '
'; if (empty($goods[0]['title'])) { $s .= ''; } else { $s .= '' . $goods[0]['title'] . ''; } $s .= '
'; } else { $s .= '
'; foreach ($goods as $good) { $s .= '
× ' . $good['title'] . '
'; } $s .= '
'; } return $s; } function tpl_form_field_mutil_goods($name, $value = '', $option = array('sid' => 0, 'ignore' => array())) { if (!isset($option['mutil'])) { $option['mutil'] = 1; } return tpl_form_field_goods($name, $value, $option); } function tpl_form_filter_hidden($ctrls) { global $_W; if (is_agent()) { $html = ''; } else { $html = ' '; } [$p, $ac, $do] = explode('/', $ctrls); if (!empty($p)) { $html .= ''; if (!empty($ac)) { $html .= ''; if (!empty($do)) { $html .= ''; } } } return $html; } function tpl_form_field_tiny_category_2level($name, $parents, $children, $parentid, $childid) { $html = ' '; if (!defined('TPL_INIT_TINY_CATEGORY')) { $html .= ' '; define('TPL_INIT_TINY_CATEGORY', true); } $html .= '
'; return $html; } function tpl_form_field_editor($params = array(), $callback = NULL) { $html = ''; $html .= ''; $html .= '' . $params['value'] . ''; $html .= '修改'; $html .= ''; $html .= ''; $html .= ' '; $html .= ''; return $html; } /** * Comment: 状态改变控制器 * Author: zzw * Date: 2019/9/18 14:30 * @param string $url 状态改变后提交的地址 * @param string $val 当前的值 * @param int $open 开启的值 * @param int $close 关闭的值 * @return string */ function tpl_change_status($url, $val, $open = 1, $close = 0) { $url = web_url($url); #1、生成基础内容 if ($val == $open) $html = ''; else $html = ''; return $html; } /** * Comment: 用户选择器 * Author: zzw * Date: 2019/11/29 18:17 * @param string|int $mid 用户id名称 * @param string|int $midVal 用户id值 * @return string */ function tpl_select_user($mid, $midVal,$title = '选择用户') { $default = './resource/images/nopic.jpg'; if(!empty($midVal)) $member = Member::wl_member_get($midVal); $html = '
'.$title.'
'; return $html; } /** * Comment: 时间选择器 tpl_form_field_daterange的重构版本 * Author: zzw * Date: 2020/4/9 11:53 * @param $name * @param array $value * @param bool $time * @return string */ function tpl_select_time_info($name, $value = array(), $time = false) { $s = ' '; define('TPL_INIT_DATERANGE_DATE' , true); if ($value['starttime'] !== false && $value['start'] !== false) { if($value['start']) { $value['starttime'] = empty($time) ? date('Y-m-d',strtotime($value['start'])) : date('Y-m-d H:i',strtotime($value['start'])); } $value['starttime'] = empty($value['starttime']) ? (empty($time) ? date('Y-m-d') : date('Y-m-d H:i') ): $value['starttime']; } else { $value['starttime'] = '请选择'; } if ($value['endtime'] !== false && $value['end'] !== false) { if($value['end']) { $value['endtime'] = empty($time) ? date('Y-m-d',strtotime($value['end'])) : date('Y-m-d H:i',strtotime($value['end'])); } $value['endtime'] = empty($value['endtime']) ? $value['starttime'] : $value['endtime']; } else { $value['endtime'] = '请选择'; } $s .= ' '; return $s; } /** * Comment: 图片选择模型 —— 单选 * Author: zzw * Date: 2020/8/31 18:50 * @param $name * @param string $default_img * @return string */ function attachment_select($name,$default_img = '',$ordernum = 0){ //名称处理 $idName = str_replace(['[',']'],'_',$name); $http_url = $default_img; if($http_url) $http_url = tomedia($http_url); //生成html信息 $html = '
×
'; return $html; } function attachment_select2W($name,$default_img = '',$ordernum = 0){ //名称处理 $idName = str_replace(['[',']'],'_',$name); $http_url = $default_img; if($http_url) $http_url = tomedia($http_url); //生成html信息 $html = '
×
'; return $html; } /** * Comment: 图片选择模型 —— 多选 * Author: zzw * Date: 2020/8/31 19:35 * @param $name * @param string $default_img * @return string */ function attachment_select_multi($name,$default_img = ''){ //名称处理 $idName = str_replace(['[',']'],'_',$name); //默认图片信息处理 $html = ''; if(is_array($default_img) && count($default_img) > 0){ foreach($default_img as $attKey => $attVal){ //图片信息处理 $httpUrl = tomedia($attVal); //生成html信息 $html .= '
×
'; } } //生成html信息 $html = '
'.$html.'
'; return $html; } /** * Comment: 生成百度富文本编辑器 * Author: zzw * Date: 2020/9/3 14:38 * @param $name * @param string $value * @return string */ function tpl_diy_editor_create($name,$value = ''){ $html = ''; return $html; } /** * Comment: 地图定位 * Author: zzw * Date: 2020/9/8 16:02 * @param $addressName * @param $lngName * @param $latName * @param $address * @param $lng * @param $lat * @return string */ function tpl_select_address($addressName,$lngName,$latName,$address,$lng,$lat){ //名称处理 $idAddressName = str_replace(['[',']'],'_',$addressName); $idLngName = str_replace(['[',']'],'_',$lngName); $idLatName = str_replace(['[',']'],'_',$latName); //生成html信息 $html = '
地图定位
'; return $html; } /** * Comment: 红包选择器 * Author: zzw * Date: 2020/9/14 15:22 * @param string $name * @param string $id * @return string */ function tpl_select_redPack($name = '',$id = ''){ $html = '
'; return $html; } /** * Comment: 音频选择器 * Author: zzw * Date: 2021/2/1 10:12 * @param $name * @param string $defaultUrl * @return string */ function attachment_select_audio($name,$defaultUrl = ''){ //名称处理 $idName = str_replace(['[',']'],'_',$name); //生成html信息 $html = '
'; return $html; } /** * Comment: 视频选择器 * Author: zzw * Date: 2021/2/26 17:39 * @param $name * @param string $defaultUrl * @return string */ function attachment_select_video($name,$defaultUrl = ''){ //名称处理 $idName = str_replace(['[',']'],'_',$name); $http_url = $defaultUrl; if($http_url) $http_url = tomedia($http_url); //生成html信息 $html = '
×
'; return $html; }