本文整理匯總了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;
}