/** * @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>'; }
<?php $t_email = user_get_email($t_user['id']); print_email_link($t_email, $t_email); ?> </td> <td> <?php echo get_enum_element('access_levels', $t_user['access_level']); ?> </td> <td class="center"> <?php # You need global or project-specific permissions to remove users # from this project if ($t_can_manage_users && access_has_project_level($t_user['access_level'], $f_project_id)) { if (project_includes_user($f_project_id, $t_user['id'])) { print_button("manage_proj_user_remove.php?project_id={$f_project_id}&user_id=" . $t_user['id'], lang_get('remove_link')); $t_removable_users_exist = true; } } ?> </td> </tr> <?php } # end for ?> <tr> <td> </td> <td> </td> <td> </td>
/** * Copy all users and their permissions from the source project to the * destination project. The $p_access_level_limit parameter can be used to * limit the access level for users as they're copied to the destination * project (the highest access level they'll receieve in the destination * project will be equal to $p_access_level_limit). * @param int Destination project ID * @param int Source project ID * @param int Access level limit (null = no limit) * @return null */ function project_copy_users($p_destination_id, $p_source_id, $p_access_level_limit = null) { # Copy all users from current project over to another project $t_rows = project_get_local_user_rows($p_source_id); $t_count = count($t_rows); for ($i = 0; $i < $t_count; $i++) { $t_row = $t_rows[$i]; if ($p_access_level_limit !== null && $t_row['access_level'] > $p_access_level_limit) { $t_destination_access_level = $p_access_level_limit; } else { $t_destination_access_level = $t_row['access_level']; } # if there is no duplicate then add a new entry # otherwise just update the access level for the existing entry if (project_includes_user($p_destination_id, $t_row['user_id'])) { project_update_user_access($p_destination_id, $t_row['user_id'], $t_destination_access_level); } else { project_add_user($p_destination_id, $t_row['user_id'], $t_destination_access_level); } } }
function project_copy_users($p_destination_id, $p_source_id) { # Copy all users from current project over to another project $rows = project_get_local_user_rows($p_source_id); for ($i = 0; $i < sizeof($rows); $i++) { extract($rows[$i], EXTR_PREFIX_ALL, 'v'); # if there is no duplicate then add a new entry # otherwise just update the access level for the existing entry if (project_includes_user($p_destination_id, $v_user_id)) { project_update_user_access($p_destination_id, $v_user_id, $v_access_level); } else { project_add_user($p_destination_id, $v_user_id, $v_access_level); } } }