예제 #1
0
function trcacc($trname, $varname, $oldstr = '', $coid = 0, $source = 0, $ids = '', $vmode = 0, $smode = 0, $guide = '', $width = '25%')
{
    //vmode:034smode:02345
    $_mc = defined('M_MCENTER') ? 1 : 0;
    $vmode != 4 && ($arr = cacc_arr($coid, $source, $ids));
    $str = '';
    if (!$vmode && !$smode) {
        $arr = array(0 => array('title' => lang('p_choose'), 'level' => 0)) + $arr;
        foreach ($arr as $k => $v) {
            $arr[$k]['title'] = str_repeat('    ', $v['level']) . $v['title'];
        }
        $str = "<select name=\"{$varname}\" id=\"{$varname}\">" . umakeoption($arr, $oldstr) . '</select>';
    } elseif ($vmode <= 3) {
        foreach ($arr as $k => $v) {
            $str .= "[{$k},{$v['pid']},'" . addslashes($v['title']) . "'," . (empty($v['unsel']) ? 0 : 1) . '],';
        }
        $str = "<script>var data = [{$str}];\nmake_mbox('', '{$varname}', data, '{$oldstr}',{$smode});</script>";
    } else {
        $str = "<div><script>make_mbox('', '{$varname}', 'action=cacc&coid={$coid}&source={$source}&ids={$ids}', '{$oldstr}',{$smode});</script></div>";
    }
    if ($_mc) {
        $addstr = "<div id=\"alert_{$varname}\" name=\"alert_{$varname}\" class=\"red\"></div>";
        if ($guide) {
            $addstr .= "<font class=\"gray\">{$guide}</font>";
        }
        echo "<tr><td width=\"{$width}\" class=\"item1\"><b>{$trname}</b></td>\n";
        echo "<td class=\"item2\">{$str}{$addstr}</td></tr>\n";
    } else {
        $addstr = "<div id=\"alert_{$varname}\" name=\"alert_{$varname}\" class=\"mistake0\"></div>";
        if ($guide) {
            $addstr .= "<div class=\"tips1\">{$guide}</div>";
        }
        echo "<tr><td width=\"{$width}\" class=\"txt txtright fB borderright\">" . $trname . "</td>\n";
        echo "<td class=\"txt txtleft\">{$str}{$addstr}</td></tr>\n";
    }
}
예제 #2
0
function cn_select($varname, $value = 0, $sid = 0, $coid = 0, $chid = 0, $addstr = '', $framein = 0, $max = 0, $notip = 0, $emode = 0, $evarname = '', $evalue = 0)
{
    //$addstr为空时的字符,也是提示性字符//$framein不排除结构性栏目
    global $ca_vmode, $cotypes;
    $_mc = defined('M_MCENTER') ? 1 : 0;
    $vmode = $coid ? @$cotypes[$coid]['vmode'] : $ca_vmode;
    if ($max && $vmode < 2) {
        $vmode = 3;
    }
    if (!$vmode) {
        $str = "<select style=\"vertical-align: middle;\" name=\"{$varname}\">" . umakeoption(($addstr ? array('0' => array('title' => $addstr)) : array()) + uccidsarr($coid, $chid, $framein, 0), $value) . "</select>";
    } elseif ($vmode == 1) {
        $str = umakeradio($varname, ($addstr ? array('0' => array('title' => $addstr)) : array()) + uccidsarr($coid, $chid, $framein, 1), $value);
    } elseif ($vmode == 2) {
        global $acatalogs;
        $items = $coid ? read_cache('coclasses', $coid) : ($sid == -1 ? $acatalogs : read_cache('catalogs', '', '', $sid));
        $str = "<input type=\"hidden\" name=\"{$varname}\" value=\"{$value}\"><input onclick=\"cataarea('scatainfo{$coid}','{$varname}',{$sid},{$coid},{$chid},0," . ($max ? 1 : 0) . ");return false\" class=\"uploadbtn\" type=\"button\" value=\"" . ($addstr ? $addstr : lang('p_choose')) . "\" />&nbsp; <span id=\"scatainfo{$coid}\">" . cnstitle($value, $max, $items) . "</span>";
    } elseif ($vmode == 3) {
        $arr = uccidsarr($coid, $chid, $framein, 1, 1);
        $str = "<script>var data = [";
        foreach ($arr as $k => $v) {
            $str .= "[{$k},{$v['pid']},'" . addslashes($v['title']) . "'," . (empty($v['unsel']) ? 0 : 1) . '],';
        }
        $str .= "];\nmake_mbox('', '{$varname}', data, '{$value}',{$max},{$notip});</script>";
        unset($arr);
    } else {
        $data = $coid ? "coid&coid={$coid}" : 'caid';
        $data .= "&chid={$chid}&framein={$framein}&sid={$sid}";
        $str = "<span><script>make_mbox('', '{$varname}', 'action={$data}', '{$value}',{$max},{$notip});</script></span>";
    }
    if ($emode) {
        !$evalue && ($evalue = '');
        $str .= lang('enddate1') . ($emode > 1 ? '*' : '') . "<input type=\"text\" size=\"10\" id=\"{$evarname}\" name=\"{$evarname}\" value=\"{$evalue}\" onclick=\"ShowCalendar(this.id);\"><span id=\"alert_{$evarname}\" name=\"alert_{$evarname}\" class=\"" . ($_mc ? 'red' : 'mistake0') . "\"></span>\n";
    }
    return $str;
}