/** * Muestra una lista de las categorías existentes */ function shop_show_categos() { global $xoopsModule, $xoopsSecurity; $row = array(); ShopFunctions::categos_list($row); $categories = array(); foreach ($row as $k) { $catego = new ShopCategory(); $catego->assignVars($k); $catego->loadProducts(); $categories[] = array('id_cat' => $catego->id(), 'description' => $catego->getVar('description', 'n'), 'products' => $catego->getVar('products', 'n'), 'name' => $catego->getVar('name', 'n'), 'indent' => $k['indent'], 'shortname' => $catego->getVar('shortname', 'n')); } // Categories pagination // Paginamos $limit = 15; if (count($categories) > $limit) { $page = rmc_server_var($_GET, 'page', 1); $page = $page < 1 ? 1 : $page; $limit_c = $page * ($limit - 1); $limit_c = $limit_c > count($categories) - 1 ? count($categories) - 1 : $limit_c; $tpages = ceil(count($categories) / 3); if ($page > $tpages) { $page = $tpages; } $nav = new RMPageNav(count($categories), $limit, $page, 5); $nav->target_url('?page={PAGE_NUM}'); $i = ($page - 1) * $limit; while ($i <= $limit_c) { $pcategories[] = $categories[$i]; $i++; } $categories = $pcategories; } ShopFunctions::include_required_files(); RMTemplate::get()->add_head('<script type="text/javascript"> function cat_del_confirm(cat, id){ var string = "' . __('Do you really want to delete "%s"', 'shop') . '"; string = string.replace("%s", cat); var ret = confirm(string); if (ret){ $("#tblCats input[type=checkbox]").removeAttr("checked"); $("#cat-"+id).attr("checked","checked"); $("#cat-op").val("delete"); $("#tblCats").submit(); } } </script>'); RMTemplate::get()->set_help('http://redmexico.com.mx/docs/minishop/'); xoops_cp_location('<a href="./">' . $xoopsModule->name() . '</a> » ' . __('Categories', 'shop')); xoops_cp_header(); $desc = ''; $posts = ''; $parent = ''; $selcat = ''; $new = ''; $name = ''; $shortcut = ''; extract($_GET); include RMTemplate::get()->get_template('admin/shop_categories.php', 'module', 'shop'); RMTemplate::get()->assign('xoops_pagetitle', __('Categories Management', 'shop')); RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.checkboxes.js'); xoops_cp_footer(); }