Open Journal Systems  3.3.0
PKPLicenseForm.inc.php
1 <?php
15 use \PKP\components\forms\FormComponent;
16 use \PKP\components\forms\FieldRadioInput;
17 use \PKP\components\forms\FieldRichTextarea;
18 use \PKP\components\forms\FieldText;
19 
20 define('FORM_LICENSE', 'license');
21 
24  public $id = FORM_LICENSE;
25 
27  public $method = 'PUT';
28 
36  public function __construct($action, $locales, $context) {
37  $this->action = $action;
38  $this->locales = $locales;
39 
40  $licenseOptions = \Application::getCCLicenseOptions();
41  $licenseUrlOptions = [];
42  foreach ($licenseOptions as $url => $label) {
43  $licenseUrlOptions[] = [
44  'value' => $url,
45  'label' => __($label),
46  ];
47  }
48  $licenseUrlOptions[] = [
49  'value' => 'other',
50  'label' => __('manager.distribution.license.other'),
51  'isInput' => true,
52  ];
53 
54  $this->addField(new FieldRadioInput('copyrightHolderType', [
55  'label' => __('submission.copyrightHolder'),
56  'type' => 'radio',
57  'options' => [
58  ['value' => 'author', 'label' => __('user.role.author')],
59  ['value' => 'context', 'label' => __('context.context')],
60  ['value' => 'other', 'label' => __('submission.copyrightHolder.other')],
61  ],
62  'value' => $context->getData('copyrightHolderType'),
63  ]))
64  ->addField(new FieldText('copyrightHolderOther', [
65  'label' => __('submission.copyrightOther'),
66  'description' => __('submission.copyrightOther.description'),
67  'isMultilingual' => true,
68  'showWhen' => ['copyrightHolderType', 'other'],
69  'value' => $context->getData('copyrightHolderOther'),
70  ]))
71  ->addField(new FieldRadioInput('licenseUrl', [
72  'label' => __('manager.distribution.license'),
73  'type' => 'radio',
74  'options' => $licenseUrlOptions,
75  'value' => $context->getData('licenseUrl'),
76  ]))
77  ->addField(new FieldRichTextarea('licenseTerms', [
78  'label' => __('manager.distribution.licenseTerms'),
79  'tooltip' => __('manager.distribution.licenseTerms.description'),
80  'isMultilingual' => true,
81  'value' => $context->getData('licenseTerms'),
82  'toolbar' => 'bold italic superscript subscript | link | blockquote bullist numlist',
83  'plugins' => 'paste,link,lists',
84  ]));
85  }
86 }
PKP\components\forms\context\PKPLicenseForm\$method
$method
Definition: PKPLicenseForm.inc.php:27
PKP\components\forms\FieldRichTextarea
Definition: FieldRichTextarea.inc.php:15
PKP\components\forms\FieldText
Definition: FieldText.inc.php:15
PKP\components\forms\context
Definition: PKPAnnouncementSettingsForm.inc.php:14
PKP\components\forms\FieldRadioInput
Definition: FieldRadioInput.inc.php:16
PKP\components\forms\context\PKPLicenseForm
Definition: PKPLicenseForm.inc.php:22
PKPApplication\getCCLicenseOptions
static getCCLicenseOptions()
Definition: PKPApplication.inc.php:686
PKP\components\forms\context\FORM_LICENSE
const FORM_LICENSE
Definition: PKPLicenseForm.inc.php:20
PKP\components\forms\context\PKPLicenseForm\$id
$id
Definition: PKPLicenseForm.inc.php:24
PKP\components\forms\FormComponent\$action
$action
Definition: FormComponent.inc.php:37
PKP\components\forms\FormComponent
Definition: FormComponent.inc.php:20
PKP\components\forms\context\PKPLicenseForm\__construct
__construct($action, $locales, $context)
Definition: PKPLicenseForm.inc.php:36
PKP\components\forms\FormComponent\addField
addField($field, $position=[])
Definition: FormComponent.inc.php:94
PKP\components\forms\FormComponent\$locales
$locales
Definition: FormComponent.inc.php:43