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


PHP Block::getById方法代码示例

本文整理汇总了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());
 }
开发者ID:monkeytie,项目名称:korona,代码行数:19,代码来源:block.ctrl.php

示例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()) {
开发者ID:VonUniGE,项目名称:concrete5-1,代码行数:31,代码来源:process.php

示例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;
	}
开发者ID:notzen,项目名称:concrete5,代码行数:23,代码来源:controller.php

示例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();
 }
开发者ID:homer6,项目名称:concrete5-mirror,代码行数:18,代码来源:controller.php


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