* @license See LICENSE that came packaged with this software */ class saSettingActions extends sfActions { public function executeIndex(sfWebRequest $request) { $this->groups = Doctrine::getTable('saSetting')->createQuery() ->groupBy('setting_group') ->execute(); $this->form = new SettingsForm(); if($settings = $request->getParameter($this->form->getName())) { $this->form->bind($settings, $request->getFiles($this->form->getName())); if ($this->form->isValid()) { foreach ($this->form->getValues() as $slug => $value) { $setting = Doctrine::getTable('saSetting')->findOneBySlug($slug); if ($setting) { if($value instanceof sfValidatedFile) { $value = $value->save(); } $setting->setValue($value); $setting->save(); } } $this->getUser()->addMessage('Nastavení uloženo.'); $this->redirect('sa_setting'); } } } }