本文整理汇总了PHP中XoopsBlock::getAllByGroupModule方法的典型用法代码示例。如果您正苦于以下问题:PHP XoopsBlock::getAllByGroupModule方法的具体用法?PHP XoopsBlock::getAllByGroupModule怎么用?PHP XoopsBlock::getAllByGroupModule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XoopsBlock
的用法示例。
在下文中一共展示了XoopsBlock::getAllByGroupModule方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: retrieveBlocks
function retrieveBlocks()
{
global $xoopsUser, $xoopsModule, $xoopsConfig;
$startMod = $xoopsConfig['startpage'] == '--' ? 'system' : $xoopsConfig['startpage'];
if (@is_object($xoopsModule)) {
list($mid, $dirname) = array($xoopsModule->getVar('mid'), $xoopsModule->getVar('dirname'));
$isStart = substr($_SERVER['PHP_SELF'], -9) == 'index.php' && $xoopsConfig['startpage'] == $dirname;
} else {
list($mid, $dirname) = array(0, 'system');
$isStart = !@empty($GLOBALS['xoopsOption']['show_cblock']);
}
$groups = @is_object($xoopsUser) ? $xoopsUser->getGroups() : array(XOOPS_GROUP_ANONYMOUS);
$oldzones = array(XOOPS_SIDEBLOCK_LEFT => 'canvas_left', XOOPS_SIDEBLOCK_RIGHT => 'canvas_right', XOOPS_CENTERBLOCK_LEFT => 'page_topleft', XOOPS_CENTERBLOCK_CENTER => 'page_topcenter', XOOPS_CENTERBLOCK_RIGHT => 'page_topright', XOOPS_CENTERBLOCK_BOTTOMLEFT => 'page_bottomleft', XOOPS_CENTERBLOCK_BOTTOM => 'page_bottomcenter', XOOPS_CENTERBLOCK_BOTTOMRIGHT => 'page_bottomright');
foreach ($oldzones as $zone) {
$this->blocks[$zone] = array();
}
if ($this->theme) {
$template =& $this->theme->template;
$backup = array($template->caching, $template->cache_lifetime);
} else {
$template =& new XoopsTpl();
}
$xoopsblock = new XoopsBlock();
$block_arr = array();
$block_arr = $xoopsblock->getAllByGroupModule($groups, $mid, $isStart, XOOPS_BLOCK_VISIBLE);
$template->assign('ezblocks', $block_arr);
//ezsky hack
foreach ($block_arr as $block) {
// ezsky hack start
if ($block->getVar('side') == XOOPS_BLOCK_CALLBACK) {
continue;
}
// ezsky hack end
$side = $oldzones[$block->getVar('side')];
if ($var = $this->buildBlock($block, $template)) {
$this->blocks[$side][$var["id"]] = $var;
}
}
if ($this->theme) {
list($template->caching, $template->cache_lifetime) = $backup;
}
}
示例2: retrieveBlocks
function retrieveBlocks()
{
global $xoopsUser, $xoopsModule, $xoopsConfig;
if (@is_object($xoopsModule)) {
list($mid, $dirname) = array($xoopsModule->getVar('mid'), $xoopsModule->getVar('dirname'));
} else {
list($mid, $dirname) = array(0, 'system');
}
$startMod = $xoopsConfig['startpage'] == '--' ? 'system' : $xoopsConfig['startpage'];
$isStart = substr($_SERVER['SCRIPT_NAME'], -9) == 'index.php' && $startMod == $dirname;
$groups = @is_object($xoopsUser) ? $xoopsUser->getGroups() : array(XOOPS_GROUP_ANONYMOUS);
$oldzones = array(XOOPS_SIDEBLOCK_LEFT => 'canvas_left', XOOPS_SIDEBLOCK_RIGHT => 'canvas_right', XOOPS_CENTERBLOCK_CENTER => 'page_top', XOOPS_CENTERBLOCK_LEFT => 'page_topleft', XOOPS_CENTERBLOCK_RIGHT => 'page_topright');
$xoopsblock = new XoopsBlock();
$block_arr = array();
$block_arr = $xoopsblock->getAllByGroupModule($groups, $mid, $isStart, XOOPS_BLOCK_VISIBLE);
foreach ($block_arr as $block) {
$side = $oldzones[$block->getVar('side')];
if ($var = $this->buildBlock($block)) {
$this->blocks[$side][] = $var;
}
}
}
示例3: list_blocks
function list_blocks()
{
global $xoopsUser, $xoopsConfig;
include_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
//OpenTable();
$selmod = isset($_GET['selmod']) ? intval($_GET['selmod']) : 0;
$selvis = isset($_GET['selvis']) ? intval($_GET['selvis']) : 2;
$selgrp = isset($_GET['selgrp']) ? intval($_GET['selgrp']) : XOOPS_GROUP_USERS;
echo "\r\n <h4 style='text-align:left;'>" . _AM_BADMIN . "</h4>";
echo '<form action="admin.php" method="get">';
$form = "<select size=\"1\" name=\"selmod\" onchange=\"location='" . XOOPS_URL . "/modules/system/admin.php?fct=blocksadmin&selvis={$selvis}&selgrp={$selgrp}&selmod='+this.options[this.selectedIndex].value\">";
$module_handler =& xoops_gethandler('module');
$criteria = new CriteriaCompo(new Criteria('hasmain', 1));
$criteria->add(new Criteria('isactive', 1));
$module_list =& $module_handler->getList($criteria);
$toponlyblock = false;
$module_list[-1] = _AM_TOPPAGE;
$selmod = isset($_GET['selmod']) ? intval($_GET['selmod']) : -1;
ksort($module_list);
foreach ($module_list as $k => $v) {
$sel = '';
if ($k == $selmod) {
$sel = ' selected="selected"';
}
$form .= '<option value="' . $k . '"' . $sel . '>' . $v . '</option>';
}
$form .= '</select> <input type="hidden" name="fct" value="blocksadmin" />';
printf(_AM_SVISIBLEIN, $form);
$member_handler =& xoops_gethandler('member');
$group_list =& $member_handler->getGroupList();
$group_sel = _AM_GROUP . " <select size=\"1\" name=\"selgrp\" onchange=\"location='" . XOOPS_URL . "/modules/system/admin.php?fct=blocksadmin&selvis={$selvis}&selmod={$selmod}&selgrp='+this.options[this.selectedIndex].value\">";
$group_list[0] = '#' . _AM_UNASSIGNED;
// fix for displaying blocks unassigned to any group
foreach ($group_list as $k => $v) {
$sel = '';
if ($k == $selgrp) {
$sel = ' selected="selected"';
}
$group_sel .= '<option value="' . $k . '"' . $sel . '>' . $v . '</option>';
}
$group_sel .= '</select> ';
echo $group_sel;
echo _AM_VISIBLE . " <select size=\"1\" name=\"selvis\" onchange=\"location='" . XOOPS_URL . "/modules/system/admin.php?fct=blocksadmin&selmod={$selmod}&selgrp={$selgrp}&selvis='+this.options[this.selectedIndex].value\">";
$selvis0 = $selvis1 = $selvis2 = "";
switch ($selvis) {
case 0:
$selvis0 = 'selected="selected"';
break;
case 1:
$selvis1 = 'selected="selected"';
break;
case 2:
default:
$selvis2 = 'selected="selected"';
break;
}
echo '<option value="0" ' . $selvis0 . '>' . _NO . '</option>';
echo '<option value="1" ' . $selvis1 . '>' . _YES . '</option>';
echo '<option value="2" ' . $selvis2 . '>' . _ALL . '</option>';
echo '</select> <input type="submit" value="' . _GO . '" name="selsubmit" />';
echo '</form>';
echo "<form action='admin.php' name='blockadmin' method='post'>\r\n <table width='100%' class='outer' cellpadding='4' cellspacing='1'>\r\n <tr valign='middle'><th width='20%'>" . _AM_BLKDESC . "</th><th>" . _AM_TITLE . "</th><th>" . _AM_MODULE . "</th><th align='center' nowrap='nowrap'>" . _AM_SIDE . "<br />" . _LEFT . "-" . _CENTER . "-" . _RIGHT . "</th><th align='center'>" . _AM_WEIGHT . "</th><th align='center'>" . _AM_VISIBLE . "</th><th align='right'>" . _AM_ACTION . "</th></tr>\r\n ";
if ($selvis == 2) {
$selvis = null;
}
if ($selgrp == 0) {
// get blocks that are not assigned to any groups
$block_arr =& XoopsBlock::getNonGroupedBlocks($selmod, $toponlyblock, $selvis, 'b.side,b.weight,b.bid');
} else {
$block_arr =& XoopsBlock::getAllByGroupModule($selgrp, $selmod, $toponlyblock, $selvis, 'b.side,b.weight,b.bid');
}
$block_count = count($block_arr);
$class = 'even';
$module_list2 =& $module_handler->getList();
// for custom blocks
$module_list2[0] = ' ';
foreach (array_keys($block_arr) as $i) {
$sel0 = $sel1 = $ssel0 = $ssel1 = $ssel2 = $ssel3 = $ssel4 = "";
if ($block_arr[$i]->getVar("visible") == 1) {
$sel1 = " checked='checked'";
} else {
$sel0 = " checked='checked'";
}
if ($block_arr[$i]->getVar("side") == XOOPS_SIDEBLOCK_LEFT) {
$ssel0 = " checked='checked'";
} elseif ($block_arr[$i]->getVar("side") == XOOPS_SIDEBLOCK_RIGHT) {
$ssel1 = " checked='checked'";
} elseif ($block_arr[$i]->getVar("side") == XOOPS_CENTERBLOCK_LEFT) {
$ssel2 = " checked='checked'";
} elseif ($block_arr[$i]->getVar("side") == XOOPS_CENTERBLOCK_RIGHT) {
$ssel4 = " checked='checked'";
} elseif ($block_arr[$i]->getVar("side") == XOOPS_CENTERBLOCK_CENTER) {
$ssel3 = " checked='checked'";
}
if ($block_arr[$i]->getVar("title") == "") {
$title = " ";
} else {
$title = $block_arr[$i]->getVar("title");
}
$name = $block_arr[$i]->getVar("name");
//.........这里部分代码省略.........
示例4: list_blocks
function list_blocks()
{
global $xoopsUser, $xoopsConfig, $xoopsDB;
include_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
$module_handler =& xoops_gethandler('module');
$criteria = new CriteriaCompo(new Criteria('hasmain', 1));
$criteria->add(new Criteria('isactive', 1));
// Modules for blocks to be visible in
$display_list = $module_handler->getList($criteria);
unset($criteria);
// Modules generating the blocks
$generator_list = $module_handler->getList();
// for custom blocks
$generator_list[0] = _AM_CUSTOM;
$requests = array("selmod" => -1, "selgen" => 1, "selvis" => -1, "selgrp" => XOOPS_GROUP_USERS);
foreach ($requests as $req => $def) {
if (isset($_GET[$req])) {
${$req} = intval($_GET[$req]);
} elseif (isset($_COOKIE[$req])) {
${$req} = intval($_COOKIE[$req]);
} else {
${$req} = $def;
}
}
echo "<h4>" . _AM_BADMIN . "</h4>";
// For selection of generated by
echo '<form action="admin.php" method="get">';
$form = "<select size=\"1\" name=\"selgen\" onchange=\"location='" . XOOPS_URL . "/modules/system/admin.php?fct=blocksadmin&selmod={$selmod}&selvis={$selvis}&selgrp={$selgrp}&selgen='+this.options[this.selectedIndex].value\">";
$generator_list[-1] = _AM_TYPES;
ksort($generator_list);
foreach ($generator_list as $k => $v) {
$form .= '<option value="' . $k . '"' . ($k == $selgen ? ' selected="selected"' : '') . '>' . $v . '</option>';
}
$form .= '</select> ';
printf(_AM_GENERATOR, $form);
// For selection of visible in
$form = "<select size=\"1\" name=\"selmod\" onchange=\"location='" . XOOPS_URL . "/modules/system/admin.php?fct=blocksadmin&selgen={$selgen}&selvis={$selvis}&selgrp={$selgrp}&selmod='+this.options[this.selectedIndex].value\">";
//$toponlyblock = false;
ksort($display_list);
$display_list_spec[-2] = _AM_TYPES;
$display_list_spec[0] = _AM_ALLPAGES;
$display_list_spec[-1] = _AM_TOPPAGE;
$display_list = $display_list_spec + $display_list;
foreach ($display_list as $k => $v) {
$form .= '<option value="' . $k . '"' . ($k == $selmod ? ' selected="selected"' : '') . '>' . $v . '</option>';
}
$form .= '</select> ';
// <input type="hidden" name="fct" value="blocksadmin" />';
printf(_AM_SVISIBLEIN, $form);
unset($display_list[-2]);
// For selection of group access
$member_handler =& xoops_gethandler('member');
$group_list = $member_handler->getGroupList();
$group_sel = _AM_GROUP . " <select size=\"1\" name=\"selgrp\" onchange=\"location='" . XOOPS_URL . "/modules/system/admin.php?fct=blocksadmin&selgen={$selgen}&selvis={$selvis}&selmod={$selmod}&selgrp='+this.options[this.selectedIndex].value\">";
$group_list[0] = _AM_UNASSIGNED;
$group_list[-1] = _AM_TYPES;
foreach ($group_list as $k => $v) {
$group_sel .= '<option value="' . $k . '"' . ($k == $selgrp ? ' selected="selected"' : '') . '>' . $v . '</option>';
}
$group_sel .= '</select> ';
echo $group_sel;
// For selection of visiblility
echo _AM_VISIBLE . " <select size=\"1\" name=\"selvis\" onchange=\"location='" . XOOPS_URL . "/modules/system/admin.php?fct=blocksadmin&selgen={$selgen}&selmod={$selmod}&selgrp={$selgrp}&selvis='+this.options[this.selectedIndex].value\">";
echo '<option value="0"' . ($selvis == 0 ? ' selected="selected"' : '') . '>' . _NO . '</option>';
echo '<option value="1"' . ($selvis == 1 ? ' selected="selected"' : '') . '>' . _YES . '</option>';
echo '<option value="-1"' . ($selvis == -1 ? ' selected="selected"' : '') . '>' . _AM_TYPES . '</option>';
echo '</select> <input type="hidden" name="fct" value="blocksadmin" /><input type="submit" value="' . _GO . '" name="selsubmit" />';
echo '</form><br />';
echo "<form action='admin.php' name='blockadmin' method='post'>\r\n <table width='100%' class='outer' cellpadding='4' cellspacing='1'>\r\n <tr valign='middle' align='center'>\r\n <th width='15%'>" . _AM_TITLE . "</th>\r\n <th width='20%'>" . _AM_BLKDESC . "</th>\r\n <th width='10%'>" . _AM_MODULE . "</th>\r\n <th width='10%' nowrap='nowrap'>" . _AM_SIDE . "<br />" . _LEFT . "-" . _CENTER . "-" . _RIGHT . "</th>\r\n <th width='10%'>" . _AM_VISIBLEIN . "</th>\r\n <th width='10%'>" . _AM_BCACHETIME . "</th>\r\n <th width='10%'>" . _AM_VISIBLE . "</th>\r\n <th width='10%'>" . _AM_WEIGHT . "</th>\r\n <th>" . _AM_ACTION . "</th>\r\n </tr>\r\n ";
if ($selvis == -1) {
//$selvis = null;
}
$order_block = (isset($selvis) ? "" : "b.visible DESC, ") . "b.side,b.weight,b.bid";
$vis_block = $selvis == -1 ? null : $selvis;
$mod_block = $selmod == -2 ? null : $selmod;
if ($selgrp == 0) {
// get blocks that are not assigned to any groups
$block_arr = XoopsBlock::getNonGroupedBlocks($mod_block, $toponlyblock = false, $vis_block, $order_block);
} else {
$grp_block = $selgrp == -1 ? null : $selgrp;
$block_arr = XoopsBlock::getAllByGroupModule($grp_block, $mod_block, $toponlyblock = false, $vis_block, $order_block);
}
if ($selgen >= 0) {
foreach (array_keys($block_arr) as $bid) {
if ($block_arr[$bid]->getVar("mid") != $selgen) {
unset($block_arr[$bid]);
}
}
}
//xoops_result(array_keys($block_arr));
$block_count = count($block_arr);
$class = 'even';
$block_mod = array();
if ($block_count) {
$sql = 'SELECT block_id, module_id FROM ' . $xoopsDB->prefix('block_module_link') . ' WHERE block_id IN (' . implode(', ', array_keys($block_arr)) . ')';
$result = $xoopsDB->query($sql);
while ($row = $xoopsDB->fetchArray($result)) {
$block_mod[$row['block_id']][] = $row['module_id'];
}
}
//.........这里部分代码省略.........
示例5: htmlspecialchars
$xoopsTpl->assign('xoops_pagetitle', $xoopsModule->getVar('name'));
$xoopsTpl->assign('xoops_dirname', $xoopsModule->getVar('dirname'));
$moduleid = $xoopsModule->getVar('mid');
if (preg_match("/index\\.php\$/i", xoops_getenv('PHP_SELF')) && $xoopsConfig['startpage'] == $xoopsModule->getVar('dirname')) {
$toppage = true;
}
} else {
$xoopsTpl->assign('xoops_pagetitle', htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES));
$xoopsTpl->assign('xoops_dirname', "system");
$moduleid = 0;
if (!empty($xoopsOption['show_cblock'])) {
$toppage = true;
}
}
// Get blocks
$block_arr =& $xoopsblock->getAllByGroupModule($groups, $moduleid, $toppage, XOOPS_BLOCK_VISIBLE);
foreach (array_keys($block_arr) as $i) {
$bcachetime = $block_arr[$i]->getVar('bcachetime');
if (empty($bcachetime)) {
$xoopsTpl->xoops_setCaching(0);
} else {
$xoopsTpl->xoops_setCaching(2);
$xoopsTpl->xoops_setCacheTime($bcachetime);
}
$btpl = $block_arr[$i]->getVar('template') != '' ? $block_arr[$i]->getVar('template') : "system_block_dummy.html";
if (empty($bcachetime) || !$xoopsTpl->is_cached('db:' . $btpl, 'blk_' . $block_arr[$i]->getVar('bid'))) {
$xoopsLogger->addBlock($block_arr[$i]->getVar('name'));
$bresult =& $block_arr[$i]->buildBlock();
if (!$bresult) {
continue;
}
示例6: retrieveBlocks
/**
* xos_logos_PageBuilder::retrieveBlocks()
*
* @return
*/
function retrieveBlocks()
{
global $xoopsConfig;
$xoopsPreload =& XoopsPreload::getInstance();
$startMod = $xoopsConfig['startpage'] == '--' ? 'system' : $xoopsConfig['startpage'];
if (isset($GLOBALS['xoopsModule']) && is_object($GLOBALS['xoopsModule'])) {
list($mid, $dirname) = array($GLOBALS['xoopsModule']->getVar('mid'), $GLOBALS['xoopsModule']->getVar('dirname'));
$isStart = substr($_SERVER['PHP_SELF'], -9) == 'index.php' && $xoopsConfig['startpage'] == $dirname && empty($_SERVER['QUERY_STRING']);
} else {
list($mid, $dirname) = array(0, 'system');
$isStart = !empty($GLOBALS['xoopsOption']['show_cblock']);
}
$groups = isset($GLOBALS['xoopsUser']) && is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : array(XOOPS_GROUP_ANONYMOUS);
$oldzones = array(XOOPS_SIDEBLOCK_LEFT => 'canvas_left', XOOPS_SIDEBLOCK_RIGHT => 'canvas_right', XOOPS_CENTERBLOCK_LEFT => 'page_topleft', XOOPS_CENTERBLOCK_CENTER => 'page_topcenter', XOOPS_CENTERBLOCK_RIGHT => 'page_topright', XOOPS_CENTERBLOCK_BOTTOMLEFT => 'page_bottomleft', XOOPS_CENTERBLOCK_BOTTOM => 'page_bottomcenter', XOOPS_CENTERBLOCK_BOTTOMRIGHT => 'page_bottomright');
foreach ($oldzones as $zone) {
$this->blocks[$zone] = array();
}
if ($this->theme) {
$template =& $this->theme->template;
$backup = array($template->caching, $template->cache_lifetime);
} else {
$template = null;
$template = new XoopsTpl();
}
$xoopsblock = new XoopsBlock();
$block_arr = array();
$block_arr = $xoopsblock->getAllByGroupModule($groups, $mid, $isStart, XOOPS_BLOCK_VISIBLE);
$xoopsPreload->triggerEvent('core.class.theme_blocks.retrieveBlocks', array(&$this, &$template, &$block_arr));
foreach ($block_arr as $block) {
$side = $oldzones[$block->getVar('side')];
if ($var = $this->buildBlock($block, $template)) {
$this->blocks[$side][$var["id"]] = $var;
}
}
if ($this->theme) {
list($template->caching, $template->cache_lifetime) = $backup;
}
}
示例7: XoopsBlock
$xoopsTpl->assign('xoops_banner', xoops_getbanner());
} else {
$xoopsTpl->assign('xoops_banner', ' ');
}
// Weird, but need extra <script> tags for 2.0.x themes
$xoopsTpl->assign('xoops_js', '//--></script><script type="text/javascript" src="' . XOOPS_URL . '/include/xoops.js"></script><script type="text/javascript"><!--');
// get all blocks and assign to smarty
$xoopsblock = new XoopsBlock();
$block_arr = array();
if (is_object($xoopsUser)) {
$xoopsTpl->assign(array('xoops_isuser' => true, 'xoops_userid' => $xoopsUser->getVar('uid'), 'xoops_uname' => $xoopsUser->getVar('uname'), 'xoops_isadmin' => $xoopsUserIsAdmin));
if (!empty($xoopsModule)) {
// set page title
$xoopsTpl->assign(array('xoops_pagetitle' => $xoopsModule->getVar('name'), 'xoops_modulename' => $xoopsModule->getVar('name'), 'xoops_dirname' => $xoopsModule->getVar('dirname')));
if (preg_match("/index\\.php\$/i", xoops_getenv('PHP_SELF')) && $xoopsConfig['startpage'] == $xoopsModule->getVar('dirname')) {
$block_arr =& $xoopsblock->getAllByGroupModule($xoopsUser->getGroups(), $xoopsModule->getVar('mid'), true, XOOPS_BLOCK_VISIBLE);
} else {
$block_arr =& $xoopsblock->getAllByGroupModule($xoopsUser->getGroups(), $xoopsModule->getVar('mid'), false, XOOPS_BLOCK_VISIBLE);
}
} else {
$xoopsTpl->assign('xoops_pagetitle', htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES, _CHARSET));
if (!empty($xoopsOption['show_cblock'])) {
$block_arr =& $xoopsblock->getAllByGroupModule($xoopsUser->getGroups(), 0, true, XOOPS_BLOCK_VISIBLE);
} else {
$block_arr =& $xoopsblock->getAllByGroupModule($xoopsUser->getGroups(), 0, false, XOOPS_BLOCK_VISIBLE);
}
}
} else {
$xoopsTpl->assign(array('xoops_isuser' => false, 'xoops_isadmin' => false));
if (!empty($xoopsModule)) {
// set page title