/**
 * A function that prepares the version string for outputting to the user on view / print issue pages.
 * This function would add the version date, if appropriate.
 *
 * @param integer $p_project_id  The project id.
 * @param integer $p_version_id  The version id.  If false then this method will return an empty string.
 * @return The formatted version string.
 */
function prepare_version_string($p_project_id, $p_version_id)
{
    if ($p_version_id === false) {
        return '';
    }
    $t_version_text = version_full_name($p_version_id, null, $p_project_id);
    if (access_has_project_level(config_get('show_version_dates_threshold'), $p_project_id)) {
        $t_short_date_format = config_get('short_date_format');
        $t_version = version_get($p_version_id);
        $t_version_text .= ' (' . date($t_short_date_format, $t_version->date_order) . ')';
    }
    return $t_version_text;
}
/**
 * @param $types
 */
function print_document_selection($types)
{
    $project_id = gpc_get_int('project_id', helper_get_current_project());
    $specmanagement_database_api = new specmanagement_database_api();
    echo '<select name="version_id">';
    foreach ($types as $type) {
        $type_string = string_html_specialchars($type);
        $type_id = $specmanagement_database_api->get_type_id($type);
        $version_id_array = get_version_ids($type_id, $project_id);
        foreach ($version_id_array as $version_id) {
            $version_spec_project_id = version_get_field($version_id, 'project_id');
            if (project_includes_user($version_spec_project_id, auth_get_current_user_id()) || user_is_administrator(auth_get_current_user_id())) {
                $version_string = version_full_name($version_id);
                echo '<option value="' . $version_id . '">';
                echo $type_string . " - " . $version_string;
                echo '</option>';
            }
        }
    }
    echo '</select>';
}
			</td>
			<td class="center">
				<?php 
    echo lang_get('actions');
    ?>
			</td>
		</tr>
