示例#1
0
function cnodesfromcnc(&$cnconfig, $sid = 0)
{
    global $db, $tblprefix;
    $cncid = $cnconfig['cncid'];
    $idsarr = cfgs2ids($cnconfig['configs'], $sid);
    $cnodes1 = array();
    $i = 0;
    foreach ($idsarr as $k => $ids) {
        if (!$i && empty($ids)) {
            return $cnodes1;
        }
        if (empty($ids)) {
            unset($idsarr[$k]);
        }
        $i++;
    }
    $i = 0;
    $j = count($idsarr) - 1;
    foreach ($idsarr as $k => $ids) {
        $kvar = !$k ? 'caid' : 'ccid' . $k;
        if (!$i) {
            foreach ($ids as $id) {
                $k2 = $kvar . '=' . $id;
                save_cnode($k2, $sid, $cncid);
                $cnodes1[$k2] = '';
            }
        } else {
            foreach ($cnodes1 as $k1 => $v1) {
                foreach ($ids as $id) {
                    $k2 = $k1 . '&' . $kvar . '=' . $id;
                    save_cnode($k2, $sid, $cncid);
                    if ($i != $j) {
                        $cnodes1[$k2] = '';
                    }
                }
            }
        }
        $i++;
    }
    unset($idsarr, $ids);
    return;
}
示例#2
0
include_once M_ROOT . "./include/cnode.fun.php";
include_once M_ROOT . "./include/cparse.fun.php";
include_once M_ROOT . "./include/parse/general.php";
$url_type = 'cnode';
include 'urlsarr.inc.php';
if ($action == 'cnconfigs') {
    if (!submitcheck('bcnconfigs')) {
        url_nav(lang('cnodeadmin'), $urlsarr, 'cnconfigs');
        $addstr = "&nbsp; &nbsp; >><a href=\"?entry={$entry}&action=cnconfigsadd{$param_suffix}\" onclick=\"return floatwin('open_cnodes',this)\">" . lang('cnconfigsadd') . "</a>";
        tabheader(lang('cnconfigadmin') . $addstr, 'cnodesupdate', "?entry={$entry}&action={$action}{$param_suffix}", 3);
        trcategory(array("<input class=\"checkbox\" type=\"checkbox\" name=\"chkall\" onclick=\"checkall(this.form, 'selectid', 'chkall')\">", array(lang('config_name'), 'txtL'), array(lang('catas_configs'), 'txtL'), array(lang('mlclass'), 'txtL'), lang('order'), lang('copy'), lang('edit')));
        $cnidsarr = array();
        foreach ($cnconfigs as $k => $v) {
            $configstr = '';
            $i = 0;
            $idsarr = cfgs2ids($v['configs'], $sid);
            foreach ($v['configs'] as $k1 => $v1) {
                $configstr .= ($configstr ? ' x ' : '') . (!$k1 ? lang('catalog') : @$cotypes[$k1]['cname']) . '(' . count($idsarr[$k1]) . ')';
                !$i && ($type = lang(!$k1 ? 'catalog' : @$cotypes[$k1]['cname']));
                !$i && ($mlclassstr = fetch_mlclass($k1, $v['configs'][$k1]));
                $i++;
            }
            $cnidsarr[$k] = $v['cname'] . '(' . $type . ')';
            echo "<tr class=\"txt\">" . "<td class=\"txtC w30\"><input class=\"checkbox\" type=\"checkbox\" name=\"selectid[]\" value=\"{$k}\"></td>\n" . "<td class=\"txtL\"><input type=\"text\" size=\"25\" maxlength=\"30\" name=\"cnconfigsnew[{$k}][cname]\" value=\"{$v['cname']}\"></td>\n" . "<td class=\"txtL\">{$configstr}</td>\n" . "<td class=\"txtL\">{$mlclassstr}</td>\n" . "<td class=\"txtC w40\"><input type=\"text\" size=\"4\" maxlength=\"4\" name=\"cnconfigsnew[{$k}][vieworder]\" value=\"{$v['vieworder']}\"></td>\n" . "<td class=\"txtC w30\"><a href=\"?entry={$entry}&action=cnconfigdetail&cncid={$k}{$param_suffix}&iscopy=1\" onclick=\"return floatwin('open_cnodes',this)\">" . lang('copy') . "</a></td>\n" . "<td class=\"txtC w30\"><a href=\"?entry={$entry}&action=cnconfigdetail&cncid={$k}{$param_suffix}\" onclick=\"return floatwin('open_cnodes',this)\">" . lang('detail') . "</a></td>\n" . "</tr>\n";
        }
        tabfooter();
        tabheader(lang('operate_item'));
        $str = "<input class=\"radio\" type=\"radio\" name=\"arcdeal\" value=\"update\" checked><b>" . lang('updatecnode') . "</b> &nbsp;";
        $str .= "<input class=\"radio\" type=\"radio\" name=\"arcdeal\" value=\"delete\">" . lang('delete') . lang('cncfg') . " &nbsp;";
        trbasic(lang('choose_item'), '', $str, '');
        $cnmodearr = array(0 => lang('cnopmode0'), 1 => lang('cnopmode1'), 2 => lang('cnopmode2'));