Completed
Push — master ( 01b1a5...81f493 )
by Michael
04:03
created

SmartAutocompleteElement::render()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 24
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 5
Bugs 1 Features 0
Metric Value
cc 1
eloc 17
c 5
b 1
f 0
nc 1
nop 0
dl 0
loc 24
rs 8.9713
1
<?php
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
class SmartAutocompleteElement extends XoopsFormText
13
{
14
    public $_include_file;
15
16
    /**
17
     * SmartAutocompleteElement constructor.
18
     * @param string $caption
19
     * @param string $name
20
     * @param int    $include_file
21
     * @param int    $size
22
     * @param string $maxlength
23
     * @param string $value
24
     */
25
    public function __construct($caption, $name, $include_file, $size, $maxlength, $value = '')
26
    {
27
        $this->_include_file = $include_file;
28
        parent::__construct($caption, $name, $size, $maxlength, $value);
29
    }
30
31
    /**
32
     * Prepare HTML for output
33
     *
34
     * @return string HTML
35
     */
36
    public function render()
37
    {
38
        $ret = "<input type='text' name='" .
39
               $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...
40
               "' id='" .
41
               $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...
42
               "' size='" .
43
               $this->getSize() .
44
               "' maxlength='" .
45
               $this->getMaxlength() .
46
               "' value='" .
47
               $this->getValue() .
48
               "'" .
49
               $this->getExtra() .
50
               ' />';
51
52
        $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...
53
54
    <script type="text/javascript">
55
        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...
56
    </script>';
57
58
        return $ret;
59
    }
60
}
61