private function installPages()
{
// add extra's
$subscribeId = $this->insertExtra($this->getModule(), 'block', 'SubscribeForm', 'Subscribe', null, 'N', 3001);
$unsubscribeId = $this->insertExtra($this->getModule(), 'block', 'UnsubscribeForm', 'Unsubscribe', null, 'N', 3002);
$this->insertExtra($this->getModule(), 'widget', 'SubscribeForm', 'Subscribe', null, 'N', 3003);
// loop languages
foreach ($this->getLanguages() as $language) {
$pageId = $this->insertPage(array('title' => 'Newsletters', 'language' => $language));
// check if a page for mailmotor subscribe already exists in this language
if (!(bool) $this->getDB()->getVar('SELECT 1
FROM pages AS p
INNER JOIN pages_blocks AS b ON b.revision_id = p.revision_id
WHERE b.extra_id = ? AND p.language = ?
LIMIT 1', array($subscribeId, $language))) {
$this->insertPage(array('parent_id' => $pageId, 'title' => 'Subscribe', 'language' => $language), null, array('extra_id' => $subscribeId, 'position' => 'main'));
}
// check if a page for mailmotor unsubscribe already exists in this language
if (!(bool) $this->getDB()->getVar('SELECT 1
FROM pages AS p
INNER JOIN pages_blocks AS b ON b.revision_id = p.revision_id
WHERE b.extra_id = ? AND p.language = ?
LIMIT 1', array($unsubscribeId, $language))) {
$this->insertPage(array('parent_id' => $pageId, 'title' => 'Unsubscribe', 'language' => $language), null, array('extra_id' => $unsubscribeId, 'position' => 'main'));
}
}
}