function mywordsBlockCats($options) { global $xoopsModuleConfig, $xoopsModule; $categos = array(); MWFunctions::categos_list($categos, 0, 0, $options[0]); $block = array(); $mc = $xoopsModule && $xoopsModule->getVar('dirname') == 'mywords' ? $xoopsModuleConfig : RMSettings::module_settings('mywords'); foreach ($categos as $k) { $ret = array(); $cat = new MWCategory(); $cat->assignVars($k); $cat->loadPosts(); $ret['id'] = $cat->id(); $ret['name'] = $cat->getVar('name'); if (isset($options[1]) && $options[1]) { $ret['posts'] = $cat->getVar('posts'); } $ret['indent'] = $k['indent'] * 2; $ret['link'] = $cat->permalink(); $block['categos'][] = $ret; } RMTemplate::get()->add_style('mwblocks.css', 'mywords'); return $block; }
/** * Muestra una lista de las categorías existentes */ function showCategos() { global $tpl, $xoopsSecurity, $xoopsModule, $xoopsSecurity; $row = array(); MWFunctions::categos_list($row); $categories = array(); foreach ($row as $k) { $catego = new MWCategory(); $catego->assignVars($k); $catego->loadPosts(); $categories[] = array('id_cat' => $catego->id(), 'description' => $catego->getVar('description', 'n'), 'posts' => $catego->getVar('posts', '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; } MWFunctions::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\\"', 'mywords') . '"; 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/mywords/descripcion-del-modulo#categorias'); xoops_cp_location('<a href="./">' . $xoopsModule->name() . '</a> » ' . __('Categories', 'mywords')); xoops_cp_header(); $desc = ''; $posts = ''; $parent = ''; $selcat = ''; $new = ''; $name = ''; $shortcut = ''; extract($_GET); include RMTemplate::get()->get_template('admin/mywords_categories.php', 'module', 'mywords'); RMTemplate::get()->assign('xoops_pagetitle', __('Categories Management', 'mywords')); RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.checkboxes.js'); RMTemplate::get()->add_script('../include/js/categories.js'); xoops_cp_footer(); }