Proyectos de Subversion LeadersLinked - Backend

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 www 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 LeadersLinked\Mapper\PushTemplateMapper;
10
use LeadersLinked\Model\PushTemplate;
11
 
12
 
13
class PushMicrolearningNotificationForm extends Form
14
{
15
 
16
    /**
17
     *
18
     * @param AdapterInterface $adapter
19
     */
20
    public function __construct($adapter)
21
    {
22
        parent::__construct();
23
        $this->setInputFilter(new PushMicrolearningNotificationFilter($adapter));
24
 
25
 
26
 
27
        $this->add([
28
            'name' => 'push_template_id',
29
            'type' => \Laminas\Form\Element\Select::class,
30
            'attributes' => [
31
                'id' => 'push_template_id',
32
            ],
33
            'options' => [
34
                'value_options' => $this->getSelectOptions($adapter)
35
            ]
36
        ]);
37
 
38
    }
39
 
40
    /**
41
     *
42
     * @param AdapterInterface $adapter
43
     */
44
    private function getSelectOptions($adapter)
45
    {
46
        $options = [];
47
 
48
        $mapper = PushTemplateMapper::getInstance($adapter);
49
        $records = $mapper->fetchAllActiveByType(PushTemplate::TYPE_MICRO_LEARNING);
50
 
51
        foreach($records as $record)
52
        {
53
            $options[$record->uuid] = $record->title;
54
        }
55
        return $options;
56
    }
57
 
58
 
59
 
60
 
61
 
62
}
63
 
64