-
Notifications
You must be signed in to change notification settings - Fork 447
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'pkp:main' into structured-citations
- Loading branch information
Showing
46 changed files
with
1,814 additions
and
274 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
classes/components/forms/invitation/AcceptUserDetailsForm.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<?php | ||
/** | ||
* @file classes/components/forms/invitation/AcceptUserDetailsForm.php | ||
* | ||
* Copyright (c) 2014-2024 Simon Fraser University | ||
* Copyright (c) 2000-2024 John Willinsky | ||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING. | ||
* | ||
* @class AcceptUserDetailsForm | ||
* | ||
* | ||
* @brief Handles accept invitation user details form | ||
*/ | ||
|
||
namespace PKP\components\forms\invitation; | ||
|
||
use PKP\components\forms\FieldSelect; | ||
use PKP\components\forms\FieldText; | ||
use PKP\components\forms\FormComponent; | ||
use PKP\facades\Locale; | ||
|
||
class AcceptUserDetailsForm extends FormComponent | ||
{ | ||
public const ACCEPT_FORM_USER_DETAILS = 'acceptUserDetails'; | ||
/** @copydoc FormComponent::$id */ | ||
public $id = self::ACCEPT_FORM_USER_DETAILS; | ||
|
||
/** @copydoc FormComponent::$method */ | ||
public $method = 'POST'; | ||
|
||
/** | ||
* Constructor | ||
* | ||
* @param string $action URL to submit the form to | ||
* @param array $locales Supported locales | ||
*/ | ||
public function __construct($action, $locales) | ||
{ | ||
$this->action = $action; | ||
$this->locales = $locales; | ||
|
||
$countries = []; | ||
foreach (Locale::getCountries() as $country) { | ||
$countries[] = [ | ||
'value' => $country->getAlpha2(), | ||
'label' => $country->getLocalName() | ||
]; | ||
} | ||
|
||
usort($countries, function ($a, $b) { | ||
return strcmp($a['label'], $b['label']); | ||
}); | ||
|
||
$this->addField(new FieldText('givenName', [ | ||
'label' => __('user.givenName'), | ||
'description' => __('acceptInvitation.userDetailsForm.givenName.description'), | ||
'isRequired' => true, | ||
'isMultilingual' => true, | ||
'size' => 'large', | ||
'value' => '' | ||
])) | ||
->addField(new FieldText('familyName', [ | ||
'label' => __('user.familyName'), | ||
'description' => __('acceptInvitation.userDetailsForm.familyName.description'), | ||
'isRequired' => false, | ||
'isMultilingual' => true, | ||
'size' => 'large', | ||
'value' => '' | ||
])) | ||
->addField(new FieldText('affiliation', [ | ||
'label' => __('user.affiliation'), | ||
'description' => __('acceptInvitation.userDetailsForm.affiliation.description'), | ||
'isMultilingual' => true, | ||
'isRequired' => false, | ||
'size' => 'large', | ||
|
||
])) | ||
->addField(new FieldSelect('userCountry', [ | ||
'label' => __('acceptInvitation.userDetailsForm.countryOfAffiliation.label'), | ||
'description' => __('acceptInvitation.userDetailsForm.countryOfAffiliation.description'), | ||
'options' => $countries, | ||
'isRequired' => true, | ||
'size' => 'large', | ||
])); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
/** | ||
* @file classes/components/forms/invitation/UserDetailsForm.php | ||
* | ||
* Copyright (c) 2014-2024 Simon Fraser University | ||
* Copyright (c) 2000-2024 John Willinsky | ||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING. | ||
* | ||
* @class AcceptUserDetailsForm | ||
* | ||
* | ||
* @brief Handles send invitation user details form | ||
*/ | ||
|
||
namespace PKP\components\forms\invitation; | ||
|
||
use PKP\components\forms\FieldHTML; | ||
use PKP\components\forms\FieldText; | ||
use PKP\components\forms\FormComponent; | ||
|
||
class UserDetailsForm extends FormComponent | ||
{ | ||
public const FORM_USER_DETAILS = 'userDetails'; | ||
/** @copydoc FormComponent::$id */ | ||
public $id = self::FORM_USER_DETAILS; | ||
|
||
/** @copydoc FormComponent::$method */ | ||
public $method = 'POST'; | ||
|
||
/** | ||
* Constructor | ||
* | ||
* @param string $action URL to submit the form to | ||
* @param array $locales Supported locales | ||
*/ | ||
public function __construct(string $action, array $locales) | ||
{ | ||
$this->action = $action; | ||
$this->locales = $locales; | ||
|
||
$this->addField(new FieldText('inviteeEmail', [ | ||
'label' => __('user.email'), | ||
'description' => __('invitation.email.description'), | ||
'isRequired' => true, | ||
'size' => 'large', | ||
])) | ||
->addField(new FieldHTML('orcid', [ | ||
'label' => __('user.orcid'), | ||
'description' => __('invitation.orcid.description'), | ||
'isRequired' => false, | ||
'size' => 'large', | ||
])) | ||
->addField(new FieldText('givenName', [ | ||
'label' => __('user.givenName'), | ||
'description' => __('invitation.givenName.description'), | ||
'isRequired' => false, | ||
'isMultilingual' => true, | ||
'size' => 'large', | ||
])) | ||
->addField(new FieldText('familyName', [ | ||
'label' => __('user.familyName'), | ||
'description' => __('invitation.familyName.description'), | ||
'isRequired' => false, | ||
'isMultilingual' => true, | ||
'size' => 'large', | ||
])); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.