/** * Determine if there is a transition possible between two workflow states. The * direction of the transition is factored into this check. * @param integer $p_from_status_id Source status ID. * @param integer $p_to_status_id Destination status ID. * @return boolean Whether a transition exists in the specified direction */ function workflow_transition_edge_exists($p_from_status_id, $p_to_status_id) { if ($p_from_status_id == $p_to_status_id) { return false; } $t_project_workflow = workflow_parse(config_get('status_enum_workflow')); return isset($t_project_workflow['exit'][$p_from_status_id][$p_to_status_id]); }
} echo '</div>' . "\n"; echo '</div>' . "\n"; echo '<br />' . "\n\n"; } echo '<br /><br />'; # count arcs in and out of each status $t_enum_status = config_get('status_enum_string'); $t_status_arr = MantisEnum::getAssocArrayIndexedByValues($t_enum_status); $t_extra_enum_status = '0:non-existent,' . $t_enum_status; $t_lang_enum_status = '0:' . lang_get('non_existent') . ',' . lang_get('status_enum_string'); $t_all_status = explode(',', $t_extra_enum_status); # gather all versions of the workflow $g_file_workflow = workflow_parse(config_get_global('status_enum_workflow')); $g_global_workflow = workflow_parse(config_get('status_enum_workflow', null, ALL_USERS, ALL_PROJECTS)); $g_project_workflow = workflow_parse(config_get('status_enum_workflow', null, ALL_USERS, $t_project)); # validate the project workflow $t_validation_result = ''; foreach ($t_status_arr as $t_status => $t_label) { if (isset($g_project_workflow['exit'][$t_status][$t_status])) { $t_validation_result .= '<tr><td>' . MantisEnum::getLabel($t_lang_enum_status, $t_status) . '</td><td bgcolor="#FFED4F">' . lang_get('superfluous') . '</td></tr>'; } } # check for entry == 0 without exit == 0, unreachable state foreach ($t_status_arr as $t_status => $t_status_label) { if (0 == count($g_project_workflow['entry'][$t_status]) && 0 < count($g_project_workflow['exit'][$t_status])) { $t_validation_result .= '<tr><td>' . MantisEnum::getLabel($t_lang_enum_status, $t_status) . '</td><td bgcolor="#FF0088">' . lang_get('unreachable') . '</td></tr>'; } } # check for exit == 0 without entry == 0, unleaveable state foreach ($t_status_arr as $t_status => $t_status_label) {
# end function access_row function access_end() { echo '</tbody></table></div><br />' . "\n"; } echo '<br /><br />'; # count arcs in and out of each status $t_enum_status = config_get('status_enum_string'); $t_status_arr = MantisEnum::getAssocArrayIndexedByValues($t_enum_status); $t_extra_enum_status = '0:non-existent,' . $t_enum_status; $t_lang_enum_status = '0:' . lang_get('non_existent') . ',' . lang_get('status_enum_string'); $t_all_status = explode(',', $t_extra_enum_status); # gather all versions of the workflow $t_file_workflow = workflow_parse(config_get_global('status_enum_workflow')); $t_global_workflow = workflow_parse(config_get('status_enum_workflow', null, null, ALL_PROJECTS)); $t_project_workflow = workflow_parse(config_get('status_enum_workflow')); # validate the project workflow $t_validation_result = ''; foreach ($t_status_arr as $t_status => $t_label) { if (isset($t_project_workflow['exit'][$t_status][$t_status])) { $t_validation_result .= '<tr><td>' . MantisEnum::getLabel($t_lang_enum_status, $t_status) . '</td><td bgcolor="#FFED4F">' . lang_get('superfluous') . '</td></tr>'; } } # check for entry == 0 without exit == 0, unreachable state foreach ($t_status_arr as $t_status => $t_status_label) { if (0 == count($t_project_workflow['entry'][$t_status]) && 0 < count($t_project_workflow['exit'][$t_status])) { $t_validation_result .= '<tr><td>' . MantisEnum::getLabel($t_lang_enum_status, $t_status) . '</td><td bgcolor="#FF0088">' . lang_get('unreachable') . '</td></tr>'; } } # check for exit == 0 without entry == 0, unleaveable state foreach ($t_status_arr as $t_status => $t_status_label) {