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


PHP Permissions::canEditBlock方法代码示例

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


在下文中一共展示了Permissions::canEditBlock方法的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]));
//.........这里部分代码省略.........
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:101,代码来源:Menu.php

示例2: edit

 public function edit($cID, $arHandle, $bID, $action)
 {
     $c = \Page::getByID($cID);
     if (is_object($c) && !$c->isError()) {
         $b = \Block::getByID($bID, $c, $arHandle);
         if (is_object($b)) {
             $bp = new \Permissions($b);
             if ($bp->canEditBlock()) {
                 $controller = $b->getController();
                 return $this->deliverResponse($controller, $action);
             }
         }
     }
     $response = new Response(t('Access Denied'));
     return $response;
 }
开发者ID:robertdamoc,项目名称:concrete5,代码行数:16,代码来源:action.php

示例3: validateEditBlockPassThruAction

 public function validateEditBlockPassThruAction(Block $b)
 {
     $bp = new \Permissions($b);
     return $bp->canEditBlock();
 }
开发者ID:ceko,项目名称:concrete5-1,代码行数:5,代码来源:BlockController.php

示例4:

        >

    <?php 
    if (is_object($css) && $b->getBlockTypeHandle() != BLOCK_HANDLE_LAYOUT_PROXY) {
        ?>
    <div class="<?php 
        echo $css->getContainerClass();
        ?>
" >
    <?php 
    }
    ?>

        <ul class="ccm-edit-mode-inline-commands ccm-ui">
            <?php 
    if ($p->canEditBlock() && $btw->getBlockTypeHandle() != BLOCK_HANDLE_LAYOUT_PROXY) {
        ?>
                <li><a data-inline-command="move-block" href="#"><i class="fa fa-arrows"></i></a></li>
            <?php 
    }
    ?>
        </ul>

        <div class="ccm-ui">

            <div class="popover fade ccm-edit-mode-block-menu" data-block-menu="block-menu-b<?php 
    echo $b->getBlockID();
    ?>
-<?php 
    echo $a->getAreaID();
    ?>
开发者ID:ryanneilstroud,项目名称:xsericon,代码行数:31,代码来源:block_header_view.php

示例5: edit_composer

 public function edit_composer($cID, $arHandle, $ptComposerFormLayoutSetControlID, $action)
 {
     $c = \Page::getByID($cID);
     $setControl = FormLayoutSetControl::getByID($ptComposerFormLayoutSetControlID);
     if (is_object($setControl)) {
         if (is_object($c) && !$c->isError()) {
             $formControl = $setControl->getPageTypeComposerControlObject();
             if ($formControl instanceof BlockControl) {
                 $b = $formControl->getPageTypeComposerControlBlockObject($c);
                 if (is_object($b)) {
                     $bp = new \Permissions($b);
                     if ($bp->canEditBlock()) {
                         $controller = $b->getController();
                         return $this->deliverResponse($controller, $action);
                     }
                 }
             }
         }
     }
     $response = new Response(t('Access Denied'));
     return $response;
 }
开发者ID:Remo,项目名称:concrete5-1,代码行数:22,代码来源:action.php

示例6: die

<?php

defined('C5_EXECUTE') or die("Access Denied.");
$cID = intval($_REQUEST['cID']);
$bID = intval($_REQUEST['bID']);
$arHandle = Loader::helper('security')->sanitizeString($_REQUEST['arHandle']);
if ($cID > 0 && $bID > 0) {
    $c = Page::getByID($cID);
    $b = Block::getByID($bID, $c, $arHandle);
    if (is_object($b) && !$b->isError()) {
        $bp = new Permissions($b);
        if ($bp->canEditBlock()) {
            $bt = $b->getBlockTypeObject();
            $controller = $b->getController();
            $controller->runTask('edit', array());
            $sets = $controller->getSets();
            $helpers = $controller->getHelperObjects();
            $data = array_merge($sets, $helpers);
            $data['b'] = $b;
            $data['controller'] = $controller;
            ?>
			<div class="ccm-ui">
			<form method="post" id="ccm-gathering-edit-form" action="<?php 
            echo $b->getBlockEditAction();
            ?>
" enctype="multipart/form-data">
				<?php 
            echo Loader::helper('validation/token')->output();
            ?>
				<input type="hidden" name="arHandle" value="<?php 
            echo $arHandle;
开发者ID:seebaermichi,项目名称:concrete5,代码行数:31,代码来源:edit.php


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