<?php
define('CURSCRIPT','member_comment');
require dirname(__FILE__).'/global.php';
require MYMPS_INC.'/db.class.php';

$mlevel = array();
$mlevel[0] = '<font color=red>待审</font>';
$mlevel[1] = '<font color=#006acd>正常</font>';

$commentlevel = $commentlevel ? $commentlevel : 'l2';

if(!submit_check(CURSCRIPT.'_submit')){
	
	$where = "WHERE 1";
	if($commentlevel == 'l0'){
		$where .= " AND a.commentlevel = '0'";
	}elseif($commentlevel == 'l1'){
		$where .= " AND a.commentlevel = '1'";
	}else{
		$where .= "";
	}
	$where .= $keywords ? " AND a.reply LIKE '%".$keywords."%'" : '';
	!chk_adm_purview("purview_机构点评")&& write_msg("很抱歉，您所在会员组没有当前菜单的操作权限！");
	$here = '网友点评';
	$rows_num = $db->getOne("SELECT COUNT(a.id) FROM `{$db_mymps}member_comments` AS a $where");
	$param	  = setParam(array("part","commentlevel"));
	$comment 	  = page1("SELECT a.*,b.tname FROM `{$db_mymps}member_comments` AS a LEFT JOIN `{$db_mymps}member` AS b ON a.userid=b.userid $where ORDER BY a.id DESC");
	include mayi_tpl(CURSCRIPT);
} else {
	if(is_array($ids)){
		if($part == 'delall'){
			foreach ($ids as $kids => $vids){
				mymps_delete("member_comments","WHERE id = ".$vids);
			}
			write_msg('成功删除指定点评信息！',$url,'writerecord');
		} elseif (strstr($part,'level')) {
			$part = FileExt($part);
			foreach ($ids as $kids => $vids){
				$db->query("UPDATE `{$db_mymps}member_comments` SET commentlevel = '$part' WHERE id = ".$vids);
			}
			write_msg('成功修改指定点评的信息状态为'.$mlevel[$part].'！',$url,'writerecord');
		} else {
			write_msg('Undefined Action!');
		}
	} else {
		write_msg('请选定您要操作处理的点评！');
	}
}

is_object($db) && $db->Close();
$mymps_global = $db = $db_mymps = $part = NULL;
?>