__construct($modtype); } //析构函数 function __construct($modtype) { $this->name = $modtype; $this->db = $GLOBALS['dsql']; $query = "SELECT * FROM #@__member_model WHERE name='{$modtype}'"; $diyinfo = $this->db->getone($query); if (!is_array($diyinfo)) { showMsg('参数不正确,该会员模型不存在', 'javascript:;'); exit(); } $etypes = array(); $egroups = array(); $this->db->Execute('me', 'SELECT * FROM `#@__stepselect` ORDER BY id desc'); while ($arr = $this->db->GetArray()) { $etypes[] = $arr; $egroups[$arr['egroup']] = $arr['itemname']; } $this->egroups = $egroups; $this->modid = $diyinfo['id']; $this->table = $diyinfo['table']; $this->description = $diyinfo['description']; $this->state = $diyinfo['state']; $this->issystem = $diyinfo['issystem']; $this->info = $diyinfo['info']; } //end func __construct() /** * 获取用户数据表单 * * @access public * @param string $type 表单类型 * @param string $value 值 * @param string $admintype 模型类型 * @return string */ function getForm($type = 'post', $value = '', $admintype = 'membermodel2') { global $cfg_cookie_encode; $dtp = new DedeTagParse(); $dtp->SetNameSpace("field", "<", ">"); $dtp->LoadSource($this->info); $formstring = ''; $formfields = ''; $func = $type == 'post' ? 'GetFormItem' : 'GetFormItemValue'; if (is_array($dtp->CTags)) { foreach ($dtp->CTags as $tagid => $tag) { if ($tag->GetAtt('autofield')) { if ($tag->GetAtt('state') == 1) { //如果启用该字段 if ($type == 'post') { //对一些字段进行特殊处理 if ($tag->GetName() == 'onlynet') { $formstring .= '
  • 联系方式限制:
    不公开所有联系方式 不公开电话、详细地址 公开所有联系方式
  • '; } else if ($tag->GetName() == 'place' || $tag->GetName() == 'oldplace') { $formtitle = ($tag->GetName() == 'place') ? '目前所在地' : '家乡所在地'; $formstring .= '
  • ' . GetEnumsForm( 'nativeplace', 0, $tag->GetName() ) . '
    ' . $formtitle . ':
  • '; } else if (array_key_exists($tag->GetName(), $this->egroups)) { //对联动模型进行特殊处理 $formstring .= '
  • ' . GetEnumsForm( $tag->GetName(), 0, $tag->GetName() ) . '
    ' . $this->egroups[$tag->GetName()] . ':
  • '; } else if ($tag->GetAtt('type') == 'checkbox') { //对checkbox模型进行特殊处理 $formstring .= $func($tag, $admintype); } else { $formstring .= $func($tag, $admintype); } } else { if ($tag->GetName() == 'onlynet') { $formstring .= '

    不公开所有联系方式 不公开电话、详细地址 公开所有联系方式

    '; } else if ($tag->GetName() == 'place' || $tag->GetName() == 'oldplace') { $formtitle = ($tag->GetName() == 'place') ? '目前所在地' : '家乡所在地'; $formstring .= '
    ' . GetEnumsForm('nativeplace', $value[$tag->GetName()], $tag->GetName()) . '
    '; } else if ($tag->GetName() == 'birthday') { $formstring .= '
    '; } else if (array_key_exists($tag->GetName(), $this->egroups)) { //对联动模型进行特殊处理 $formstring .= '
    ' . GetEnumsForm($tag->GetName(), $value[$tag->GetName()], $tag->GetName()) . '
    '; } else if ($tag->GetAtt('type') == 'checkbox') { //对checkbox模型进行特殊处理 $formstring .= $func($tag, dede_htmlspecialchars($value[$tag->GetName()], ENT_QUOTES), $admintype); } else if ($tag->GetAtt('type') == 'img') { $fieldname = $tag->GetName(); $labelname = $tag->GetAtt('itemname'); $fvalue = dede_htmlspecialchars($value[$tag->GetName()], ENT_QUOTES); $imgstrng = "
    \r\n
    "; $formstring .= $imgstrng; } else { $formstring .= $func($tag, dede_htmlspecialchars($value[$tag->GetName()], ENT_QUOTES), $admintype); //echo $formstring; } } $formfields .= $formfields == '' ? $tag->GetName() . ',' . $tag->GetAtt('type') : ';' . $tag->GetName() . ',' . $tag->GetAtt('type'); } } } } $formstring .= "\n"; $formstring .= ""; return $formstring; } //end func getForm /** * 获取字段列表 * * @access public * @param string * @return array */ function getFieldList() { $dtp = new DedeTagParse(); $dtp->SetNameSpace("field", "<", ">"); $dtp->LoadSource($this->info); $fields = array(); if (is_array($dtp->CTags)) { foreach ($dtp->CTags as $tagid => $tag) { $fields[$tag->GetName()] = array($tag->GetAtt('itemname'), $tag->GetAtt('type')); } } return $fields; } }