<?php

include dirname(__FILE__) . '/../../../lib/AbstractXmlPhoneLoginApp.php';
require_once "lib/XmlInputScreen.php";
require_once "lib/XmlButtons.php";
require_once "lib/XmlTextScreen.php";

class XmlPhoneLoginApp extends AbstractXMLPhoneLoginApp
{

    private $screen = null;

    public function renderLoginExtension()
    {
        $URI = $this->appURL();
        $screen = new XmlInputScreen();

        $screen->setURl($URI);
        $screen->setInputItem(__("XML_LOGIN_APP_EXTENSION"), 'extension', XmlInputFlags::NUMBERS);
        $screen->printScreen();
    }

    public function renderLoginPIN()
    {
        $URI = $this->appURL();
        $URI.="?extension=" . $_REQUEST["extension"];
        $screen = new XmlInputScreen();

        $screen->setURl($URI);
        $screen->setInputItem(__("XML_LOGIN_APP_PIN"), 'pin', XmlInputFlags::PASSWORD_NUMERIC_MODE);
        $screen->printScreen();
    }

    public function renderSucces()
    {
        $this->renderAppTextScreens(__('XML_LOGIN_APP_ENTRY_SUCCESFUL'));
    }

    public function renderNoExtensionFound()
    {
        $this->renderAppTextScreens(__('XML_LOGIN_APP_WRONG_EXTENSION'));
    }

    public function renderWrongPIN()
    {
        $this->renderAppTextScreens(__('XML_LOGIN_APP_WRONG_PIN'));
    }

    public function renderNoSipFound()
    {
        $this->renderAppTextScreens(__('XML_LOGIN_APP_NO_SIP'));
    }
    
    public function renderAppTextScreens($text)
    {
        $screen = new XmlTextScreen();
        $screen->setText($text);
        $screen->addButton(XmlIndexButtons::F4, __("XML_GLOBAL_BACK_BTN"), "", XmlSoftkeyButtons::F_ABORT);
        $screen->printScreen();
    }
}
