Ejemplo n.º 1
0
function logview_user_list(&$fld, $page, $kind)
{
    global $_logview_msg;
    // 登録ユーザ以上でなければ、他のユーザを知ることは禁止
    if (Auth::check_role('role_enrollee')) {
        return '';
    }
    $wiki = Factory::Wiki($page);
    $all_user = Auth::user_list();
    $all_user_idx = 0;
    $excludes_user = array();
    foreach ($all_user as $auth_api => $val1) {
        foreach ($val1 as $user => $val) {
            $group = empty($val['group']) ? '' : $val['group'];
            if ($kind != 'login' && Auth::auth($page, 'read', false, $user, $group)) {
                $excludes_user[$auth_api][$user] = '';
                continue;
            }
            $all_user_idx++;
        }
    }
    $user_list = array();
    foreach ($fld as $line) {
        $user_list[$line['auth_api']][$line['user']] = '';
    }
    $check_list = array();
    foreach ($all_user as $auth_api => $val1) {
        foreach ($val1 as $user => $val) {
            if (isset($user_list[$auth_api][$val['displayname']])) {
                continue;
            }
            if (isset($excludes_user[$auth_api][$user])) {
                continue;
            }
            $check_list[] = array('name' => $val['displayname'], 'auth_api' => $auth_api);
        }
    }
    $ctr = count($check_list);
    if ($ctr == 0) {
        return '';
    }
    $ret = '<fieldset>' . "\n" . '<legend>' . $_logview_msg['info_unused'] . '</legend>' . "\n";
    // 未確認者一覧
    $ret .= '<div>' . $_logview_msg['all_user'] . ': ' . $all_user_idx . ' ' . $_logview_msg['number_unused'] . ': ' . $ctr . ' ' . $_logview_msg['availability'] . ': ' . floor(100 - $ctr / $all_user_idx * 100) . '%</div></fieldset>' . "\n";
    // 人数
    sort($check_list);
    $ctr = 0;
    foreach ($check_list as $user) {
        $ctr++;
        $ret .= '<small><strong>' . $ctr . '.</strong></small>' . $user['name'];
        if (PLUGIN_LOGVIEW_DISPLAY_AUTH_API) {
            $ret .= ' <small><span style="color: ' . PLUGIN_LOGVIEW_COLOR_AUTH_API . '">' . $user['auth_api'] . '</span></small>';
        }
        $ret .= "\n";
    }
    return $ret;
}