Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function action_general()
- {
- // New settings model.
- $this->model = new Model_Settings;
- // Check for post.
- if(HTTP_Request::POST == $this->request->method())
- {
- // Get current session instance.
- $this->session = Session::instance();
- // Copy post array.
- $update_info = $this->request->post();
- // Remove.
- array_pop($update_info);
- // Update options.
- try
- {
- // Update settingses.
- $this->model->update_settings($update_info);
- // Set notification message.
- $this->session->set('warning_message', 'Settings saved successfully!');
- }
- catch(Exception $e)
- {
- // Update failed. Set error message.
- $this->session->set('error_message', 'Update failed: Failed to save settings.');
- }
- $this->redirect($this->request->uri());
- }
- // Set template title.
- $this->template->set('title', 'General settings');
- // Set content.
- $this->content = View::factory('administration/settings/index')
- ->set('settings', ORM::factory('Settings')->find_all()->as_array('name', 'value'));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement