/** * Load blocks for this panel * * @return Flex_Panel */ function loadBlocks() { $ret = array(); $groups = array(0); try { $groups = array_keys(Zoo::getService('user')->getCurrentUser()->getGroups()); } catch (Zoo_Exception_Service $e) { // Do nothing } $cacheid = "Flex_panel_" . $this->id . "_" . implode("_", $groups); try { $ret = Zoo::getService("cache")->load($cacheid); } catch (Zoo_Exception_Service $e) { // @todo: Remove this comment: I'm beginning to tire of writing try-catch for services } if (!$ret) { $factory = new Flex_Panel_Block_Factory(); $ret = $factory->getPanelBlocks($this); try { // If no cache service available, no need to do cache tag processing $cache = Zoo::getService('cache'); $tags = array('panel', 'panel_' . $this->id); foreach ($ret as $region => $blocks) { foreach ($blocks as $block) { $tags[] = "block_" . $block->id; } } $cache->save($ret, $cacheid, $tags, null); } catch (Zoo_Exception_Service $e) { // No caching available } } $this->blocks = $ret; // Allow for method chaining return $this; }