/** * Render panel blocks * @return void */ public function dispatchLoopShutdown() { if (!Zend_Layout::getMvcInstance()->isEnabled()) { // No layout, no panel content return; } if (!$this->panel) { // No panel to display return; } $this->panel->loadBlocks()->render(); }
/** * Configure content for a panel */ public function contentAction() { $this->view->jQuery()->enable()->uiEnable(); if ($this->getRequest()->isPost()) { $blocks = $this->getRequest()->getParam('block', array()); $panel_block_factory = new Flex_Panel_Block_Factory(); if ($blocks) { $regions = array(); $block_factory = new Flex_Block_Factory(); $block_options = $this->getRequest()->getParam('options', array()); foreach ($blocks as $block) { if (!is_numeric($block) && substr($block, 0, 4) != "new-") { // region $current_region = $block; $regions[$current_region] = array(); } else { if (is_numeric($block)) { $block_obj = $block_factory->find($block)->current(); $panel_block = $panel_block_factory->fetchRow($panel_block_factory->select()->where('panel_id = ?', $this->panel->id)->where('block_id = ?', $block_obj->id)); } else { $block_obj = $block_factory->createRow(); $block_obj->save(); $panel_block = $panel_block_factory->createRow(array('panel_id' => $this->panel->id, 'block_id' => $block_obj->id)); } $regions[$current_region][] = $panel_block; } } foreach ($regions as $region => $blocks) { foreach ($blocks as $key => $block) { $block->region = $region; $block->weight = $key; $block->save(); } } } else { // Remove all blocks from panel $panel_block_factory->delete("panel_id = " . $this->panel->id); } // Clear cache for panel Zoo::getService('cache')->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array('panel_' . $this->panel->id)); } // Render blocks on the panel in admin view $layout = $this->panel->loadBlocks()->getLayout(); $layout->is_admin_page = true; $this->view->content = $layout->render($this->panel->blocks); }