|
|
| 31 |
parent::Form('manager/languageSettings.tpl'); |
31 |
parent::Form('manager/languageSettings.tpl'); |
| 32 |
|
32 |
|
| 33 |
$this->settings = array( |
33 |
$this->settings = array( |
| 34 |
'supportedLocales' => 'object' |
34 |
'supportedLocales' => 'object', |
|
|
35 |
'supportedFormLocales' => 'object' |
| 35 |
); |
36 |
); |
| 36 |
|
37 |
|
| 37 |
$site =& Request::getSite(); |
38 |
$site =& Request::getSite(); |
|
|
| 67 |
|
68 |
|
| 68 |
$this->setData('primaryLocale', $conference->getPrimaryLocale()); |
69 |
$this->setData('primaryLocale', $conference->getPrimaryLocale()); |
| 69 |
|
70 |
|
| 70 |
if ($this->getData('supportedLocales') == null || !is_array($this->getData('supportedLocales'))) { |
71 |
foreach (array('supportedFormLocales', 'supportedLocales') as $name) { |
| 71 |
$this->setData('supportedLocales', array()); |
72 |
if ($this->getData($name) == null || !is_array($this->getData($name))) { |
|
|
73 |
$this->setData($name, array()); |
| 74 |
} |
| 72 |
} |
75 |
} |
| 73 |
} |
76 |
} |
| 74 |
|
77 |
|
|
|
| 80 |
$vars[] = 'primaryLocale'; |
83 |
$vars[] = 'primaryLocale'; |
| 81 |
$this->readUserVars($vars); |
84 |
$this->readUserVars($vars); |
| 82 |
|
85 |
|
| 83 |
if ($this->getData('supportedLocales') == null || !is_array($this->getData('supportedLocales'))) { |
86 |
foreach (array('supportedFormLocales', 'supportedLocales') as $name) { |
| 84 |
$this->setData('supportedLocales', array()); |
87 |
if ($this->getData($name) == null || !is_array($this->getData($name))) { |
|
|
88 |
$this->setData($name, array()); |
| 89 |
} |
| 85 |
} |
90 |
} |
| 86 |
} |
91 |
} |
| 87 |
|
92 |
|
|
|
| 93 |
$settingsDao =& DAORegistry::getDAO('ConferenceSettingsDAO'); |
98 |
$settingsDao =& DAORegistry::getDAO('ConferenceSettingsDAO'); |
| 94 |
|
99 |
|
| 95 |
// Verify additional locales |
100 |
// Verify additional locales |
| 96 |
$supportedLocales = array(); |
101 |
foreach (array('supportedLocales', 'supportedFormLocales') as $name) { |
| 97 |
foreach ($this->getData('supportedLocales') as $locale) { |
102 |
$$name = array(); |
| 98 |
if (Locale::isLocaleValid($locale) && in_array($locale, $this->availableLocales)) { |
103 |
foreach ($this->getData($name) as $locale) { |
| 99 |
array_push($supportedLocales, $locale); |
104 |
if (Locale::isLocaleValid($locale) && in_array($locale, $this->availableLocales)) { |
|
|
105 |
array_push($$name, $locale); |
| 106 |
} |
| 100 |
} |
107 |
} |
| 101 |
} |
108 |
} |
| 102 |
|
109 |
|
| 103 |
$primaryLocale = $this->getData('primaryLocale'); |
110 |
$primaryLocale = $this->getData('primaryLocale'); |
| 104 |
|
111 |
|
| 105 |
if ($primaryLocale != null && !empty($primaryLocale) && !in_array($primaryLocale, $supportedLocales)) { |
112 |
// Make sure at least the primary locale is chosen as available |
| 106 |
array_push($supportedLocales, $primaryLocale); |
113 |
if ($primaryLocale != null && !empty($primaryLocale)) { |
|
|
114 |
foreach (array('supportedLocales', 'supportedFormLocales') as $name) { |
| 115 |
if (!in_array($primaryLocale, $$name)) { |
| 116 |
array_push($$name, $primaryLocale); |
| 117 |
} |
| 118 |
} |
| 107 |
} |
119 |
} |
| 108 |
$this->setData('supportedLocales', $supportedLocales); |
120 |
$this->setData('supportedLocales', $supportedLocales); |
|
|
121 |
$this->setData('supportedFormLocales', $supportedFormLocales); |
| 109 |
|
122 |
|
| 110 |
foreach ($this->_data as $name => $value) { |
123 |
foreach ($this->_data as $name => $value) { |
| 111 |
if (!in_array($name, array_keys($this->settings))) continue; |
124 |
if (!in_array($name, array_keys($this->settings))) continue; |
|
|
| 121 |
$conference->setPrimaryLocale($this->getData('primaryLocale')); |
134 |
$conference->setPrimaryLocale($this->getData('primaryLocale')); |
| 122 |
$conferenceDao->updateConference($conference); |
135 |
$conferenceDao->updateConference($conference); |
| 123 |
} |
136 |
} |
| 124 |
|
|
|
| 125 |
} |
137 |
} |
| 126 |
|
138 |
|
| 127 |
?> |
139 |
?> |