/** * Update notification messages and enabled options * @return JSON object success */ public function updateJsonAction() { $id = $this->_getParam('id'); $iso = $this->_getParam('iso', RM_Environment::getInstance()->getLocale()); $message = $this->_getParam('message'); $model = new RM_EmailNotifications(); $dbRow = $model->fetchByID($id); if ($dbRow == null) { return array('data' => array('success' => false)); } $dbRow->{$iso} = $message; $dbRow->save(); return array('data' => array('success' => true)); }
public function install() { parent::install(); $languageModule = new RM_Languages(); $languages = $languageModule->fetchAll(); require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'EmailNotifications.php'; $model = new RM_EmailNotifications(); foreach ($languages as $language) { if ($language->iso !== 'en_GB') { $model->addLanguage($language->iso); } } //Currently we just added extra columns and need to clean cache Zend_Db_Table_Abstract::getDefaultMetadataCache()->clean(); //Copy en_GB default value to all other languages $emailNotification = $model->fetchByName('ReservationCompleteSuccessful', RM_EmailNotifications::REGULAR_USER); foreach ($languages as $language) { $iso = $language->iso; if ($iso !== 'en_GB') { $emailNotification->{$iso} = $emailNotification->en_GB; } } $emailNotification->save(); }