Proyectos de Subversion LeadersLinked - Backend

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
15398 efrain 1
<?php
2
 
3
declare(strict_types=1);
4
 
5
namespace LeadersLinked\Form\DiscoveryContact;
6
 
7
use Laminas\Form\Form;
8
use Laminas\Db\Adapter\Adapter;
9
use Laminas\Db\Adapter\AdapterInterface;
10
use Laminas\Log\LoggerInterface;
11
use LeadersLinked\Mapper\CompanySizeMapper;
12
use LeadersLinked\Mapper\IndustryMapper;
13
use LeadersLinked\Mapper\DiscoveryContactInteractionTypeMapper;
14
 
15
class InteractionForm extends Form
16
{
17
 
18
    /**
19
     *
20
     * @param Adapter $adapter
21
     * @param int $company_id
22
     */
23
    public function __construct($adapter, $company_id)
24
    {
25
        parent::__construct();
26
        $this->setInputFilter(new InteractionFilter($adapter, $company_id));
27
 
28
 
29
        $this->add([
30
            'name' => 'notes',
31
            'type' => \Laminas\Form\Element\Textarea::class,
32
             'attributes' => [
33
                'id' 			=> 'notes',
34
            ]
35
        ]);
36
 
37
 
38
        $this->add([
39
            'name' => 'interaction_type_id',
40
            'type' => \Laminas\Form\Element\Select::class,
41
            'options' => [
42
                'empty_option' => 'LABEL_STATUS',
43
                'value_options' => $this->optionsInteractionTypes($adapter, $company_id),
44
            ],
45
            'attributes' => [
46
                'id' => 'interaction_type_id',
47
            ]
48
        ]);
49
 
50
    }
51
 
52
    private function optionsInteractionTypes($adapter, $company_id)
53
    {
54
        $items = [];
55
 
56
        $discoveryContactInteractionTypeMapper = DiscoveryContactInteractionTypeMapper::getInstance($adapter);
57
        $records = $discoveryContactInteractionTypeMapper->fetchAllActiveByCompanyId($company_id);
58
        foreach($records as $record)
59
        {
60
            $items[ $record->uuid ] = $record->name;
61
        }
62
 
63
        return $items;
64
    }
65
}