refactor solution to PHP through AI
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
require_once __DIR__ . '/../common/ElixFormsComponent.php';
|
||||
|
||||
use ElixForms\Common\ElixFormsComponent;
|
||||
|
||||
/**
|
||||
* Pagina custom "Scelta Carriera" per elixForms.
|
||||
* Equivalente PHP della pagina React scelta-carriera.
|
||||
*
|
||||
* Estende ElixFormsComponent sovrascrivendo:
|
||||
* - createCustomFormFields(): definisce dropdown, text, textarea, boolean, radio, checkbox
|
||||
* - renderExtraContentPost(): aggiunge un alert informativo in fondo
|
||||
*/
|
||||
class SceltaCarrieraPage extends ElixFormsComponent
|
||||
{
|
||||
protected function createCustomFormFields(): string
|
||||
{
|
||||
$html = '';
|
||||
|
||||
// Dropdown: COL0015 Goals
|
||||
$html .= $this->createDropdownInput('COL0015', 'COL0015 Goals', [
|
||||
['value' => 0, 'label' => 'Not applicable'],
|
||||
['value' => 1, 'label' => 'Goal 1: No poverty'],
|
||||
['value' => 2, 'label' => 'Goal 2: Zero hunger'],
|
||||
['value' => 3, 'label' => 'Goal 3: Good health and well-being'],
|
||||
['value' => 4, 'label' => 'Goal 4: Quality education'],
|
||||
['value' => 5, 'label' => 'Goal 5: Gender equality'],
|
||||
['value' => 6, 'label' => 'Goal 6: Clean water and sanitation'],
|
||||
['value' => 7, 'label' => 'Goal 7: Affordable and clean energy'],
|
||||
['value' => 8, 'label' => 'Goal 8: Decent work and economic growth'],
|
||||
['value' => 9, 'label' => 'Goal 9: Industry, Innovation, and Infrastructure'],
|
||||
['value' => 10, 'label' => 'Goal 10: Reduced inequalities'],
|
||||
['value' => 11, 'label' => 'Goal 11: Sustainable cities and communities'],
|
||||
['value' => 12, 'label' => 'Goal 12: Responsible consumption and production'],
|
||||
['value' => 13, 'label' => 'Goal 13: Climate action'],
|
||||
['value' => 14, 'label' => 'Goal 14: Life below water'],
|
||||
['value' => 15, 'label' => 'Goal 15: Life on land'],
|
||||
['value' => 16, 'label' => 'Goal 16: Peace, justice and strong institutions'],
|
||||
['value' => 17, 'label' => 'Goal 17: Partnerships for the goals'],
|
||||
], true);
|
||||
|
||||
// Text input: COL0002
|
||||
$html .= $this->createTextInput('COL0002', 'Campo STRING', true);
|
||||
|
||||
// Textarea: COL0003
|
||||
$html .= $this->createTextAreaInput('COL0003', 'Campo TEXTAREA', true);
|
||||
|
||||
// Boolean: COL0004
|
||||
$html .= $this->createBooleanInput('COL0004', 'Campo BOOLEAN', true);
|
||||
|
||||
// Radio: COL0005
|
||||
$html .= $this->createRadioInput('COL0005', 'Campo RADIO', [
|
||||
['value' => 1, 'label' => 'Opzione 1'],
|
||||
['value' => 2, 'label' => 'Opzione 2'],
|
||||
['value' => 3, 'label' => 'Altra opzione'],
|
||||
], true);
|
||||
|
||||
// Checkbox: COL0006
|
||||
$html .= $this->createCheckboxInput('COL0006', 'Campo CHECKBOX', [
|
||||
['value' => 4, 'label' => 'Check 1'],
|
||||
['value' => 5, 'label' => 'Check 2'],
|
||||
['value' => 6, 'label' => 'Altro check'],
|
||||
]);
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
protected function renderExtraContentPost(): string
|
||||
{
|
||||
return '<div class="alert alert-info mt-4">Questa pagina è la versione PHP della custom page Scelta Carriera.</div>';
|
||||
}
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// Entry point — Istanziazione e rendering della pagina
|
||||
// =============================================================================
|
||||
|
||||
$page = new SceltaCarrieraPage([
|
||||
'moduleName' => '',
|
||||
'alertInfoMessage' => '',
|
||||
'userDisplayName' => 'John Doe',
|
||||
'headerTitle' => 'Modulo A/13 - Richiesta di Certificato',
|
||||
'cardTitle' => 'Scelta Carriera',
|
||||
'cardDescription' => 'Benvenuto nella piattaforma di scelta carriera! Esplora le tue opzioni e trova la strada giusta per te.',
|
||||
'headerHeroImageSrc' => '',
|
||||
]);
|
||||
|
||||
echo $page->render();
|
||||
Reference in New Issue
Block a user