Proyectos de Subversion LeadersLinked - Services

Rev

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

Rev 1 Rev 345
Línea 1... Línea 1...
1
<?php
1
<?php
2
 
-
 
3
declare(strict_types=1);
2
declare(strict_types = 1);
4
 
-
 
5
namespace LeadersLinked\Form\UserProfile;
3
namespace LeadersLinked\Form\UserProfile;
Línea 6... Línea 4...
6
 
4
 
7
use Laminas\Form\Form;
5
use Laminas\Form\Form;
8
use Laminas\Db\Adapter\AdapterInterface;
6
use Laminas\Db\Adapter\AdapterInterface;
Línea 9... Línea -...
9
use LeadersLinked\Mapper\AptitudeMapper;
-
 
10
 
7
use LeadersLinked\Mapper\AptitudeMapper;
11
 
8
 
Línea 12... Línea 9...
12
class AptitudeForm extends Form
9
class AptitudeForm extends Form
13
{
10
{
14
 
11
 
15
    /**
12
    /**
16
     * 
13
     *
17
     * @param AdapterInterface $adapter
14
     * @param AdapterInterface $adapter
18
     */
15
     */
19
    public function __construct($adapter) 
16
    public function __construct($adapter)
Línea 20... Línea 17...
20
    {
17
    {
21
        parent::__construct();
18
        parent::__construct();
22
        $this->setInputFilter(new AptitudeFilter($adapter));
19
        $this->setInputFilter(new AptitudeFilter($adapter));
23
 
20
 
24
        $this->add([
21
        $this->add([
25
            'name' => 'aptitudes',
22
            'name' => 'aptitudes',
26
            'type' => \Laminas\Form\Element\Select::class,
23
            'type' => \Laminas\Form\Element\Select::class,
27
            'attributes' => [
24
            'attributes' => [
28
                'multiple' 	=> 'yes',
25
                'multiple' => 'yes',
29
                'id' => 'aptitudes',
26
                'id' => 'aptitudes'
30
            ],
27
            ],
31
            'options' => [
28
            'options' => [
32
                'disable_inarray_validator' => true,
-
 
33
                'value_options' => $this->getSelectOptions($adapter)
29
                'disable_inarray_validator' => true,
34
            ]
30
                'value_options' => $this->getSelectOptions($adapter)
35
        ]);
31
            ]
36
        
32
        ]);
37
    }
33
    }
38
    
34
 
39
    /**
35
    /**
40
     *
36
     *
41
     * @param AdapterInterface $adapter
37
     * @param AdapterInterface $adapter
42
     */
38
     */
43
    private function getSelectOptions($adapter) 
39
    private function getSelectOptions($adapter)
44
    {
40
    {
45
        $mapper = AptitudeMapper::getInstance($adapter);
41
        $mapper = AptitudeMapper::getInstance($adapter);
46
        $records = $mapper->fetchAllActive();
-
 
47
        
42
        $records = $mapper->fetchAllActive();
48
        $items = [];
43
 
49
        foreach($records as $record)
44
        $items = [];
50
        {
45
        foreach ($records as $record) {
51
            $items[$record->uuid] = $record->name;
46
            $items[$record->uuid] = $record->name;
52
        }
47
        }
53
        
48