Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezarticle/user/menubox.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: menubox.php 9305 2002-02-27 15:06:55Z master $
5 //
6 //
7 //
8 // Created on: <17-Oct-2000 12:16:07 bf>
9 //
10 // This source file is part of Exponential Basic, publishing software.
11 //
12 // Copyright (C) 1999-2001 eZ Systems. All rights reserved.
13 //
14 // This program is free software; you can redistribute it and/or
15 // modify it under the terms of the GNU General Public License
16 // as published by the Free Software Foundation; either version 2
17 // of the License, or (at your option) any later version.
18 //
19 // This program is distributed in the hope that it will be useful,
20 // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 // GNU General Public License for more details.
23 //
24 // You should have received a copy of the GNU General Public License
25 // along with this program; if not, write to the Free Software
26 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
27 //
28
29 // include_once( "classes/INIFile.php" );
30 // include_once( "classes/ezcachefile.php" );
31 // include_once( "ezuser/classes/ezobjectpermission.php" );
32
33 $ini =& eZINI::instance( 'site.ini' );
34 $Language = $ini->variable( "eZArticleMain", "Language" );
35 $PageCaching = $ini->variable( "eZArticleMain", "PageCaching" );
36
37 function createArticleMenu( $menuCacheFile = false, $ini = null,
38 $Language = null, $GlobalSiteDesign = null,
39 $GlobalSectionID = null, $CategoryID = null, $url_array = null )
40 {
41 // global $ini;
42 // global $Language;
43 // global $GenerateStaticPage;
44 // global $GlobalSiteDesign;
45 // global $GlobalSectionID;
46 // global $CategoryID;
47 // global $url_array;
48
49 // include_once( "classes/eztemplate.php" );
50
51 // include_once( "ezarticle/classes/ezarticlecategory.php" );
52 // include_once( "ezarticle/classes/ezarticle.php" );
53
54 $t = new eZTemplate( "kernel/ezarticle/user/" . $ini->variable( "eZArticleMain", "TemplateDir" ),
55 "kernel/ezarticle/user/intl", $Language, "menubox.php" );
56
57 $t->setAllStrings();
58
59 $t->set_file( array(
60 "menu_box_tpl" => "menubox.tpl"
61 ) );
62
63 $t->set_block( "menu_box_tpl", "article_category_tpl", "article_category" );
64 $t->set_block( "menu_box_tpl", "submit_article_tpl", "submit_article" );
65
66 $t->set_var( "submit_article", "" );
67
68 $t->set_var( "sitedesign", $GlobalSiteDesign );
69
70 $t->set_var( "section_id", $GlobalSectionID );
71
72 // List all categories
73 if ( !isset( $CategoryID ) )
74 $CategoryID = 0;
75
76 $target = '';
77
78 $articleCategory = new eZArticleCategory( $CategoryID );
79
80 $articleCategory_array = $articleCategory->getByParent( $articleCategory );
81
82 $t->set_var( "top_title", $articleCategory->name() );
83
84 $i = 0;
85 if ( is_array($articleCategory_array))
86 {
87 foreach( $articleCategory_array as $categoryItem )
88 {
89 if( eZObjectPermission::hasPermission( $categoryItem->id(), "article_category", 'r' ) )
90 {
91 $t->set_var( "articlecategory_id", $categoryItem->id() );
92 $t->set_var( "articlecategory_title", $categoryItem->name() );
93
94 if (
95 (( $url_array[2] == "archive" ) && ( $url_array[3] == $categoryItem->id() ))
96 || (( $url_array[2] == "articleview" ) && ( $url_array[5] == $categoryItem->id() ))
97 )
98 {
99 $t->set_var( "mark", "menumark" );
100 }
101 else
102 {
103 $t->set_var( "mark", "" );
104 }
105
106 $t->parse( "article_category", "article_category_tpl", true );
107 $i++;
108 }
109 }
110 }
111
112 if ( $i == 0 )
113 $t->set_var( "article_category", "" );
114
115
116 // user-submitted articles
117 // include_once( "ezuser/classes/ezuser.php" );
118
119 if ( eZUser::currentUser() != false &&
120 $ini->variable( "eZArticleMain", "UserSubmitArticles" ) == "enabled" )
121 {
122 $t->parse( "submit_article", "submit_article_tpl", true );
123 }
124
125 if ( is_a( $menuCacheFile, "eZCacheFile" ) )
126 {
127 $output = $t->parse( "output", "menu_box_tpl" );
128 $menuCacheFile->store( $output );
129 print( $output );
130 }
131 else
132 {
133 $t->pparse( "output", "menu_box_tpl" );
134 }
135
136 }
137
138
139 // do the caching
140 if ( $PageCaching == "enabled" )
141 {
142 $user =& eZUser::currentUser();
143 $groupstr = "";
144 if( is_a( $user, "eZUser" ) )
145 {
146 $groupIDArray = $user->groups( false );
147 sort( $groupIDArray );
148 $first = true;
149 foreach( $groupIDArray as $groupID )
150 {
151 $first ? $groupstr .= "$groupID" : $groupstr .= "-$groupID";
152 $first = false;
153 }
154 }
155
156 unset( $menuCacheFile );
157 $menuCacheFile = new eZCacheFile( "kernel/ezarticle/cache",
158 array( "menubox",
159 $groupstr,
160 $GlobalSiteDesign,
161 $CategoryID
162 ),
163 "cache", "," );
164
165 if ( $menuCacheFile->exists() )
166 {
167 print( $menuCacheFile->contents() );
168 }
169 else{
170 createArticleMenu( $menuCacheFile, $ini, $Language, $GlobalSiteDesign, $GlobalSectionID, $CategoryID, $url_array );
171 }
172 }
173 else
174 {
175 createArticleMenu( false, $ini, $Language, $GlobalSiteDesign, $GlobalSectionID, $CategoryID, $url_array );
176 }
177
178 ?>
$i
$i
Definition: admin/adlist.php:91
$CategoryID
$CategoryID
Definition: admin/articleedit.php:53
eZArticleCategory
Definition: ezarticlecategory.php:45
eZObjectPermission\hasPermission
static hasPermission( $objectID, $moduleTable, $permission, $user=false)
Definition: ezobjectpermission.php:76
eZTemplate
Definition: eztemplate.php:107
eZUser\currentUser
static & currentUser()
Definition: ezuser.php:896
$t
foreach( $Modules as $module) if(isset( $ItemInsert)) $t
Definition: classes/admin/linklist.php:168
$GlobalSectionID
$GlobalSectionID
Definition: ezad/user/datasupplier.php:28
$url_array
$url_array
Definition: ezaddress/admin/datasupplier.php:34
createArticleMenu
createArticleMenu( $menuCacheFile=false, $ini=null, $Language=null, $GlobalSiteDesign=null, $GlobalSectionID=null, $CategoryID=null, $url_array=null)
Definition: ezarticle/user/menubox.php:37
$Language
$Language
Definition: ezarticle/user/menubox.php:34
$ini
$ini
Definition: ezarticle/user/menubox.php:33
$PageCaching
$PageCaching
Definition: ezarticle/user/menubox.php:35
$groupID
$groupID
Definition: ezgroupeventcalendar/user/dayview.php:90
$output
$output
Definition: formpreview.php:81
$GlobalSiteDesign
global $GlobalSiteDesign
Definition: latestmessages.php:52
$user
$user
Definition: user/adlist.php:39
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.