* @license PHP License * @package WB * @subpackage content */ /** * Load base class */ WBClass::load('WBContent'); /** * Content component: Static * * @version 0.1.0 * @package WB * @subpackage content */ class WBContent_Menu_Sitemap extends WBContent { /** * my parameter list * @var array */ protected $config = array( 'renderer' => 'SitemapHTML', 'treemenu' => '', 'menu' => '1', 'maxlevel' => '-1', 'ignorelist' => array(), 'children' => array() ); /** * menu digger * @var WBDatasource_MenuDigger */ private $digger; /** * menu digger listener * @var WBDatasource_MenuDigger_Listener_SitemapHTML */ private $listener; /** * run * * run component * * @return array parameter list */ public function run() { $treeMenu = 'WBDatasource_TreeMenu'; if (!empty($this->config['treemenu'])) { $treeMenu .= '_' . $this->config['treemenu']; } $tm = WBClass::create($treeMenu); $tm->useChildTrees($this->config['children']); $this->listener = WBClass::create('WBDatasource_MenuDigger_Listener_' . $this->config['renderer']); $this->digger = WBClass::create('WBDatasource_MenuDigger'); $this->digger->addListener($this->listener); $this->digger->setTreeMenu($tm); $this->digger->setRoot($this->config['menu']); $this->digger->setMaxLevel(intval($this->config['maxlevel'])); if (is_array($this->config['ignorelist'])) { $this->digger->ignore($this->config['ignorelist']); } return $this->config; } /** * receive output * * fetch output of this content component * * @return string */ public function getString() { $this->loadTemplates('display'); $this->digger->dig(); $this->tmpl->addGlobalVars($this->config, 'CONFIG_'); $this->tmpl->addGlobalVar('sitemap', $this->listener->getSnippet()); return $this->tmpl->getParsedTemplate('snippet'); } } ?>