public function view() { $this->setPageType('form'); $this->setTitle(__('%1$s – %2$s', array(__('Symphony'), __('Preferences')))); $this->appendSubheading(__('Preferences')); $bIsWritable = true; $formHasErrors = is_array($this->_errors) && !empty($this->_errors); if (!is_writable(CONFIG)) { $this->pageAlert(__('The Symphony configuration file, <code>/manifest/config.php</code>, is not writable. You will not be able to save changes to preferences.'), Alert::ERROR); $bIsWritable = false; } else { if ($formHasErrors) { $this->pageAlert(__('An error occurred while processing this form. <a href="#error">See below for details.</a>'), Alert::ERROR); } else { if (isset($this->_context[0]) && $this->_context[0] == 'success') { $this->pageAlert(__('Preferences saved.'), Alert::SUCCESS); } } } // Get available languages $languages = Lang::getAvailableLanguages(); if (count($languages) > 1) { // Create language selection $group = new XMLElement('fieldset'); $group->setAttribute('class', 'settings'); $group->appendChild(new XMLElement('legend', __('System Language'))); $label = Widget::Label(); // Get language names asort($languages); foreach ($languages as $code => $name) { $options[] = array($code, $code == Symphony::Configuration()->get('lang', 'symphony'), $name); } $select = Widget::Select('settings[symphony][lang]', $options); $label->appendChild($select); $group->appendChild($label); $group->appendChild(new XMLElement('p', __('Authors can set up a differing language in their profiles.'), array('class' => 'help'))); // Append language selection $this->Form->appendChild($group); } //Get available EmailGateways $email_gateway_manager = new EmailGatewayManager($this); $email_gateways = $email_gateway_manager->listAll(); if (count($email_gateways) >= 1) { $group = new XMLElement('fieldset', NULL, array('class' => 'settings picker')); $group->appendChild(new XMLElement('legend', __('Default Email Settings'))); $label = Widget::Label(__('Gateway')); // Get gateway names ksort($email_gateways); $default_gateway = $email_gateway_manager->getDefaultGateway(); $selected_is_installed = $email_gateway_manager->__find($default_gateway); $options = array(); foreach ($email_gateways as $handle => $details) { $options[] = array($handle, $handle == $default_gateway || $selected_is_installed == false && $handle == 'sendmail', $details['name']); } $select = Widget::Select('settings[Email][default_gateway]', $options); $label->appendChild($select); $group->appendChild($label); // Append email gateway selection $this->Form->appendChild($group); } foreach ($email_gateways as $gateway) { $gateway_settings = $email_gateway_manager->create($gateway['handle'])->getPreferencesPane(); if (is_a($gateway_settings, 'XMLElement')) { $this->Form->appendChild($gateway_settings); } } /** * Add Extension custom preferences. Use the $wrapper reference to append objects. * * @delegate AddCustomPreferenceFieldsets * @param string $context * '/system/preferences/' * @param XMLElement $wrapper * An XMLElement of the current page */ Symphony::ExtensionManager()->notifyMembers('AddCustomPreferenceFieldsets', '/system/preferences/', array('wrapper' => &$this->Form)); $div = new XMLElement('div'); $div->setAttribute('class', 'actions'); $attr = array('accesskey' => 's'); if (!$bIsWritable) { $attr['disabled'] = 'disabled'; } $div->appendChild(Widget::Input('action[save]', __('Save Changes'), 'submit', $attr)); $this->Form->appendChild($div); }