当前位置: 首页>>代码示例>>PHP>>正文


PHP XoopsBlock::getAllBlocks方法代码示例

本文整理汇总了PHP中XoopsBlock::getAllBlocks方法的典型用法代码示例。如果您正苦于以下问题:PHP XoopsBlock::getAllBlocks方法的具体用法?PHP XoopsBlock::getAllBlocks怎么用?PHP XoopsBlock::getAllBlocks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XoopsBlock的用法示例。


在下文中一共展示了XoopsBlock::getAllBlocks方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: hypconfGetBlocks

function hypconfGetBlocks()
{
    static $ret = null;
    if (!is_null($ret)) {
        return $ret;
    }
    include_once XOOPS_ROOT_PATH . "/class/xoopsblock.php";
    $bobj = new XoopsBlock();
    $blocks = $bobj->getAllBlocks('object', null, true);
    $ret = array();
    if ($blocks) {
        foreach ($blocks as $block) {
            $name = $block->getVar('title') ? $block->getVar('title') : $block->getVar('name');
            $bid = $block->getVar("bid");
            if ($module = hypconfGetModuleName($block->getVar("mid"))) {
                $ret[$module . ':' . $name] = array('confop_value' => $bid, 'confop_name' => $module . ':' . $name);
            }
        }
        ksort($ret);
    }
    return $ret;
}
开发者ID:nouphet,项目名称:rata,代码行数:22,代码来源:admin_func.php

