| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Old Sites/Libteiser - Ojs/ojs2/classes/manager/form/ |
Upload File : |
<?php
/**
* @file classes/manager/form/PaymentSettingsForm.inc.php
*
* Copyright (c) 2006-2009 Gunther Eysenbach, Juan Pablo Alperin, MJ Suhonos
* Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
*
* @class PayMethodSettingsForm
* @ingroup manager_form
*
* @brief Form for conference managers to modify Payment Plugin settings
*
*/
import('form.Form');
class PayMethodSettingsForm extends Form {
/** @var $errors string */
var $errors;
/** @var $plugins array */
var $plugins;
/**
* Constructor
*/
function PayMethodSettingsForm() {
parent::Form('manager/payments/payMethodSettingsForm.tpl');
// Load the plugins.
$this->plugins =& PluginRegistry::loadCategory('paymethod');
// Add form checks
$this->addCheck(new FormValidatorInSet($this, 'paymentMethodPluginName', 'optional', 'manager.payment.paymentPluginInvalid', array_keys($this->plugins)));
}
/**
* Display the form.
*/
function display() {
$templateMgr = &TemplateManager::getManager();
$templateMgr->assign_by_ref('paymentMethodPlugins', $this->plugins);
parent::display();
}
/**
* Initialize form data from current group group.
*/
function initData() {
$journal =& Request::getJournal();
// Allow the current selection to supercede the stored value
$paymentMethodPluginName = Request::getUserVar('paymentMethodPluginName');
if (empty($paymentMethodPluginName) || !in_array($paymentMethodPluginName, array_keys($this->plugins))) {
$paymentMethodPluginName = $journal->getSetting('paymentMethodPluginName');
}
if (!isset($this->plugins[$paymentMethodPluginName])) {
// Choose an arbitrary default if no valid plugin chosen
$paymentMethodPluginName = array_shift(array_keys($this->plugins));
}
// A valid payment method plugin should now be chosen.
$paymentMethodPlugin =& $this->plugins[$paymentMethodPluginName];
$this->_data = array(
'paymentMethodPluginName' => $paymentMethodPluginName
);
if (isset($this->plugins[$paymentMethodPluginName])) {
$plugin =& $this->plugins[$paymentMethodPluginName];
foreach ($plugin->getSettingsFormFieldNames() as $field) {
$this->_data[$field] = $plugin->getSetting($journal->getJournalId(), $field);
}
}
}
/**
* Assign form data to user-submitted data.
*/
function readInputData() {
$this->readUserVars(array(
'paymentMethodPluginName'
));
$paymentMethodPluginName = $this->getData('paymentMethodPluginName');
if (isset($this->plugins[$paymentMethodPluginName])) {
$plugin =& $this->plugins[$paymentMethodPluginName];
$this->readUserVars($plugin->getSettingsFormFieldNames());
}
}
/**
* Save settings
*/
function execute() {
$journal =& Request::getJournal();
// Save the general settings for the form
foreach (array('paymentMethodPluginName') as $journalSettingName) {
$journal->updateSetting($journalSettingName, $this->getData($journalSettingName));
}
// Save the specific settings for the plugin
$paymentMethodPluginName = $this->getData('paymentMethodPluginName');
if (isset($this->plugins[$paymentMethodPluginName])) {
$plugin =& $this->plugins[$paymentMethodPluginName];
foreach ($plugin->getSettingsFormFieldNames() as $field) {
$plugin->updateSetting($journal->getJournalId(), $field, $this->getData($field));
}
}
}
}
?>