当前位置: 首页>>代码示例>>PHP>>正文


PHP nv_fix_cat_order函数代码示例

本文整理汇总了PHP中nv_fix_cat_order函数的典型用法代码示例。如果您正苦于以下问题:PHP nv_fix_cat_order函数的具体用法?PHP nv_fix_cat_order怎么用?PHP nv_fix_cat_order使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了nv_fix_cat_order函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: nv_fix_cat_order

/**
 * nv_fix_cat_order()
 *
 * @param mixed $mid
 * @param integer $parentid
 * @param integer $order
 * @param integer $lev
 * @return
 */
function nv_fix_cat_order($mid, $parentid = 0, $order = 0, $lev = 0)
{
    global $db, $db_config, $lang_module, $lang_global, $module_name, $module_data, $op;
    $array = array();
    $sql = "SELECT `id`, `parentid` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` WHERE `parentid`=" . $parentid . " AND `mid`= " . $mid . " ORDER BY `weight` ASC";
    $result = $db->sql_query($sql);
    $array_cat_order = array();
    while ($row = $db->sql_fetchrow($result)) {
        $array_cat_order[] = $row['id'];
    }
    $db->sql_freeresult();
    $weight = 0;
    if ($parentid > 0) {
        ++$lev;
    } else {
        $lev = 0;
    }
    foreach ($array_cat_order as $catid_i) {
        ++$order;
        ++$weight;
        $sql = "UPDATE `" . NV_PREFIXLANG . "_" . $module_data . "_rows` SET `weight`=" . $weight . ", `order`=" . $order . ", `lev`='" . $lev . "' WHERE `id`=" . intval($catid_i);
        $db->sql_query($sql);
        $order = nv_fix_cat_order($mid, $catid_i, $order, $lev);
    }
    return $order;
}
开发者ID:atarubi,项目名称:nuke-viet,代码行数:35,代码来源:admin.functions.php

示例2: nv_fix_cat_order

/**
 * nv_fix_cat_order()
 *
 * @param integer $parentid
 * @param integer $order
 * @param integer $lev
 * @return
 */
function nv_fix_cat_order($parentid = 0, $order = 0, $lev = 0)
{
    global $db, $module_data;
    $sql = 'SELECT catid, parentid FROM ' . NV_PREFIXLANG . '_' . $module_data . '_cat WHERE parentid=' . $parentid . ' ORDER BY weight ASC';
    $result = $db->query($sql);
    $array_cat_order = array();
    while ($row = $result->fetch()) {
        $array_cat_order[] = $row['catid'];
    }
    $result->closeCursor();
    $weight = 0;
    if ($parentid > 0) {
        ++$lev;
    } else {
        $lev = 0;
    }
    foreach ($array_cat_order as $catid_i) {
        ++$order;
        ++$weight;
        $sql = 'UPDATE ' . NV_PREFIXLANG . '_' . $module_data . '_cat SET weight=' . $weight . ', sort=' . $order . ', lev=' . $lev . ' WHERE catid=' . intval($catid_i);
        $db->query($sql);
        $order = nv_fix_cat_order($catid_i, $order, $lev);
    }
    $numsubcat = $weight;
    if ($parentid > 0) {
        $sql = 'UPDATE ' . NV_PREFIXLANG . '_' . $module_data . '_cat SET numsubcat=' . $numsubcat;
        if ($numsubcat == 0) {
            $sql .= ",subcatid='', viewcat='viewcat_page_new'";
        } else {
            $sql .= ",subcatid='" . implode(',', $array_cat_order) . "'";
        }
        $sql .= ' WHERE catid=' . intval($parentid);
        $db->query($sql);
    }
    return $order;
}
开发者ID:hongoctrien,项目名称:nukeviet,代码行数:44,代码来源:admin.functions.php

示例3: nv_fix_cat_order

function nv_fix_cat_order($parentid = 0, $order = 0, $lev = 0)
{
    global $db, $db_config, $lang_module, $lang_global, $module_name, $module_data, $op;
    $query = "SELECT `catid`, `parentid` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_cat` WHERE `parentid`=" . $parentid . " ORDER BY `weight` ASC";
    $result = $db->sql_query($query);
    $array_cat_order = array();
    while ($row = $db->sql_fetchrow($result)) {
        $array_cat_order[] = $row['catid'];
    }
    $db->sql_freeresult();
    $weight = 0;
    if ($parentid > 0) {
        $lev++;
    } else {
        $lev = 0;
    }
    foreach ($array_cat_order as $catid_i) {
        $order++;
        $weight++;
        $sql = "UPDATE `" . NV_PREFIXLANG . "_" . $module_data . "_cat` SET `weight`=" . $weight . ", `order`=" . $order . ", `lev`='" . $lev . "' WHERE `catid`=" . intval($catid_i);
        $db->sql_query($sql);
        $order = nv_fix_cat_order($catid_i, $order, $lev);
    }
    $numsubcat = $weight;
    if ($parentid > 0) {
        $sql = "UPDATE `" . NV_PREFIXLANG . "_" . $module_data . "_cat` SET `numsubcat`=" . $numsubcat;
        if ($numsubcat == 0) {
            $sql .= ",`subcatid`='', `viewcat`='viewcat_page_new'";
        } else {
            $sql .= ",`subcatid`='" . implode(",", $array_cat_order) . "'";
        }
        $sql .= " WHERE `catid`=" . intval($parentid);
        $db->sql_query($sql);
    }
    return $order;
}
开发者ID:syphuonglam,项目名称:creative-portal,代码行数:36,代码来源:admin.functions.php

