/**
 * GetCatidInParent()
 *
 * @param mixed $category_id
 * @param integer $check_inhome
 * @return
 */
function GetCatidInParent($category_id, $check_inhome = 0)
{
    global $global_photo_cat, $array_cat;
    $array_cat[] = $category_id;
    $subcatid = explode(',', $global_photo_cat[$category_id]['subcatid']);
    if (!empty($subcatid)) {
        foreach ($subcatid as $id) {
            if ($id > 0) {
                if ($global_photo_cat[$id]['numsubcat'] == 0) {
                    if (!$check_inhome or $check_inhome and $global_photo_cat[$id]['inhome'] == 1) {
                        $array_cat[] = $id;
                    }
                } else {
                    $array_cat_temp = GetCatidInParent($id, $check_inhome);
                    foreach ($array_cat_temp as $catid_i) {
                        if (!$check_inhome or $check_inhome and $global_photo_cat[$catid_i]['inhome'] == 1) {
                            $array_cat[] = $catid_i;
                        }
                    }
                }
            }
        }
    }
    return array_unique($array_cat);
}
/**
 * GetCatidInParent()
 *
 * @param mixed $catid
 * @return
 */
function GetCatidInParent($catid)
{
    global $list_cats;
    $array_cat = array();
    $array_cat[] = $catid;
    $subcatid = explode(',', $list_cats[$catid]['subcatid']);
    if (!empty($subcatid)) {
        foreach ($subcatid as $id) {
            if ($id > 0) {
                if ($list_cats[$id]['numsubcat'] == 0) {
                    $array_cat[] = (int) $id;
                } else {
                    $array_cat_temp = GetCatidInParent($id);
                    foreach ($array_cat_temp as $catid_i) {
                        $array_cat[] = (int) $catid_i;
                    }
                }
            }
        }
    }
    return array_unique($array_cat);
}
Exemple #3
0
    $alias = $global_array_cat[$catid]['alias'];
    $description = $global_array_cat[$catid]['description'];
    $descriptionhtml = $global_array_cat[$catid]['descriptionhtml'];
    $viewdescription = $global_array_cat[$catid]['viewdescription'];
    $image = $global_array_cat[$catid]['image'];
    $keywords = $global_array_cat[$catid]['keywords'];
    $groups_view = $global_array_cat[$catid]['groups_view'];
    $featured = $global_array_cat[$catid]['featured'];
    if (!defined('NV_IS_ADMIN_MODULE')) {
        if (!(isset($array_cat_admin[$admin_id][$parentid]) and $array_cat_admin[$admin_id][$parentid]['admin'] == 1)) {
            Header('Location: ' . NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $op . '&parentid=' . $parentid);
            die;
        }
    }
    $caption = $lang_module['edit_cat'];
    $array_in_cat = GetCatidInParent($catid);
} else {
    $caption = $lang_module['add_cat'];
    $array_in_cat = array();
}
$savecat = $nv_Request->get_int('savecat', 'post', 0);
if (!empty($savecat)) {
    $catid = $nv_Request->get_int('catid', 'post', 0);
    $parentid_old = $nv_Request->get_int('parentid_old', 'post', 0);
    $parentid = $nv_Request->get_int('parentid', 'post', 0);
    $title = $nv_Request->get_title('title', 'post', '', 1);
    $titlesite = $nv_Request->get_title('titlesite', 'post', '', 1);
    $keywords = $nv_Request->get_title('keywords', 'post', '', 1);
    $description = $nv_Request->get_string('description', 'post', '');
    $description = nv_nl2br(nv_htmlspecialchars(strip_tags($description)), '<br />');
    $descriptionhtml = $nv_Request->get_editor('descriptionhtml', '', NV_ALLOWED_HTML_TAGS);
$lang_global['description_suggest_max'] = sprintf($lang_global['length_suggest_max'], 160);
$xtpl = new XTemplate('content.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file);
$xtpl->assign('LANG', $lang_module);
$xtpl->assign('GLANG', $lang_global);
$xtpl->assign('rowcontent', $rowcontent);
$xtpl->assign('NV_BASE_ADMINURL', NV_BASE_ADMINURL);
$xtpl->assign('NV_NAME_VARIABLE', NV_NAME_VARIABLE);
$xtpl->assign('NV_OP_VARIABLE', NV_OP_VARIABLE);
$xtpl->assign('MODULE_NAME', $module_name);
$xtpl->assign('OP', $op);
$xtpl->assign('module_name', $module_name);
foreach ($global_array_cat as $catid_i => $array_value) {
    if (defined('NV_IS_ADMIN_MODULE')) {
        $check_show = 1;
    } else {
        $array_cat = GetCatidInParent($catid_i);
        $check_show = array_intersect($array_cat, $array_cat_check_content);
    }
    if (!empty($check_show)) {
        $space = intval($array_value['lev']) * 30;
        $xtitle_i = '';
        $lev_i = $array_value['lev'];
        if ($lev_i > 0) {
            $xtitle_i .= '&nbsp;&nbsp;&nbsp;|';
            for ($i = 1; $i <= $lev_i; ++$i) {
                $xtitle_i .= '---';
            }
            $xtitle_i .= '>&nbsp;';
        }
        $catiddisplay = (sizeof($array_catid_in_row) > 1 and in_array($catid_i, $array_catid_in_row)) ? '' : ' display: none;';
        $temp = array('catid' => $catid_i, 'space' => $space, 'title' => $xtitle_i . $array_value['title'], 'disabled' => !in_array($catid_i, $array_cat_check_content) ? ' disabled="disabled"' : '', 'selected' => in_array($catid_i, $array_catid_in_row) ? ' selected="selected"' : '', 'catidchecked' => $catid_i == $rowcontent['catid'] ? ' selected="selected"' : '', 'catiddisplay' => $catiddisplay);
Exemple #5
0
// List file
$page_title = $lang_module['download_filemanager'];
$where = array();
$base_url = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name;
$array_search = array('q' => $nv_Request->get_title('q', 'get', ''), 'catid' => $nv_Request->get_int('catid', 'get', 0), 'active' => $nv_Request->get_int('active', 'get', '-1'), 'per_page' => $nv_Request->get_int('per_page', 'get', '30'));
if (empty($list_cats)) {
    Header('Location: ' . NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=cat-content');
    exit;
}
if (!empty($array_search['q'])) {
    $base_url .= '&q=' . $array_search['q'];
    $where[] = '(title LIKE "%' . $array_search['q'] . '%" OR description LIKE "%' . $array_search['q'] . '%" OR introtext LIKE "%' . $array_search['q'] . '%" OR author_name LIKE "%' . $array_search['q'] . '%" OR author_email LIKE "%' . $array_search['q'] . '%")';
}
if (!empty($array_search['catid'])) {
    $base_url .= '&catid=' . $array_search['catid'];
    $where[] = 'catid IN (' . implode(',', GetCatidInParent($array_search['catid'])) . ')';
}
if ($array_search['active'] >= 0) {
    $base_url .= '&active=' . $array_search['active'];
    $where[] = 'status=' . $array_search['active'];
}
$db->sqlreset()->select('COUNT(*)')->from(NV_MOD_TABLE);
if (!empty($where)) {
    $db->where(implode(' AND ', $where));
}
$num_items = $db->query($db->sql())->fetchColumn();
$page = $nv_Request->get_int('page', 'get', 1);
$per_page = $array_search['per_page'];
$db->select('*')->order('uploadtime DESC')->limit($per_page)->offset(($page - 1) * $per_page);
$result2 = $db->query($db->sql());
$array = array();
}
$groups_download = explode(',', $array['groups_download']);
$array['groups_download'] = array();
foreach ($groups_list as $key => $title) {
    $array['groups_download'][] = array('key' => $key, 'title' => $title, 'checked' => in_array($key, $groups_download) ? ' checked="checked"' : '');
}
$xtpl = new XTemplate('cat_add.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file);
$xtpl->assign('FORM_ACTION', $form_action);
$xtpl->assign('LANG', $lang_module);
$xtpl->assign('DATA', $array);
$xtpl->assign('ONCHANGE', $catid ? '' : 'onchange="get_alias();"');
if (!empty($error)) {
    $xtpl->assign('ERROR', $error);
    $xtpl->parse('main.error');
}
$list_catsubs = GetCatidInParent($catid);
foreach ($list_cats as $_catid => $value) {
    if (!in_array($_catid, $list_catsubs)) {
        $value['space'] = '';
        if ($value['lev'] > 0) {
            for ($i = 1; $i <= $value['lev']; $i++) {
                $value['space'] .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
            }
        }
        $value['selected'] = $_catid == $array['parentid'] ? ' selected="selected"' : '';
        $xtpl->assign('LISTCATS', $value);
        $xtpl->parse('main.parentid');
    }
}
foreach ($array['groups_view'] as $group) {
    $xtpl->assign('GROUPS_VIEW', $group);
Exemple #7
0
                }
                die($content);
            }
        }
    }
    die($lang_module['rating_error1']);
}
$page_title = $mod_title = $module_info['custom_title'];
$key_words = $module_info['keywords'];
$viewcat = $download_config['indexfile'];
$contents = '';
if ($viewcat == 'viewcat_main_bottom') {
    $array_cats = array();
    foreach ($list_cats as $value) {
        if (empty($value['parentid'])) {
            $array_cat = GetCatidInParent($value['id']);
            $db->sqlreset()->select('COUNT(*)')->from(NV_MOD_TABLE)->where('status=1 AND catid IN (' . implode(',', $array_cat) . ')');
            $num_items = $db->query($db->sql())->fetchColumn();
            if ($num_items) {
                $db->select('id, catid, title, alias, introtext , uploadtime, author_name, filesize, fileimage, view_hits, download_hits, comment_hits');
                $db->order('uploadtime DESC');
                $db->limit($value['numlink']);
                $result = $db->query($db->sql());
                $array_item = array();
                while ($row = $result->fetch()) {
                    $uploadtime = (int) $row['uploadtime'];
                    if ($uploadtime >= $today) {
                        $uploadtime = $lang_module['today'] . ', ' . date('H:i', $row['uploadtime']);
                    } elseif ($uploadtime >= $yesterday) {
                        $uploadtime = $lang_module['yesterday'] . ', ' . date('H:i', $row['uploadtime']);
                    } else {
Exemple #8
0
$key_words = $module_info['keywords'];
$base_url = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name;
$base_url_rewrite = nv_url_rewrite($base_url, true);
$page_url_rewrite = $page ? nv_url_rewrite($base_url . '/page-' . $page, true) : $base_url_rewrite;
$request_uri = $_SERVER['REQUEST_URI'];
if (!($home or $request_uri == $base_url_rewrite or $request_uri == $page_url_rewrite or NV_MAIN_DOMAIN . $request_uri == $base_url_rewrite or NV_MAIN_DOMAIN . $request_uri == $page_url_rewrite)) {
    $redirect = '<meta http-equiv="Refresh" content="3;URL=' . $base_url_rewrite . '" />';
    nv_info_die($lang_global['error_404_title'], $lang_global['error_404_title'], $lang_global['error_404_content'] . $redirect);
}
if ($module_config[$module_name]['home_view'] == 'home_view_grid_by_cat') {
    $array_cate = array();
    if (!empty($global_photo_cat)) {
        foreach ($global_photo_cat as $_category_id => $category) {
            if ($category['parent_id'] == 0 and $category['inhome'] != 0 and $category['status'] != 0) {
                $array_cat = array();
                $array_cat = GetCatidInParent($_category_id, true);
                // Fetch Limit
                $db->sqlreset()->select('COUNT(*)')->from(TABLE_PHOTO_NAME . '_album')->where('category_id IN (' . implode(',', $array_cat) . ') AND status =1');
                $num_count = $db->query($db->sql())->fetchColumn();
                $db->sqlreset()->select('a.album_id, a.category_id, a.name, a.alias, a.capturelocal, a.description, a.num_photo, a.date_added, a.viewed, a.author, r.file, r.thumb')->from(TABLE_PHOTO_NAME . '_album a')->join('LEFT JOIN  ' . TABLE_PHOTO_NAME . '_rows r ON ( a.album_id = r.album_id )')->where(' a.status =1 AND r.defaults = 1 AND a.category_id IN (' . implode(',', $array_cat) . ' )')->order('a.album_id DESC')->limit($category['numlinks']);
                $result = $db->query($db->sql());
                $array_content = array();
                while (list($album_id, $category_id, $name, $alias, $capturelocal, $description, $num_photo, $date_added, $viewed, $author_id, $file, $thumb) = $result->fetch(3)) {
                    $sql = 'SELECT userid, username, first_name, last_name, photo FROM ' . NV_USERS_GLOBALTABLE . ' WHERE active=1 AND userid= ' . $author_id;
                    $array_user = nv_db_cache($sql, 'userid', $module_name);
                    if (!empty($array_user)) {
                        foreach ($array_user as $array_user_i) {
                            if (!empty($array_user_i['first_name']) && !empty($array_user_i['last_name'])) {
                                $author_upload = $array_user_i['first_name'] . ' ' . $array_user_i['last_name'];
                            } else {
                                $author_upload = $array_user_i['username'];
Exemple #9
0
         } else {
             $thumb = NV_BASE_SITEURL . 'themes/' . $module_info['template'] . '/images/' . $module_file . '/no-image.jpg';
         }
         $data_content[] = array('id' => $id, 'listcatid' => $listcatid, 'publtime' => $publtime, 'title' => $title, 'alias' => $alias, 'hometext' => $hometext, 'homeimgalt' => $homeimgalt, 'homeimgthumb' => $thumb, 'product_price' => $product_price, 'product_number' => $product_number, 'product_code' => $product_code, 'discount_id' => $discount_id, 'money_unit' => $money_unit, 'showprice' => $showprice, 'newday' => $global_array_shops_cat[$listcatid]['newday'], 'gift_content' => $gift_content, 'gift_from' => $gift_from, 'gift_to' => $gift_to, 'link_pro' => NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $global_array_shops_cat[$listcatid]['alias'] . '/' . $alias . $global_config['rewrite_exturl'], 'link_order' => NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=setcart&amp;id=' . $id);
     }
     if (empty($data_content) and $page > 1) {
         Header('Location: ' . nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name, true));
         exit;
     }
     $base_url = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name;
     $html_pages = nv_alias_page($page_title, $base_url, $num_items, $per_page, $page);
 } elseif ($pro_config['home_view'] == 'view_home_cat') {
     foreach ($global_array_shops_cat as $catid_i => $array_info_i) {
         if ($array_info_i['parentid'] == 0 and $array_info_i['inhome'] != 0) {
             $array_cat = array();
             $array_cat = GetCatidInParent($catid_i, true);
             // Fetch Limit
             $db->sqlreset()->select('COUNT(*)')->from($db_config['prefix'] . '_' . $module_data . '_rows t1')->where('listcatid IN (' . implode(',', $array_cat) . ') AND inhome=1 AND status =1');
             $num_pro = $db->query($db->sql())->fetchColumn();
             $db->select('id, listcatid, publtime, ' . NV_LANG_DATA . '_title, ' . NV_LANG_DATA . '_alias, ' . NV_LANG_DATA . '_hometext, homeimgalt, homeimgfile, homeimgthumb, product_code, product_number, product_price, money_unit, discount_id, showprice, ' . NV_LANG_DATA . '_gift_content, gift_from, gift_to')->order('id DESC')->limit($array_info_i['numlinks']);
             $result = $db->query($db->sql());
             $data_pro = array();
             while (list($id, $listcatid, $publtime, $title, $alias, $hometext, $homeimgalt, $homeimgfile, $homeimgthumb, $product_code, $product_number, $product_price, $money_unit, $discount_id, $showprice, $gift_content, $gift_from, $gift_to) = $result->fetch(3)) {
                 if ($homeimgthumb == 1) {
                     $thumb = NV_BASE_SITEURL . NV_FILES_DIR . '/' . $module_upload . '/' . $homeimgfile;
                 } elseif ($homeimgthumb == 2) {
                     $thumb = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/' . $homeimgfile;
                 } elseif ($homeimgthumb == 3) {
                     $thumb = $homeimgfile;
                 } else {
                     $thumb = NV_BASE_SITEURL . 'themes/' . $module_info['template'] . '/images/' . $module_file . '/no-image.jpg';
    $search .= " AND product_price BETWEEN " . $price1 . " AND " . $price2 . " ";
} elseif ($price2 == -1 and $price1 >= 0) {
    $search .= " AND product_price >= " . $price1 . " ";
} elseif ($price1 == -1 and $price2 > 0) {
    $search .= " AND product_price < " . $price2 . " ";
}
if (!empty($typemoney)) {
    $search .= " AND money_unit = " . $db->quote($typemoney);
}
$sql_i = ", if(t1.money_unit ='" . $pro_config['money_unit'] . "', t1.product_price , t1.product_price * t2.exchange ) AS product_saleproduct ";
$order_by = " product_saleproduct DESC ";
if (!empty($typemoney)) {
    $search .= " AND money_unit = " . $db->quote($typemoney);
}
if ($cataid != 0) {
    $array_cat = GetCatidInParent($cataid);
    $search .= " AND listcatid IN (" . implode(",", $array_cat) . ") ";
}
if ($sid != 0) {
    $search .= " AND source_id =" . $sid . " ";
}
if (empty($search)) {
    $contents = "<div align =\"center\">" . $lang_module['notresult'] . "</div>";
    include NV_ROOTDIR . '/includes/header.php';
    echo nv_site_theme($contents);
    include NV_ROOTDIR . '/includes/footer.php';
    exit;
}
$show_price = "";
if ($pro_config['active_price']) {
    if (!empty($price1_temp) or !empty($price2_temp)) {
Exemple #11
0
            $i = 0;
            while ($row = $result->fetch()) {
                ++$i;
                $uploadtime = nv_date('d/m/Y H:i', $row['uploadtime']);
                $array_item[] = array('id' => $row['id'], 'title' => $row['title'], 'introtext' => $row['introtext'], 'uploadtime' => $uploadtime, 'author_name' => !empty($row['author_name']) ? $row['author_name'] : $lang_module['unknown'], 'filesize' => !empty($row['filesize']) ? nv_convertfromBytes($row['filesize']) : '', 'imagesrc' => !empty($row['fileimage']) ? NV_BASE_SITEURL . NV_FILES_DIR . $row['fileimage'] : '', 'view_hits' => $row['view_hits'], 'download_hits' => (int) $row['download_hits'], 'comment_hits' => (int) $row['comment_hits'], 'more_link' => NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $list_cats[$row['catid']]['alias'] . '/' . $row['alias'] . $global_config['rewrite_exturl'], 'edit_link' => NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;edit=1&amp;id=' . (int) $row['id'], 'del_link' => NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name);
            }
            $numfile = $db->query('SELECT COUNT(*) FROM ' . NV_MOD_TABLE . ' WHERE catid IN ( ' . implode(',', $array_cat) . ' )')->fetchColumn();
            if ($i) {
                $subs[] = array('catid' => $sub, 'title' => $list_cats[$sub]['title'], 'link' => NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $list_cats[$sub]['alias'], 'description' => $list_cats[$sub]['description'], 'subcats' => $list_cats[$sub]['subcatid'], 'numfile' => $numfile, 'items' => $array_item);
            }
            unset($array_item);
        }
    }
    $contents = theme_viewcat_main($cat_data['viewcat'], $subs, $array, $cat_data, $generate_page);
} elseif ($cat_data['viewcat'] == 'viewcat_list_new') {
    $array_cat = GetCatidInParent($cat_data['id']);
    $db->sqlreset()->select('COUNT(*)')->from(NV_MOD_TABLE)->where('catid IN (' . implode(',', $array_cat) . ') AND status=1');
    $num_items = $db->query($db->sql())->fetchColumn();
    $cat_data['numfile'] = $num_items;
    $db->select('id, catid, title, alias, introtext , uploadtime, author_name, filesize, fileimage, view_hits, download_hits, comment_hits')->order('uploadtime DESC')->limit($per_page)->offset(($page - 1) * $per_page);
    $result = $db->query($db->sql());
    while ($row = $result->fetch()) {
        $cattitle = '<a href="' . NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $list_cats[$row['catid']]['alias'] . '">' . $list_cats[$row['catid']]['title'] . '</a>';
        $uploadtime = (int) $row['uploadtime'];
        if ($uploadtime >= $today) {
            $uploadtime = $lang_module['today'] . ', ' . date('H:i', $row['uploadtime']);
        } elseif ($uploadtime >= $yesterday) {
            $uploadtime = $lang_module['yesterday'] . ', ' . date('H:i', $row['uploadtime']);
        } else {
            $uploadtime = nv_date('d/m/Y H:i', $row['uploadtime']);
        }
 /**
  * nv_filter_product_cat()
  *
  * @return
  */
 function nv_filter_product_cat($block_config)
 {
     global $module_name, $lang_module, $module_info, $site_mods, $module_file, $module_upload, $db, $module_data, $db_config, $id, $catid, $pro_config, $global_config, $global_array_group, $global_array_shops_cat, $nv_Request, $array_id_group, $catid, $op;
     if ($op != 'viewcat') {
         return '';
     }
     $module = $block_config['module'];
     $array_cat = GetCatidInParent($catid);
     $group_style = $block_config['group_style'];
     $xtpl = new XTemplate('block.filter_product_cat.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file);
     $xtpl->assign('LANG', $lang_module);
     $xtpl->assign('CATID', $catid);
     $xtpl->assign('MODULE_URL', nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name, true));
     $xtpl->assign('CAT_ALIAS', $global_array_shops_cat[$catid]['alias']);
     $catid = GetParentCatFilter($catid);
     $result = $db->query('SELECT groupid FROM ' . $db_config['prefix'] . '_' . $site_mods[$module]['module_data'] . '_group_cateid WHERE cateid = ' . $catid);
     $i = 0;
     while (list($groupid) = $result->fetch(3)) {
         $groupinfo = $global_array_group[$groupid];
         $groupinfo['key'] = str_replace('-', '_', $groupinfo['alias']);
         $groupinfo['class'] = strtolower($groupinfo['alias']);
         $xtpl->assign('MAIN_GROUP', $groupinfo);
         $subgroup = GetGroupidInParent($groupid, 0, 1);
         if (!empty($subgroup)) {
             foreach ($subgroup as $subgroup_id) {
                 if (!empty($global_array_group[$subgroup_id]['image'])) {
                     $global_array_group[$subgroup_id]['image'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/' . $global_array_group[$subgroup_id]['image'];
                 }
                 $global_array_group[$subgroup_id]['checked'] = '';
                 if ($group_style[$groupid] == 'label') {
                     if (in_array($subgroup_id, $array_id_group)) {
                         $global_array_group[$subgroup_id]['checked'] = 'checked="checked"';
                     }
                 } elseif ($group_style[$groupid] == 'image') {
                     if (in_array($subgroup_id, $array_id_group)) {
                         $global_array_group[$subgroup_id]['checked'] = 'checked="checked"';
                     }
                 }
                 $xtpl->assign('SUB_GROUP', $global_array_group[$subgroup_id]);
                 if ($group_style[$groupid] == 'label') {
                     if (in_array($subgroup_id, $array_id_group)) {
                         $xtpl->parse('main.group.sub_group.loop.label.active');
                     }
                     $xtpl->parse('main.group.sub_group.loop.label');
                 } elseif ($group_style[$groupid] == 'image') {
                     if (in_array($subgroup_id, $array_id_group)) {
                         $xtpl->parse('main.group.sub_group.loop.image.active');
                     }
                     $xtpl->parse('main.group.sub_group.loop.image');
                 } else {
                     $xtpl->parse('main.group.sub_group.loop.checkbox');
                 }
                 $xtpl->parse('main.group.sub_group.loop');
             }
             $xtpl->parse('main.group.sub_group');
         }
         if ($i == 0) {
             $xtpl->parse('main.group.border_top');
         }
         $xtpl->parse('main.group');
         $i++;
     }
     $xtpl->parse('main');
     return $xtpl->text('main');
 }