| 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 : /inetpub/wwwroot/Topogeo/ojs/plugins/generic/openAds/ |
Upload File : |
<?php
/**
* @file OpenAdsSettingsForm.inc.php
*
* Copyright (c) 2003-2012 John Willinsky
* Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
*
* @class OpenAdsSettingsForm
* @ingroup plugins_generic_openAds
*
* @brief Form for journal managers to modify Article XML Galley plugin settings
*/
// $Id$
import('lib.pkp.classes.form.Form');
class OpenAdsSettingsForm extends Form {
/** @var $journalId int */
var $journalId;
/** @var $plugin object */
var $plugin;
/** @var $openAdsConnection object */
var $openAdsConnection;
/**
* Constructor
* @param $plugin object
* @param $openAdsConnection object
* @param $journalId int
*/
function OpenAdsSettingsForm(&$plugin, $openAdsConnection, $journalId) {
$templateMgr =& TemplateManager::getManager();
parent::Form($plugin->getTemplatePath() . 'settingsForm.tpl');
$this->journalId = $journalId;
$this->plugin =& $plugin;
$this->openAdsConnection =& $openAdsConnection;
$this->addCheck(new FormValidatorPost($this));
}
/**
* Initialize form data.
*/
function initData() {
$journalId = $this->journalId;
$plugin =& $this->plugin;
$this->setData('ads', $this->openAdsConnection->getAds());
$this->setData('headerAdId', $plugin->getSetting($journalId, 'headerAdId'));
$this->setData('headerAdOrientation', $plugin->getSetting($journalId, 'headerAdOrientation'));
$this->setData('sidebarAdId', $plugin->getSetting($journalId, 'sidebarAdId'));
$this->setData('contentAdId', $plugin->getSetting($journalId, 'contentAdId'));
$this->setData('pluginName', $plugin->getName());
}
/**
* Display the form.
*/
function display() {
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('orientationOptions', array(
AD_ORIENTATION_LEFT => 'plugins.generic.openads.orientation.left',
AD_ORIENTATION_CENTRE => 'plugins.generic.openads.orientation.centre',
AD_ORIENTATION_RIGHT => 'plugins.generic.openads.orientation.right'
));
parent::display();
}
/**
* Assign form data to user-submitted data.
*/
function readInputData() {
$this->readUserVars(array('headerAdId', 'headerAdOrientation', 'contentAdId', 'sidebarAdId'));
}
/**
* Save settings.
*/
function execute() {
$plugin =& $this->plugin;
$journalId = $this->journalId;
$plugin->updateSetting($journalId, 'headerAdId', $this->getData('headerAdId'));
$plugin->updateSetting($journalId, 'headerAdOrientation', $this->getData('headerAdOrientation'));
$plugin->updateSetting($journalId, 'contentAdId', $this->getData('contentAdId'));
$plugin->updateSetting($journalId, 'sidebarAdId', $this->getData('sidebarAdId'));
return true;
}
}
?>