* Template that will be rendered on the login page */ $appId = $_['appId']; //Gets the current user's language $userLang = \OCA\AgreeDisclaimer\Utils::getUserLang(); if (!\OC_L10N::languageExists($appId, $userLang)) { #It can be that some language dialects hasn't being translated, so, a #suitable language will be searched. ie: if 'de_CH' isn't available, then #'de_DE' (formal german) will be used. In case that 'de_DE' isn't available, #then 'de' (informal german will be used). If no fallback language is found, #then the defined default language will be used. In case nothing is found, #then ownCloud will decide which language to use, which in most cases is #'en'. $langFallbacks = \OCA\AgreeDisclaimer\Utils::getFallbackLang($userLang); $defaultLangProp = $appId . 'DefaultLang'; $defLang = \OCA\AgreeDisclaimer\Controller\SettingsController::getSetting($defaultLangProp, 'en'); if ($defLang !== $userLang) { $langFallbacks[] = $defLang; } foreach ($langFallbacks as $langCode) { if (\OC_L10N::languageExists($appId, $langCode)) { \OC_L10N::forceLanguage($langCode); \OCP\Util::writeLog($appId, "The language: {$userLang} hasn't been " . "yet translated, falling back to: {$langCode}", \OCP\Util::WARN); break; } } } /** * Adds the javascript utilities to the login page */ script($appId, 'utils');
/** * ownCloud - agreedisclaimer * * This file is licensed under the MIT License. See the COPYING file. * * @author Josef Meile <*****@*****.**> * @copyright Josef Meile 2015 */ /** * Template that will be rendered on the admin page */ use OCA\AgreeDisclaimer\Controller\SettingsController; use OCA\AgreeDisclaimer\AppInfo\Application; //Gets the application settings $appId = Application::APP_ID; $data = SettingsController::getSettings(true, true); $adminSettings = $data['adminSettings']; $txtFileProp = $appId . 'TxtFile'; $txtFile = $adminSettings[$txtFileProp]['value']; $txtFileContentsProp = $txtFileProp . 'Contents'; $txtFilePathProp = $txtFileProp . 'Path'; if ($adminSettings[$txtFileProp]['file']['error'] === '') { //If there isn't any error with the txt file, then its contents will be //retreived $textAreaContents = $adminSettings[$txtFileProp]['file']['content']; } else { //Otherwise, an error will be displayed $textAreaContents = $adminSettings[$txtFileProp]['file']['error']; } $pdfFileProp = $appId . 'PdfFile'; $pdfFile = $adminSettings[$pdfFileProp]['value'];