'; $html .= ''; if (!defined('TPL_INIT_CALENDAR')) { $html .= ' '; define('TPL_INIT_CALENDAR', true); } return $html; } function tpl_app_fans_form($field, $value = '', $placeholder = '') { $placeholders[$field] = '请填写' . $placeholder; if(in_array($field, array('birth', 'reside', 'gender', 'education', 'constellation', 'zodiac', 'bloodtype'))) { $placeholders[$field] = '请选择' . $placeholder; } if($field == 'height') { $placeholders[$field] = '请填写' . $placeholder . '(单位:cm)'; } elseif ($field == 'weight') { $placeholders[$field] = '请填写' . $placeholder . '(单位:kg)'; } switch ($field) { case 'avatar': $html = tpl_app_form_field_avatar('avatar', $value); break; case 'birth': case 'birthyear': case 'birthmonth': case 'birthday': $html = tpl_app_form_field_calendar('birth', $value); break; case 'reside': case 'resideprovince': case 'residecity': case 'residedist': $html = tpl_app_form_field_district('reside', $value); break; case 'bio': case 'interest': $html = ''; break; case 'gender': case 'education': case 'constellation': case 'zodiac': case 'bloodtype': if($field == 'gender') { $options = array( '0' => '保密', '1' => '男', '2' => '女', ); $text_value = $options[$value]; } else { if ($field == 'bloodtype') { $options = array('A', 'B', 'AB', 'O', '其它'); } elseif ($field == 'zodiac') { $options = array('鼠', '牛', '虎', '兔', '龙', '蛇', '马', '羊', '猴', '鸡', '狗', '猪'); } elseif ($field == 'constellation') { $options = array('水瓶座', '双鱼座', '白羊座', '金牛座', '双子座', '巨蟹座', '狮子座', '处女座', '天秤座', '天蝎座', '射手座', '摩羯座'); } elseif ($field == 'education') { $options = array('博士', '硕士', '本科', '专科', '中学', '小学', '其它'); } $text_value = $value; } $data = array(); foreach($options as $key => $option) { if(!$option) { continue; } if($field == 'gender') { $data[] = array( 'text' => $option, 'value' => $key ); } else { $data[] = array( 'text' => $option, 'value' => $option ); } } if($field != 'gender') { $text_value = $value; unset($options); } $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; } function tpl_app_form_field_calendar($name, $values = array()) { $value = (empty($values['year']) || empty($values['month']) || empty($values['day'])) ? '' : implode('-', $values); $html = ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; if (!defined('TPL_INIT_CALENDAR')) { $html .= ' '; define('TPL_INIT_CALENDAR', true); } return $html; } function tpl_app_form_field_district($name, $values = array()) { $value = (empty($values['province']) || empty($values['city'])) ? '' : implode(' ', $values); $html = ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ' '; return $html; } function tpl_app_form_field_avatar($name, $value = '', $type = 0) { $val = './resource/images/nopic.jpg'; if (!empty($value)) { $val = tomedia($value); } $html = ' '; if ($type) { $html = '
'; } $href = url('mc/profile/avatar'); $html .= ""; return $html; } function tpl_app_form_field_image($name, $value = '') { $thumb = empty($value) ? 'images/global/nopic.jpg' : $value; $thumb = tomedia($thumb); $html = <<
EOF; return $html; } function tpl_app_coupon_item($item) { load()->model('activity'); $type_names = activity_coupon_type_label(); if ($item['type'] == COUPON_TYPE_DISCOUNT) { $icon = '
'.$item['extra']['discount'] * 0.1.'
'; } elseif ($item['type'] == COUPON_TYPE_CASH) { $icon = '
' . $item['extra']['reduce_cost'] * 0.01 . '
满' . $item['extra']['least_cost'] * 0.01 . '元可用
'; } elseif ($item['type'] == COUPON_TYPE_GROUPON) { $icon = ''; } elseif ($item['type'] == COUPON_TYPE_GIFT) { $icon = ''; } elseif ($item['type'] == COUPON_TYPE_GENERAL) { $icon = ''; } $extra_func = '
' . $item['extra_func']['credit'] . '
'; $html .= '
' . $icon . '
' . $item['title']. '
' . $extra_func . '
' . $item['extra_date_info'] . '
' . $type_names[$item['type']][0] . '使用规则
兑换
'; return $html; } function tpl_form_field_image($name, $value) { $thumb = empty($value) ? 'images/global/nopic.jpg' : $value; $thumb = tomedia($thumb); $html = << .webuploader-pick {color:#333;} EOF; return $html; }