public function view() { $bv = new BlockView($this->blockType); $bv->setAreaObject($this->area); // Handle special posted area parameters here if (isset($_REQUEST['arGridMaximumColumns'])) { $this->area->setAreaGridMaximumColumns(intval($_REQUEST['arGridMaximumColumns'])); } if (isset($_REQUEST['arEnableGridContainer']) && $_REQUEST['arEnableGridContainer'] == 1) { $this->area->enableGridContainer(); } $bv->addScopeItems(array('a' => $this->a, 'cp' => $this->permissions, 'ap' => $this->areaPermissions)); $this->set('blockView', $bv); $this->set('blockType', $this->blockType); $this->set('btHandle', $this->blockType->getBlockTypeHandle()); $this->set("blockTypeController", $this->blockTypeController); $this->set('area', $this->area); }
/** * displays the Area in the page * ex: $a = new Area('Main'); $a->display($c);. * * @param Page $c * @param Block[] $alternateBlockArray optional array of blocks to render instead of default behavior * * @return bool */ public function display($c = false, $alternateBlockArray = null) { if (!$c) { $c = Page::getCurrentPage(); } $v = View::getRequestInstance(); if (!is_object($c) || $c->isError()) { return false; } $this->load($c); $ap = new Permissions($this); if (!$ap->canViewArea()) { return false; } $blocksToDisplay = $alternateBlockArray ? $alternateBlockArray : $this->getAreaBlocksArray(); $u = new User(); // 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()) { View::element('block_area_header', array('a' => $this)); } else { View::element('block_area_header_view', array('a' => $this)); } foreach ($blocksToDisplay as $b) { $bv = new BlockView($b); $bv->setAreaObject($this); $p = new Permissions($b); if ($p->canViewBlock()) { if (!$c->isEditMode()) { echo $this->enclosingStart; } $bv->render('view'); if (!$c->isEditMode()) { echo $this->enclosingEnd; } } } if ($this->showControls && $c->isEditMode() && $ap->canViewAreaControls()) { View::element('block_area_footer', array('a' => $this)); } else { View::element('block_area_footer_view', array('a' => $this)); } }
</li> </ul> <?php } ?> </div> </nav> <div id="ccm-stack-container"> <?php $a = Area::get($stackToEdit, STACKS_AREA_NAME); $a->forceControlsToDisplay(); View::element('block_area_header', array('a' => $a)); foreach ($blocks as $b) { $bv = new BlockView($b); $bv->setAreaObject($a); $p = new Permissions($b); if ($p->canViewBlock()) { $bv->render('view'); } } //View::element('block_area_footer', array('a' => $a)); print '</div>'; // No, we don't include the footer because we don't want all area controls available. // But the footer element has a closing DIV we need. ?> </div> <?php if ($deleteLabels !== null) { ?>