SmartAutocompleteElement::render()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
1
<?php namespace XoopsModules\Smartobject\Form\Elements;
2
3
/**
4
 * Contains the SmartObjectControl class
5
 *
6
 * @license    GNU
7
 * @author     marcan <[email protected]>
8
 * @link       http://smartfactory.ca The SmartFactory
9
 * @package    SmartObject
10
 * @subpackage SmartObjectForm
11
 */
12
13
use XoopsModules\Smartobject;
14
15
/**
16
 * Class SmartAutocompleteElement
17
 * @package XoopsModules\Smartobject\Form\Elements
18
 */
19
class SmartAutocompleteElement extends \XoopsFormText
20
{
21
    public $_include_file;
22
23
    /**
24
     * SmartAutocompleteElement constructor.
25
     * @param string $caption
26
     * @param string $name
27
     * @param int    $include_file
28
     * @param int    $size
29
     * @param string $maxlength
30
     * @param string $value
31
     */
32
    public function __construct($caption, $name, $include_file, $size, $maxlength, $value = '')
33
    {
34
        $this->_include_file = $include_file;
35
        parent::__construct($caption, $name, $size, $maxlength, $value);
36
    }
37
38
    /**
39
     * Prepare HTML for output
40
     *
41
     * @return string HTML
42
     */
43
    public function render()
44
    {
45
        $ret = "<input type='text' name='" . $this->getName() . "' id='" . $this->getName() . "' size='" . $this->getSize() . "' maxlength='" . $this->getMaxlength() . "' value='" . $this->getValue() . "'" . $this->getExtra() . '>';
0 ignored issues
show
Bug introduced by
Consider using $this->name. There is an issue with getName() and APC-enabled PHP versions.
Loading history...
46
47
        $ret .= '   <div class="smartobject_autocomplete_hint" id="smartobject_autocomplete_hint' . $this->getName() . '"></div>
0 ignored issues
show
Bug introduced by
Consider using $this->name. There is an issue with getName() and APC-enabled PHP versions.
Loading history...
48
49
    <script type="text/javascript">
50
        new Ajax.Autocompleter("' . $this->getName() . '","smartobject_autocomplete_hint' . $this->getName() . '","' . $this->_include_file . '?key=' . $this->getName() . '");
0 ignored issues
show
Bug introduced by
Consider using $this->name. There is an issue with getName() and APC-enabled PHP versions.
Loading history...
51
    </script>';
52
53
        return $ret;
54
    }
55
}
56