ultimix

- Main Page
- Data Structures
- Files
- Examples

- File List
- Globals

content_markup.php
Go to the documentation of this file.
1 <?php
2
3 /*
4 * This source code is a part of the Ultimix Project.
5 * It is distributed under BSD license. All other third side source code (like tinyMCE) is distributed under
6 * it's own license wich could be found from the corresponding files or sources.
7 * This source code is provided "as is" without any warranties or garanties.
8 *
9 * Have a nice day!
10 *
11 * @url http://ultimix.sorceforge.net
12 *
13 * @author Alexey "gdever" Dodonov
14 */
15
26 class content_markup_1_0_0{
27
38 var $CachedMultyFS = false;
39 var $CategoryAlgorithms = false;
40 var $ContentAccess = false;
41 var $ContentAlgorithms = false;
42 var $ContentView = false;
43 var $Security = false;
44 var $String = false;
45
60 function __construct()
61 {
62 try
63 {
64 $this->CachedMultyFS = get_package( 'cached_multy_fs' , 'last' , __FILE__ );
65 $this->CategoryAlgorithms = get_package( 'category::category_algorithms' , 'last' , __FILE__ );
66 $this->ContentAccess = get_package( 'content::content_access' , 'last' , __FILE__ );
67 $this->ContentAlgorithms = get_package( 'content::content_algorithms' , 'last' , __FILE__ );
68 $this->ContentView = get_package( 'content::content_view' , 'last' , __FILE__ );
69 $this->load_content_packages();
70 $this->Security = get_package( 'security' , 'last' , __FILE__ );
71 $this->String = get_package( 'string' , 'last' , __FILE__ );
72 }
73 catch( Exception $e )
74 {
75 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
76 }
77 }
78
101 private function get_articles( &$Settings )
102 {
103 try
104 {
105 $CategoryNames = $Settings->get_setting( 'category' );
106
107 $CategoryIds = $this->CategoryAlgorithms->get_category_ids( $CategoryNames );
108
109 return( $this->ContentAccess->select_content_by_category( $CategoryIds ) );
110 }
111 catch( Exception $e )
112 {
113 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
114 }
115 }
116
139 function compile_content_links( &$Settings )
140 {
141 try
142 {
143 $Articles = $this->get_articles( $Settings );
144
145 $Code = '{lang:no_articles_were_found}';
146
147 if( isset( $Articles[ 0 ] ) )
148 {
149 $TemplateName = $Settings->get_setting( 'template' , 'content_link.tpl' );
150 $Code = '';
151
152 foreach( $Articles as $Item )
153 {
154 $Code .= $this->CachedMultyFS->get_template( __FILE__ , $TemplateName );
155 $Code = $this->String->print_record( $Code , $Item );
156 }
157 }
158
159 return( $Code );
160 }
161 catch( Exception $e )
162 {
163 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
164 }
165 }
166
189 function compile_content( &$Settings )
190 {
191 try
192 {
193 $ContentId = $Settings->get_setting( 'content_id' );
194 $Settings->set_setting( 'content_view' , 1 );
195 $this->Security->set_g( 'content_id' , $ContentId );
196
197 $Code = $this->ContentView->view( $Settings );
198
199 return( $Code );
200 }
201 catch( Exception $e )
202 {
203 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
204 }
205 }
206
229 function compile_print_content_url( &$Settings )
230 {
231 try
232 {
233 $ContentId = $Settings->get_setting( 'content_id' );
234 $Code = $this->CachedMultyFS->get_template( __FILE__ , 'print_content_url.tpl' );
235 $Code = str_replace( '{content_id}' , $ContentId , $Code );
236
237 return( $Code );
238 }
239 catch( Exception $e )
240 {
241 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
242 }
243 }
244 }
245
246 ?>