示例4: nv_fix_cat_order

function nv_fix_cat_order($parentid = 0, $order = 0, $lev = 0)
{
    global $db, $db_config, $lang_module, $lang_global, $module_name, $module_data, $op;
    $query = "SELECT catid, parentid FROM " . NV_PREFIXLANG . "_" . $module_data . "_cat WHERE parentid=" . $parentid . " ORDER BY weight ASC";
    $result = $db->query($query);
    $array_cat_order = array();
    while ($row = $result->fetch()) {
        $array_cat_order[] = $row['catid'];
    }
    $db->sqlreset();
    $weight = 0;
    if ($parentid > 0) {
        $lev++;
    } else {
        $lev = 0;
    }
    foreach ($array_cat_order as $catid_i) {
        $order++;
        $weight++;
        $sql = "UPDATE " . NV_PREFIXLANG . "_" . $module_data . "_cat SET weight=" . $weight . ", orders=" . $order . ", lev='" . $lev . "' WHERE catid=" . intval($catid_i);
        $db->query($sql);
        $order = nv_fix_cat_order($catid_i, $order, $lev);
    }
    $numsubcat = $weight;
    if ($parentid > 0) {
        $sql = "UPDATE " . NV_PREFIXLANG . "_" . $module_data . "_cat SET numsubcat=" . $numsubcat;
        if ($numsubcat == 0) {
            $sql .= ",subcatid=''";
        } else {
            $sql .= ",subcatid='" . implode(",", $array_cat_order) . "'";
        }
        $sql .= " WHERE catid=" . intval($parentid);
        $db->query($sql);
    }
    return $order;
}
开发者ID:ngoctu2008,项目名称:nv4_module_laws,代码行数:36,代码来源:admin.functions.php

示例5: while

