aboutsummaryrefslogtreecommitdiff
path: root/lib/classes/forms/MultiquicksearchInput.php
blob: c7a9a02fa29055df8d8c0a69b455bda20e9339e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php

namespace Studip\Forms;

class MultiquicksearchInput extends Input
{
    public function render()
    {
        $options = $this->extractOptionsFromAttributes($this->attributes);

        $name = $this->name;
        if (substr($name, -2) === '[]') {
            $name .= substr($name, 0, -2);
        }

        $template = $GLOBALS['template_factory']->open('forms/multiquicksearch_input');
        $template->title      = $this->title;
        $template->name       = $name;
        $template->value      = $this->getValue();
        $template->id         = md5(uniqid());
        $template->required   = $this->required;
        $template->attributes = arrayToHtmlAttributes($this->attributes);
        $template->options    = $options;
        return $template->render();
    }

    public function getRequestValue()
    {
        return \Request::getArray($this->name);
    }
}