Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ProjectManagement/ProjectManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -515,9 +515,9 @@ function view_bug_pm_summary( $p_event, $p_bug_id ) {
$t_todo = get_actual_work_todo( $t_work );

echo '<tr ' . helper_alternate_class() . '>';
echo '<td class="category">Est</td><td>' . minutes_to_time( $t_est, true ) . '</td>
<td class="category">Done</td><td>' . minutes_to_time( $t_done, false ) . '</td>
<td class="category">Todo</td><td>' . minutes_to_time( $t_todo, true ) . '</td></tr>';
echo '<td class="category">' . plugin_lang_get( 'est' ) . '</td><td>' . minutes_to_time( $t_est, true ) . '</td>
<td class="category">' . plugin_lang_get( 'done' ) . '</td><td>' . minutes_to_time( $t_done, false ) . '</td>
<td class="category">' . plugin_lang_get( 'todo' ) . '</td><td>' . minutes_to_time( $t_todo, true ) . '</td></tr>';
}

# Fetch customer payment summary
Expand Down Expand Up @@ -573,7 +573,7 @@ function view_bug_time_registration( $p_event, $p_bug_id ) {
$t_result_fetch_todo = db_query_bound( $t_query_fetch_todo );

# Get the different worktypes as an array
$t_work_types = MantisEnum::getAssocArrayIndexedByValues( plugin_config_get( 'work_types' ) );
$t_work_types = plugin_lang_get_enum( 'work_types' );

# Remove worktypes which are off limits for this account
$t_limited_work_types = plugin_config_get( 'work_type_thresholds' );
Expand Down
23 changes: 23 additions & 0 deletions ProjectManagement/ProjectManagementAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,29 @@ class Action {
const DELETE = 3;
}


/*
* TODO: Review if is the correct place for this function!!
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's indeed the correct place. I'd add some comments though, something like:

/**
 * This is essentially the plugin version of get_enum_element in core/helper_api.
 * Given a plugin enum string and num, return the appropriate string for the
 * specified user/project
 * @param string $p_enum_name
 * @param int $p_val
 * @param int|null $p_user user id, defaults to null (all users)
 * @param int|null $p_project project id, defaults to null (all projects)
 * @return string
 */

*/
function plugin_get_enum_element( $p_enum_name, $p_val, $p_user = null, $p_project = null ) {
$config_var = plugin_config_get( $p_enum_name, null, $p_user, $p_project );
$string_var = plugin_lang_get( $p_enum_name . '_enum_string' );

return MantisEnum::getLocalizedLabel( $config_var, $string_var, $p_val );
}

function plugin_lang_get_enum( $p_enum_name ) {
$t_config_var_value = plugin_config_get( $p_enum_name );
$t_enum_values = MantisEnum::getAssocArrayIndexedByValues( $t_config_var_value );

foreach ( $t_enum_values as $t_key => $t_value ) {
$t_enum_values[$t_key] = plugin_get_enum_element ( $p_enum_name, $t_key );
}

return $t_enum_values;
}


/**
* Converts the specified amount of minutes to a string formatted as 'HH:MM'.
* @param float $p_minutes an amount of minutes.
Expand Down
2 changes: 1 addition & 1 deletion ProjectManagement/classes/PlottableBug.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,4 @@ public function plot_specific_start( $p_unique_id, $p_last_dev_day, $p_min_date,
</tr>
<?php
}
}
}
15 changes: 14 additions & 1 deletion ProjectManagement/lang/strings_english.txt
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,17 @@
$s_plugin_ProjectManagement_friday = 'friday';
$s_plugin_ProjectManagement_saturday = 'saturday';
$s_plugin_ProjectManagement_sunday = 'sunday';
?>

$s_plugin_ProjectManagement_January = 'January';
$s_plugin_ProjectManagement_February = 'February';
$s_plugin_ProjectManagement_March = 'March';
$s_plugin_ProjectManagement_April = 'April';
$s_plugin_ProjectManagement_May = 'May';
$s_plugin_ProjectManagement_June = 'June';
$s_plugin_ProjectManagement_July = 'July';
$s_plugin_ProjectManagement_August = 'August';
$s_plugin_ProjectManagement_September = 'September';
$s_plugin_ProjectManagement_October = 'October';
$s_plugin_ProjectManagement_November = 'November';
$s_plugin_ProjectManagement_December = 'December';

16 changes: 15 additions & 1 deletion ProjectManagement/lang/strings_spanish.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
$s_plugin_ProjectManagement_title = 'Gestion de proyectos';
$s_plugin_ProjectManagement_ein = '';
$s_plugin_ProjectManagement_title = 'Gestion de proyectos';
$s_plugin_ProjectManagement_configuration = 'Configuracion';
$s_plugin_ProjectManagement_settings_updated = 'Parametros actualizados';

Expand Down Expand Up @@ -148,4 +149,17 @@
$s_plugin_ProjectManagement_friday = 'viernes';
$s_plugin_ProjectManagement_saturday = 'sabado';
$s_plugin_ProjectManagement_sunday = 'domingo';

$s_plugin_ProjectManagement_January = 'Enero';
$s_plugin_ProjectManagement_February = 'Febrero';
$s_plugin_ProjectManagement_March = 'Marzo';
$s_plugin_ProjectManagement_April = 'Abril';
$s_plugin_ProjectManagement_May = 'Mayo';
$s_plugin_ProjectManagement_June = 'Junio';
$s_plugin_ProjectManagement_July = 'Julio';
$s_plugin_ProjectManagement_August = 'Agosto';
$s_plugin_ProjectManagement_September = 'Septiembre';
$s_plugin_ProjectManagement_October = 'Octubre';
$s_plugin_ProjectManagement_November = 'Noviembre';
$s_plugin_ProjectManagement_December = 'Diciembre';
?>
19 changes: 15 additions & 4 deletions ProjectManagement/pages/html_api.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,22 @@ function print_plugin_enum_string_option_list( $p_enum_name, $p_val = 0 ) {
foreach ( $t_enum_values as $t_key => $t_value ) {
echo '<option value="' . $t_key . '"';
check_selected( $p_val, $t_key );
echo '>' . $t_value . '</option>';
echo '>' . plugin_get_enum_element ( $p_enum_name, $t_key ) . '</option>';
}
}

function print_plugin_enum_string_selected_value( $p_enum_name, $p_val = 0 ) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this function used anywhere ? Can't find any references - at least not in this master branch, perhaps you use it in other branches of yours ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vincens,

I'm using it in a peace of code that is not still pushed

Regards,
Daniel Tamajón

2013/7/17 Vincent Sels [email protected]

In ProjectManagement/pages/html_api.php:

}

}

+function print_plugin_enum_string_selected_value( $p_enum_name, $p_val = 0 ) {

Is this function used anywhere ? Can't find any references - at least not
in this master branch, perhaps you use it in other branches of yours ?


Reply to this email directly or view it on GitHubhttps://github.com//pull/30/files#r5238366
.

$t_config_var_value = plugin_config_get( $p_enum_name );
$t_enum_values = MantisEnum::getAssocArrayIndexedByValues( $t_config_var_value );

foreach ( $t_enum_values as $t_key => $t_value ) {
if ( $p_val == $t_key )
return plugin_get_enum_element ( $p_enum_name, $t_key );
}

return null;
}

/***
* Prints the start of a region that is used as header of a collapsable section.
* @param $p_div_id string The unique name for this div.
Expand Down Expand Up @@ -250,8 +262,7 @@ function print_resource_unavailability_list( $p_user_id ) {
# First print an empty entry to avoid accidental deletion!
echo '<option value="" selected="selected"></option>';

$t_config_var_value = plugin_config_get( 'unavailability_types' );
$t_enum_values = MantisEnum::getAssocArrayIndexedByValues( $t_config_var_value );
$t_enum_values = plugin_lang_get_enum ( 'unavailability_types' );
while ( $t_row = db_fetch_array( $t_result ) ) {
$t_period_string =
date( config_get( 'short_date_format' ), $t_row["start_date"] ) . ' - ' .
Expand All @@ -264,4 +275,4 @@ function print_resource_unavailability_list( $p_user_id ) {
}
}

?>
?>
4 changes: 2 additions & 2 deletions ProjectManagement/pages/report_registration_page.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
$t_bug_table = db_get_table( 'mantis_bug_table' );
$t_project_table = db_get_table( 'mantis_project_table' );
$t_category_table = db_get_table( 'mantis_category_table' );
$t_work_types = MantisEnum::getAssocArrayIndexedByValues( plugin_config_get( 'work_types' ) );
$t_work_types = plugin_lang_get_enum( 'work_types' );
$t_customer_work_type_exclusion_clause = build_customer_worktype_exclude_clause('work_type');

$t_const_done = PLUGIN_PM_DONE;
Expand Down Expand Up @@ -146,7 +146,7 @@
$t_category_link = $t_plugin_page . '&category_id=' . $row["category_id"];
$t_bug_summary = $row["bug_summary"];
$t_book_date = date( config_get( 'short_date_format' ), $row["book_date"] );
$t_work_type = MantisEnum::getLabel( plugin_config_get( "work_types" ), $row["work_type"] );
$t_work_type = plugin_get_enum_element( 'work_types', $row["work_type"] );
$t_work_type_link = $t_plugin_page . '&work_type=' . $row["work_type"];
$t_hours = format( $row["minutes"] / 60 );
$t_hourly_rate = format( $row["hourly_rate"] );
Expand Down
4 changes: 3 additions & 1 deletion ProjectManagement/pages/report_resource_progress_page.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
echo plugin_lang_get( 'project_without_versions' );
} else if ( $t_all_versions_selected ) {
echo plugin_lang_get( 'all_versions_selected' );
} else if ( version_get_id( $f_target_version ) === false ) {
echo plugin_lang_get( 'project_without_versions' );
} else {
# Release dates of previous and current version
$t_release_date_target = version_get_field( version_get_id( $f_target_version ), 'date_order' );
Expand Down Expand Up @@ -347,4 +349,4 @@
}

echo '</form>'; # The whole page must be a form to include the input elements from underlying sections
}
}
4 changes: 2 additions & 2 deletions ProjectManagement/pages/target_overview_page.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
$t_category_name = $row["category_name"];
$t_bug_id = string_get_bug_view_link( $row['bug_id'], null, false );
$t_bug_summary = $row["summary"];
$t_work_type = MantisEnum::getLabel( plugin_config_get( "work_types" ), $row["work_type"] );
$t_work_type = plugin_get_enum_element( 'work_types', $row["work_type"] );
$t_target_date = date( config_get( 'short_date_format' ), $row["target_date"] );

$t_days_overdue = days_between( $row["target_date"] ) * -1;
Expand Down Expand Up @@ -139,4 +139,4 @@
}
?>

</table>
</table>
4 changes: 2 additions & 2 deletions ProjectManagement/pages/time_registration_page.php
Original file line number Diff line number Diff line change
Expand Up @@ -326,12 +326,12 @@
<tr class="spacer"/>

<tr <?php echo helper_alternate_class() ?>>
<td><?php echo date( 'F' ) ?></td>
<td><?php echo plugin_lang_get( date( 'F' ) ) ?></td>
<td class="right"><?php echo minutes_to_time( $t_row_month["minutes"], false ) ?></td>
</tr>

<tr <?php echo helper_alternate_class() ?>>
<td><?php echo date( 'F', mktime( 0, 0, 0, date( 'm' ) - 1, 1 ) ) ?></td>
<td><?php echo plugin_lang_get( date( 'F', mktime( 0, 0, 0, date( 'm' ) - 1, 1 ) ) ) ?></td>
<td class="right"><?php echo minutes_to_time( $t_row_last_month["minutes"], false ) ?></td>
</tr>

Expand Down