Minahito
minah****@users*****
2005年 12月 10日 (土) 18:50:35 JST
Index: xoops2jp/html/kernel/block.php diff -u xoops2jp/html/kernel/block.php:1.2.8.1 xoops2jp/html/kernel/block.php:1.2.8.2 --- xoops2jp/html/kernel/block.php:1.2.8.1 Wed Oct 19 02:21:03 2005 +++ xoops2jp/html/kernel/block.php Sat Dec 10 18:50:35 2005 @@ -1,5 +1,5 @@ <?php -// $Id: block.php,v 1.2.8.1 2005/10/18 17:21:03 minahito Exp $ +// $Id: block.php,v 1.2.8.2 2005/12/10 09:50:35 minahito Exp $ // ------------------------------------------------------------------------ // // XOOPS - PHP Content Management System // // Copyright (c) 2000 XOOPS.org // @@ -196,6 +196,35 @@ return $block; } + /** + * Create a new block by array that is defined in xoops_version. You must + * be careful that the value that it is returned doesn't have $mid, $func_num + * and $dirname. + * + * @param $info array + * @return object XoopsBlock + */ + function &createByInfo($info) + { + $block=&$this->create(); + + $options=isset($info['options']) ? $info['options'] : null; + $edit_func=isset($info['edit_func']) ? $info['edit_func'] : null; + + $block->setVar('options',$options); + $block->setVar('name',$info['name']); + $block->setVar('title',$info['name']); + $block->setVar('block_type','M'); + $block->setVar('c_type',1); + $block->setVar('func_file',$info['file']); + $block->setVar('show_func',$info['show_func']); + $block->setVar('edit_func',$edit_func); + $block->setVar('template',$info['template']); + $block->setVar('last_modified',time()); + + return $block; + } + /** * retrieve a specific {@link XoopsBlock} *