Ejemplo n.º 1
0
<?php

defined('IN_DESTOON') or exit('Access Denied');
require MD_ROOT . '/expert.class.php';
$do = new expert();
$menus = array(array('添加专家', '?moduleid=' . $moduleid . '&file=' . $file . '&action=add'), array('专家列表', '?moduleid=' . $moduleid . '&file=' . $file));
if (in_array($action, array('', 'check'))) {
    $level = isset($level) ? intval($level) : 0;
    $sfields = array('按条件', '姓名', '会员名', '擅长领域', '专家介绍');
    $dfields = array('title', 'title', 'username', 'major', 'content');
    $sorder = array('结果排序方式', '添加时间降序', '添加时间升序', '修改时间降序', '修改时间升序', '浏览人气降序', '浏览人气升序', '被提问数降序', '被提问数升序', '回答次数降序', '回答次数升序', '被采纳数降序', '被采纳数升序');
    $dorder = array('addtime DESC', 'addtime DESC', 'addtime ASC', 'edittime DESC', 'edittime ASC', 'hits DESC', 'hits ASC', 'ask DESC', 'ask ASC', 'answer DESC', 'answer ASC', 'best DESC', 'best ASC');
    isset($fields) && isset($dfields[$fields]) or $fields = 0;
    isset($order) && isset($dorder[$order]) or $order = 0;
    $fields_select = dselect($sfields, 'fields', '', $fields);
    $order_select = dselect($sorder, 'order', '', $order);
    $level_select = level_select('level', '级别', $level);
    $condition = '';
    if ($keyword) {
        $condition .= " AND {$dfields[$fields]} LIKE '%{$keyword}%'";
    }
    if ($level) {
        $condition .= " AND level={$level}";
    }
}
switch ($action) {
    case 'add':
        if ($submit) {
            if ($do->pass($post)) {
                $do->add($post);
                dmsg('添加成功', '?moduleid=' . $moduleid . '&file=' . $file);