/** * Return all template files of a particular group as array * * @author Leo Feyer <http://www.contao.org> * @see Controll::getTemplate in Contao OpenSource CMS * * @param string * @param integer * * @return array * @throws Exception */ protected function getTemplateGroup($prefix, $themeId = 0) { $folders = array(); $templates = array(); // Add the templates root directory $folders[] = TL_ROOT . '/templates'; // Add the theme templates folder if ($themeId > 0) { $theme = \Database::getInstance()->prepare("SELECT * FROM orm_avisota_message_theme WHERE id=?")->limit(1)->execute($themeId); if ($theme->numRows > 0 && $theme->templateDirectory != '') { $folders[] = TL_ROOT . '/' . $theme->templateDirectory; } } else { $newsletter = AvisotaStatic::getNewsletter(); // Check for a theme folder if ($newsletter) { $folders[] = TL_ROOT . '/' . $newsletter->getTheme()->getTemplateDirectory(); } } // Add the module templates folders if they exist foreach ($this->Config->getActiveModules() as $module) { $folder = TL_ROOT . '/system/modules/' . $module . '/templates'; if (is_dir($folder)) { $folders[] = $folder; } } // Find all matching templates foreach ($folders as $folder) { $files = preg_grep('/^' . preg_quote($prefix, '/') . '/i', scan($folder)); foreach ($files as $file) { $filename = basename($file); $templates[] = substr($filename, 0, strrpos($filename, '.')); } } natcasesort($templates); $templates = array_values(array_unique($templates)); return $templates; }
public function getCurrentTransport() { $newsletter = AvisotaStatic::getNewsletter(); $category = AvisotaStatic::getCategory(); if ($category && $category->transport && $category->setTransport == 'category') { $transportModuleId = $category->transport; } else { if ($newsletter && $newsletter->transport) { $transportModuleId = $newsletter->transport; } else { if ($category && $category->transport) { $transportModuleId = $category->transport; } else { $transportModuleId = 0; } } } return AvisotaTransport::getTransportModule($transportModuleId); }