ultimix

- Main Page
- Data Structures
- Files
- Examples

- File List
- Globals

lang_view.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 lang_view_1_0_0{
27
38 var $CachedMultyFS = false;
39 var $Lang = false;
40
55 function __construct()
56 {
57 try
58 {
59 $this->CachedMultyFS = get_package( 'cached_multy_fs' , 'last' , __FILE__ );
60 $this->Lang = get_package( 'lang' , 'last' , __FILE__ );
61 }
62 catch( Exception $e )
63 {
64 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
65 }
66 }
67
78 var $Output;
79
98 function set_locale_form( $Options )
99 {
100 try
101 {
102 $LangList = $this->Lang->get_list_of_languages();
103
104 $Form = $this->CachedMultyFS->get_template( __FILE__ , 'lang_form.tpl' );
105 $this->Output = $Form;
106
107 foreach( $LangList as $Lang )
108 {
109 $LangFlag = $Lang === $this->Lang->get_locale() ? 'active' : 'inactive';
110
111 $Template = $this->CachedMultyFS->get_template( __FILE__ , $LangFlag.'_lang.tpl' );
112
113 $Template = str_replace( '{client_lang}' , $Lang , $Template );
114 $this->Output = str_replace( '{lang_list}' , "$Template{lang_list}" , $this->Output );
115 }
116 }
117 catch( Exception $e )
118 {
119 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
120 }
121 }
122
141 function view( &$Options )
142 {
143 try
144 {
145 if( $Options->get_setting( 'lang_file' , false ) )
146 {
147 $ComponentHTML = '{lang_file:'.$Options->get_all_settings().'}';
148 $Changed = false;
149 $ComponentHTML = $this->LangMarkup->compile_lang_file( $Options );
150 return( '' );
151 }
152
153 $ContextSet = get_package( 'gui::context_set' , 'last' , __FILE__ );
154
155 $ContextSet->add_context( dirname( __FILE__ ).'/conf/cfcx_set_locale_form' );
156
157 if( $ContextSet->execute( $Options , $this ) )return( $this->Output );
158 }
159 catch( Exception $e )
160 {
161 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
162 }
163 }
164 }
165
166 ?>