-
Notifications
You must be signed in to change notification settings - Fork 5
/
InlineHtmlGalleySettingsForm.inc.php
70 lines (57 loc) · 1.82 KB
/
InlineHtmlGalleySettingsForm.inc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
/**
* @file plugins/generic/inlineHtmlGalley/InlineHtmlGalleySettingsForm.inc.php
*
* Copyright (c) University of Pittsburgh
* Distributed under the GNU GPL v2 or later. For full terms see the file docs/COPYING.
*
* @class InlineHtmlGalleySettingsForm
* @ingroup plugins_generic_inlineHtmlGalley
*
* @brief Form to provide settings for the InlineHtmlGalley plugin
*/
import('lib.pkp.classes.form.Form');
class InlineHtmlGalleySettingsForm extends Form {
/** @var $plugin InlineHtmlGalleyPlugin */
var $plugin;
/** @var $contextId int */
var $contextId;
/**
* Constructor
* @param $plugin InlineHtmlGalleyPlugin
* @param $contextId int
*/
function __construct($plugin, $contextId) {
$this->plugin = $plugin;
$this->contextId = $contextId;
parent::__construct(method_exists($plugin, 'getTemplateResource') ? $plugin->getTemplateResource('settingsForm.tpl') : $plugin->getTemplatePath() . 'settingsForm.tpl');
$this->addCheck(new FormValidatorPost($this));
$this->addCheck(new FormValidatorCSRF($this));
}
/**
* @copydoc Form::initData()
*/
function initData() {
$this->setData('xpath', $this->plugin->getSetting($this->contextId, 'xpath'));
}
/**
* @copydoc Form::readInputData()
*/
function readInputData() {
$this->readUserVars(array('xpath'));
}
/**
* @copydoc Form::fetch()
*/
function fetch($request) {
$templateMgr = TemplateManager::getManager($request);
$templateMgr->assign('pluginName', $this->plugin->getName());
return parent::fetch($request);
}
/**
* @copydoc Form::execute()
*/
function execute() {
$this->plugin->updateSetting($this->contextId, 'xpath', $this->getData('xpath'));
}
}