<?php

include dirname(__FILE__) . '/../../../../lib/AbstractXmlPhonebookApp.php';

abstract class AbstractTiptel30xxXmlPhonebookApp extends AbstractXmlPhonebookApp
{

    public function appURL($params = array())
    {
        $protocol = cfg('PROV_PROTOCOL');
        $host = cfg('PROV_HOST');
        $port = cfg('PROV_PORT');
        $prov = cfg('PROV_BASEPATH');

        if ($port != '') {
            $port = ":" . $port;
        }
        $Phone = $this->getPhoneModel();
        $appUrl = $protocol . $host . $port . $prov . "pb/" . $Phone->mac_addr . ".xml";

        $firstParam = true;
        foreach ($params as $key => $value) {
            if ($firstParam) {
                $appUrl .= "?" . $key . '=' . $value;
                $firstParam = false;
            } else {
                $appUrl .= "&" . $key . '=' . $value;
            }
        }
        return $appUrl;
    }
}
