Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

sourcesiteedit.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: sourcesiteedit.php 8504 2001-11-19 09:46:46Z jhe $
5 //
6 // Created on: <26-Nov-2000 17:55:31 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( "classes/INIFile.php" );
28 // include_once( "classes/ezhttptool.php" );
29
30 $ini = eZINI::instance( 'site.ini' );
31
32 $Language = $ini->variable( "eZNewsFeedMain", "Language" );
33 $ImageDir = $ini->variable( "eZNewsFeedMain", "ImageDir" );
34
35 // include_once( "classes/eztemplate.php" );
36 // include_once( "classes/ezlocale.php" );
37
38 // include_once( "eznewsfeed/classes/eznewsimporter.php" );
39 // include_once( "eznewsfeed/classes/ezsourcesite.php" );
40
41 // include_once( "eznewsfeed/classes/eznewscategory.php" );
42
43 if ( $Action == "Insert" )
44 {
45 $sourcesite = new eZSourceSite();
46
47 $sourcesite->setName( $SourceSiteName );
48 $sourcesite->setURL( $SourceSiteURL );
49 $sourcesite->setLogin( $SourceSiteLogin );
50 $sourcesite->setPassword( $SourceSitePassword );
51 $category = new eZNewsCategory( $CategoryID );
52 $sourcesite->setCategory( $category );
53 $sourcesite->setDecoder( $DecoderChoice );
54
55 if ( $SourceSiteIsActive == "on" )
56 {
57 $sourcesite->setIsActive( true );
58 }
59 else
60 {
61 $sourcesite->setIsActive( false );
62 }
63
64
65 if ( $SourceSiteAutoPublish == "on" )
66 {
67 $sourcesite->setAutoPublish( true );
68 }
69 else
70 {
71 $sourcesite->setAutoPublish( false );
72 }
73
74 $sourcesite->store();
75
76 eZHTTPTool::header( "Location: /newsfeed/importnews/" );
77 exit();
78 }
79
80 if ( $Action == "Update" )
81 {
82 $sourcesite = new eZSourceSite( $SourceSiteID );
83
84 $sourcesite->setName( $SourceSiteName );
85 $sourcesite->setURL( $SourceSiteURL );
86 $sourcesite->setLogin( $SourceSiteLogin );
87 $sourcesite->setPassword( $SourceSitePassword );
88 $category = new eZNewsCategory( $CategoryID );
89 $sourcesite->setCategory( $category );
90 $sourcesite->setDecoder( $DecoderChoice );
91
92
93 if ( $SourceSiteIsActive == "on" )
94 {
95 $sourcesite->setIsActive( true );
96 }
97 else
98 {
99 $sourcesite->setIsActive( false );
100 }
101
102 if ( $SourceSiteAutoPublish == "on" )
103 {
104 $sourcesite->setAutoPublish( true );
105 }
106 else
107 {
108 $sourcesite->setAutoPublish( false );
109 }
110
111 $sourcesite->store();
112
113 eZHTTPTool::header( "Location: /newsfeed/importnews/" );
114 exit();
115 }
116
117
118 $t = new eZTemplate( "kernel/eznewsfeed/admin/" . $ini->variable( "eZNewsFeedMain", "AdminTemplateDir" ),
119 "kernel/eznewsfeed/admin/intl/", $Language, "sourcesiteedit.php" );
120
121 $t->setAllStrings();
122
123 $t->set_file( array(
124 "news_edit_page_tpl" => "sourcesiteedit.tpl"
125 ) );
126
127 $t->set_block( "news_edit_page_tpl", "value_tpl", "value" );
128 $t->set_block( "news_edit_page_tpl", "decoder_tpl", "decoder" );
129
130 if ( $Action == "New" )
131 {
132 $t->set_var( "source_site_name_value", "" );
133 $t->set_var( "source_site_id_value", "" );
134 $t->set_var( "source_site_url_value", "" );
135 $t->set_var( "source_site_login_value", "" );
136 $t->set_var( "source_site_password_value", "" );
137 $t->set_var( "action_value", "insert" );
138 }
139
140
141
142 if ( $Action == "Edit" )
143 {
144 $sourcesite = new eZSourceSite( $SourceSiteID );
145
146 $t->set_var( "source_site_name_value", $sourcesite->name() );
147 $t->set_var( "source_site_url_value", $sourcesite->url() );
148 $t->set_var( "source_site_login_value", $sourcesite->login() );
149 $t->set_var( "source_site_password_value", $sourcesite->password() );
150 $t->set_var( "source_site_id", $sourcesite->id() );
151 $decoderChoice = $sourcesite->decoder();
152 $t->set_var( "action_value", "update" );
153
154 $category = $sourcesite->category();
155 $categoryID = $category->id();
156
157 if ( $sourcesite->isActive() == true )
158 {
159 $t->set_var( "source_site_isactive_value", "checked" );
160 }
161 else
162 {
163 $t->set_var( "source_site_isactive_value", "" );
164 }
165
166 if ( $sourcesite->autoPublish() == true )
167 {
168 $t->set_var( "source_site_auto_publish_value", "checked" );
169 }
170 else
171 {
172 $t->set_var( "source_site_auto_publish_value", "" );
173 }
174 }
175
176
177
178
179 // decoder select
180 $decoders = eZNewsImporter::listDecoders();
181 foreach( $decoders as $decoderItem )
182 {
183 if( isset( $decoderChoice ) && trim( $decoderChoice ) == $decoderItem )
184 {
185 $t->set_var( "choice_selected", "selected" );
186 }
187 else
188 {
189 $t->set_var( "choice_selected", "" );
190 }
191 $t->set_var( "decoder_value", $decoderItem );
192 $t->parse( "decoder", "decoder_tpl", true );
193 }
194
195
196 // category select
197 $category = new eZNewsCategory();
198 $categoryArray = $category->getAll( );
199
200 foreach ( $categoryArray as $catItem )
201 {
202 if ( $Action == "Edit" )
203 {
204 if ( $categoryID == $catItem->id() )
205 {
206 $t->set_var( "selected", "selected" );
207 }
208 else
209 {
210 $t->set_var( "selected", "" );
211 }
212 }
213 else
214 {
215 $t->set_var( "selected", "" );
216 }
217
218 $t->set_var( "option_value", $catItem->id() );
219 $t->set_var( "option_name", $catItem->name() );
220
221 $t->parse( "value", "value_tpl", true );
222 }
223
224 $t->pparse( "output", "news_edit_page_tpl" );
225
226 ?>
$CategoryID
$CategoryID
Definition: admin/articleedit.php:53
eZHTTPTool\header
static header( $string)
Definition: ezhttptool.php:96
eZNewsCategory
Definition: eznewscategory.php:42
eZNewsImporter\listDecoders
static listDecoders()
Definition: eznewsimporter.php:70
eZSourceSite
Definition: ezsourcesite.php:44
eZTemplate
Definition: eztemplate.php:107
$Action
$Action
Definition: companysearch.php:80
exit
exit
Definition: folder.php:81
$categoryID
else $categoryID
Definition: productview.php:66
$ImageDir
$ImageDir
Definition: sourcesiteedit.php:33
$Language
$Language
Definition: sourcesiteedit.php:32
$ini
$ini
Definition: sourcesiteedit.php:30
$category
foreach( $decoders as $decoderItem) $category
Definition: sourcesiteedit.php:197
$t
if( $Action=="Insert") if( $Action=="Update") $t
Definition: sourcesiteedit.php:118
$decoders
if( $Action=="New") if( $Action=="Edit") $decoders
Definition: sourcesiteedit.php:180
$categoryArray
$categoryArray
Definition: sourcesiteedit.php:198
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.