本文整理汇总了PHP中XoopsBlock::assignVar方法的典型用法代码示例。如果您正苦于以下问题:PHP XoopsBlock::assignVar方法的具体用法?PHP XoopsBlock::assignVar怎么用?PHP XoopsBlock::assignVar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XoopsBlock
的用法示例。
在下文中一共展示了XoopsBlock::assignVar方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
redirect_header('myblocksadmin.php', 4, 'Invalid block');
}
if (empty($_POST['options'])) {
$options = array();
} else {
if (is_array($_POST['options'])) {
$options = $_POST['options'];
} else {
$options = explode('|', $_POST['options']);
}
}
// for backward compatibility
// $cblock =& $block->clone(); or $cblock =& $block->xoopsClone();
$cblock = new XoopsBlock();
foreach ($block->vars as $k => $v) {
$cblock->assignVar($k, $v['value']);
}
$cblock->setNew();
$myts =& MyTextSanitizer::getInstance();
$cblock->setVar('side', $_POST['bside']);
$cblock->setVar('weight', $_POST['bweight']);
$cblock->setVar('visible', $_POST['bvisible']);
$cblock->setVar('title', $_POST['btitle']);
$cblock->setVar('content', @$_POST['bcontent']);
$cblock->setVar('c_type', @$_POST['bctype']);
$cblock->setVar('bcachetime', $_POST['bcachetime']);
if (isset($options) && count($options) > 0) {
$options = implode('|', $options);
$cblock->setVar('options', $options);
}
$cblock->setVar('bid', 0);
示例2: intval
function do_clone($bid)
{
$bid = intval($bid);
$request = $this->fetchRequest4Block($bid);
$block = new XoopsBlock($bid);
if (!$block->getVar('bid')) {
die('Invalid bid');
}
if (!$this->canClone($block)) {
die('Invalid block_type');
}
if (empty($_POST['options'])) {
$options = array();
} else {
if (is_array($_POST['options'])) {
$options = $_POST['options'];
} else {
$options = explode('|', $_POST['options']);
}
}
// for backward compatibility
// $cblock =& $block->clone(); or $cblock =& $block->xoopsClone();
$cblock = new XoopsBlock();
foreach ($block->vars as $k => $v) {
$cblock->assignVar($k, $v['value']);
}
$cblock->setNew();
$cblock->setVar('bid', 0);
$cblock->setVar('block_type', $block->getVar('block_type') == 'C' ? 'C' : 'D');
$cblock->setVar('func_num', $this->find_func_num_vacancy($block->getVar('mid')));
// store the block into DB as a new one
$newbid = $cblock->store();
if (!$newbid) {
return $cblock->getHtmlErrors();
}
// update the block by the request
$this->update_block($newbid, $request['side'], $request['weight'], $request['visible'], $request['title'], $request['content'], $request['ctype'], $request['bcachetime'], is_array(@$_POST['options']) ? $_POST['options'] : array());
// block_module_link update
$this->updateBlockModuleLink($newbid, $request['bmodule']);
// group_permission update
$this->updateBlockReadGroupPerm($newbid, $request['bgroup']);
return _MD_A_MYBLOCKSADMIN_DBUPDATED;
}