Login   Register  
PHP Classes
elePHPant
Icontem

File: CiscoIPPhone/Core/CiscoXMLIconItem.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Tyler Winfield  >  Cisco IP Phone Framework  >  CiscoIPPhone/Core/CiscoXMLIconItem.php  >  Download  
File: CiscoIPPhone/Core/CiscoXMLIconItem.php
Role: Class source
Content type: text/plain
Description: class object for XML icon items
Class: Cisco IP Phone Framework
Generate XML for services of Cisco IP phones
Author: By
Last change:
Date: 3 years ago
Size: 3,451 bytes
 

Contents

Class file image Download
<?php
/* 
 * This software is freely available and distributed under the Mozilla Public
 * License agreement (MPL).   A copy of the MPL may obtain at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
 * the specific language governing rights and limitations under the License.
 *
 * Original code by Minded Software Solutions (http://minded.ca/)
 * Initial Developer - Tyler Winfield
 * Copyright (C) Minded Software Solutions.  All Rights Reserved.
 */

/**
 * CiscoXMLIconItem
 *   object class for creating icons item objects to be associated with menu items objects
 *
 * @author twinfield
 */
class CiscoXMLIconItem {
    public 
$iconItem;

    public function 
__construct()
    {
        
$this->iconItem = new DOMDocument('1.0''utf-8');
        
$this->iconItem->appendChild($this->iconItem->createElement('IconItem'));
    }

    public function 
setIndex($index)
    {
        if(isset(
$this->iconItem->documentElement->Index)) {
            
$this->iconItem->getElementsByTagName('Index')->item(0)->nodeValue = (string)$index;
        } else {
            
$this->iconItem->documentElement->appendChild($this->iconItem->createElement('Index', (string)$index));
        }
    }

    public function 
getIndex()
    {
        return 
$this->iconItem->getElementsByTagName('Index')->item(0)->nodeValue;
    }

    public function 
setURL($url)
    {
        if(
$this->iconItem->getElementsByTagName('URL')->length 0) {
            
$this->iconItem->getElementsByTagName('URL')->item(0)->nodeValue htmlspecialchars($url);
        } else {
            
$this->iconItem->documentElement->appendChild($this->iconItem->createElement('URL'htmlspecialchars($url)));
        }
    }

    public function 
getURL()
    {
        return 
$this->iconItem->getElementsByTagName('URL')->item(0)->nodeValue;
    }

    public function 
setSize($width$height)
    {
        if(
$this->iconItem->getElementsByTagName('Width')->length 0) {
            
$this->iconItem->getElementsByTagName('Width')->item(0)->nodeValue = (string)$width;
        } else {
            
$this->iconItem->documentElement->appendChild($this->iconItem->createElement('Width', (string)$width));
        }

        if(
$this->iconItem->getElementsByTagName('Height')->length 0) {
            
$this->iconItem->getElementsByTagName('Height')->item(0)->nodeValue = (string)$height;
        } else {
            
$this->iconItem->documentElement->appendChild($this->iconItem->createElement('Height', (string)$height));
        }
    }

    public function 
setDepth($depth)
    {
        if(
$this->iconItem->getElementsByTagName('Depth')->length 0) {
            
$this->iconItem->getElementsByTagName('Depth')->item(0)->nodeValue = (string)$depth;
        } else {
            
$this->iconItem->documentElement->appendChild($this->iconItem->createElement('Depth', (string)$depth));
        }
    }

    public function 
setData($data)
    {
        if(
$this->iconItem->getElementsByTagName('Data')->length 0) {
            
$this->iconItem->getElementsByTagName('Data')->item(0)->nodeValue = (string)$data;
        } else {
            
$this->iconItem->documentElement->appendChild($this->iconItem->createElement('Data', (string)$data));
        }
    }
}
?>