function display_edit_oc_form($project_id) { ?> <table width="90%"> <tr> <td align="center" class="naglowek">Wybierz sk³ad OC do projektu <i><?php echo display_link_to_project($project_id); ?> </i><hr></td> </tr> <tr> <td class="naglowek_maly">Aby wybraæ kilka osób, przytrzymaj klawisz CTRL</td> </tr> <tr> <td><form method="POST" action="<?php echo get_www_root(); ?> ocp/edit_oc.php"> <select name="oc_ids[]" size="20" multiple> <?php $active_users = get_active_users(); foreach ($active_users as $user_id => $login) { if (!is_ocp($user_id, $project_id)) { echo '<option value="' . $user_id . '"'; if (is_oc_member($user_id, $project_id)) { echo ' selected'; } echo '>' . htmlspecialchars(stripslashes($login)) . "</option>\n"; } } ?> </select></td> </tr> <tr> <td><input type="hidden" name="project_id" value="<?php echo $project_id; ?> "> <input type="submit" value="Zmieñ"></form> </td> </tr> </table> <?php }
function change_project_ocp($project_id, $new_ocp_id) { $old_ocp_id = get_project_ocp($project_id); $q = 'update projects set ocp_id=' . $new_ocp_id . ' where project_id=' . $project_id; db_connect(); $r = mysql_query($q); if ($r === false) { return false; } if (mysql_affected_rows() === 0) { return false; } $q = 'update projects_orgs set oc_responsible_id=' . $new_ocp_id . ' where oc_responsible_id=' . $old_ocp_id . ' and project_id=' . $project_id; $r = mysql_query($q); if ($r === false) { return false; } if (is_oc_member($new_ocp_id, $project_id)) { if (mysql_query('delete from oc where oc_member_id=' . $new_ocp_id . ' and project_id=' . $project_id) === false) { return false; } } return true; }