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


PHP Permissions::canAddBlock方法代码示例

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


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

示例1: add

 public function add($cID, $arHandle, $btID, $action)
 {
     $c = \Page::getByID($cID);
     if (is_object($c) && !$c->isError()) {
         $a = \Area::getOrCreate($c, $arHandle);
         if (is_object($a)) {
             $ap = new \Permissions($a);
             $bt = \BlockType::getByID($btID);
             if (is_object($bt) && $ap->canAddBlock($bt)) {
                 $controller = $bt->getController();
                 return $this->deliverResponse($controller, $action);
             }
         }
     }
     $response = new Response(t('Access Denied'));
     return $response;
 }
开发者ID:Remo,项目名称:concrete5-1,代码行数:17,代码来源:action.php

示例2: foreach

     Loader::model('pile');
     // we're taking an existing block and aliasing it to here
     foreach ($_REQUEST['pcID'] as $pcID) {
         $pc = PileContent::get($pcID);
         $p = $pc->getPile();
         if ($p->isMyPile()) {
             if ($_REQUEST['deletePileContents']) {
                 $pc->delete();
             }
         }
         if ($pc->getItemType() == "BLOCK") {
             $bID = $pc->getItemID();
             $b = Block::getByID($bID);
             $b->setBlockAreaObject($a);
             $bt = BlockType::getByHandle($b->getBlockTypeHandle());
             if ($ap->canAddBlock($bt)) {
                 if (!$bt->includeAll()) {
                     $nvc = $c->getVersionToModify();
                     $b->alias($nvc);
                 } else {
                     $b->alias($c);
                 }
             }
         }
     }
 } else {
     if (isset($_REQUEST['bID'])) {
         if ($_REQUEST['globalBlock']) {
             $scrapbookHelper = Loader::helper('concrete/scrapbook');
             $c1 = $scrapbookHelper->getGlobalScrapbookPage();
             $a1 = Area::get($c1, $_REQUEST['globalScrapbook']);
开发者ID:VonUniGE,项目名称:concrete5-1,代码行数:31,代码来源:process.php

示例3: die

<?php

defined('C5_EXECUTE') or die("Access Denied.");
use Concrete\Block\Form\MiniSurvey;
$miniSurvey = new MiniSurvey();
$bID = $_GET['bID'];
//Permissions Check
$bID = $_REQUEST['bID'];
if ($_GET['cID'] && $_GET['arHandle']) {
    $c = Page::getByID($_GET['cID'], 'RECENT');
    $a = Area::get($c, $_GET['arHandle']);
    if (intval($_GET['bID']) == 0) {
        //add survey mode
        $ap = new Permissions($a);
        $bt = BlockType::getByID($_GET['btID']);
        if (!$ap->canAddBlock($bt)) {
            $badPermissions = true;
        }
    } else {
        //edit survey mode
        // this really ought to be refactored
        if (!$a->isGlobalArea()) {
            $b = Block::getByID($_REQUEST['bID'], $c, $a);
            if ($b->getBlockTypeHandle() == BLOCK_HANDLE_SCRAPBOOK_PROXY) {
                $b = Block::getByID($b->getController()->getOriginalBlockID());
                $b->setBlockAreaObject($a);
                $b->loadNewCollection($c);
                $bID = $b->getBlockID();
            }
        } else {
            $b = Block::getByID($_REQUEST['bID'], Stack::getByName($a->getAreaHandle()), STACKS_AREA_NAME);
开发者ID:meixelsberger,项目名称:concrete5-5.7.0,代码行数:31,代码来源:services.php

示例4: die

<?php 

defined('C5_EXECUTE') or die("Access Denied.");

$c = Page::getByID($_REQUEST['cID']);
$cp = new Permissions($c);
$bt = BlockType::getByID($_REQUEST['btID']);
$a = Area::get($c, $_REQUEST['arHandle']);
if (!is_object($a)) {
	exit;
}
$ap = new Permissions($a);
$canContinue = ($_REQUEST['btask'] == 'alias') ? $ap->canAddBlocks() : $ap->canAddBlock($bt);

if (!$canContinue) {
	exit;
}
	
$c->loadVersionObject('RECENT');
require_once(DIR_FILES_ELEMENTS_CORE . '/dialog_header.php');

if ($ap->canAddBlock($bt)) {
	$cnt = $bt->getController();
	if (!is_a($cnt, 'BlockController')) {
		$jsh = Loader::helper('concrete/interface');
		print '<div class="ccm-error">' . t('Unable to load the controller for this block type. Perhaps it has been moved or removed.') . '</div>';
		print '<br><br>';
		print $jsh->button_js(t('Close'), 'jQuery.fn.dialog.closeTop()', 'left');
	} else {
		$bv = new BlockView();
		$bv->render($bt, 'add', array(
开发者ID:rii-J,项目名称:concrete5-de,代码行数:31,代码来源:add_block_popup.php

示例5: die

<?php  
defined('C5_EXECUTE') or die("Access Denied.");

$miniSurvey= new Minisurvey();

//Permissions Check
if($_GET['cID'] && $_GET['arHandle']){
	$c = Page::getByID($_GET['cID'], 'RECENT');
	$a = Area::get($c, $_GET['arHandle']);  
	if(intval($_GET['bID'])==0){ 
		//add survey mode
		$ap = new Permissions($a);	
		$bt = BlockType::getByID($_GET['btID']);	
		if(!$ap->canAddBlock($bt)) $badPermissions=true;
	}else{
		//edit survey mode
		$b = Block::getByID($_GET['bID'], $c, $a);
		$bp = new Permissions($b);
		if( !$bp->canWrite() ) $badPermissions=true;
	}
}else $badPermissions=true;
if($badPermissions){
	echo t('Invalid Permissions');
	die;
} 


switch ($_GET['mode']){

	case 'addQuestion':
		$miniSurvey->addEditQuestion($_POST);
开发者ID:rii-J,项目名称:concrete5-de,代码行数:31,代码来源:services.php


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