';
return $s;
}
function tpl_fans_form($field, $value = '') {
switch ($field) {
case 'avatar':
$avatar_url = '../attachment/images/global/avatars/';
$html = '';
if (!defined('TPL_INIT_AVATAR')) {
$html .= '
';
define('TPL_INIT_AVATAR', true);
}
if (!defined('TPL_INIT_IMAGE')) {
global $_W;
if (defined('IN_MOBILE')) {
$html .= <<
// in mobile
function showImageDialog(elm) {
require(["jquery", "util"], function($, util){
var btn = $(elm);
var ipt = btn.parent().prev();
var val = ipt.val();
var img = ipt.parent().next().children();
util.image(elm, function(url){
img.get(0).src = url.url;
ipt.val(url.attachment);
});
});
}
EOF;
} else {
$html .= <<
// in web
function showImageDialog(elm, opts) {
require(["util"], function(util){
var btn = $(elm);
var ipt = btn.parent().prev();
var val = ipt.val();
var img = ipt.parent().next().find('img');
util.image(val, function(url){
img.get(0).src = url.url;
ipt.val(url.attachment);
}, {multiple:false,type:"image",direct:true}, opts);
});
}
EOF;
}
define('TPL_INIT_IMAGE', true);
}
$val = './resource/images/nopic.jpg';
if (!empty($value)) {
$val = tomedia($value);
}
$options = array();
$options['width'] = '200';
$options['height'] = '200';
if (defined('IN_MOBILE')) {
$html .= <<
EOF;
} else {
$html .= '
';
}
break;
case 'birth':
case 'birthyear':
case 'birthmonth':
case 'birthday':
$html = tpl_form_field_calendar('birth', $value);
break;
case 'reside':
case 'resideprovince':
case 'residecity':
case 'residedist':
$html = tpl_form_field_district('reside', $value);
break;
case 'bio':
case 'interest':
$html = '';
break;
case 'gender':
$html = '
';
break;
case 'education':
case 'constellation':
case 'zodiac':
case 'bloodtype':
if ($field == 'bloodtype') {
$options = array('A', 'B', 'AB', 'O', '其它');
} elseif ($field == 'zodiac') {
$options = array('鼠', '牛', '虎', '兔', '龙', '蛇', '马', '羊', '猴', '鸡', '狗', '猪');
} elseif ($field == 'constellation') {
$options = array('水瓶座', '双鱼座', '白羊座', '金牛座', '双子座', '巨蟹座', '狮子座', '处女座', '天秤座', '天蝎座', '射手座', '摩羯座');
} elseif ($field == 'education') {
$options = array('博士', '硕士', '本科', '专科', '中学', '小学', '其它');
}
$html = '';
break;
case 'nickname':
case 'realname':
case 'address':
case 'mobile':
case 'qq':
case 'msn':
case 'email':
case 'telephone':
case 'taobao':
case 'alipay':
case 'studentid':
case 'grade':
case 'graduateschool':
case 'idcard':
case 'zipcode':
case 'site':
case 'affectivestatus':
case 'lookingfor':
case 'nationality':
case 'height':
case 'weight':
case 'company':
case 'occupation':
case 'position':
case 'revenue':
default:
$html = '';
break;
}
return $html;
}