/** * @static * @return AvisotaBackend */ public static function getInstance() { if (self::$instance === null) { self::$instance = new AvisotaBackend(); } return self::$instance; }
public function addHeader($add, $dc) { $key = $GLOBALS['TL_LANG']['orm_avisota_message_category']['recipients'][0]; $add[$key] = array(); $category = AvisotaNewsletterCategory::load($dc->id); $fallback = $category->recipientsMode == 'byNewsletterOrCategory'; $selectedRecipients = $category->getRecipients(); $recipients = AvisotaBackend::getInstance()->getRecipients(true); foreach ($recipients as $group => $lists) { list($source, $group) = explode(':', $group, 2); foreach ($lists as $listKey => $list) { if (in_array($listKey, $selectedRecipients)) { $add[$key][] = sprintf('<a href="contao/main.php?do=avisota_recipient_source&act=edit&id=%d">%s » %s</a>%s', $source, $group, $list, $fallback ? ' ' . $GLOBALS['TL_LANG']['orm_avisota_message']['fallback'] : ''); } } } $add[$key] = implode('<br>', $add[$key]); if ($category->themeMode == 'byNewsletterOrCategory') { $key = $GLOBALS['TL_LANG']['orm_avisota_message_category']['theme'][0]; $add[$key] .= ' ' . $GLOBALS['TL_LANG']['orm_avisota_message']['fallback']; } return $add; }