2015-07-27 13:06:22 +02:00
|
|
|
<?php
|
|
|
|
|
2015-08-05 20:49:43 +02:00
|
|
|
/** This class displays the Language and Timezone setup popup dialog that you see on first run. */
|
2015-07-27 13:06:22 +02:00
|
|
|
class SetupController extends Zend_Controller_Action
|
|
|
|
{
|
|
|
|
public function init()
|
|
|
|
{
|
|
|
|
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
|
|
|
$ajaxContext->addActionContext('setup-language-timezone', 'json');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setupLanguageTimezoneAction()
|
|
|
|
{
|
|
|
|
$this->view->layout()->disableLayout();
|
|
|
|
$this->_helper->viewRenderer->setNoRender(true);
|
|
|
|
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$form = new Application_Form_SetupLanguageTimezone();
|
|
|
|
|
|
|
|
if ($request->isPost()) {
|
2015-07-27 20:38:42 +02:00
|
|
|
$formData = $request->getPost();
|
2015-07-27 13:06:22 +02:00
|
|
|
if ($form->isValid($formData)) {
|
|
|
|
$userService = new Application_Service_UserService();
|
|
|
|
$currentUser = $userService->getCurrentUser();
|
|
|
|
$currentUserId = $currentUser->getDbId();
|
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
Application_Model_Preference::SetUserTimezone($formData['setup_timezone'], $currentUserId);
|
|
|
|
|
|
|
|
Application_Model_Preference::SetUserLocale($formData['setup_language'], $currentUserId);
|
|
|
|
Application_Model_Preference::SetDefaultLocale($formData['setup_language']);
|
2015-07-27 13:06:22 +02:00
|
|
|
|
|
|
|
Application_Model_Preference::setLangTimezoneSetupComplete(true);
|
|
|
|
|
2015-08-27 22:59:21 +02:00
|
|
|
$this->_redirect('/showbuilder');
|
2015-07-27 13:06:22 +02:00
|
|
|
}
|
|
|
|
}
|
2015-08-27 22:59:21 +02:00
|
|
|
$this->_redirect('/showbuilder');
|
2015-07-27 13:06:22 +02:00
|
|
|
}
|
2021-10-11 16:10:47 +02:00
|
|
|
}
|