Proyectos de Subversion LeadersLinked - Backend

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
115 efrain 1
<?php
2
 
3
declare(strict_types=1);
4
 
5
namespace LeadersLinked\Form;
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;
12
use LeadersLinked\Mapper\CompetencyTypeMapper;
13
use LeadersLinked\Mapper\CompanyMicrolearningTopicMapper;
14
use LeadersLinked\Mapper\CompanyMicrolearningCapsuleMapper;
15446 efrain 15
use LeadersLinked\Mapper\SelfEvaluationFormMapper;
115 efrain 16
 
17
class SelfEvaluationFormForm extends Form
18
{
19
 
20
    /**
21
     *
22
     * @param AdapterInterface $adapter
23
     * @param int $company_id
24
     */
25
    public function __construct($adapter, $company_id)
26
    {
27
        parent::__construct();
28
        $this->setInputFilter(new SelfEvaluationFormFilter($adapter));
29
 
30
        $this->add([
31
            'name' => 'form_uuid',
32
            'type' => \Laminas\Form\Element\Select::class,
33
            'attributes' => [
34
                'id' => 'form_uuid',
35
            ],
36
            'options' => [
37
                'value_options' => $this->getSelectFormOptions($adapter, $company_id)
38
            ]
39
        ]);
40
 
41
    }
42
 
43
    /**
44
     *
45
     * @param AdapterInterface $adapter
46
     */
47
    private function getSelectFormOptions($adapter, $company_id)
48
    {
49
        $options = [];
50
 
15446 efrain 51
        $mapper = SelfEvaluationFormMapper::getInstance($adapter);
115 efrain 52
        $records = $mapper->fetchAllByCompanyId($company_id);
53
 
54
        foreach($records as $record)
55
        {
56
            $options[$record->uuid] = $record->name;
57
        }
58
        return $options;
59
    }
60
 
61
 
62
}