Skip to content

Commit

Permalink
plugin:xoopsblock formating block list
Browse files Browse the repository at this point in the history
#xoopsblock 又は #xoopsblock(?) で表示される、ブロック一覧をモジュール別にリストアップするようにした。
  • Loading branch information
nao-pon committed Jan 11, 2013
1 parent 0f96b2f commit d78684b
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion xoops_trust_path/modules/xpwiki/plugin/xoopsblock.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,36 @@ function plugin_xoopsblock_convert() {
$arr = $xoopsblock->getAllBlocksByGroup($this->plugin_xoopsblock_getByType("Anonymous"));
}

// for Render mode
if ($this->root->vars['page'] === '#RenderMode') {
$this->root->rtf['disable_render_cache'] = true;
}

$ret = "";

if ($tgt == "?"){
$module_handler =& xoops_gethandler('module');
$module_name = array();
$list = array();
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>";
$mid = $myblock->getVar('mid');
if (! isset($module_name[$mid])) {
$module = $module_handler->get($myblock->getVar('mid'));
$module_name[$mid] = is_object($module)? $module->getVar('name') : 'Custom Block';
unset($module);
}
$list[$module_name[$mid]][] = '<li>('.$bid.') '.$name.'</li>';
}
ksort($list);
$ret = '<ul>';
foreach($list as $key => $val) {
$ret .= '<li>' . $key . '<ul>' . join("\n", $val) . '</ul></li>';
}
$ret .= '</ul>';
} else {
global $xoopsTpl;

Expand Down

0 comments on commit d78684b

Please sign in to comment.