/** * nv_list_cats() * * @param bool $is_link * @param bool $is_parentlink * @return */ function nv_list_cats($is_link = false, $is_parentlink = true) { global $db, $module_data, $module_name, $module_info; $sql = "SELECT * FROM " . NV_PREFIXLANG . "_" . $module_data . "_categories WHERE status=1 ORDER BY parentid,weight ASC"; $result = $db->query($sql); $list = array(); while ($row = $result->fetch()) { if (nv_user_in_groups($row['groups_view'])) { $list[$row['id']] = array('id' => (int) $row['id'], 'title' => $row['title'], 'alias' => $row['alias'], 'description' => $row['description'], 'parentid' => (int) $row['parentid'], 'subcats' => array(), 'keywords' => $row['keywords']); } } $list2 = array(); if (!empty($list)) { foreach ($list as $row) { if (!$row['parentid'] or isset($list[$row['parentid']])) { $list2[$row['id']] = $list[$row['id']]; $list2[$row['id']]['name'] = $list[$row['id']]['title']; if ($is_link) { $list2[$row['id']]['name'] = "<a href=\"" . NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=" . $list2[$row['id']]['alias'] . "\">" . $list2[$row['id']]['name'] . "</a>"; } if ($row['parentid']) { $list2[$row['parentid']]['subcats'][] = $row['id']; $list2[$row['id']]['name'] = nv_setcats($row['parentid'], $list, $list2[$row['id']]['name'], $is_parentlink); } if ($is_parentlink) { $list2[$row['id']]['name'] = "<a href=\"" . NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "\">" . $module_info['custom_title'] . "</a> » " . $list2[$row['id']]['name']; } } } } return $list2; }
/** * nv_list_cats() * * @param bool $is_link * @param bool $is_parentlink * @return */ function nv_list_cats($is_link = false, $is_parentlink = true) { global $module_data, $module_name, $module_info; $sql = "SELECT `id`,`title`,`alias`,`description`,`who_view`,`groups_view`,`who_download`,`groups_download`, `parentid` \n FROM `" . NV_PREFIXLANG . "_" . $module_data . "_categories` WHERE `status`=1 ORDER BY `parentid`,`weight` ASC"; $list = nv_db_cache($sql, 'id'); $list2 = array(); if (!empty($list)) { foreach ($list as $row) { if (nv_set_allow($row['who_view'], $row['groups_view'])) { if (!$row['parentid'] or isset($list[$row['parentid']])) { $list2[$row['id']] = $list[$row['id']]; $list2[$row['id']]['name'] = $list[$row['id']]['title']; $list2[$row['id']]['is_download_allow'] = (int) nv_set_allow($row['who_download'], $row['groups_download']); $list2[$row['id']]['subcats'] = array(); if ($is_link) { $list2[$row['id']]['name'] = "<a href=\"" . NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=" . $list2[$row['id']]['alias'] . "\">" . $list2[$row['id']]['name'] . "</a>"; } if ($row['parentid']) { $list2[$row['parentid']]['subcats'][] = $row['id']; $list2[$row['id']]['name'] = nv_setcats($row['parentid'], $list, $list2[$row['id']]['name'], $is_parentlink); } if ($is_parentlink) { $list2[$row['id']]['name'] = "<a href=\"" . NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "\">" . $module_info['custom_title'] . "</a> » " . $list2[$row['id']]['name']; } } } } } return $list2; }
/** * nv_list_cats() * * @param bool $is_link * @param bool $is_parentlink * @return */ function nv_list_cats($is_link = false, $is_parentlink = true) { global $module_data, $module_name, $module_info; $sql = 'SELECT id,title,alias,description,groups_view,groups_download,viewcat,numlink,parentid FROM ' . NV_PREFIXLANG . '_' . $module_data . '_categories WHERE status=1 ORDER BY parentid,weight ASC'; $list = nv_db_cache($sql, 'id'); $list_cats = array(); if (!empty($list)) { foreach ($list as $row) { if (nv_user_in_groups($row['groups_view'])) { if (!$row['parentid'] or isset($list[$row['parentid']])) { $list_cats[$row['id']] = $list[$row['id']]; $list_cats[$row['id']]['name'] = $list[$row['id']]['title']; $list_cats[$row['id']]['is_download_allow'] = nv_user_in_groups($row['groups_download']); $list_cats[$row['id']]['subcats'] = array(); if ($is_link) { $list_cats[$row['id']]['name'] = '<a href="' . NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $list_cats[$row['id']]['alias'] . '">' . $list_cats[$row['id']]['name'] . '</a>'; } if ($row['parentid']) { if (isset($list_cats[$row['parentid']])) { $list_cats[$row['parentid']]['subcats'][] = $row['id']; } $list_cats[$row['id']]['name'] = nv_setcats($row['parentid'], $list, $list_cats[$row['id']]['name'], $is_parentlink); } if ($is_parentlink) { $list_cats[$row['id']]['name'] = '<a href="' . NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '">' . $module_info['custom_title'] . '</a> » ' . $list_cats[$row['id']]['name']; } } } } } return $list_cats; }
/** * nv_listcats() * * @param mixed $parentid * @param integer $m * @return */ function nv_listcats($parentid, $m = 0) { global $db, $module_data; $sql = "SELECT * FROM `" . NV_PREFIXLANG . "_" . $module_data . "_categories` ORDER BY `parentid`,`weight` ASC"; $result = $db->sql_query($sql); $list = array(); while ($row = $db->sql_fetchrow($result)) { $list[$row['parentid']][] = array('id' => (int) $row['id'], 'parentid' => (int) $row['parentid'], 'title' => $row['title'], 'alias' => $row['alias'], 'description' => $row['description'], 'who_view' => (int) $row['who_view'], 'groups_view' => !empty($row['groups_view']) ? explode(",", $row['groups_view']) : array(), 'weight' => (int) $row['weight'], 'status' => $row['weight'], 'name' => $row['title'], 'selected' => $parentid == $row['id'] ? " selected=\"selected\"" : ""); } if (empty($list)) { return $list; } $list2 = array(); foreach ($list[0] as $value) { if ($value['id'] != $m) { $list2[$value['id']] = $value; if (isset($list[$value['id']])) { $list2 = nv_setcats($list2, $value['id'], $list, $m); } } } return $list2; }
/** * nv_listcats() * * @param mixed $parentid * @param integer $m * @return */ function nv_listcats($parentid, $m = 0) { global $db, $module_data; $sql = 'SELECT * FROM ' . NV_PREFIXLANG . '_' . $module_data . '_categories ORDER BY parentid, weight ASC'; $result = $db->query($sql); $list = array(); while ($row = $result->fetch()) { $list[$row['parentid']][] = array('id' => (int) $row['id'], 'parentid' => (int) $row['parentid'], 'title' => $row['title'], 'alias' => $row['alias'], 'description' => $row['description'], 'groups_view' => !empty($row['groups_view']) ? explode(',', $row['groups_view']) : array(6), 'groups_download' => !empty($row['groups_download']) ? explode(',', $row['groups_download']) : array(6), 'weight' => (int) $row['weight'], 'status' => $row['status'], 'name' => $row['title'], 'selected' => $parentid == $row['id'] ? ' selected="selected"' : ''); } if (empty($list)) { return $list; } $list2 = array(); foreach ($list[0] as $value) { if ($value['id'] != $m) { $list2[$value['id']] = $value; if (isset($list[$value['id']])) { $list2 = nv_setcats($list2, $value['id'], $list, $m); } } } return $list2; }