]>
src.bluestatic.org Git - bugdar.git/blob - admin/language.php
2 /*=====================================================================*\
3 || ###################################################################
5 || # Copyright (c)2004-2008 Blue Static
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version 2 of the License.
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
22 require_once ( './global.php' );
23 require_once ( './includes/api_language.php' );
25 APIError ( array ( new API_Error_Handler ( $admin ), 'admin_error' ));
27 NavLinks
:: optionsPages ();
28 $navigator- > set_focus ( 'tab' , 'options' , null );
30 if (! can_perform ( 'canadmintools' ))
35 // ###################################################################
37 if ( empty ( $_REQUEST [ 'do' ]))
39 $_REQUEST [ 'do' ] = 'modify' ;
42 // ###################################################################
44 if ( $_REQUEST [ 'do' ] == 'kill' )
46 $language = new LanguageAPI ();
47 $language- > set ( 'languageid' , $input- > in
[ 'languageid' ]);
48 $language- > set_condition ();
51 $admin- > redirect ( 'language.php?do=modify' );
54 // ###################################################################
56 if ( $_REQUEST [ 'do' ] == 'delete' )
58 $admin- > page_confirm ( T ( 'Are you sure you want to delete this language?' ), 'language.php' , 'kill' , array ( 'languageid' => $input- > inputClean ( 'languageid' , TYPE_UINT
)));
61 // ###################################################################
63 if ( $_POST [ 'do' ] == 'insert' )
65 $language = new LanguageAPI ();
66 $language- > set ( 'title' , $input- > in
[ 'title' ]);
67 $language- > set ( 'charset' , $input- > in
[ 'charset' ]);
68 $language- > set ( 'direction' , $input- > in
[ 'direction' ]);
69 $language- > set ( 'userselect' , $input- > in
[ 'userselect' ]);
70 $language- > set ( 'langcode' , $input- > in
[ 'langcode' ]);
73 $admin- > redirect ( 'language.php?do=modify' );
76 // ###################################################################
78 if ( $_REQUEST [ 'do' ] == 'add' )
80 NavLinks
:: languagesAdd ();
81 $navigator- > set_focus ( 'link' , 'options-languages-add' , 'options-languages' );
83 $admin- > page_start ( T ( 'New Language' ));
85 $admin- > form_start ( 'language.php' , 'insert' );
86 $admin- > table_start ();
87 $admin- > table_head ( T ( 'New Language' ));
89 $admin- > row_input ( T ( 'Title' ), 'title' );
90 $admin- > row_input ( T ( 'Gettext Language Code (<em><a href="http://www.gnu.org/software/gettext/manual/html_chapter/gettext_15.html">language</a></em>_<em><a href="http://www.gnu.org/software/gettext/manual/html_chapter/gettext_16.html">COUNTRY</a></em>)' ), 'langcode' );
91 $admin- > row_input ( T ( 'Character Set' ), 'charset' , 'utf-8' );
92 $admin- > list_item ( T ( 'Left-to-Right' ), 'ltr' , true );
93 $admin- > list_item ( T ( 'Right-to-Left' ), 'rtl' );
94 $admin- > row_list ( T ( 'Direction' ), 'direction' );
95 $admin- > row_yesno ( T ( 'User Selectable' ), 'userselect' , true );
104 // ###################################################################
106 if ( $_POST [ 'do' ] == 'update' )
108 $language = new LanguageAPI ();
109 $language- > set ( 'languageid' , $input- > in
[ 'languageid' ]);
110 $language- > set_condition ();
111 $language- > set ( 'title' , $input- > in
[ 'title' ]);
112 $language- > set ( 'charset' , $input- > in
[ 'charset' ]);
113 $language- > set ( 'direction' , $input- > in
[ 'direction' ]);
114 $language- > set ( 'userselect' , $input- > in
[ 'userselect' ]);
115 $language- > set ( 'langcode' , $input- > in
[ 'langcode' ]);
118 $admin- > redirect ( 'language.php?do=modify' );
121 // ###################################################################
123 if ( $_REQUEST [ 'do' ] == 'edit' )
125 NavLinks
:: languagesEdit ( $input- > in
[ 'languageid' ]);
126 $navigator- > set_focus ( 'link' , 'options-languages-edit' , 'options-languages' );
128 $languageapi = new LanguageAPI ();
129 $languageapi- > set ( 'languageid' , $input- > in
[ 'languageid' ]);
130 $languageapi- > set_condition ();
131 $languageapi- > fetch ();
133 $language =& $languageapi- > record
;
135 $admin- > page_start ( T ( 'Edit Language' ));
137 $admin- > form_start ( 'language.php' , 'update' );
138 $admin- > table_start ();
139 $admin- > table_head ( sprintf ( T ( 'Edit Language - %1 $s' ), $language [' title
']));
141 $admin- >form_hidden_field(' languageid
', $language [' languageid
']);
143 $admin- >row_input(T(' Title
'), ' title
', $language [' title
']);
144 $admin- >row_input(T(' Gettext Language
Code (< em
>< a href
= "http://www.gnu.org/software/gettext/manual/html_chapter/gettext_15.html" > language
</ a
></ em
> _
< em
>< a href
= "http://www.gnu.org/software/gettext/manual/html_chapter/gettext_16.html" > COUNTRY
</ a
></ em
>) '), ' langcode
', $language [' langcode
']);
145 $admin- >row_input(T(' Character Set
'), ' charset
', $language [' charset
']);
146 $admin- >list_item(T(' Left
- to
- Right
'), ' ltr
', (( $language [' direction
'] == ' ltr
') ? true : false));
147 $admin- >list_item(T(' Right
- to
- Left
'), ' rtl
', (( $language [' direction
'] == ' rtl
') ? true : false));
148 $admin- >row_list(T(' Direction
'), ' direction
');
149 $admin- >row_yesno(T(' User Selectable
'), ' userselect
', $language [' userselect
']);
151 $admin- >row_submit();
158 // ###################################################################
160 if ( $_REQUEST [' do '] == ' modify
')
162 NavLinks::languagesAdd();
163 $navigator- >set_focus(' link
', ' options
- pages
- languages
', ' options
- pages
');
165 $admin- >page_start(T(' Manage Languages
'));
167 $admin- >table_start();
168 $admin- >table_head(T(' Manage Languages
'), 3, ' language_manage
');
170 $admin- >table_column_head(array(T(' Title
'), T(' Language Code
/ Charset
'), T(' Options
')));
172 $languages = $db- >query("SELECT * FROM " . TABLE_PREFIX . "language ORDER BY languageid ASC");
173 foreach ( $languages as $language )
175 $admin- >row_multi_item(array(
176 "<a href= \" language.php?do=edit&languageid= $language [languageid] \" > $language [title]</a>" => ' l
',
177 $language [' langcode
'] . ' / ' . $language [' charset
'] => ' c
',
178 ((bugdar:: $options [' defaultlanguage
'] == $language [' languageid
']) ? ' < strong
> ' . T(' DEFAULT LANGUAGE
') . ' </ strong
> / ' : ' ') . ( $language [' userselect
'] ? T(' User Selectable
') : T(' Private ')) => ' c
'