當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。