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


PHP XoopsBlock::setNew方法代码示例

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


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

示例1: test_insertBlock

 public function test_insertBlock()
 {
     $block = new XoopsBlock();
     $block->setNew();
     $instance = new XoopsBlockHandler($this->conn);
     $value = $instance->insertBlock($block);
     $bid = $block->bid();
     $this->assertEquals($bid, $value);
     $value = $instance->get($bid);
     $this->assertEquals($bid, $value->bid());
     $value = $instance->deleteBlock($block);
     $this->assertSame(true, $value);
     $value = $instance->get($bid);
     $this->assertSame(null, $value);
 }
开发者ID:RanLee,项目名称:XoopsCore,代码行数:15,代码来源:blockHandlerTest.php

示例2: create

 /**
  * create a new block
  *
  * @see XoopsBlock
  * @param  bool $isNew is the new block new??
  * @return XoopsBlock XoopsBlock reference to the new block
  **/
 public function create($isNew = true)
 {
     $block = new XoopsBlock();
     if ($isNew) {
         $block->setNew();
     }
     return $block;
 }
开发者ID:geekwright,项目名称:XoopsCore25,代码行数:15,代码来源:block.php

示例3: array

 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);
 $cblock->setVar('block_type', $block_type == 'C' ? 'C' : 'D');
 $cblock->setVar('func_num', 255);
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:31,代码来源:blocksadmin.inc.php

示例4: intval

 function do_edit($bid)
 {
     $bid = intval($bid);
     if ($bid <= 0) {
         // new custom block
         $new_block = new XoopsBlock();
         $new_block->setNew();
         $new_block->setVar('name', $this->get_blockname_from_ctype('C'));
         $new_block->setVar('block_type', 'C');
         $new_block->setVar('func_num', 0);
         $bid = $new_block->store();
         $request = $this->fetchRequest4Block(0);
         // permission copy
         foreach ($GLOBALS['xoopsUser']->getGroups() as $gid) {
             $sql = "INSERT INTO " . $this->db->prefix('group_permission') . " (gperm_groupid, gperm_itemid, gperm_modid, gperm_name) VALUES ({$gid}, {$bid}, 1, 'block_read')";
             $this->db->query($sql);
         }
     } else {
         $request = $this->fetchRequest4Block($bid);
     }
     // update the block by the request
     $msg = $this->update_block($bid, $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($bid, $request['bmodule']);
     // group_permission update
     $this->updateBlockReadGroupPerm($bid, $request['bgroup']);
     return $msg;
 }
开发者ID:BackupTheBerlios,项目名称:peakxoops-svn,代码行数:28,代码来源:MyBlocksAdmin.class.php


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