4 * @file PressLanguagesHandler.inc.php
6 * Copyright (c) 2003-2008 John Willinsky
7 * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
9 * @class PressLanguagesHandler
10 * @ingroup pages_manager
12 * @brief Handle requests for changing press language settings.
15 // $Id: PressLanguagesHandler.inc.php,v 1.5 2009/09/22 21:27:34 asmecher Exp $
17 import('pages.manager.ManagerHandler');
19 class PressLanguagesHandler
extends ManagerHandler
{
23 function PressLanguagesHandler() {
24 parent
::ManagerHandler();
28 * Display form to edit language settings.
30 function languages() {
32 $this->setupTemplate(true);
34 import('manager.form.LanguageSettingsForm');
36 $settingsForm = new LanguageSettingsForm();
37 $settingsForm->initData();
38 $settingsForm->display();
42 * Save changes to language settings.
44 function saveLanguageSettings() {
46 $this->setupTemplate(true);
48 import('manager.form.LanguageSettingsForm');
50 $settingsForm = new LanguageSettingsForm();
51 $settingsForm->readInputData();
53 if ($settingsForm->validate()) {
54 $settingsForm->execute();
56 $templateMgr =& TemplateManager
::getManager();
57 $templateMgr->assign(array(
58 'currentUrl' => Request
::url(null, null, 'languages'),
59 'pageTitle' => 'common.languages',
60 'message' => 'common.changesSaved',
61 'backLink' => Request
::url(null, Request
::getRequestedPage()),
62 'backLinkLabel' => 'manager.pressManagement'
64 $templateMgr->display('common/message.tpl');
67 $settingsForm->display();
71 function reloadLocalizedDefaultSettings() {
72 // make sure the locale is valid
73 $locale = Request
::getUserVar('localeToLoad');
74 if ( !Locale
::isLocaleValid($locale) ) {
75 Request
::redirect(null, null, 'languages');
79 $this->setupTemplate(true);
81 $press =& Request
::getPress();
82 $pressSettingsDao =& DAORegistry
::getDAO('PressSettingsDAO');
83 $pressSettingsDao->reloadLocalizedDefaultSettings($press->getId(), 'registry/pressSettings.xml', array(
84 'indexUrl' => Request
::getIndexUrl(),
85 'pressPath' => $press->getData('path'),
86 'primaryLocale' => $press->getPrimaryLocale(),
87 'pressName' => $press->getName($press->getPrimaryLocale())
91 $templateMgr =& TemplateManager
::getManager();
92 $templateMgr->assign(array(
93 'currentUrl' => Request
::url(null, null, 'languages'),
94 'pageTitle' => 'common.languages',
95 'message' => 'common.changesSaved',
96 'backLink' => Request
::url(null, Request
::getRequestedPage()),
97 'backLinkLabel' => 'manager.pressManagement'
99 $templateMgr->display('common/message.tpl');