本文整理汇总了PHP中Permissions::canDeleteBlock方法的典型用法代码示例。如果您正苦于以下问题:PHP Permissions::canDeleteBlock方法的具体用法?PHP Permissions::canDeleteBlock怎么用?PHP Permissions::canDeleteBlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Permissions
的用法示例。
在下文中一共展示了Permissions::canDeleteBlock方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(Application $app, $config, Block $b, Page $c, Area $a)
{
parent::__construct();
$p = new \Permissions($b);
$this->permissions = $p;
$this->block = $b;
$this->page = $c;
$this->area = $a;
$this->setAttribute('data-block-menu', 'block-menu-b' . $b->getBlockID());
$this->setAttribute('class', 'ccm-edit-mode-block-menu');
$btw = $b->getBlockTypeObject();
$btOriginal = $btw;
$bID = $b->getBlockID();
$aID = $a->getAreaID();
$heightPlus = 20;
$btHandle = $btw->getBlockTypeHandle();
$editInline = false;
if ($btw->supportsInlineEdit()) {
$editInline = true;
}
if ($btw->getBlockTypeHandle() == BLOCK_HANDLE_SCRAPBOOK_PROXY) {
$_bi = $b->getInstance();
$_bo = Block::getByID($_bi->getOriginalBlockID());
$btOriginal = BlockType::getByHandle($_bo->getBlockTypeHandle());
$btHandle = $btOriginal->getBlockTypeHandle();
$heightPlus = 80;
if ($btOriginal->supportsInlineEdit()) {
$editInline = true;
}
}
$canDesign = $p->canEditBlockDesign() && $config->get('concrete.design.enable_custom') == true;
$canModifyGroups = $p->canEditBlockPermissions() && $config->get('concrete.permissions.model') != 'simple' && !$a->isGlobalArea();
$canEditName = $p->canEditBlockName();
$canEditCacheSettings = $p->canEditBlockCacheSettings();
$canEditCustomTemplate = $p->canEditBlockCustomTemplate();
$canScheduleGuestAccess = $config->get('concrete.permissions.model') != 'simple' && $p->canGuestsViewThisBlock() && $p->canScheduleGuestAccess() && !$a->isGlobalArea();
$canAliasBlockOut = $c->isMasterCollection() && !$a->isGlobalArea();
if ($canAliasBlockOut) {
$ct = Type::getByID($c->getPageTypeID());
}
$isAlias = $b->isAlias();
$u = new \User();
$numChildren = !$isAlias ? $b->getNumChildren() : 0;
if ($isAlias) {
$deleteMessage = t('Do you want to delete this block?');
} elseif ($numChildren) {
$deleteMessage = t('Do you want to delete this block? This item is an original. If you delete it, you will delete all blocks aliased to it');
} else {
$deleteMessage = t('Do you want to delete this block?');
}
if ($btOriginal->getBlockTypeHandle() == BLOCK_HANDLE_STACK_PROXY) {
if (is_object($_bo)) {
$bi = $_bo->getInstance();
} else {
$bi = $b->getInstance();
}
$stack = \Stack::getByID($bi->stID);
if (is_object($stack)) {
$sp = new \Permissions($stack);
if ($sp->canWrite()) {
$this->addItem(new LinkItem(\URL::to('/dashboard/blocks/stacks', 'view_details', $stack->getCollectionID()), t('Manage Stack Contents')));
}
}
} else {
if ($p->canEditBlock() && $b->isEditable()) {
if ($editInline) {
if ($b->getBlockTypeHandle() == BLOCK_HANDLE_LAYOUT_PROXY) {
$this->addItem(new LinkItem('javascript:void(0)', t('Edit Layout'), ['data-menu-action' => 'edit_inline', 'data-area-enable-grid-container' => $a->isGridContainerEnabled(), 'data-area-grid-maximum-columns' => $a->getAreaGridMaximumColumns()]));
} else {
$this->addItem(new LinkItem('javascript:void(0)', t('Edit Block'), ['data-menu-action' => 'edit_inline', 'data-area-enable-grid-container' => $a->isGridContainerEnabled(), 'data-area-grid-maximum-columns' => $a->getAreaGridMaximumColumns()]));
}
} else {
$this->addItem(new LinkItem('javascript:void(0)', t('Edit Block'), ['data-menu-action' => 'block_dialog', 'data-menu-href' => \URL::to('/ccm/system/dialogs/block/edit'), 'dialog-title' => t('Edit %s', t($btOriginal->getBlockTypeName())), 'dialog-width' => $btOriginal->getBlockTypeInterfaceWidth(), 'dialog-height' => $btOriginal->getBlockTypeInterfaceHeight() + $heightPlus]));
}
}
}
if ($b->getBlockTypeHandle() != BLOCK_HANDLE_LAYOUT_PROXY && $b->getBlockTypeHandle() != BLOCK_HANDLE_PAGE_TYPE_OUTPUT_PROXY) {
$this->addItem(new LinkItem('javascript:void(0)', t('Copy to Clipboard'), ['data-menu-action' => 'block_scrapbook', 'data-token' => $app->make('token')->generate('tools/clipboard/to')]));
}
if ($p->canDeleteBlock()) {
$this->addItem(new LinkItem('javascript:void(0)', t('Delete'), ['data-menu-action' => 'delete_block', 'data-menu-delete-message' => $deleteMessage]));
}
if ($b->getBlockTypeHandle() != BLOCK_HANDLE_LAYOUT_PROXY) {
if ($canDesign || $canEditCustomTemplate || $canEditName || $canEditCacheSettings) {
$this->addItem(new DividerItem());
if ($canDesign || $canEditCustomTemplate) {
$this->addItem(new LinkItem('#', t('Design & Custom Template'), ['data-menu-action' => 'block_design']));
}
if ($b->getBlockTypeHandle() != BLOCK_HANDLE_PAGE_TYPE_OUTPUT_PROXY && ($canEditName || $canEditCacheSettings)) {
$this->addItem(new LinkItem('#', t('Advanced'), ['dialog-title' => t('Advanced Block Settings'), 'data-menu-action' => 'block_dialog', 'data-menu-href' => \URL::to('/ccm/system/dialogs/block/cache'), 'dialog-width' => 500, 'dialog-height' => 320]));
}
}
}
if ($b->getBlockTypeHandle() != BLOCK_HANDLE_PAGE_TYPE_OUTPUT_PROXY && ($canModifyGroups || $canScheduleGuestAccess || $canAliasBlockOut)) {
$this->addItem(new DividerItem());
if ($canModifyGroups) {
$this->addItem(new LinkItem('#', t('Permissions'), ['dialog-title' => t('Block Permissions'), 'data-menu-action' => 'block_dialog', 'data-menu-href' => \URL::to('/ccm/system/dialogs/block/permissions/list'), 'dialog-width' => 350, 'dialog-height' => 450]));
}
if ($canScheduleGuestAccess) {
$this->addItem(new LinkItem('#', t('Schedule Guest Access'), ['dialog-title' => t('Schedule Guest Access'), 'data-menu-action' => 'block_dialog', 'data-menu-href' => \URL::to('/ccm/system/dialogs/block/permissions/guest_access'), 'dialog-width' => 500, 'dialog-height' => 320]));
//.........这里部分代码省略.........
示例2: delete
public function delete()
{
$db = Loader::db();
$blocks = $this->getAreaBlocksArray();
foreach ($blocks as $b) {
$bp = new \Permissions($b);
if ($bp->canDeleteBlock()) {
$b->deleteBlock();
}
}
$db->Execute('delete from Areas where arID = ?', array($this->arID));
}
示例3: if
<a href="javascript:void(0)" onclick="GlobalScrapbook.toggleRename(<?=intval($b->bID) ?>)"><?=t('Rename')?></a>
|
<a href="javascript:void(0)" onclick="GlobalScrapbook.editBlockTemplate(<?=intval($b->bID) ?>)" ><?=t('Custom Template')?></a>
|
<? if (ENABLE_CUSTOM_DESIGN == true) { ?>
<a href="javascript:void(0)" onclick="GlobalScrapbook.editBlockDesign(<?=intval($b->bID) ?>)" ><?=t('Design')?></a>
|
<? } ?>
<a href="javascript:void(0)" onclick="GlobalScrapbook.editBlock(<?=intval($b->bID) ?>,<?=$bt->getBlockTypeInterfaceWidth()?> , <?=$bt->getBlockTypeInterfaceHeight()?> )" ><?=t('Edit')?></a>
|
<? } ?>
<? if (PERMISSIONS_MODEL != 'simple' && $bp->canAdmin()) { ?>
<a href="javascript:void(0)" onclick="GlobalScrapbook.editBlockPermissions(<?=$b->getBlockID()?>)" ><?=t('Permissions')?></a>
<? if ($bp->canDeleteBlock()) { ?>
|
<? } ?>
<? } ?>
<? if ($bp->canDeleteBlock()) { ?>
<a href="<?php echo $this->action('deleteBlock', Loader::helper('text')->entities($scrapbookName), 0, intval($b->bID), $valt->generate('delete_scrapbook_block'))?>" onclick="return GlobalScrapbook.confirmDelete()">
<?=t('Delete')?>
</a>
<? } ?>
</div>
<div id="ccm-block-type-inner<?=intval($b->bID)?>" class="ccm-block-type-inner">
<div class="ccm-block-type-inner-icon ccm-scrapbook-item-handle" style="background: url(<?=$btIcon?>) no-repeat center left;">
<img src="<?=ASSETS_URL_IMAGES?>/spacer.gif" width="16" height="16" />
</div>
示例4: t
<?php
}
?>
<?php
if (PERMISSIONS_MODEL != 'simple' && $bp->canEditBlockPermissions()) {
?>
<a href="javascript:void(0)" onclick="GlobalScrapbook.editBlockPermissions(<?php
echo $b->getBlockID();
?>
)" ><?php
echo t('Permissions');
?>
</a>
<?php
if ($bp->canDeleteBlock()) {
?>
|
<?php
}
?>
<?php
}
?>
<?php
if ($bp->canDeleteBlock()) {
?>
<a href="<?php
echo $this->action('deleteBlock', Loader::helper('text')->entities($scrapbookName), 0, intval($b->bID), $valt->generate('delete_scrapbook_block'));
?>
示例5: Permissions
case 'ajax_do_arrange':
/* called via ajax */
if ($cp->canWrite()) {
$nvc = $c->getVersionToModify();
$nvc->processArrangement($_POST['area']);
}
exit;
break;
case 'remove':
$a = Area::get($c, $_REQUEST['arHandle']);
if (is_object($a)) {
$b = Block::getByID($_REQUEST['bID'], $c, $a);
$p = new Permissions($b);
// might be block-level, or it might be area level
// we're removing a particular block of content
if ($p->canDeleteBlock()) {
$nvc = $c->getVersionToModify();
$b->loadNewCollection($nvc);
$b->deleteBlock();
$nvc->rescanDisplayOrder($_REQUEST['arHandle']);
if (isset($_POST['isAjax'])) {
exit;
}
header('Location: ' . BASE_URL . DIR_REL . '/' . DISPATCHER_FILENAME . '?cID=' . $_GET['cID'] . '&mode=edit' . $step);
exit;
}
}
break;
case 'update_block_css':
$a = Area::get($c, $_REQUEST['arHandle']);
if (is_object($a)) {
示例6: display
function display(&$c, $alternateBlockArray = null) {
if(!intval($c->cID)){
//Invalid Collection
return false;
}
$currentPage = Page::getCurrentPage();
$ourArea = Area::getOrCreate($c, $this->arHandle);
if (count($this->customTemplateArray) > 0) {
$ourArea->customTemplateArray = $this->customTemplateArray;
}
if (count($this->attributes) > 0) {
$ourArea->attributes = $this->attributes;
}
if ($this->maximumBlocks > -1) {
$ourArea->maximumBlocks = $this->maximumBlocks;
}
$ap = new Permissions($ourArea);
$blocksToDisplay = ($alternateBlockArray) ? $alternateBlockArray : $ourArea->getAreaBlocksArray($c, $ap);
$this->totalBlocks = $ourArea->getTotalBlocksInArea();
$u = new User();
$bv = new BlockView();
// now, we iterate through these block groups (which are actually arrays of block objects), and display them on the page
if (($this->showControls) && ($c->isEditMode() && ($ap->canAddBlocks() || $u->isSuperUser()))) {
$bv->renderElement('block_area_header', array('a' => $ourArea));
}
$bv->renderElement('block_area_header_view', array('a' => $ourArea));
//display layouts tied to this area
//Might need to move this to a better position
$areaLayouts = $this->getAreaLayouts($c);
if(is_array($areaLayouts) && count($areaLayouts)){
foreach($areaLayouts as $layout){
$layout->display($c,$this);
}
if($this->showControls && ($c->isArrangeMode() || $c->isEditMode())) {
echo '<div class="ccm-layouts-block-arrange-placeholder ccm-block-arrange"></div>';
}
}
foreach ($blocksToDisplay as $b) {
$bv = new BlockView();
$bv->setAreaObject($ourArea);
// this is useful for rendering areas from one page
// onto the next and including interactive elements
if ($currentPage->getCollectionID() != $c->getCollectionID()) {
$b->setBlockActionCollectionID($c->getCollectionID());
}
$p = new Permissions($b);
if (($p->canWrite() || $p->canDeleteBlock()) && $c->isEditMode() && $this->showControls) {
$includeEditStrip = true;
}
if ($p->canRead()) {
if (!$c->isEditMode()) {
echo $this->enclosingStart;
}
if ($includeEditStrip) {
$bv->renderElement('block_controls', array(
'a' => $ourArea,
'b' => $b,
'p' => $p
));
$bv->renderElement('block_header', array(
'a' => $ourArea,
'b' => $b,
'p' => $p
));
}
$bv->render($b);
if ($includeEditStrip) {
$bv->renderElement('block_footer');
}
if (!$c->isEditMode()) {
echo $this->enclosingEnd;
}
}
}
$bv->renderElement('block_area_footer_view', array('a' => $ourArea));
if (($this->showControls) && ($c->isEditMode() && ($ap->canAddBlocks() || $u->isSuperUser()))) {
$bv->renderElement('block_area_footer', array('a' => $ourArea));
}
}