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


PHP Module::getActiveBlocks方法代码示例

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


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

示例1: header

/**
 * Defined in session.php
 *
 * @global Tree $WT_TREE
 */
global $WT_TREE;
use Fisharebest\Webtrees\Controller\PageController;
use Fisharebest\Webtrees\Module\CkeditorModule;
define('WT_SCRIPT_NAME', 'block_edit.php');
require './includes/session.php';
$block_id = Filter::getInteger('block_id');
$block = Database::prepare("SELECT SQL_CACHE * FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOneRow();
// Check access.  (1) the block must exist and be enabled, (2) gedcom blocks require
// managers, (3) user blocks require the user or an admin
$blocks = Module::getActiveBlocks($WT_TREE);
if (!$block || !array_key_exists($block->module_name, $blocks) || $block->gedcom_id && !Auth::isManager(Tree::findById($block->gedcom_id)) || $block->user_id && $block->user_id != Auth::id() && !Auth::isAdmin()) {
    header('Location: ' . WT_BASE_URL);
    return;
}
$block = $blocks[$block->module_name];
if (Filter::post('save')) {
    $ctype = Filter::post('ctype', 'user', 'gedcom');
    header('Location: ' . WT_BASE_URL . 'index.php?ctype=' . $ctype . '&ged=' . $WT_TREE->getNameUrl());
    $block->configureBlock($block_id);
    return;
}
$ctype = FIlter::get('ctype', 'user', 'gedcom');
$controller = new PageController();
$controller->setPageTitle(I18N::translate('Configure') . ' — ' . $block->getTitle())->pageHeader();
if (Module::getModuleByName('ckeditor')) {
开发者ID:tunandras,项目名称:webtrees,代码行数:30,代码来源:block_edit.php

示例2: callBlock

 /**
  * Create any of the other blocks.
  *
  * Use as #callBlock:block_name#
  *
  * @param string[] $params
  *
  * @return string
  */
 public function callBlock($params = array())
 {
     global $ctype;
     if (isset($params[0]) && $params[0] != '') {
         $block = $params[0];
     } else {
         return '';
     }
     $all_blocks = array();
     foreach (Module::getActiveBlocks($this->tree) as $name => $active_block) {
         if ($ctype == 'user' && $active_block->isUserBlock() || $ctype == 'gedcom' && $active_block->isGedcomBlock()) {
             $all_blocks[$name] = $active_block;
         }
     }
     if (!array_key_exists($block, $all_blocks) || $block == 'html') {
         return '';
     }
     // Build the config array
     array_shift($params);
     $cfg = array();
     foreach ($params as $config) {
         $bits = explode('=', $config);
         if (count($bits) < 2) {
             continue;
         }
         $v = array_shift($bits);
         $cfg[$v] = implode('=', $bits);
     }
     $block = $all_blocks[$block];
     $block_id = Filter::getInteger('block_id');
     $content = $block->getBlock($block_id, false, $cfg);
     return $content;
 }
开发者ID:AlexSnet,项目名称:webtrees,代码行数:42,代码来源:Stats.php

示例3: array

// Define all the icons we're going to use
$IconUarrow = 'icon-uarrow';
$IconDarrow = 'icon-darrow';
if (I18N::direction() === 'ltr') {
    $IconRarrow = 'icon-rarrow';
    $IconLarrow = 'icon-larrow';
    $IconRDarrow = 'icon-rdarrow';
    $IconLDarrow = 'icon-ldarrow';
} else {
    $IconRarrow = 'icon-larrow';
    $IconLarrow = 'icon-rarrow';
    $IconRDarrow = 'icon-ldarrow';
    $IconLDarrow = 'icon-rdarrow';
}
$all_blocks = array();
foreach (Module::getActiveBlocks($WT_TREE) as $name => $block) {
    if ($user_id && $block->isUserBlock() || $gedcom_id && $block->isGedcomBlock()) {
        $all_blocks[$name] = $block;
    }
}
if ($user_id) {
    $blocks = FunctionsDb::getUserBlocks($user_id);
} else {
    $blocks = FunctionsDb::getTreeBlocks($gedcom_id);
}
if ($action === 'update') {
    foreach (array('main', 'side') as $location) {
        if ($location === 'main') {
            $new_blocks = $main;
        } else {
            $new_blocks = $right;
开发者ID:tronsmit,项目名称:webtrees,代码行数:31,代码来源:index_edit.php


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