<?php 
}
foreach ($t_versions as $t_version) {
    if ($t_version['project_id'] != $f_project_id) {
        $t_inherited = true;
    } else {
        $t_inherited = false;
    }
    $t_name = version_full_name($t_version['id'], $t_inherited, $f_project_id);
    $t_released = $t_version['released'];
    $t_obsolete = $t_version['obsolete'];
    if (!date_is_null($t_version['date_order'])) {
        $t_date_formatted = date(config_get('complete_date_format'), $t_version['date_order']);
    } else {
        $t_date_formatted = ' ';
    }
    ?>
<!-- Repeated Info Rows -->
		<tr <?php 
    echo helper_alternate_class();
    ?>
>
			<td>
				<?php 
/**
 * @param $version
 */
function print_version($version)
{
    echo '<td style="version">';
    echo string_display(version_full_name($version['id']));
    echo '</td>';
}
function print_name($edit_page, $version)
{
    echo '<td width="200">';
    if ($edit_page) {
        echo '<label for="proj-version-new-version">';
        echo '<span class="input" style="width:100%;">';
        echo '<input type="text" id="proj-version-new-version" name="version[]"
                      style="width:100%;" maxlength="64" value="' . string_attribute($version['version']) . '" />';
        echo '</span>';
        echo '</label>';
    } else {
        echo string_display(version_full_name($version['id']));
    }
    echo '</td>';
}
#
# You should have received a copy of the GNU General Public License
# along with MantisBT.  If not, see <http://www.gnu.org/licenses/>.
/**
 * @package MantisBT
 * @copyright Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
 * @copyright Copyright (C) 2002 - 2011  MantisBT Team - mantisbt-dev@lists.sourceforge.net
 * @link http://www.mantisbt.org
 */
/**
 * MantisBT Core API's
 */
require_once 'core.php';
plugin_require_api('core/gantt_api.php');
require_api('version_api.php');
access_ensure_project_level(config_get('view_summary_threshold'));
$f_project_id = gpc_get_int('project_id', null);
$f_version_id = gpc_get_int('version_id', null);
$f_inherited = gpc_get_bool('inherited', true);
$f_start_index = gpc_get_int('start_index', -1);
$f_length = gpc_get_int('length', null);
$f_slice = gpc_get_int('slice', null);
if (null != $f_project_id && null != $f_version_id) {
    $t_metrics = gantt_create_summary($f_project_id, $f_version_id, $f_inherited, $f_start_index, $f_length);
    $t_gantt_chart_title = project_get_name($f_project_id);
    $t_gantt_chart_subtitle = version_full_name($f_version_id, $f_inherited, $f_project_id);
    if ($f_start_index != -1 && $f_length != null) {
        $t_gantt_chart_subtitle .= " (" . plugin_lang_get('part') . $f_slice . ")";
    }
    gantt_chart($t_metrics, $t_gantt_chart_title, $t_gantt_chart_subtitle);
}
 /**
  * Prints all available versions into the document head
  *
  * @param $versions
  * @param $act_version
  */
 public function print_doc_head_versions($versions, $act_version)
 {
     $specmanagement_database_api = new specmanagement_database_api();
     foreach ($versions as $version) {
         $type_string = $specmanagement_database_api->get_type_string($specmanagement_database_api->get_type_by_version($version['id']));
         if (strlen($type_string) > 0) {
             $same_version = $act_version->id == $version['id'];
             echo '<tr>';
             $this->print_doc_head_version_col($same_version, date_is_null($version['date_order']) ? '' : string_attribute(date(config_get('calendar_date_format'), $version['date_order'])));
             $this->print_doc_head_version_col($same_version, version_full_name($version['id']));
             if ($same_version) {
                 $this->print_doc_head_version_col($same_version, '');
             } else {
                 $change_button_string = '<form method="post" name="form_set_source" action="' . plugin_page('changes') . '">' . '<input type="hidden" name="version_other" value="' . $version['id'] . '" />' . '<input type="hidden" name="version_my" value="' . $act_version->id . '" />' . '<input type="submit" name="formSubmit" class="button" value="' . plugin_lang_get('head_changes') . '"/>' . '</form>';
                 $this->print_doc_head_version_col($same_version, $change_button_string);
             }
             $show_button_string = '<form method="post" name="form_set_source" action="' . plugin_page('editor') . '">' . '<input type="hidden" name="version_id" value="' . $version['id'] . '" />' . '<input type="submit" name="formSubmit" class="button" value="' . plugin_lang_get('head_view') . '"/>' . '</form>';
             $this->print_doc_head_version_col($same_version, $show_button_string);
             echo '</tr>';
         }
     }
 }
	</form><?php

	$t_versions = version_get_all_rows( $f_project_id, /* released = */ null, /* obsolete = */ null );
	if ( count( $t_versions ) > 0 ) { ?>
	<table id="versions" cellspacing="1" cellpadding="5" border="1">
		<tr class="row-category">
			<th><?php echo lang_get( 'version' ) ?></th>
			<th><?php echo lang_get( 'released' ) ?></th>
			<th><?php echo lang_get( 'obsolete' ) ?></th>
			<th><?php echo lang_get( 'timestamp' ) ?></th>
			<th colspan="2"><?php echo lang_get( 'actions' ) ?></th>
		</tr><?php

		foreach ( $t_versions as $t_version ) {
			$t_inherited = ( $t_version['project_id'] != $f_project_id ?  true : false );
			$t_name = version_full_name( $t_version['id'], /* showProject */ $t_inherited, $f_project_id );
			$t_released = $t_version['released'];
			$t_obsolete = $t_version['obsolete'];
			if( !date_is_null( $t_version['date_order'] ) ) {
				$t_date_formatted = date( config_get( 'complete_date_format' ), $t_version['date_order'] );
			} else {
				$t_date_formatted = ' ';
			} ?>

		<tr <?php echo helper_alternate_class() ?>>
			<td><?php echo string_display( $t_name ) ?></td>
			<td><?php echo trans_bool( $t_released ) ?></td>
			<td><?php echo trans_bool( $t_obsolete ) ?></td>
			<td><?php echo $t_date_formatted ?></td>
			<td><?php
				$t_version_id = version_get_id( $t_name, $f_project_id );
Exemple #9
0
function gantt_create_summary_by_user($p_user_id, $p_project_id, $p_version_id, $p_inherited)
{
    $t_bug_table = db_get_table('mantis_bug_table');
    $t_project_id = db_prepare_int($p_project_id);
    $t_user_id = db_prepare_int($p_user_id);
    $t_version_name = version_full_name($p_version_id, $p_inherited, $t_project_id);
    $t_version_name = db_prepare_string($t_version_name);
    $query = "SELECT id, summary, date_submitted, handler_id, due_date\n               FROM {$t_bug_table}\n               WHERE handler_id='" . db_param() . "'";
    if (null != $p_project_id && ALL_PROJECTS != $p_project_id) {
        $query .= " AND target_version='" . db_param() . "'";
        $result = db_query_bound($query, array($t_user_id, $t_version_name));
    } else {
        $result = db_query_bound($query, array($t_user_id));
    }
    while ($row = db_fetch_array($result)) {
        $t_results[] = $row;
    }
    $t_metrics = array();
    $t_dates_arr = array();
    $t_i = 0;
    foreach ($t_results as $t_bug_data) {
        $t_bug_id = $t_bug_data['id'];
        $t_title_id = $t_bug_data['summary'];
        $t_creation_date = $t_bug_data['date_submitted'];
        $t_handler_id = $t_bug_data['handler_id'];
        $t_extra = "";
        $t_actype = ACTYPE_NORMAL;
        $t_start_date = gantt_get_start_date($t_bug_id);
        $t_due_date = gantt_get_due_date($t_bug_id, $t_start_date);
        if (null == gantt_get_resolution_date($t_bug_id) && null != gantt_get_assigned_date($t_bug_id)) {
            $t_extra = " (" . user_get_name($t_handler_id) . ")";
        }
        if (null == $t_due_date) {
            $t_actype = ACTYPE_MILESTONE;
        }
        switch ($t_actype) {
            case ACTYPE_NORMAL:
                $t_dates_arr[] = $t_start_date;
                $t_dates_arr[] = $t_due_date;
                $t_metrics[] = array($t_i, $t_actype, $t_bug_id, $t_start_date, $t_due_date, $t_extra);
                break;
            case ACTYPE_MILESTONE:
                $t_dates_arr[] = $t_start_date;
                $t_metrics[] = array($t_i, $t_actype, $t_bug_id, $t_start_date, null, $t_extra);
                break;
        }
        $t_i++;
    }
    $t_dates_range = gantt_graph_best_dates_range($t_dates_arr);
    return array('metrics' => $t_metrics, 'range' => $t_dates_range);
}