Ejemplo n.º 1
0
 public function editSettingsAction()
 {
     $form = new Omeka_Form_GeneralSettings();
     $bootstrap = $this->getInvokeArg('bootstrap');
     $derivatives = $bootstrap->getResource('Filederivatives');
     if (isset($derivatives) && !$derivatives->getStrategy() instanceof Omeka_File_Derivative_Strategy_ExternalImageMagick) {
         $form->removeElement('path_to_convert');
     }
     $form->setDefaults($bootstrap->getResource('Options'));
     fire_plugin_hook('general_settings_form', array('form' => $form));
     $form->removeDecorator('Form');
     $this->view->form = $form;
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($_POST)) {
             $options = $form->getValues();
             // Everything except the CSRF hash should correspond to a
             // valid option in the database.
             unset($options['settings_csrf']);
             foreach ($options as $key => $value) {
                 set_option($key, $value);
             }
             $this->_helper->flashMessenger(__('The general settings have been updated.'), 'success');
             $this->_helper->redirector('edit-settings');
         } else {
             $this->_helper->flashMessenger(__('There were errors found in your form. Please edit and resubmit.'), 'error');
         }
     }
 }
Ejemplo n.º 2
0
 public function editSettingsAction()
 {
     require_once APP_DIR . '/forms/GeneralSettings.php';
     $form = new Omeka_Form_GeneralSettings();
     $form->setDefaults($this->getInvokeArg('bootstrap')->getResource('Options'));
     fire_plugin_hook('general_settings_form', array('form' => $form));
     $form->removeDecorator('Form');
     $this->view->form = $form;
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($_POST)) {
             $options = $form->getValues();
             // Everything except the CSRF hash should correspond to a
             // valid option in the database.
             unset($options['settings_csrf']);
             foreach ($options as $key => $value) {
                 set_option($key, $value);
             }
             $this->_helper->flashMessenger(__('The general settings have been updated.'), 'success');
             $this->_helper->redirector('edit-settings');
         } else {
             $this->_helper->flashMessenger(__('There were errors found in your form. Please edit and resubmit.'), 'error');
         }
     }
 }