/** * Execute the form, but first: * Make sure we're not saving an empty entry for sponsors. (This would * result in a possibly empty heading for the Sponsors section in About * the Journal.) */ function execute() { foreach (array('sponsors', 'contributors') as $element) { $elementValue = (array) $this->getData($element); foreach (array_keys($elementValue) as $key) { $values = array_values((array) $elementValue[$key]); $isEmpty = true; foreach ($values as $value) { if (!empty($value)) { $isEmpty = false; } } if ($isEmpty) { unset($elementValue[$key]); } } $this->setData($element, $elementValue); } return parent::execute(); }
/** * Execute the form, but first: * Make sure we're not saving an empty entry for sponsors. (This would * result in a possibly empty heading for the Sponsors section in About * the Journal.) */ function execute() { foreach (array('sponsors', 'contributors') as $element) { $elementValue = (array) $this->getData($element); foreach (array_keys($elementValue) as $key) { $values = array_values((array) $elementValue[$key]); $isEmpty = true; foreach ($values as $value) { if (!empty($value)) { $isEmpty = false; } } if ($isEmpty) { unset($elementValue[$key]); } } $this->setData($element, $elementValue); } // In case the category list changed, flush the cache. $categoryDao =& DAORegistry::getDAO('CategoryDAO'); $categoryDao->rebuildCache(); return parent::execute(); }
function execute() { // Save the block plugin layout settings. $blockVars = array('blockSelectLeft', 'blockUnselected', 'blockSelectRight'); foreach ($blockVars as $varName) { ${$varName} = array_map('urldecode', split(' ', Request::getUserVar($varName))); } $plugins =& PluginRegistry::loadCategory('blocks'); foreach ($plugins as $key => $junk) { $plugin =& $plugins[$key]; // Ref hack $plugin->setEnabled(!in_array($plugin->getName(), $blockUnselected)); if (in_array($plugin->getName(), $blockSelectLeft)) { $plugin->setBlockContext(BLOCK_CONTEXT_LEFT_SIDEBAR); $plugin->setSeq(array_search($key, $blockSelectLeft)); } else { if (in_array($plugin->getName(), $blockSelectRight)) { $plugin->setBlockContext(BLOCK_CONTEXT_RIGHT_SIDEBAR); $plugin->setSeq(array_search($key, $blockSelectRight)); } } unset($plugin); } return parent::execute(); }
function execute() { // Save the block plugin layout settings. $blockVars = array('blockSelectLeft', 'blockUnselected', 'blockSelectRight'); foreach ($blockVars as $varName) { ${$varName} = split(' ', Request::getUserVar($varName)); } $plugins =& PluginRegistry::loadCategory('blocks'); foreach ($plugins as $key => $junk) { $plugin =& $plugins[$key]; // Ref hack $plugin->setEnabled(!in_array($plugin->getName(), $blockUnselected)); if (in_array($plugin->getName(), $blockSelectLeft)) { $plugin->setBlockContext(BLOCK_CONTEXT_LEFT_SIDEBAR); $plugin->setSeq(array_search($key, $blockSelectLeft)); } else { if (in_array($plugin->getName(), $blockSelectRight)) { $plugin->setBlockContext(BLOCK_CONTEXT_RIGHT_SIDEBAR); $plugin->setSeq(array_search($key, $blockSelectRight)); } } unset($plugin); } // Save alt text for images $journal =& Request::getJournal(); $journalId = $journal->getJournalId(); $locale = $this->getFormLocale(); $settingsDao =& DAORegistry::getDAO('JournalSettingsDAO'); $images = $this->images; foreach ($images as $settingName) { $value = $journal->getSetting($settingName); if (!empty($value)) { $imageAltText = $this->getData($this->image_settings[$settingName]); $value[$locale]['altText'] = $imageAltText[$locale]; $settingsDao->updateSetting($journalId, $settingName, $value, 'object', true); } } // Save remaining settings return parent::execute(); }
function execute() { return parent::execute(); }
function execute() { $proposalSourceDao =& DAORegistry::getDAO('ProposalSourceDAO'); if ($proposalSourceDao->countSources() > 0) { $journal = Request::getJournal(); $originalSourceCurrencyAlpha = $journal->getSetting('sourceCurrency'); $formSourceCurrencyApha = $this->getData('sourceCurrency'); if ($originalSourceCurrencyAlpha != $formSourceCurrencyApha) { $exchangeRate = $this->getData('convertionRate'); $exchangeRate = preg_replace('/\\s+/', '', $exchangeRate); $exchangeRate = trim($exchangeRate); if (preg_match('/^[0-9]+([\\.,][0-9]*)?$/', $exchangeRate)) { $exchangeRate = rtrim($exchangeRate, " \t\n\r\v.,0"); if ($exchangeRate != "") { $exchangeRate = str_replace(",", ".", $exchangeRate); $proposalSourceDao->changeCurrency($exchangeRate); } else { return null; } } else { return null; } } } return parent::execute(); }