function print_version_option_list($p_version = '', $p_project_id = null, $p_released = null, $p_leading_blank = true, $p_with_subs = false) { if (null === $p_project_id) { $c_project_id = helper_get_current_project(); } else { $c_project_id = db_prepare_int($p_project_id); } if ($p_with_subs) { $versions = version_get_all_rows_with_subs($c_project_id, $p_released, null); } else { $versions = version_get_all_rows($c_project_id, $p_released, null); } # Ensure the selected version (if specified) is included in the list # Note: Filter API specifies selected versions as an array if (!is_array($p_version)) { if (!empty($p_version)) { $t_version_id = version_get_id($p_version, $c_project_id); if ($t_version_id !== false) { $versions[] = version_cache_row($t_version_id); } } } if ($p_leading_blank) { echo '<option value=""></option>'; } $t_listed = array(); $t_max_length = config_get('max_dropdown_length'); $t_show_version_dates = access_has_project_level(config_get('show_version_dates_threshold')); $t_short_date_format = config_get('short_date_format'); foreach ($versions as $version) { # If the current version is obsolete, and current version not equal to $p_version, # then skip it. if ((int) $version['obsolete'] == 1) { if ($version['version'] != $p_version) { continue; } } $t_version = string_attribute($version['version']); if (!in_array($t_version, $t_listed)) { $t_listed[] = $t_version; echo '<option value="' . $t_version . '"'; check_selected($p_version, $version['version']); $t_version_string = string_attribute(prepare_version_string($c_project_id, $version['id'])); echo '>', string_shorten($t_version_string, $t_max_length), '</option>'; } } }
/** * get information about a version given its id * @param int $p_version_id * @return VersionData */ function version_get($p_version_id) { static $t_vars; $row = version_cache_row($p_version_id); if ($t_vars == null) { $t_reflection = new ReflectionClass('VersionData'); $t_vars = $t_reflection->getDefaultProperties(); } $t_version_data = new VersionData(); $t_row_keys = array_keys($row); # Check each variable in the class foreach ($t_vars as $var => $val) { # If we got a field from the DB with the same name if (in_array($var, $t_row_keys, true)) { # Store that value in the object $t_version_data->{$var} = $row[$var]; } } return $t_version_data; }
function getVersionInformation($p_project_id, $p_version = "") { $t_version_id = version_get_id($p_version, $p_project_id); $t_version_id = version_cache_row($t_version_id, false); return $t_version_id; }
function version_get($p_version_id) { $row = version_cache_row($p_version_id); $t_version_data = new VersionData(); $t_row_keys = array_keys($row); $t_vars = get_object_vars($t_version_data); # Check each variable in the class foreach ($t_vars as $var => $val) { # If we got a field from the DB with the same name if (in_array($var, $t_row_keys, true)) { # Store that value in the object $t_version_data->{$var} = $row[$var]; } } return $t_version_data; }
/** * get information about a version given its id * @param integer $p_version_id A valid version identifier. * @return VersionData */ function version_get($p_version_id) { $t_row = version_cache_row($p_version_id); return new VersionData($t_row); }