在PHPCMS原有系统里面,中介在前台激活后是不用
审核就可以在前台发布房产信息的,现在在这儿提供一下程序,实现让中介激活后必须通过管理员的审核才能在前台发表房产信息。
第一步:在PHPCMS系统
后台的会员管理中有个自定义字段,点击添加字段,设置字段属性如图:
[attachimg]38[/attachimg]
第二步:在PHPCMS系统中找到member/admin/templates,在该文件下面新建两个模板,命名分别为member_house_check.tpl.php和member_house_manage.tpl.php。然后具体操作这两个文件。在
member_house_check.tpl.php文件中复制会员审核
member_check.tpl.php的文件代码:
进行一点点修改成为如下代码:(注意对比批量批准的action这个很重要哟o(∩_∩)o...在文章中我用红色标记,主要就这步,把批量删除这个按钮去掉,因为它们都在会员这块,删除就删除会员了;其它就是一些标题改动了,一看就明了!)
复制内容到剪贴板
代码:
<?php
defined('IN_PHPCMS') or exit('Access Denied');
include admintpl('header');
?>
<body>
<?=$menu?>
<form method="post" name="myform">
<table cellpadding="2" cellspacing="1" class="tableborder">
<tr>
<th colspan='10'>待审核会员列表</th>
</tr>
<tr align='center'>
<td width="5%" class="tablerowhighlight">选中</td>
<td width="5%" class="tablerowhighlight">ID</td>
<td width="12%" class="tablerowhighlight">帐号</td>
<td width="8%" class="tablerowhighlight">姓名</td>
<td width="5%" class="tablerowhighlight">性别</td>
<td width="15%" class="tablerowhighlight">所在地区</td>
<td width="13%" class="tablerowhighlight">E-mail</td>
<td width="12%" class="tablerowhighlight">注册时间</td>
<td width="10%" class="tablerowhighlight">注册IP</td>
<td width="15%" class="tablerowhighlight">管理操作</td>
</tr>
<?php
if(is_array($members))
{
foreach($members as $member){ ?>
<tr align="center" onMouseOut="this.style.backgroundColor='#F1F3F5'" onMouseOver="this.style.backgroundColor='#BFDFFF'" bgColor='#F1F3F5'>
<td><input type="checkbox" name="userid[]" id="userid[]" value="<?=$member['userid']?>"></td>
<td><?=$member['userid']?></td>
<td><a href="<?=$MOD['linkurl']?>member.php?action=show&username=<?=urlencode($member['username'])?>" target="_blank"><?=$member['username']?></a></td>
<td><?=$member['truename']?></td>
<td><?=$genders[$member['gender']]?></td>
<td><?=$member['province']?>-<?=$member['city']?></td>
<td><?=$member['email']?></td>
<td><?=date('Y-m-d', $member['regtime'])?></td>
<td><?=$member['regip']?></td>
<td align="center">
<a href='?mod=<?=$mod?>&file=member&action=view&userid=<?=$member['userid']?>' title="点击查看会员资料
最后登录时间:<?=$member['lastlogintime']?>
最后登录IP:<?=$member['lastloginip']?>
登录次数:<?=$member['logintimes']?>">查看</a> |
<a href='?mod=<?=$mod?>&file=member&action=note&userid=<?=$member['userid']?>' title="关于该会员的管理笔记都记在这里">备注</a> |
<a href='?mod=<?=$mod?>&file=member&action=edit&userid=<?=$member['userid']?>'>修改</a>
</td>
</tr>
<?php }
}
?>
</table>
<table width="100%" height="25" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="10%"><input name='chkall' type='checkbox' id='chkall' onclick='checkall(this.form)' value='checkbox'>全选/反选</td>
<td>
<input type="submit" name="submit" value="批量批准" onClick="document.myform.action='?mod=<?=$mod?>&file=<?=$file?>&action=check_house&dosubmit=1'"> </td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" border="0" width="100%" height="30">
<tr>
<td align="center"><?=$pages?></td>
</tr>
</table>
</form>
</body>
</html>
在新建的页面 member_house_manage.tpl.php 中同样复制member_check.tpl.php文件的代码把代码中的和上面member_house_check.tpl.php中的代码大体一致只是action=check_house改为action=oncheck_houseOK了同样删除批量删除这个按钮,不然操作之伯会删除会员哟,按钮弄个批量取消批准,呵呵……
第三步:在PHPCMS系统中找到member/admin/下找到member.inc.php文件(注意这是关键中的关键哟)
在任何一个break;后面添加如下四个case
复制内容到剪贴板
代码:
//by xiuling 房产审核!
case 'house_check':
if($dosubmit)
{
$member->check($userid);
showmessage($LANG['operation_success'], $forward);
}
else
{
$page = isset($page) ? intval($page) : 1;
$pagesize = $PHPCMS['pagesize'] ? $PHPCMS['pagesize'] : 30;
$offset = ($page-1)*$pagesize;
$condition = " AND my_house_membertype=2 AND my_house_check=0";
$r = $db->get_one("SELECT count(*) as num FROM ".TABLE_MEMBER." m,".TABLE_MEMBER_INFO." i WHERE m.userid=i.userid $condition");
$pages = phppages($r['num'], $page, $pagesize);
$members = $member->get_list($condition, $page, $pagesize);
include admintpl('member_house_check');
}
break;
//by xiuling 批准中介
case 'check_house':
$userids = is_array($userid) ? implode(',', $userid) : $userid;
if(!$userids) showmessage($LANG['select_account'], $PHP_REFERER);
if($dosubmit)
{
$db->query("UPDATE ".TABLE_MEMBER_INFO." SET my_house_check=1 $sql WHERE userid IN($userids)");
showmessage($LANG['operation_success'], $forward);
}
else
{
$member = array();
$result = $db->query("SELECT userid,username FROM ".TABLE_MEMBER_INFO." WHERE userid IN($userids)");
while($r = $db->fetch_array($result))
{
$member[$r['userid']] = $r['username'];
}
$groupids = showgroup('select', 'groupid', $groupid);
include admintpl('member_house_check');
}
break;
//by xiuling 房产管理
case 'house_manage':
if($dosubmit)
{
$member->check($userid);
showmessage($LANG['operation_success'], $forward);
}
else
{
$page = isset($page) ? intval($page) : 1;
$pagesize = $PHPCMS['pagesize'] ? $PHPCMS['pagesize'] : 30;
$offset = ($page-1)*$pagesize;
$condition = " AND my_house_membertype=2 AND my_house_check=1";
$r = $db->get_one("SELECT count(*) as num FROM ".TABLE_MEMBER." m,".TABLE_MEMBER_INFO." i WHERE m.userid=i.userid $condition");
$pages = phppages($r['num'], $page, $pagesize);
$members = $member->get_list($condition, $page, $pagesize);
include admintpl('member_house_manage');
}
break;
//by xiuling 批量取消批准
case 'oncheck_house':
$userids = is_array($userid) ? implode(',', $userid) : $userid;
if(!$userids) showmessage($LANG['select_account'], $PHP_REFERER);
if($dosubmit)
{
$db->query("UPDATE ".TABLE_MEMBER_INFO." SET my_house_check=0 $sql WHERE userid IN($userids)");
showmessage($LANG['operation_success'], $forward);
}
else
{
$member = array();
$result = $db->query("SELECT userid,username FROM ".TABLE_MEMBER_INFO." WHERE userid IN($userids)");
while($r = $db->fetch_array($result))
{
$member[$r['userid']] = $r['username'];
}
$groupids = showgroup('select', 'groupid', $groupid);
include admintpl('member_house_manage');
}
break;
这些代码和会员批量审核和批量取消审核是差不多的,呵呵……只是稍加修改……
第四步:在member/admin/templates中找到
left.tpl.php文件中找到
<TBODY style="display:" id="member">在其下面加上如下代码:(注意红色的action和所建两个模板的文件名前部分勿必一样哟)
复制内容到剪贴板
代码:
<tr>
<td height="22" bgcolor="#FFFFFF" onMouseOver="this.style.backgroundColor='#F8F8F8'" onMouseOut="this.style.backgroundColor='#FFFFFF'"><a href="?mod=member&file=member&action=house_check" target="right"><font color="#FF0000">审核房产中介</font></a></td>
</tr>
<tr>
<td height="22" bgcolor="#FFFFFF" onMouseOver="this.style.backgroundColor='#F8F8F8'" onMouseOut="this.style.backgroundColor='#FFFFFF'"><a href="?mod=member&file=member&action=house_manage" target="right"><font color="#FF0000">房产中介管理</font></a></td>
</tr>
好了,看累了吧,呵呵,希望对做房产的朋友挣中介的钱,呵呵,也希望对用PHPCMS建站的朋友对房产这方面的开发与应用有所帮助……
前台的调用待续,呵呵……这主要是程序工作……
如有不清楚的,联系我,我们互相交流……