Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezimagecatalogue/xmlrpc/categorylist.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: categorylist.php 9520 2002-05-08 13:05:20Z jb $
5 //
6 // Created on: <26-Oct-2000 19:40:18 bf>
7 //
8 // This source file is part of Exponential Basic, publishing software.
9 //
10 // Copyright (C) 1999-2001 eZ Systems. All rights reserved.
11 //
12 // This program is free software; you can redistribute it and/or
13 // modify it under the terms of the GNU General Public License
14 // as published by the Free Software Foundation; either version 2
15 // of the License, or (at your option) any later version.
16 //
17 // This program is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 //
22 // You should have received a copy of the GNU General Public License
23 // along with this program; if not, write to the Free Software
24 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
25 //
26
27 // include_once( "ezimagecatalogue/classes/ezimagecategory.php" );
28 // include_once( "ezimagecatalogue/classes/ezimage.php" );
29 // include_once( "classes/ezlocale.php" );
30 // include_once( "ezsitemanager/classes/ezsection.php" );
31
32 if ( $Command == "list" )
33 {
34 $list_categories = false;
35 $list_images = false;
36 if ( is_object( $Data["ListType"] ) )
37 {
38 $ListType = $Data["ListType"]->value();
39 if ( is_object( $ListType["Catalogues"] ) )
40 $list_categories = true;
41 if ( is_object( $ListType["Elements"] ) )
42 $list_images = true;
43 }
44
45 if ( !$list_categories and !$list_images )
46 {
47 $list_categories = true;
48 $list_images = true;
49 }
50
51 $offset = 0;
52 $max = -1;
53 $total = 0;
54
55 if ( is_object( $Data["Part"] ) )
56 {
57 $Part = $Data["Part"]->value();
58 $offset = $Part["Offset"]->value();
59 $max = $Part["Max"]->value();
60 }
61
62 $category = new eZImageCategory( $ID );
63
64 $loc_max = $max;
65 $loc_offset = $offset;
66
67 $cat = array();
68 if ( $list_categories )
69 {
70 $categoryCount = $category->countByParent( $category );
71 $total += $categoryCount;
72 if ( $loc_offset < $categoryCount )
73 {
74 $categoryList =& $category->getByParent( $category, $loc_offset, $loc_max );
75 $loc_max -= count( $categoryList );
76
77 foreach ( $categoryList as $catItem )
78 {
79 $cols = array( "Description" => new eZXMLRPCString( $catItem->description( false ) ) );
80 $cat[] = new eZXMLRPCStruct( array( "URL" => createURLStruct( "ezimagecatalogue",
81 "category",
82 $catItem->id() ),
83 "Name" => new eZXMLRPCString( $catItem->name( false ) ),
84 "Columns" => new eZXMLRPCStruct( $cols )
85 )
86 );
87 }
88 }
89 $loc_offset = max( 0, $loc_offset - $categoryCount );
90 }
91
92 $art = array();
93 if ( $list_images )
94 {
95 $imageCount = $category->imageCount( true );
96 $total += $imageCount;
97 if ( $loc_max > 0 and $loc_offset >= 0 )
98 {
99 $imageList =& $category->images( "time", $loc_offset, $loc_max, false, true );
100 foreach( $imageList as $imageItem )
101 {
102 $cols = array( "Caption" => new eZXMLRPCString( $imageItem->caption( false ) ),
103 "Description" => new eZXMLRPCString( $imageItem->description( false ) ),
104 "FileName" => new eZXMLRPCString( $imageItem->originalFileName() )
105 );
106 $art[] = new eZXMLRPCStruct( array( "URL" => createURLStruct( "ezimagecatalogue",
107 "image",
108 $imageItem->id() ),
109 "Name" => new eZXMLRPCString( $imageItem->name( false ) ),
110 "Thumbnail" => new eZXMLRPCBool( true ),
111 "Columns" => new eZXMLRPCStruct( $cols )
112 )
113 );
114 }
115 }
116 // if ( $offset > 0 )
117 // usleep( 5000000 );
118 }
119
120 $par = array();
121 if ( $offset == 0 )
122 {
123 $path =& $category->path();
124 if ( $category->id() != 0 )
125 {
126 $par[] = createURLStruct( "ezimagecatalogue", "category", 0 );
127 }
128 else
129 {
130 $par[] = createURLStruct( "ezimagecatalogue", "" );
131 }
132 foreach( $path as $item )
133 {
134 if ( $item[0] != $category->id() )
135 $par[] = createURLStruct( "ezimagecatalogue", "category", $item[0] );
136 }
137 }
138
139 $part_arr = array( "Offset" => new eZXMLRPCInt( $offset ),
140 "Total" => new eZXMLRPCInt( $total ) );
141
142 $section_id = eZImageCategory::sectionIDStatic( $category->id() );
143 $section_lang = false;
144 if ( $section_id != 0 )
145 {
146 $section = new eZSection( $section_id );
147 $section_lang = $section->language();
148 }
149 if ( $offset == 0 )
150 {
151 $part_arr["Begin"] = new eZXMLRPCBool( true );
152 }
153 if ( $total == $offset + count( $cat ) + count( $art ) )
154 {
155 $part_arr["End"] = new eZXMLRPCBool( true );
156 }
157 $part = new eZXMLRPCStruct( $part_arr );
158
159 if ( $offset == 0 )
160 $cols = new eZXMLRPCStruct( array( "Caption" => new eZXMLRPCString( "text" ),
161 "Description" => new eZXMLRPCString( "text" ),
162 "FileName" => new eZXMLRPCString( "text" )
163 ) );
164 $ret = array( "Catalogues" => $cat,
165 "Elements" => $art,
166 "Path" => $par,
167 "Part" => $part );
168 if ( $offset == 0 )
169 $ret["Columns"] = $cols;
170
171 if ( $section_lang != false )
172 {
173 $charsetLocale = new eZLocale( $section_lang );
174 $section_charset = $charsetLocale->languageISO();
175 $ret["Section"] = new eZXMLRPCStruct( array( "Language" => $section_lang,
176 "Charset" => $section_charset ) );
177 }
178
179 $ReturnData = new eZXMLRPCStruct( $ret );
180 }
181 else if ( $Command == "tree" )
182 {
183 $cat = new eZImageCategory();
184 $tree =& categoryTree( $cat );
185 $ReturnData = createTreeStruct( $tree, "ezimagecatalogue", "category" );
186 }
187 else if ( $Command == "search" )
188 {
189 $keywords = $Data["Keywords"]->value();
190 $texts = array();
191 foreach( $keywords as $keyword )
192 {
193 $texts[] = $keyword->value();
194 }
195 $elements = array();
196 $result =& eZImageCategory::search( $texts, false, "name", $User );
197 foreach( $result as $item )
198 {
199 $catid = $item->parent( false );
200 $cat = new eZImageCategory();
201 $cat->get( $catid );
202 $element = array();
203 $element["Name"] = new eZXMLRPCString( $item->name( false ) );
204 $element["CategoryName"] = new eZXMLRPCString( $cat->name( false ) );
205 $element["Location"] = createURLStruct( "ezimagecatalogue", "category", $item->id() );
206 $element["CategoryLocation"] = createURLStruct( "ezimagecatalogue", "category", $catid );
207 $element["WebURL"] = new eZXMLRPCString( rewriteWebURL( "/imagecatalogue/image/list/" . $item->id() . "/" ) );
208 $element["CategoryWebURL"] = new eZXMLRPCString( rewriteWebURL( "/imagecatalogue/image/list/$catid/" ) );
209 $elements[] = new eZXMLRPCStruct( $element );
210 }
211 $ret = array( "Elements" => new eZXMLRPCArray( $elements ) );
212 handleSearchData( $ret );
213 $ReturnData = new eZXMLRPCStruct( $ret );
214 }
215
216 function &categoryTree( $cat )
217 {
218 $children =& eZImageCategory::getByParent( $cat );
219 $child_array = array();
220 foreach( $children as $child )
221 {
222 $child_array[] = categoryTree( $child );
223 }
224 $section_id = eZImageCategory::sectionIDStatic( $cat->id() );
225 $section_lang = false;
226 if ( $section_id != 0 )
227 {
228 $section = new eZSection( $section_id );
229 $section_lang = $section->language();
230 }
231 $item = array( "ID" => $cat->id(),
232 "Name" => $cat->name( false ),
233 "Children" => $child_array );
234 if ( $section_lang != false )
235 {
236 $charsetLocale = new eZLocale( $section_lang );
237 $section_charset = $charsetLocale->languageISO();
238 $item["Section"] = new eZXMLRPCStruct( array( "Language" => $section_lang,
239 "Charset" => $section_charset ) );
240 }
241 return $item;
242 }
243
244 ?>
$category
if( $Action=="Edit") $category
Definition: adedit.php:378
$categoryList
foreach( $pathArray as $path) $categoryList
Definition: admin/adlist.php:86
$total
else $total["inctax"]
Definition: checkout.php:1359
eZImageCategory
Definition: ezimagecategory.php:43
eZImageCategory\getByParent
getByParent( $parent, $offset=0, $max=-1)
Definition: ezimagecategory.php:298
eZImageCategory\search
& search( $name, $literal=false, $sortby='name', $user=false)
Definition: ezimagecategory.php:103
eZImageCategory\sectionIDStatic
static sectionIDStatic( $categoryID)
Definition: ezimagecategory.php:835
eZLocale
Definition: ezlocale.php:119
eZSection
Definition: ezsection.php:45
eZXMLRPCArray
Definition: ezxmlrpcarray.php:37
eZXMLRPCBool
Definition: ezxmlrpcbool.php:37
eZXMLRPCInt
Definition: ezxmlrpcint.php:37
eZXMLRPCString
Definition: ezxmlrpcstring.php:37
eZXMLRPCStruct
Definition: ezxmlrpcstruct.php:37
$item
$item
Definition: classes/admin/linklist.php:228
$result
$result
Definition: companysearch.php:94
$tree
$tree
Definition: ezad/admin/categoryedit.php:172
$ListType
$ListType
Definition: ezaddress/admin/datasupplier.php:31
$cat
if(isset( $DeleteCategories)) $cat
Definition: ezforum/admin/categoryedit.php:49
$imageList
$imageList
Definition: ezimagecatalogue/admin/unassigned.php:96
$imageCount
else $imageCount
Definition: ezimagecatalogue/admin/unassigned.php:102
$section
$section
Definition: ezimagecatalogue/user/categoryedit.php:393
categoryTree
if( $Command=="list") else if( $Command=="tree") else if( $Command=="search")& categoryTree( $cat)
Definition: ezimagecatalogue/xmlrpc/categorylist.php:216
$ret
$ret
Definition: ezsitemanager/admin/filelist.php:88
$offset
$offset
Definition: ezstats/admin/cron.php:51
$element
if(! $parent) $element
Definition: folder.php:64
$elements
$elements
Definition: formedit.php:355
$ReturnData
$ReturnData
Definition: tag.php:48
$part
$part
Definition: tag.php:46
$part_arr
foreach( $tagList as $tag) $part_arr
Definition: tag.php:42
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.