if ($catid > 0) {
    if ($mod == 'weight' and $new_vid > 0 and (defined('NV_IS_ADMIN_MODULE') or $parentid > 0 and isset($array_cat_admin[$admin_id][$parentid]) and $array_cat_admin[$admin_id][$parentid]['admin'] == 1)) {
        $sql = 'SELECT catid FROM ' . NV_PREFIXLANG . '_' . $module_data . '_cat WHERE catid!=' . $catid . ' AND parentid=' . $parentid . ' ORDER BY weight ASC';
        $result = $db->query($sql);
        $weight = 0;
        while ($row = $result->fetch()) {
            ++$weight;
            if ($weight == $new_vid) {
                ++$weight;
            }
            $sql = 'UPDATE ' . NV_PREFIXLANG . '_' . $module_data . '_cat SET weight=' . $weight . ' WHERE catid=' . $row['catid'];
            $db->query($sql);
        }
        $sql = 'UPDATE ' . NV_PREFIXLANG . '_' . $module_data . '_cat SET weight=' . $new_vid . ' WHERE catid=' . $catid;
        $db->query($sql);
        nv_fix_cat_order();
        $content = 'OK_' . $parentid;
    } elseif (defined('NV_IS_ADMIN_MODULE') or isset($array_cat_admin[$admin_id][$catid]) and $array_cat_admin[$admin_id][$catid]['add_content'] == 1) {
        if ($mod == 'inhome' and ($new_vid == 0 or $new_vid == 1)) {
            $sql = 'UPDATE ' . NV_PREFIXLANG . '_' . $module_data . '_cat SET inhome=' . $new_vid . ' WHERE catid=' . $catid;
            $db->query($sql);
            $content = 'OK_' . $parentid;
        } elseif ($mod == 'numlinks' and $new_vid >= 0 and $new_vid <= 20) {
            $sql = 'UPDATE ' . NV_PREFIXLANG . '_' . $module_data . '_cat SET numlinks=' . $new_vid . ' WHERE catid=' . $catid;
            $db->query($sql);
            $content = 'OK_' . $parentid;
        } elseif ($mod == 'newday' and $new_vid >= 0 and $new_vid <= 10) {
            $sql = 'UPDATE ' . NV_PREFIXLANG . '_' . $module_data . '_cat SET newday=' . $new_vid . ' WHERE catid=' . $catid;
            $db->query($sql);
            $content = 'OK_' . $parentid;
        } elseif ($mod == 'viewcat' and $nv_Request->isset_request('new_vid', 'post')) {
开发者ID:hongoctrien,项目名称:module-videos,代码行数:31,代码来源:change_cat.php

示例6: die

$mid = $nv_Request->get_int('mid', 'post', 0);
$parentid = $nv_Request->get_int('parentid', 'post', 0);
if (empty($id)) {
    die('NO_' . $id);
}
$sql = "SELECT `title` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` WHERE `id`=" . $id . " AND `parentid`=" . $parentid;
$result = $db->sql_query($sql);
if ($db->sql_numrows($result) != 1) {
    die('NO_' . $id);
}
nv_insert_logs(NV_LANG_DATA, $module_name, 'Delete menu item', "Item ID  " . $id, $admin_info['userid']);
$sql = "DELETE FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` WHERE `id`=" . $id . " AND `parentid`=" . $parentid;
$db->sql_query($sql);
if ($db->sql_affectedrows() > 0) {
    nv_del_moduleCache($module_name);
    nv_fix_cat_order($mid);
    // Cap nhat cho bo menu
    $arr_block = array();
    $sql = "SELECT `id` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` WHERE `mid`= " . $mid;
    $result = $db->sql_query($sql);
    while ($row = $db->sql_fetchrow($result)) {
        $arr_block[] = $row['id'];
    }
    $sql = "UPDATE `" . NV_PREFIXLANG . "_" . $module_data . "_menu` SET `menu_item`= '" . implode(",", $arr_block) . "' WHERE `id`=" . $mid;
    $db->sql_query($sql);
    // Cap nhat cho menu cha
    if ($parentid > 0) {
        $sql = "SELECT `subitem` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` WHERE `id`=" . $parentid;
        $result = $db->sql_query($sql);
        if ($db->sql_numrows($result) == 1) {
            list($subitem) = $db->sql_fetchrow($result);
开发者ID:atarubi,项目名称:nuke-viet,代码行数:31,代码来源:del_row.php

示例7: intval

     }
 } else {
     if ($db->sql_numrows($db->sql_query("SELECT `title` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` WHERE `title`=" . $db->dbescape($post['title']) . " AND `parentid`=" . $post['parentid'] . " AND `mid`=" . $post['mid'] . " AND `id` NOT IN (" . $post['id'] . ")")) != 0) {
         $error = $lang_module['title_exit_cat'];
     } else {
         $sql = "UPDATE `" . NV_PREFIXLANG . "_" . $module_data . "_rows` SET\n\t\t\t\t`parentid`=" . intval($post['parentid']) . ", \n\t\t\t\t`mid`=" . intval($post['mid']) . ",\n\t\t\t\t`title`=" . $db->dbescape($post['title']) . ",\n\t\t\t\t`link`=" . $db->dbescape($post['link']) . ",\n\t\t\t\t`note`=" . $db->dbescape($post['note']) . ",\n\t\t\t\t`who_view`=" . intval($post['who_view']) . " ,\n\t\t\t\t`groups_view`=" . $db->dbescape($post['groups_view']) . ",\n\t\t\t\t`module_name`=" . $db->dbescape($post['module_name']) . ",\t\n\t\t\t\t`op`=" . $db->dbescape($post['op']) . ",\n\t\t\t\t`target`=" . intval($post['target']) . ",\n\t\t\t\t`css`=" . $db->dbescape($post['css']) . ", \n\t\t\t\t`active_type`=" . intval($post['active_type']) . "\n\t\t\tWHERE `id`=" . intval($post['id']);
         if ($db->sql_query($sql)) {
             if ($pa_old != $post['parentid']) {
                 list($weight) = $db->sql_fetchrow($db->sql_query("SELECT max(`weight`) FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` WHERE `mid`=" . intval($post['mid']) . " AND `parentid`=" . intval($post['parentid'] . " ")));
                 $weight = intval($weight) + 1;
                 $sql = "UPDATE `" . NV_PREFIXLANG . "_" . $module_data . "_rows` SET `weight`=" . intval($weight) . " WHERE `id`=" . intval($post['id']);
                 $db->sql_query($sql);
             }
             nv_fix_cat_order($post['mid']);
             if ($post['mid'] != $mid_old) {
                 nv_fix_cat_order($mid_old);
                 $arr_block = array();
                 $sql = "SELECT `id` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` WHERE `mid`=" . $post['mid'];
                 $result = $db->sql_query($sql);
                 while ($row = $db->sql_fetchrow($result)) {
                     $arr_block[] = $row['id'];
                 }
                 $sql = "UPDATE `" . NV_PREFIXLANG . "_" . $module_data . "_menu` SET `menu_item`= '" . implode(",", $arr_block) . "' WHERE `id`=" . $post['mid'];
                 $db->sql_query($sql);
                 $arr_block = array();
                 $sql = "SELECT `id` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` WHERE `mid`= " . $mid_old;
                 $result = $db->sql_query($sql);
                 while ($row = $db->sql_fetchrow($result)) {
                     $arr_block[] = $row['id'];
                 }
                 $sql = "UPDATE `" . NV_PREFIXLANG . "_" . $module_data . "_menu` SET `menu_item`='" . implode(",", $arr_block) . "' WHERE `id`=" . $mid_old;
开发者ID:atarubi,项目名称:nuke-viet,代码行数:31,代码来源:add_menu.php


注:本文中的nv_fix_cat_order函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。