1<?php
2/**
3 * This file contains all Horde_Core_Ui_VarRenderer extensions for Whups
4 * specific form fields.
5 *
6 * Copyright 2008-2017 Horde LLC (http://www.horde.org/)
7 *
8 * See the enclosed file LICENSE for license information (BSD). If you
9 * did not receive this file, see http://www.horde.org/licenses/bsdl.php.
10 *
11 * @author  Jan Schneider <jan@horde.org>
12 * @package Whups
13 */
14
15/**
16 * The Horde_Core_Ui_VarRenderer_whups class provides additional methods for
17 * rendering Whups_Form_Type_whupsemail fields.
18 *
19 * @author  Jan Schneider <jan@horde.org>
20 * @package Whups
21 */
22class Horde_Core_Ui_VarRenderer_whups extends Horde_Core_Ui_VarRenderer_Html {
23
24    function _renderVarInput_whups_form_type_whupsemail($form, &$var, &$vars)
25    {
26        $name = $var->getVarName();
27
28        $GLOBALS['injector']->getInstance('Horde_Core_Factory_Imple')
29            ->create(
30                'Whups_Ajax_Imple_ContactAutoCompleter',
31                array('id' => $name)
32            );
33
34        return sprintf('<input type="text" name="%s" id="%s" value="%s" autocomplete="off"%s />',
35                       $name,
36                       $name,
37                       @htmlspecialchars($var->getValue($vars)),
38                       $this->_getActionScripts($form, $var))
39            . '<span id="' . $name . '_loading_img" style="display:none;">'
40            . Horde::img('loading.gif', _("Loading..."))
41            . '</span>';
42    }
43
44}
45