<?php
// 
// $Id: eznewscustomerhh.php,v 1.1 2000/09/28 13:07:22 pkej-cvs Exp $
//
// Definition of eZNewsCustomerHH class
//
// Paul K Egell-Johnsen <pkej@ez.no>
// Created on: <28-Sep-2000 13:03:00 pkej>
//

global $data;
global $theXMLParser;

//!! eZNews
//! $openTags handles the XML open tags.
/*
    This is the array of opening tags. All character data between an opening
    and closing tag is stored in the global $parsedXML array, with the name
    of the tag as the key to the data.
 */

$openTags = array
(
    'ezflower' => '<ezflower>',
    'price' => '<price>',
    'name' => '<name>',
    'description' => '<description>',
    'pictureid' => '<pictureid/>',
    'categoryid' => '<categoryid/>',
    'product' => '<product>',
    'id' => '<id/>'
);

//!! eZNews
//! $closeTags handles the XML close tags.
/*
    This is the array of closing tags. All character data between an opening
    and closing tag is stored in the global $parsedXML array, with the name
    of the tag as the key to the data.
 */
$closeTags = array
(
    'ezflower' => '</ezflower>',
    'price' => '</price>',
    'name' => '</name>',
    'description' => '</description>',
    'product' => '</product>'
);

//!! eZNews
//! eZNewsCustomerHH handles parsing for our customer Heistad Hagesenter.
/*!
 */

include_once( "eznews/classes/eznewsxml.php" );

$data = <<<EOT
<?xml version="1.0"?>
<ezflower> <product> <name>Dekorasjoner</name>
                       <description>Vi kan også skaffe det meste av andre dekorasjoner til kiste og
                       kirke.</description> <price>På forespørsel</price> <pictureid value="90"/>
                       <categoryid value="8"/> </product> <product> <name>Kranser</name>
                       <description>Her er den enkleste typen kranser vi kan tilby: En enkelt
                       blomst!</description> <price>Kr. 10,-</price> <pictureid value="89"/>
                       <categoryid value="8"/> </product> <product> <name>Bla bla</name>
                       <description>asdfasdfa asdf asdf asdfasasdf as df asdf a sdf</description>
                       <price>200 300 400</price> <pictureid value="97"/> <categoryid value="8"/>
                       </product> </ezflower>
EOT;

class drop
{
    function drop()
    {
        $this->Value1 = "bother not";
        $this->Value2 = "bother too";
    }
    
    function printer()
    {
        echo "Value1: " . $this->Value1 . "<br>";
        echo "Value2: " . $this->Value2 . "<br>";
    }
    
    var $Value1;
    var $Value2;
};

class eZNewsCustomerHH extends eZNewsXML
{
    function eZNewsCustomerHH( $URLArray )
    {
    }
    
    function cheating()
    {
        eZNewsXML::eZNewsXML();
        
        $template = new drop();
        
        $this->Template = &$template;
        
        $this->Template->printer();
        
        include( "eznews/classes/eznewsxmlparser.php" );
    }
    
    function startElement( $parser, $inName, $attrs='' )
    {
        $this->currentTag = $inName;

        if ( $format == $openTags[$inName] )
        {
            switch( $inName )
            {
                case 'pictureid':
                    $this->parsedXMLAttributes[ $this->currentTag ]["value"] = $attrs["value"];
                    break;
                case 'categoryid':
                    $this->parsedXMLAttributes[ $this->currentTag ]["value"] = $attrs["value"];
                    break;
                default:
                    break;
            }
        }
    }
    
    function endElement( $parser, $inName, $attrs='' )
    {
        if( $format == $closeTags[ $inName ] )
        {
            switch( $inName )
            {
                case 'ezflower':
                    $this->printPage(  );
                    $this->parsedXML = '';
                    break;
                case 'product':
                    $this->printItem(  );
                    $this->parsedXML = '';
                    break;
                default:
                    break;
            }
        }
    }
    
    function printItem()
    {
        echo "<h1>" . $this->parsedXML["name"] . "</h1>";
        echo "<p>" . $this->parsedXML["description"] . "</p>";
        echo "<p><b>" . $this->parsedXML["price"] . "</b></p>";
    }
    
    function printPage()
    {
        $this->Template->printer();
    }

    var $Item;
    var $Template;
    var $Ini;
};

?>
