'', ); /** * Newsletter Issue * @var WBDatasource_Newsletter_Issue */ private $issue; /** * 2nd constructor * * Mend config for parent class * Additional parameter: * - trackingpixelpath */ protected function init() { $this->issue = WBClass::create('WBDatasource_Newsletter_Issue'); // call parent's init return parent::init(); } /** * Run Component * * @return array */ public function run() { if (empty($this->config['id'])) { return $this->runList(); } $this->issue->load($this->config['id']); if (!$this->issue->isOk()) { $this->loadTemplates('notfound'); $this->setStatusCode(404); return $this->config; } $this->loadTemplates('display'); $this->tmpl->addGlobalVars($this->issue->get(), 'ISSUE_'); $list = $this->issue->getArticle(); $this->tmpl->addGlobalVar('list_count', count($list)); $this->tmpl->addRows('list_entry', $list); return $this->config; } private function runList() { $this->loadTemplates('list'); $list = $this->issue->getList(); $this->tmpl->addGlobalVar('list_count', count($list)); $this->tmpl->addRows('list_entry', $list); return $this->config; } }