function qpagesBlockCategos() { global $xoopsConfig, $mc; include_once XOOPS_ROOT_PATH . '/modules/qpages/class/qpcategory.class.php'; include_once XOOPS_ROOT_PATH . '/modules/qpages/include/general.func.php'; $mc =& RMUtilities::module_config('qpages'); $db =& XoopsDatabaseFactory::getDatabaseConnection(); if (!defined('QP_URL')) { define('QP_URL', XOOPS_URL . ($mc['links'] ? $mc['basepath'] : '/modules/qpages')); } $block = array(); $categos = array(); qpArrayCategos($categos); foreach ($categos as $k) { $catego = new QPCategory(); $catego->assignVars($k); $rtn = array(); $rtn['id'] = $catego->getID(); $rtn['nombre'] = $catego->getName(); $rtn['link'] = $catego->getLink(); $rtn['ident'] = $k['saltos'] > 0 ? $k['saltos'] + 8 : 0; $block['categos'][] = $rtn; } return $block; }
$lpages = $catego->loadPages(); $pages = array(); foreach ($lpages as $p) { $ret = array(); $rp = new QPPage(); $rp->assignVars($p); $tpl->append('pages', array('id' => $rp->getID(), 'link' => $rp->getPermaLink(), 'title' => $rp->getTitle(), 'modified' => formatTimestamp($rp->getModDate(), 'l'), 'hits' => $rp->getReads(), 'desc' => $rp->getDescription())); } $tpl->assign('page_count', count($lpages)); unset($pages); // Subcategorias $result = $db->query("SELECT * FROM " . $db->prefix("qpages_categos") . " WHERE parent = " . $catego->getID()); $tpl->assign('subcats_count', $db->getRowsNum($result)); while ($k = $db->fetchArray($result)) { $cat = new QPCategory(); $cat->assignVars($k); $lpages = $cat->loadPages(); $pages = array(); foreach ($lpages as $p) { $page = new QPPage(); $page->assignVars($p); $ret = array(); $ret['titulo'] = $page->getTitle(); $ret['desc'] = $page->getDescription(); $ret['link'] = $page->getPermaLink(); $pages[] = $ret; } $link = $cat->getLink(); $subcats = $cat->getSubcategos(); $tpl->append('categos', array('id' => $cat->getID(), 'nombre' => $cat->getName(), 'desc' => $cat->getDescription(), 'pages_count' => sprintf(__('%u pages', 'qpages'), count($lpages)), 'link' => $link, 'subcats' => count($subcats) > 0 ? $subcats : '', 'subcats_count' => count($subcats))); }
/** * Obtenemos las subcategorías */ public function getSubcategos() { global $mc, $xoopsModule; $result = $this->db->query("SELECT * FROM " . $this->_dbtable . " WHERE parent='" . $this->getID() . "'"); $cats = array(); while ($row = $this->db->fetchArray($result)) { $ret = array(); $ret['id'] = $row['id_cat']; $catego = new QPCategory(); $catego->assignVars($row); $ret['nombre'] = $catego->getName(); $ret['link'] = $catego->getLink(); $ret['desc'] = $catego->getDescription(); $cats[] = $ret; } return $cats; }
// License: GPL 2.0 // -------------------------------------------------------------- $xoopsOption['template_main'] = 'qpages_index.html'; $xoopsOption['module_subpage'] = 'index'; require 'header.php'; $tpl->assign('page_title', $xoopsModule->name()); $location = '<a href="' . QP_URL . '" title="' . $xoopsModule->name() . '">' . __('Main', 'qpages') . '</a>'; $tpl->assign('page_location', $location); $tpl->assign('xoops_pagetitle', $xoopsModule->name() . ' » ' . __('Main', 'qpages')); $tpl->assign('home_text', $mc['texto']); $result = $db->query("SELECT * FROM " . $db->prefix("qpages_categos") . " WHERE parent='0' ORDER BY nombre ASC"); $categos = array(); qpArrayCategos($categos); while ($k = $db->fetchArray($result)) { $catego = new QPCategory(); $catego->assignVars($k); $lpages = $catego->loadPages(); $pages = array(); foreach ($lpages as $p) { $ret = array(); $ret['titulo'] = $p['titulo']; $ret['desc'] = TextCleaner::getInstance()->clean_disabled_tags($p['desc']); $ret['link'] = $mc['links'] ? QP_URL . '/' . $p['titulo_amigo'] . '/' : QP_URL . '/page.php?page=' . $p['titulo_amigo']; $pages[] = $ret; } $link = $catego->getLink(); $subcats = $catego->getSubcategos(); $tpl->append('categos', array('id' => $catego->getID(), 'nombre' => $catego->getName(), 'desc' => $catego->getDescription(), 'pages' => $pages, 'pages_count' => count($lpages), 'link' => $link, 'subcats' => count($subcats) > 0 ? $subcats : '', 'subcats_count' => count($subcats))); } $tpl->assign('lang_subcats', __('Subcategories', 'qpages')); $tpl->assign('lang_pagesin', __('Pages in this category', 'qpages'));