<?php

class XmlInputFlags
{

    const ASCII = 'a';
    const PHONE_NUMBER = 't';
    const NUMBERS = 'n';
    const EQUATIONS = 'e';
    const UPPERCASE = 'u';
    const LOWERCASE = 'l';
    const PASSWORD = 'p';
    const PASSWORD_NUMERIC_MODE = 'pn'; //version > 7.1.30

}

require_once "XmlScreen.php";

class XmlInputScreen extends XmlScreen
{

    public $xw;

    public function __construct()
    {
        parent::__construct('SnomIPPhoneInput');
    }

    public function setPrompt($prompt)
    {
        $this->xw->writeElement('Prompt', $prompt);
    }

    public function setURl($url)
    {
        $this->xw->writeElement('URL', $url);
    }

    /**
     * Create an Input-Field <p>
     * @param string $name <p>
     * Header of the InputItem-Field.
     * </p>
     * @param string $QSParam [optional] <p>
     * $QSParam can contain phone settings variables as arguments.
     * </p>
     * @param string $flag <p>
     * The input-flags. <br>
     * Useable Keys: <br>
     * XmlInputFlags::ASCII <br>
     * XmlInputFlags::PHONE_NUMBER <br>
     * XmlInputFlags::NUMBERS <br>
     * XmlInputFlags::EQUATIONS <br>
     * XmlInputFlags::UPPERCASE <br>
     * XmlInputFlags::LOWERCASE <br>
     * XmlInputFlags::PASSWORD <br>
     * XmlInputFlags::PASSWORD_NUMERIC_MODE <br>
     * </p>
     * @param string $default [optional] <p>
     * $default can contain phone settings variables as arguments.
     */
    public function setInputItem($name, $QSParam = '', $flag = 't', $default = '')
    {
        $this->xw->startElement('InputItem');
        $this->xw->writeElement('DisplayName', $name);
        if ($QSParam != '') {
            $this->xw->writeElement('QueryStringParam', $QSParam);
        }
        if ($default != '') {
            $this->xw->writeElement('DefaultValue', $default);
        }
        $this->xw->writeElement('InputFlags', $flag);
        $this->xw->endElement();
    }
}
