/** * Mostramos las página existentes */ function qpagesBlockPages($options) { global $xoopsConfig; include_once XOOPS_ROOT_PATH . '/modules/qpages/class/qppage.class.php'; $db =& XoopsDatabaseFactory::getDatabaseConnection(); $mc =& RMUtilities::module_config('qpages'); if (!defined('QP_URL')) { define('QP_URL', XOOPS_URL . ($mc['links'] ? $mc['basepath'] : '/modules/qpages')); } $sql = "SELECT * FROM " . $db->prefix("qpages_pages"); if ($options[0] > 0) { $sql .= " WHERE cat='{$options['0']}'"; } $sql .= " ORDER BY fecha DESC LIMIT 0,{$options['1']}"; $block = array(); $result = $db->query($sql); while ($row = $db->fetchArray($result)) { $page = new QPPage(); $page->assignVars($row); $rtn = array(); $rtn['id'] = $page->getID(); $rtn['titulo'] = $page->getTitle(); $rtn['link'] = $page->getPermaLink(); $block['pages'][] = $rtn; } return $block; }
function clonePage() { $id = rmc_server_var($_GET, 'id', 0); $page = new QPPage($id); if ($page->isNew()) { redirectMsg('pages.php', __('Specified page does not exists!', 'qpages'), 1); die; } $page->setNew(); $page->setTitle($page->getTitle() . ' [cloned]'); $page->setFriendTitle(TextCleaner::sweetstring($page->getTitle())); if (!$page->save()) { redirectMsg('pages.php', __('Page could not be cloned!', 'qpages'), 1); die; } redirectMsg('pages.php?op=edit&id=' . $page->getID(), __('Page cloned successfully!', 'qpages'), 0); }
$pagetitle .= $pagetitle == '' ? $pt[$i] : " « {$pt[$i]}"; } $tpl->assign('page_location', $location); $tpl->assign('page_title', $catego->getName()); $tpl->assign('xoops_pagetitle', $pagetitle); $tpl->assign('lang_pages', sprintf(__('Pages in %s', 'qpages'), $catego->getName())); /** * Cargamos las páginas */ $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();
$leg .= urlencode($page->getTitle() . ' (' . $page->getReads() . ' times)') . "|"; $values .= $page->getReads() . ','; } $values = rtrim($values, ','); $leg = rtrim($leg, "|"); if ($max > 0) { $chart = "http://chart.apis.google.com/chart?"; $chart .= "cht=bvs&chco=99CC00|FFCC00|0099FF|FF6600|6666FF"; $chart .= "&" . $labels . '&' . $values . "&" . $leg; $chart .= "&chbh=a,20&chs=330x300&chxr=1,0," . $max . "&chds=0," . ($max + 1); $chart .= "&chtt=" . urlencode(__('Most viewed pages', 'qpages')); } else { $chart = ''; } // Recent pages $sql = "SELECT * FROM " . $db->prefix("qpages_pages") . " ORDER BY fecha DESC LIMIT 0, 5"; $result = $db->query($sql); $pages = array(); while ($row = $db->fetchArray($result)) { $page = new QPPage(); $page->assignVars($row); $pages[] = array('id' => $page->getID(), 'title' => $page->getTitle(), 'link' => $page->getPermaLink(), 'desc' => $page->getDescription(), 'public' => $page->getAccess()); } RMTemplate::get()->set_help('http://redmexico.com.mx/docs/quickpages'); // Left widgets and right widgets $left_widgets = array(); $left_widgets = RMEvents::get()->run_event('qpages.left.widgets', $left_widgets); $right_widgets = array(); $right_widgets = RMEvents::get()->run_event('qpages.right.widgets', $right_widgets); include RMTemplate::get()->get_template('admin/qp_index.php', 'module', 'qpages'); xoops_cp_footer();