| Server IP : 127.0.1.1 / Your IP : 216.73.216.60 Web Server : Apache/2.4.58 (Ubuntu) System : Linux nepub 6.8.0-88-generic #89-Ubuntu SMP PREEMPT_DYNAMIC Sat Oct 11 01:02:46 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.2.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/html/public_html/plugins/generic/orcidProfile/classes/form/ |
Upload File : |
<?php
/**
* @file OrcidProfileStatusForm.inc.php
*
* Copyright (c) 2015-2019 University of Pittsburgh
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2003-2021 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class OrcidProfileStatusForm
* @ingroup plugins_generic_orcidProfile
*
* @brief Form for site admins to modify ORCID Profile plugin settings
*/
import('lib.pkp.classes.form.Form');
import('plugins.generic.orcidProfile.classes.OrcidValidator');
class OrcidProfileStatusForm extends Form {
const CONFIG_VARS = array(
'orcidProfileAPIPath' => 'string',
'orcidClientId' => 'string',
'orcidClientSecret' => 'string',
'sendMailToAuthorsOnPublication' => 'bool',
'logLevel' => 'string',
'isSandBox' => 'bool'
);
/** @var $contextId int */
var $contextId;
/** @var $plugin object */
var $plugin;
/** @var OrcidValidator */
var $validator;
/**
* Constructor
* @param $plugin object
* @param $contextId int
*/
function __construct($plugin, $contextId) {
$this->contextId = $contextId;
$this->plugin = $plugin;
$orcidValidator = new OrcidValidator($plugin);
$this->validator = $orcidValidator;
parent::__construct($plugin->getTemplateResource('statusForm.tpl'));
if (!$this->plugin->isGloballyConfigured()) {
}
}
/**
* Initialize form data.
*/
function initData() {
$contextId = $this->contextId;
$plugin =& $this->plugin;
$this->_data = array();
foreach (self::CONFIG_VARS as $configVar => $type) {
$this->_data[$configVar] = $plugin->getSetting($contextId, $configVar);
}
}
/**
* Fetch the form.
* @copydoc Form::fetch()
*/
function fetch($request, $template = null, $display = false) {
$contextId = $request->getContext()->getId();
$clientId = $this->plugin->getSetting($contextId, 'orcidClientId');
$clientSecret = $this->plugin->getSetting($contextId, 'orcidClientSecret');
$templateMgr = TemplateManager::getManager($request);
$aboutUrl = $request->getDispatcher()->url($request, ROUTE_PAGE, null, 'orcidapi', 'about', null);
$templateMgr->assign(array(
'globallyConfigured' => $this->plugin->isGloballyConfigured(),
'orcidAboutUrl' => $aboutUrl,
'pluginEnabled' => $this->plugin->getEnabled($contextId),
'clientIdValid' => $this->validator->validateClientId($clientId),
'clientSecretValid' => $this->validator->validateClientSecret($clientSecret),
));
return parent::fetch($request, $template, $display);
}
}