Skip to content

Commit 1532c11

Browse files
Merge pull request #20 from Selonka/master
Added language support
2 parents cde45e7 + 422b41e commit 1532c11

File tree

4 files changed

+28
-9
lines changed

4 files changed

+28
-9
lines changed

Taskodrome/Taskodrome.php

+6-4
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@ public function menu()
4141

4242
public function config()
4343
{
44-
$status_list = explode(',', lang_get( 'status_enum_string' ));
45-
foreach( $status_list as $key => $value ) {
46-
$status_list[$key] = substr($value, strpos($value, ':') + 1);
47-
}
44+
$status_list = explode(',', config_get('status_enum_string') );
45+
46+
foreach( $status_list as $key => $value ) {
47+
$status_list[$key] = explode(':', $value)[0];
48+
}
49+
4850
return array(
4951
"status_board_order_default" => $status_list,
5052
"status_board_order" => $status_list,

Taskodrome/core/config_helper.php

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
function convertStatusEnumToString($p_StatusEnumList){
4+
$t_StatusEnumList = $p_StatusEnumList;
5+
$t_status_list_language = explode(',', lang_get( 'status_enum_string' ));
6+
$t_status_enum_lang_array = array();
7+
8+
foreach( $t_status_list_language as $key => $value ) {
9+
$t_status_enum_lang_array[explode(':', $value)[0]] = explode(':', $value)[1];
10+
}
11+
12+
foreach($t_StatusEnumList as $key => $value) {
13+
$t_StatusEnumList[$key] = $t_status_enum_lang_array[explode(':', $value)[0]];
14+
}
15+
16+
return $t_StatusEnumList;
17+
}

Taskodrome/pages/config_page.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
auth_reauthenticate();
77
access_ensure_global_level( config_get( 'manage_plugin_threshold' ) );
8-
8+
require_once( config_get( 'plugin_path' ) . 'Taskodrome/core/config_helper.php' );
99
layout_page_header( plugin_lang_get( 'config_title' ) );
1010

1111
layout_page_begin( 'manage_overview_page.php' );
@@ -42,14 +42,14 @@
4242
</br>
4343
<span class="small">
4444
<?php printf( plugin_lang_get( 'default_value' ),
45-
string_attribute( implode( ';', plugin_config_get( $t_field . '_default') ) ));
45+
string_attribute( implode( ';', convertStatusEnumToString(plugin_config_get( $t_field . '_default') )) ));
4646
?>
4747
</span>
4848
</th>
4949
<td class="center" width="20%">
5050
<span class="input">
5151
<input name="<?php echo $t_field; ?>" size="75" type="text" value="<?php
52-
$t_config = plugin_config_get( $t_field, null, false, null, helper_get_current_project() );
52+
$t_config = convertStatusEnumToString(plugin_config_get( $t_field, null, false, null, helper_get_current_project()) );
5353
$t_encoded = '';
5454
foreach( $t_config as $t_value ) {
5555
$t_encoded .= "$t_value;";

Taskodrome/pages/main.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
html_robots_noindex();
4-
4+
require_once( config_get( 'plugin_path' ) . 'Taskodrome/core/config_helper.php' );
55
layout_page_header_begin(plugin_lang_get( 'board' ));
66

77
print "<link rel=\"stylesheet\" type=\"text/css\" href=\"".plugin_file('taskodrome.css')."\" />\n";
@@ -159,7 +159,7 @@ function write_bug_rows( $p_rows )
159159
print '<p class="status_color_map" value="'.$status_color_map.'"></p>';
160160

161161
$status_order = null;
162-
foreach( plugin_config_get("status_board_order", null, false, null, $current_project_id) as $t_value ) {
162+
foreach( convertStatusEnumToString( plugin_config_get("status_board_order", null, false, null, $current_project_id)) as $t_value ) {
163163
$status_order .= $t_value.';';
164164
}
165165

0 commit comments

Comments
 (0)