Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 17108 | Rev 17112 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
17002 efrain 1
<?php
2
 
3
declare(strict_types=1);
4
 
5
namespace LeadersLinked\Form\Microlearning;
6
 
7
use Laminas\Form\Form;
17091 stevensc 8
use Laminas\Form\Element\Select;
17082 stevensc 9
use LeadersLinked\Mapper\MicrolearningCapsuleMapper;
17002 efrain 10
 
11
class TopicForm extends Form
12
{
13
 
17110 stevensc 14
    public function __construct($adapter){
17002 efrain 15
        parent::__construct();
17087 stevensc 16
        $this->setInputFilter(new TopicFilter($adapter));
17002 efrain 17
 
18
         $this->add([
19
            'name' => 'title',
20
            'type' => \Laminas\Form\Element\Text::class,
21
            'attributes' => [
22
                'maxlength' 	=> 128,
23
                'id' 			=> 'title',
24
            ]
25
        ]);
26
 
27
       $this->add([
28
            'name' => 'description',
29
            'type' => \Laminas\Form\Element\Textarea::class,
30
            'attributes' => [
31
                'id'    => 'description',
32
            ]
33
        ]);
34
 
35
        $this->add([
36
            'name' => 'status',
37
            'type' => \Laminas\Form\Element\Checkbox::class,
38
            'attributes' => [
39
                'id' 			=> 'status',
40
            ],
41
            'options' => [
42
                'use_hidden_element' => false,
43
                'unchecked_value' => \LeadersLinked\Model\Topic::STATUS_INACTIVE,
44
                'checked_value'=> \LeadersLinked\Model\Topic::STATUS_ACTIVE,
45
            ]
46
        ]);
47
    }
48
 
17080 stevensc 49
    private function getSelectOptions($adapter, $company_id)
50
    {
51
        $options = [];
52
 
53
        $mapper = MicrolearningCapsuleMapper::getInstance($adapter);
17090 stevensc 54
        $records = $mapper->fetchAllActiveByCompanyId($company_id);
55
 
17080 stevensc 56
        foreach($records as $record)
57
        {
17090 stevensc 58
            $options[$record->uuid] = $record->name;
17080 stevensc 59
        }
17086 stevensc 60
        return $options;
17080 stevensc 61
    }
62
 
17002 efrain 63
}
64