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


PHP XoopsBlock::clone方法代码示例

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


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

示例1: array

    $is_custom = $myblock->getVar('block_type') == 'C' || $myblock->getVar('block_type') == 'E' ? true : false;
    $block = array('form_title' => _AM_CLONEBLOCK, 'name' => $myblock->getVar('name'), 'side' => $myblock->getVar('side'), 'weight' => $myblock->getVar('weight'), 'visible' => $myblock->getVar('visible'), 'content' => $myblock->getVar('content', 'N'), 'title' => $myblock->getVar('title', 'E'), 'modules' => $modules, 'is_custom' => $is_custom, 'ctype' => $myblock->getVar('c_type'), 'cachetime' => $myblock->getVar('bcachetime'), 'op' => 'clone_ok', 'bid' => $myblock->getVar('bid'), 'edit_form' => $myblock->getOptions(), 'template' => $myblock->getVar('template'), 'options' => $myblock->getVar('options'));
    echo '<a href="admin.php?fct=blocksadmin">' . _AM_BADMIN . '</a>&nbsp;<span style="font-weight:bold;">&raquo;&raquo;</span>&nbsp;' . _AM_CLONEBLOCK . '<br /><br />';
    include 'blockform.php';
    $form->display();
    xoops_cp_footer();
    exit;
}
if ($op == 'clone_ok') {
    $block = new XoopsBlock($bid);
    if (empty($options)) {
        $options = array();
    } elseif (!is_array($options)) {
        $options = explode('|', $options);
    }
    $clone =& $block->clone();
    if (empty($bmodule)) {
        xoops_cp_header();
        xoops_error(sprintf(_AM_NOTSELNG, _AM_VISIBLEIN));
        xoops_cp_footer();
        exit;
    }
    $clone->setVar('side', $bside);
    $clone->setVar('weight', $bweight);
    $clone->setVar('visible', $bvisible);
    $clone->setVar('title', $btitle);
    $clone->setVar('bcachetime', $bcachetime);
    if (isset($options) && count($options) > 0) {
        $options = implode('|', $options);
        $clone->setVar('options', $options);
    }
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:31,代码来源:blocksadmin.inc.php

示例2: XoopsBlock

 function clone_block_ok($bid, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options)
 {
     global $xoopsUser;
     $block = new XoopsBlock($bid);
     $clone =& $block->clone();
     if (empty($bmodule)) {
         xoops_cp_header();
         xoops_error(sprintf(_AM_NOTSELNG, _AM_VISIBLEIN));
         xoops_cp_footer();
         exit;
     }
     $clone->setVar('side', $bside);
     $clone->setVar('weight', $bweight);
     $clone->setVar('visible', $bvisible);
     $clone->setVar('content', $bcontent);
     //$clone->setVar('title', $btitle);
     $clone->setVar('bcachetime', $bcachetime);
     if (isset($options) && count($options) > 0) {
         $options = implode('|', $options);
         $clone->setVar('options', $options);
     }
     $clone->setVar('bid', 0);
     if ($block->getVar('block_type') == 'C' || $block->getVar('block_type') == 'E') {
         $clone->setVar('block_type', 'E');
     } else {
         $clone->setVar('block_type', 'D');
     }
     $newid = $clone->store();
     if (!$newid) {
         xoops_cp_header();
         $clone->getHtmlErrors();
         xoops_cp_footer();
         exit;
     }
     if ($clone->getVar('template') != '') {
         $tplfile_handler =& xoops_gethandler('tplfile');
         $btemplate =& $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block', $bid);
         if (count($btemplate) > 0) {
             $tplclone =& $btemplate[0]->clone();
             $tplclone->setVar('tpl_id', 0);
             $tplclone->setVar('tpl_refid', $newid);
             $tplman->insert($tplclone);
         }
     }
     $db =& Database::getInstance();
     foreach ($bmodule as $bmid) {
         $sql = 'INSERT INTO ' . $db->prefix('block_module_link') . ' (block_id, module_id) VALUES (' . $newid . ', ' . $bmid . ')';
         $db->query($sql);
     }
     $groups =& $xoopsUser->getGroups();
     $count = count($groups);
     for ($i = 0; $i < $count; $i++) {
         $sql = "INSERT INTO " . $db->prefix('group_permission') . " (gperm_groupid, gperm_itemid, gperm_modid, gperm_name) VALUES (" . $groups[$i] . ", " . $newid . ", 1, 'block_read')";
         $db->query($sql);
     }
     redirect_header('admin.php?fct=blocksadmin&amp;t=' . time(), 1, _AM_DBUPDATED);
 }
开发者ID:amjadtbssm,项目名称:website,代码行数:57,代码来源:blocksadmin.php


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