Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 16766 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 16766 Rev 17022
Línea 3... Línea 3...
3
declare(strict_types=1);
3
declare(strict_types=1);
Línea 4... Línea 4...
4
 
4
 
Línea 5... Línea 5...
5
namespace LeadersLinked\Form\SelfEvaluation;
5
namespace LeadersLinked\Form\SelfEvaluation;
-
 
6
 
-
 
7
use Laminas\Form\Form;
-
 
8
use Laminas\Db\Adapter\AdapterInterface;
-
 
9
use Laminas\Log\LoggerInterface;
-
 
10
use LeadersLinked\Mapper\CompanySizeMapper;
-
 
11
use LeadersLinked\Mapper\IndustryMapper;
6
 
-
 
-
 
12
use LeadersLinked\Mapper\CompetencyTypeMapper;
-
 
13
use LeadersLinked\Mapper\MicrolearningTopicMapper;
Línea 7... Línea 14...
7
use Laminas\Form\Form;
14
use LeadersLinked\Mapper\MicrolearningCapsuleMapper;
8
 
15
use LeadersLinked\Mapper\SelfEvaluationFormMapper;
Línea -... Línea 16...
-
 
16
 
-
 
17
class SelfEvaluationFormForm extends Form
-
 
18
{
-
 
19
 
-
 
20
    /**
9
 
21
     * 
10
class SelfEvaluationFormForm extends Form
22
     * @param AdapterInterface $adapter
11
{
23
     * @param int $company_id
12
 
24
     */
Línea 13... Línea 25...
13
    public function __construct() 
25
    public function __construct($adapter, $company_id) 
14
    {
26
    {
15
        parent::__construct();
27
        parent::__construct();
16
        $this->setInputFilter(new SelfEvaluationFormFilter());
28
        $this->setInputFilter(new SelfEvaluationFormFilter($adapter));
17
        
29
        
18
        $this->add([
30
        $this->add([
19
            'name' => 'language',
31
            'name' => 'form_uuid',
20
            'type' => \Laminas\Form\Element\Select::class,
-
 
21
            'attributes' => [
-
 
22
                'id' => 'language',
32
            'type' => \Laminas\Form\Element\Select::class,
23
            ],
-
 
24
            'options' => [
-
 
25
                'value_options' => [
-
 
26
                    \LeadersLinked\Model\SelfEvaluationForm::LANGUAGE_SPANISH => 'LABEL_SPANISH',
-
 
27
                    \LeadersLinked\Model\SelfEvaluationForm::LANGUAGE_ENGLISH => 'LABEL_ENGLISH',
-
 
28
                ]
-
 
29
            ]
-
 
30
        ]);
-
 
31
        
-
 
32
        
-
 
33
        $this->add([
-
 
34
            'name' => 'name',
-
 
35
            'type' => \Laminas\Form\Element\Text::class,
-
 
36
             'attributes' => [
-
 
37
                'maxlength' 	=> 128,
-
 
38
                'id' 			=> 'name',
-
 
39
            ]
-
 
40
        ]);
-
 
41
         
-
 
42
        $this->add([
33
            'attributes' => [
43
            'name' => 'description',
34
                'id' => 'form_uuid',
-
 
35
            ],
-
 
36
            'options' => [
-
 
37
                'value_options' => $this->getSelectFormOptions($adapter, $company_id)
-
 
38
            ]
-
 
39
        ]);
-
 
40
 
-
 
41
    }
-
 
42
    
-
 
43
    /**
-
 
44
     *
Línea 44... Línea -...
44
            'type' => \Laminas\Form\Element\Textarea::class,
-
 
45
            'attributes' => [
-
 
46
                'id'    => 'description',
45
     * @param AdapterInterface $adapter
47
            ]
-
 
48
        ]);
46
     */
49
        
-
 
50
        $this->add([
-
 
Línea 51... Línea -...
51
            'name' => 'text',
-
 
52
            'type' => \Laminas\Form\Element\Textarea::class,
47
    private function getSelectFormOptions($adapter, $company_id)
53
            'attributes' => [
-
 
54
                'id'    => 'text',
-
 
55
            ]
-
 
56
        ]);
-
 
57
        
48
    {
58
        $this->add([
-
 
59
            'name' => 'content',
-
 
60
            'type' => \Laminas\Form\Element\Textarea::class,
-
 
61
            'attributes' => [
49
        $options = [];
62
                'id'    => 'content',
-
 
63
            ]
-
 
64
        ]);
50
        
65
 
51
        $mapper = SelfEvaluationFormMapper::getInstance($adapter);
66
        $this->add([
-
 
67
            'name' => 'status',
-
 
68
            'type' => \Laminas\Form\Element\Checkbox::class,
-
 
69
            'attributes' => [
-
 
70
                'id' 			=> 'status',
-
 
71
            ],
-
 
72
            'options' => [
52
        $records = $mapper->fetchAllByCompanyId($company_id); 
Línea 73... Línea 53...
73
                'use_hidden_element' => false,
53
        
74
                'unchecked_value' => \LeadersLinked\Model\SelfEvaluationForm::STATUS_INACTIVE,
54
        foreach($records as $record)