1 <?php
2
3 /*
4 * This file is part of the Icybee/Installer package.
5 *
6 * (c) Olivier Laviale <olivier.laviale@gmail.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Icybee\Installer;
13
14 use Brickrouge\Element;
15 use Brickrouge\Form;
16 use Brickrouge\Group;
17 use Brickrouge\Text;
18
19 class DatabaseForm extends PanelForm
20 {
21 public function __construct()
22 {
23 global $core;
24
25 $values = array();
26
27 if (isset($core->session->install['database']))
28 {
29 $values = $core->session->install['database'];
30 }
31
32 parent::__construct
33 (
34 array
35 (
36 PanelDecorator::TITLE => t('panel.database.title'),
37 PanelDecorator::DESCRIPTION => t('panel.database.description'),
38
39 Form::VALUES => $values,
40
41 Element::CHILDREN => array
42 (
43 'username' => new Text
44 (
45 array
46 (
47 Group::LABEL => "User name",
48 Element::REQUIRED => true,
49 Element::DESCRIPTION => t('panel.database.username')
50 )
51 ),
52
53 'password' => new Text
54 (
55 array
56 (
57 Group::LABEL => "Password",
58
59 'type' => 'password'
60 )
61 ),
62
63 'name' => new Text
64 (
65 array
66 (
67 Group::LABEL => "Database name",
68 Element::REQUIRED => true,
69 Element::DESCRIPTION => t('panel.database.name'),
70 Element::DEFAULT_VALUE => "icybee"
71 )
72 ),
73
74 'host' => new Text
75 (
76 array
77 (
78 Group::LABEL => "Database host",
79
80 'placeholder' => "localhost"
81 )
82 ),
83
84 'prefix' => new Text
85 (
86 array
87 (
88 Group::LABEL => "Table prefix",
89 Element::DESCRIPTION => t('panel.database.prefix')
90 )
91 )
92 ),
93
94 'action' => '/api/install/database',
95 'autocomplete' => 'off',
96 'name' => 'database'
97 )
98 );
99 }
100 }
101