public function processAction() { $return = array(); $settingGateway = new Settings_Model_SettingGateway(); $form = $settingGateway->getForm('ModifySettings'); if ($this->_request->getPost('module')) { $module = $this->_request->getPost('module'); } $form->buildFormByModule($module); if ($form->isValid($this->_request->getPost())) { $nonInsertElements = array('saveButton', 'cancelButton', 'module'); foreach ($form as $element) { if (!in_array($element->getName(), $nonInsertElements)) { $setting = $settingGateway->fetchSetting($element->getName()); $setting->setting_value = $element->getValue(); $setting->save(); } } $flashMessenger = $this->_helper->getHelper('FlashMessenger'); $flashMessenger->setNamespace('notifications')->addMessage('Settings updated.'); $return['notification']['target'] = '.notifications'; $return['notification']['content'] = $this->view->displayMessages(true); } else { $return['formErrors'] = $form->getMessages(); } $this->_helper->json->sendJson($return); }
/** * Get the path to custom layouts */ private function fetchCustomLayoutPath($module) { if (empty($module)) { throw new FFR_Model_Exception("Module wasn't specified in the called to fetchCustomLayoutPath"); } if (isset($this->_customPath[$module]) && $this->_customPath[$module] != null) { return $this->_customPath[$module]; } $settingsGateway = new Settings_Model_SettingGateway(); $siteKey = $settingsGateway->fetchSetting('site_key'); if ($module == 'layouts') { $path = APPLICATION_PATH . '/../library/' . $siteKey . '/layouts/scripts/'; } else { $path = APPLICATION_PATH . '/../library/' . $siteKey . '/modules/' . $module . '/views/scripts/helpers/'; } if (!is_dir($path)) { mkdir($path, 0775, true); } $this->_customPath[$module] = $path; return $path; }
public function getGoogleAPI() { $settingGateway = new Settings_Model_SettingGateway(); return $settingGateway->fetchSetting($this->_googleAPISettingKey); }