echo t('Approve Changes'); ?> </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
/** * 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)); } }