示例2: list

 function plugin_xoopsblock_convert()
 {
     if ($this->root->module['platform'] !== "xoops") {
         return '';
     }
     static $css_show = FALSE;
     list($tgt, $option1, $option2) = array_pad(func_get_args(), 3, "");
     $tgt_bids = array();
     if (!$tgt || $tgt === "?") {
         $tgt = "?";
     } else {
         foreach (explode(",", $tgt) as $_bid) {
             if (preg_match("/^\\d+\$/", $_bid) && $_bid > 0) {
                 $tgt_bids[] = $_bid;
             }
         }
     }
     $align = "left";
     $around = false;
     $width = "";
     $arg = array();
     if (preg_match("/^(left|center|right)\$/i", $option2, $arg)) {
         $align = $arg[1];
     }
     if (preg_match("/^(left|center|right)\$/i", $option1, $arg)) {
         $align = $arg[1];
     }
     if (preg_match("/^(around|float|width)(:?w?([\\d]+%?)(?:px)?)?\$/i", $option2, $arg)) {
         if ($arg[1]) {
             $around = true;
         }
         $width = !strstr($arg[3], "%") ? $arg[3] . "px" : $arg[3];
         $width = "width:" . $width . ";";
     }
     if (preg_match("/^(around|float|width)(:?w?([\\d]+%?)(?:px)?)?\$/i", $option1, $arg)) {
         if ($arg[1]) {
             $around = true;
         }
         $width = !strstr($arg[3], "%") ? $arg[3] . "px" : $arg[3];
         $width = "width:" . $width . ";";
     }
     if ($align === 'center') {
         if (!$width) {
             $width = 'width:auto;';
         }
         $style = ' style="margin-left:auto;margin-right:auto;' . $width . '"';
         $around = false;
     } else {
         $style = ' style="float:' . $align . ';' . $width . '"';
     }
     $clear = $around ? '' : '<div style="clear:both;"></div>';
     global $xoopsUser;
     $xoopsblock = new XoopsBlock();
     $xoopsgroup = new XoopsGroup();
     $arr = array();
     $side = null;
     if ($this->root->userinfo['admin']) {
         $arr = $xoopsblock->getAllBlocks();
     } else {
         if ($xoopsUser) {
             $arr = $xoopsblock->getAllBlocksByGroup($xoopsUser->groups());
         } else {
             $arr = $xoopsblock->getAllBlocksByGroup($this->plugin_xoopsblock_getByType("Anonymous"));
         }
     }
     $ret = "";
     if ($tgt == "?") {
         foreach ($arr as $myblock) {
             $block = array();
             $block_type = @$myblock->getVar("type") ? $myblock->getVar("type") : $myblock->getVar("block_type");
             $name = @$myblock->getVar("title") ? $myblock->getVar("title") : $myblock->getVar("name");
             $bid = $myblock->getVar('bid');
             $ret .= "<li>(" . $bid . ")" . $name . "</li>";
         }
     } else {
         global $xoopsTpl;
         require_once XOOPS_ROOT_PATH . '/class/template.php';
         $xoopsTpl = new XoopsTpl();
         if (is_object($xoopsUser)) {
             $xoopsTpl->assign(array('xoops_isuser' => true, 'xoops_userid' => $xoopsUser->getVar('uid'), 'xoops_uname' => $xoopsUser->getVar('uname'), 'xoops_isadmin' => $xoopsUser->isAdmin()));
         }
         $xoopsTpl->assign('xoops_requesturi', htmlspecialchars($GLOBALS['xoopsRequestUri'], ENT_QUOTES));
         foreach ($tgt_bids as $bid) {
             $myblock = new XoopsBlock($bid);
             $_bid = $myblock->getVar('bid');
             if (!empty($_bid)) {
                 $bcachetime = $myblock->getVar('bcachetime');
                 // Only a guest enable cache. by nao-pon
                 //if (empty($bcachetime)) {
                 if ($bcachetime % 10 == 1) {
                     $bcachetime_guest = TRUE;
                     $bcachetime = $bcachetime - 1;
                 } else {
                     $bcachetime_guest = FALSE;
                 }
                 if (empty($bcachetime) || is_object($xoopsUser) && $bcachetime_guest) {
                     //if (empty($bcachetime)) {
                     $xoopsTpl->xoops_setCaching(0);
                 } else {
                     $xoopsTpl->xoops_setCaching(2);
//.........这里部分代码省略.........
开发者ID:nouphet,项目名称:rata,代码行数:101,代码来源:xoopsblock.inc.php

示例3: array

$new_blocks_array = array();
$blocks_array = XoopsBlock::getAllBlocks("list", XOOPS_SIDEBLOCK_LEFT);
foreach ($blocks_array as $key => $value) {
    $new_blocks_array[$key] = "<a href='" . XOOPS_URL . "/modules/system/admin.php?fct=blocksadmin&amp;op=edit&amp;bid=" . $key . "'>" . $value . " (ID: " . $key . ")</a>";
}
$r_lblock_checkbox->addOptionArray($new_blocks_array);
$r_cblock_checkbox = new XoopsFormCheckBox("<b>" . _CENTER . "</b><br />", "read_bids[]", $r_block_value);
$new_blocks_array = array();
$blocks_array = XoopsBlock::getAllBlocks("list", XOOPS_CENTERBLOCK_ALL);
foreach ($blocks_array as $key => $value) {
    $new_blocks_array[$key] = "<a href='" . XOOPS_URL . "/modules/system/admin.php?fct=blocksadmin&amp;op=edit&amp;bid=" . $key . "'>" . $value . " (ID: " . $key . ")</a>";
}
$r_cblock_checkbox->addOptionArray($new_blocks_array);
$r_rblock_checkbox = new XoopsFormCheckBox("<b>" . _RIGHT . "</b><br />", "read_bids[]", $r_block_value);
$new_blocks_array = array();
$blocks_array = XoopsBlock::getAllBlocks("list", XOOPS_SIDEBLOCK_RIGHT);
foreach ($blocks_array as $key => $value) {
    $new_blocks_array[$key] = "<a href='" . XOOPS_URL . "/modules/system/admin.php?fct=blocksadmin&amp;op=edit&amp;bid=" . $key . "'>" . $value . " (ID: " . $key . ")</a>";
}
$r_rblock_checkbox->addOptionArray($new_blocks_array);
$r_block_tray = new XoopsFormElementTray(_AM_BLOCKRIGHTS, "<br /><br />");
$r_block_tray->addElement($r_lblock_checkbox);
$r_block_tray->addElement($r_cblock_checkbox);
$r_block_tray->addElement($r_rblock_checkbox);
$op_hidden = new XoopsFormHidden("op", $op_value);
$fct_hidden = new XoopsFormHidden("fct", "groups");
$submit_button = new XoopsFormButton("", "groupsubmit", $submit_value, "submit");
$form = new XoopsThemeForm($form_title, "groupform", "admin.php");
$form->addElement(new XoopsFormToken(XoopsMultiTokenHandler::quickCreate('groups_' . $op_value)));
$form->addElement($name_text);
$form->addElement($desc_text);
开发者ID:koki-h,项目名称:xoops_utf8,代码行数:31,代码来源:groupform.php

示例4: getAddBlockForm

 function getAddBlockForm($newsletterid, $dispatchid = 0)
 {
     include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
     $form = new XoopsThemeForm(_NL_AM_ADDBLOCK, "blockform", "blocks.php");
     $criteria = new CriteriaCompo(null);
     $criteria->setSort('name');
     if (!file_exists(XOOPS_ROOT_PATH . "/kernel/blockinstance.php")) {
         //Using 2.0.13.2 or lower
         include_once XOOPS_ROOT_PATH . "/class/xoopsblock.php";
         $all_blocks = XoopsBlock::getAllBlocks();
         foreach (array_keys($all_blocks) as $i) {
             $blocks[$all_blocks[$i]->getVar('bid')] = $all_blocks[$i];
         }
     } else {
         $block_handler =& xoops_gethandler('block');
         $blocks =& $block_handler->getObjects($criteria, true);
     }
     $module_handler =& xoops_gethandler('module');
     $modules =& $module_handler->getObjects(null, true);
     $block_select = new XoopsFormSelect(_NL_AM_BLOCKTYPE, 'block_id');
     foreach ($blocks as $block) {
         // Rogue module blocks are known to appear from time to time
         // So we check if the module exists.
         if (isset($modules[$block->getVar('mid')])) {
             $block_arr[$block->getVar('mid')]['modname'] = $modules[$block->getVar('mid')]->getVar('name');
             $block_arr[$block->getVar('mid')]['blocks'][$block->getVar('bid')] = " - " . $block->getVar('name');
             $modnames[$block->getVar('mid')] = $modules[$block->getVar('mid')]->getVar('name');
             $bids[] = $block->getVar('bid');
         }
     }
     array_multisort($modnames, SORT_ASC, $block_arr);
     foreach (array_keys($block_arr) as $i) {
         $block_select->addOption("-" . $i, $block_arr[$i]['modname'], true);
         $block_select->addOptionArray($block_arr[$i]['blocks']);
     }
     $form->addElement($block_select);
     $button_tray = new XoopsFormElementTray('');
     $button_tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
     $form->addElement($button_tray);
     $form->addElement(new XoopsFormHidden("op", "block"));
     $form->addElement(new XoopsFormHidden("id", $newsletterid));
     if ($dispatchid > 0) {
         $form->addElement(new XoopsFormHidden("dispatchid", $dispatchid));
     }
     return $form;
 }
开发者ID:trabisdementia,项目名称:xuups,代码行数:46,代码来源:block.php


注:本文中的XoopsBlock::getAllBlocks方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。