本文整理汇总了PHP中Block::getById方法的典型用法代码示例。如果您正苦于以下问题:PHP Block::getById方法的具体用法?PHP Block::getById怎么用?PHP Block::getById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Block
的用法示例。
在下文中一共展示了Block::getById方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cloneBlock
public function cloneBlock()
{
if (!MongoId::isValid($this->param3)) {
throw new Exception('BLOCK NOT FOUND', 404);
}
$block = Block::getById($this->param3);
if (!is_a($block, 'Block')) {
throw new Exception('BLOCK NOT FOUND', 404);
}
$block->resetId();
$nbCopy = KLib\MongoDB::count(array('key' => $block->getKey()), 'kn_block');
if ($nbCopy > 1) {
$block->setLabel($block->getLabel() . ' Copy(' . $nbCopy . ')');
} else {
$block->setLabel($block->getLabel() . ' Copy');
}
$block->save();
return array('blockId' => $block->getId());
}
示例2: header
$pc = PileContent::get($_REQUEST['pcID']);
$p = $pc->getPile();
if ($p->isMyPile()) {
$pc->delete();
}
if ($pcID && $_REQUEST['sbURL']) {
header('Location: ' . BASE_URL . $_GET['sbURL']);
exit;
}
//global scrapbooks
} elseif ($_REQUEST['bID'] > 0 && $_REQUEST['arHandle']) {
$bID = intval($_REQUEST['bID']);
$scrapbookHelper = Loader::helper('concrete/scrapbook');
$globalScrapbookC = $scrapbookHelper->getGlobalScrapbookPage();
$globalScrapbookA = Area::get($globalScrapbookC, $_REQUEST['arHandle']);
$block = Block::getById($bID, $globalScrapbookC, $globalScrapbookA);
if ($block) {
//&& $block->getAreaHandle()=='Global Scrapbook'
$bp = new Permissions($block);
if (!$bp->canWrite()) {
throw new Exception(t('Access to block denied'));
} else {
$block->delete(1);
}
}
}
die;
break;
}
}
if ($_REQUEST['processBlock'] && $valt->validate()) {
示例3: rename_block
public function rename_block(){
$valt = Loader::helper('validation/token');
if(!$valt->validate('rename_scrapbook_block')){
$this->set('error', array($valt->getErrorMessage()));
$this->view();
return;
}
$bID=intval($_REQUEST['bID']);
$globalScrapbookC=$this->getCollectionObject();
$scrapbookName = $_REQUEST['scrapbookName'];
$globalScrapbookArea = Area::getOrCreate( $globalScrapbookC, $scrapbookName );
$block=Block::getById($bID, $globalScrapbookC, $globalScrapbookArea);
if($block && strlen($_POST['bName']) ){ //&& $block->getAreaHandle()=='Global Scrapbook'
//this is needed so the cache clears correctly
$bp = new Permissions($block);
if ($bp->canAdmin()) {
$block->setBlockAreaObject($globalScrapbookArea);
$block->updateBlockName( $_POST['bName'], 1 );
}
}
header('Location: ' . View::url('/dashboard/scrapbook', 'view') . '?scrapbookName=' . $scrapbookName);
exit;
}
示例4: rename_block
public function rename_block()
{
$bID = intval($_REQUEST['bID']);
$globalScrapbookC = $this->getCollectionObject();
$scrapbookName = $_REQUEST['scrapbookName'];
$globalScrapbookArea = Area::getOrCreate($globalScrapbookC, $scrapbookName);
$block = Block::getById($bID, $globalScrapbookC, $globalScrapbookArea);
if ($block && strlen($_POST['bName'])) {
//&& $block->getAreaHandle()=='Global Scrapbook'
//this is needed so the cache clears correctly
$bp = new Permissions($block);
if ($bp->canAdmin()) {
$block->setBlockAreaObject($globalScrapbookArea);
$block->updateBlockName($_POST['bName'], 1);
}
}
$this->view();
}