本文整理汇总了PHP中Permissions::canViewBlock方法的典型用法代码示例。如果您正苦于以下问题:PHP Permissions::canViewBlock方法的具体用法?PHP Permissions::canViewBlock怎么用?PHP Permissions::canViewBlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Permissions
的用法示例。
在下文中一共展示了Permissions::canViewBlock方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: on_page_view
public function on_page_view()
{
$stack = Stack::getByID($this->stID);
if (!is_object($stack)) {
return false;
}
$p = new Permissions($stack);
if ($p->canViewPage()) {
$blocks = $stack->getBlocks();
foreach ($blocks as $b) {
$bp = new Permissions($b);
if ($bp->canViewBlock()) {
$btc = $b->getInstance();
if ('Controller' != get_class($btc)) {
$btc->outputAutoHeaderItems();
}
$csr = $b->getBlockCustomStyleRule();
if (is_object($csr)) {
$styleHeader = '#' . $csr->getCustomStyleRuleCSSID(1) . ' {' . $csr->getCustomStyleRuleText() . "} \r\n";
$btc->addHeaderItem("<style type=\"text/css\"> \r\n" . $styleHeader . '</style>', 'VIEW');
}
$btc->runTask('on_page_view', array($view));
}
}
}
}
示例2: BlockView
</a>
<?php
}
?>
</div>
<div class="ccm-pane-body ccm-pane-body-footer clearfix" id="ccm-stack-container">
<?php
$a = Area::get($stack, 'Main');
$bv = new BlockView();
$bv->renderElement('block_area_header', array('a' => $a));
$bv->renderElement('block_area_header_view', array('a' => $a));
foreach ($blocks as $b) {
$bv = new BlockView();
$bv->setAreaObject($a);
$p = new Permissions($b);
if ($p->canViewBlock()) {
$bv->renderElement('block_controls', array('a' => $a, 'b' => $b, 'p' => $p));
$bv->renderElement('block_header', array('a' => $a, 'b' => $b, 'p' => $p));
$bv->render($b);
$bv->renderElement('block_footer');
}
}
$bv->renderElement('block_area_footer_view', array('a' => $a));
print '</div>';
// instead of loading block area footer view
?>
</div>
<?php
echo Loader::helper('concrete/dashboard')->getDashboardPaneFooterWrapper(false);
?>
示例3: display
/**
* displays the Area in the page
* ex: $a = new Area('Main'); $a->display($c);
* @param Page|Collection $c
* @param Block[] $alternateBlockArray optional array of blocks to render instead of default behavior
* @return void
*/
function display(&$c, $alternateBlockArray = null)
{
if (!intval($c->cID)) {
//Invalid Collection
return false;
}
if ($this->arIsGlobal) {
$stack = Stack::getByName($this->arHandle);
}
$currentPage = Page::getCurrentPage();
$ourArea = self::getOrCreate($c, $this->arHandle, $this->arIsGlobal);
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);
if (!$ap->canViewArea()) {
return false;
}
$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->canViewAreaControls()) {
$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>';
}
}
$blockPositionInArea = 1;
//for blockWrapper output
foreach ($blocksToDisplay as $b) {
$includeEditStrip = false;
$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());
}
if ($this->arIsGlobal && is_object($stack)) {
$b->setBlockActionCollectionID($stack->getCollectionID());
}
$p = new Permissions($b);
if ($c->isEditMode() && $this->showControls && $p->canViewEditInterface()) {
$includeEditStrip = true;
}
if ($p->canViewBlock()) {
if (!$c->isEditMode()) {
$this->outputBlockWrapper(true, $b, $blockPositionInArea);
}
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()) {
$this->outputBlockWrapper(false, $b, $blockPositionInArea);
}
}
$blockPositionInArea++;
}
$bv->renderElement('block_area_footer_view', array('a' => $ourArea));
if ($this->showControls && $c->isEditMode() && $ap->canViewAreaControls()) {
$bv->renderElement('block_area_footer', array('a' => $ourArea));
}
}
示例4: PageListBlockController
//Permissions Check
$nh = Loader::helper('validation/numbers');
if ($_GET['bID'] && $_GET['cID'] && $nh->integer($_GET['bID']) && $nh->integer($_GET['cID'])) {
$c = Page::getByID($_GET['cID']);
if (is_object($c) && !$c->isError()) {
$a = Area::get($c, $_GET['arHandle']);
//edit survey mode
$b = Block::getByID($_GET['bID'], $c, $a);
if ($b->getBlockTypeHandle() == BLOCK_HANDLE_SCRAPBOOK_PROXY) {
$cnt = $b->getController();
$b = Block::getByID($cnt->getOriginalBlockID());
}
$controller = new PageListBlockController($b);
$rssUrl = $controller->getRssUrl($b);
$bp = new Permissions($b);
if ($bp->canViewBlock() && $controller->rss) {
$cArray = $controller->getPages();
$nh = Loader::helper('navigation');
header('Content-type: text/xml');
echo "<" . "?" . "xml version=\"1.0\"?>\n";
?>
<rss version="2.0">
<channel>
<title><?php
echo $controller->rssTitle;
?>
</title>
<link><?php
echo Loader::helper('navigation')->getLinkToCollection($c, true);
?>
</link>
示例5: PageListBlockController
$c = Page::getByID($_GET['cID']);
if (is_object($c) && !$c->isError()) {
$a = Area::get($c, $_GET['arHandle']);
//edit survey mode
$b = Block::getByID($_GET['bID'],$c, $a);
if ($b->getBlockTypeHandle() == BLOCK_HANDLE_SCRAPBOOK_PROXY) {
$cnt = $b->getController();
$b = Block::getByID($cnt->getOriginalBlockID());
}
$controller = new PageListBlockController($b);
$rssUrl = $controller->getRssUrl($b);
$bp = new Permissions($b);
if( $bp->canViewBlock() && $controller->rss && ($b->getBlockFilename() == 'blog_index_thumbnail.php' || $b->getBlockFilename() == 'blog_index.php' || $b->getBlockFilename() == 'blog_index')) {
$cArray = $controller->getPages();
$nh = Loader::helper('navigation');
header('Content-type: text/xml');
echo "<" . "?" . "xml version=\"1.0\"?>\n";
?>
<rss version="2.0">
<channel>
<title><?=$controller->rssTitle?></title>
<link><?=Loader::helper('navigation')->getLinkToCollection($c, true)?></link>
<description><?=$controller->rssDescription?></description>
<?
for ($i = 0; $i < count($cArray); $i++ ) {
示例6: array
$action = $b->getBlockUpdateCssAction();
if ($_REQUEST['subtask'] == 'delete_custom_style_preset') {
$styleToDelete = CustomStylePreset::getByID($_REQUEST['deleteCspID']);
$styleToDelete->delete();
}
$refreshAction = REL_DIR_FILES_TOOLS_REQUIRED . '/edit_block_popup?btask=block_css&cID=' . $c->getCollectionID() . '&arHandle=' . $a->getAreaHandle() . '&bID=' . $b->getBlockID() . '&refresh=1';
$bv->renderElement('custom_style', array('b' => $b, 'rcID' => $rcID, 'c' => $c, 'a' => $a, 'style' => $style, 'action' => $action, 'refreshAction' => $refreshAction));
}
break;
case 'template':
if ($bp->canEditBlockCustomTemplate()) {
$bv->renderElement('block_custom_template', array('b' => $b, 'rcID' => $rcID));
}
break;
case 'view':
if ($bp->canViewBlock()) {
$bv->render($b, 'view', array('c' => $c, 'a' => $a));
}
break;
case 'view_edit_mode':
if ($bp->canViewEditInterface()) {
$btc = $b->getInstance();
// now we inject any custom template CSS and JavaScript into the header
if ('Controller' != get_class($btc)) {
$btc->outputAutoHeaderItems();
}
$btc->runTask('on_page_view', array($bv));
$v = View::getInstance();
$items = $v->getHeaderItems();
$csr = $b->getBlockCustomStyleRule();
if (is_object($csr)) {