1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace PSFS\base\config; |
4
|
|
|
|
5
|
|
|
use PSFS\base\types\Form; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Class ModuleForm |
9
|
|
|
* @package PSFS\base\config |
10
|
|
|
*/ |
11
|
|
|
class ModuleForm extends Form |
12
|
|
|
{ |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* @Injectable |
16
|
|
|
* @var \PSFS\base\Router $router |
17
|
|
|
*/ |
18
|
|
|
protected $router; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @throws \PSFS\base\exception\FormException |
22
|
|
|
* @throws \PSFS\base\exception\RouterException |
23
|
|
|
*/ |
24
|
|
|
public function __construct() |
25
|
|
|
{ |
26
|
|
|
parent::__construct(); |
27
|
|
|
$this->init(); |
28
|
|
|
$this->setAction($this->router->getRoute('admin-module')) |
29
|
|
|
->setAttrs(array()); |
30
|
|
|
|
31
|
|
|
$controllerTypes = array( |
32
|
|
|
"Normal" => t("Normal"), |
33
|
|
|
"Auth" => t("Requiere autenticación de usuario"), |
34
|
|
|
"AuthAdmin" => t("Requiere autenticación de administrador"), |
35
|
|
|
); |
36
|
|
|
$this->add('module', array( |
37
|
|
|
'label' => t('Nombre del Módulo'), |
38
|
|
|
))->add('controllerType', array( |
39
|
|
|
'label' => t('Tipo de controlador'), |
40
|
|
|
'type' => 'select', |
41
|
|
|
'data' => $controllerTypes, |
42
|
|
|
'required' => false |
43
|
|
|
))->add('api', array( |
44
|
|
|
'label' => t('Clase personalizada para API'), |
45
|
|
|
'required' => false, |
46
|
|
|
'placeholder' => t('Namespace de la clase completo'), |
47
|
|
|
)); |
48
|
|
|
//Aplicamos estilo al formulario |
49
|
|
|
$this->setAttrs(array( |
50
|
|
|
'class' => 'col-md-6', |
51
|
|
|
)); |
52
|
|
|
$this->addButton('submit', 'Generar módulo'); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* Método que devuelve el título del formulario |
57
|
|
|
* @return string |
58
|
|
|
*/ |
59
|
|
|
public function getTitle() |
60
|
|
|
{ |
61
|
|
|
return t('Gestión de Módulos'); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Método que devuelve el nombre del formulario |
66
|
|
|
* @return string |
67
|
|
|
*/ |
68
|
|
|
public function getName() |
69
|
|
|
{ |
70
|
|
|
return 'admin_modules'; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
} |
74
|
|
|
|