Subversion Repositories pageflip

[/] [modules/] [pageflip/] [getxml.php] - Blame information for rev 1

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1 bartman3000
<?php
2
//
3
//
4
// SOFTWARE NAME: eZ Publish
5
// SOFTWARE RELEASE: 4.3.0
6
// COPYRIGHT NOTICE: Copyright (C) 1999-2009 eZ Systems AS
7
// SOFTWARE LICENSE: GNU General Public License v2.0
8
// NOTICE: >
9
//   This program is free software; you can redistribute it and/or
10
//   modify it under the terms of version 2.0  of the GNU General
11
//   Public License as published by the Free Software Foundation.
12
//
13
//   This program is distributed in the hope that it will be useful,
14
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
15
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
//   GNU General Public License for more details.
17
//
18
//   You should have received a copy of version 2.0 of the GNU General
19
//   Public License along with this program; if not, write to the Free
20
//   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21
//   MA 02110-1301, USA.
22
//
23
$ini =& eZINI::instance( "site.ini" );
24
$SiteURL = $ini->variable('SiteSettings','SiteURL');
25
 
26
 
27
$Module = $Params['Module'];
28
 
29
if ( !isset ( $Params['NodeID'] ) )
30
{
31
    eZDebug::writeError( 'Cannot read NodeID' );
32
    return $Module->handleError( eZError::KERNEL_NOT_AVAILABLE, 'kernel' );
33
}
34
 
35
$nodeID = $Params['NodeID'];
36
$pagesNode = eZContentObjectTreeNode::fetch( $nodeID );
37
 
38
 
39
if ( !$pagesNode )
40
{
41
    eZDebug::writeError( 'Could not find pages in : ' . $Params['NodeID'] );
42
    return $Module->handleError( eZError::KERNEL_NOT_AVAILABLE, 'kernel' );
43
}
44
 
45
 
46
$attributes = $pagesNode->dataMap();
47
$pages = "";
48
 
49
foreach( $pagesNode->children() as $key => $page )
50
{      
51
 
52
        $contentObject = eZContentObject::fetch( $page->ContentObject->ID );
53
        $attributes2 = $contentObject->fetchDataMap();
54
        $image = new eZImageAliasHandler( $attributes2['image'] );
55
        $image_alias = $image->attribute( 'original' );
56
        $pages .= "      <page src='http://".$SiteURL."/" . $image_alias['full_path'] . "'";   
57
        if ($key<$attributes['preloads']->toString()) { $pages .= " preload='true'";}
58
        $pages .= "/>\n";
59
 
60
}
61
 
62
 
63
 
64
 
65
$prepage = new eZImageAliasHandler( $attributes['prepage'] );
66
$prepage_alias = $prepage->attribute( 'original' );
67
 
68
 
69
 
70
if ($attributes['hcover']->toString() == 1) {
71
        $hcover = 'true';
72
} else {
73
        $hcover = 'false';
74
}
75
 
76
$xmlOutput="<content";
77
$xmlOutput.=" width='".$attributes['width']->toString()."' height='".$attributes['height']->toString()."' hcover='".$hcover."' transparency='true' ";
78
if (strlen($prepage_alias['full_path']) != 0 ) {
79
$xmlOutput .=" prepage='http://".$SiteURL."/" .$prepage_alias['full_path']."'";
80
}
81
 
82
 
83
 
84
$xmlOutput.="   >\n";
85
$xmlOutput .= $pages;
86
$xmlOutput .= "</content>";
87
 
88
// headers
89
$httpCharset = eZTextCodec::httpCharset();
90
header( 'Content-Type: text/xml; charset=' . $httpCharset );
91
header( 'Content-Length: '.strlen($xmlOutput) );
92
 
93
while ( @ob_end_clean() );
94
echo $xmlOutput;
95
eZExecution::cleanExit();
96
 
97
?>