Example #1
0
        $msg = "Error while adding: " . $result;
    }
} elseif ($action == "modify") {
    $result = ModifyProject($_POST["Id"], $_POST["name"], $_POST["description"], $_POST["reviewers_emails"], $_POST["admin_email"], array_key_exists("send_notifications", $_POST) ? $_POST["send_notifications"] : "", GetLoggedUserId());
    if ($result == "") {
        $msg = "Modification successful";
    } else {
        $msg = "Error while modifying: " . $result;
    }
} elseif ($action == "delete") {
    if (!IsAdmin()) {
        $msg = "Only administrators may delete projects from the system.";
    } elseif (array_key_exists("projects", $_POST) && is_array($_POST["projects"])) {
        StartAccessToDB();
        foreach ($_POST["projects"] as $project) {
            $error = DeleteProject($project);
            if ($error != "") {
                if ($msg != "") {
                    $msg .= "<br>";
                }
                $msg .= $error;
            }
        }
        if ($msg == "") {
            $msg = "Delete successful";
        } else {
            $msg = "Error(s) while deleting: " . $msg;
        }
        EndAccessToDB();
    } else {
        $msg = "Error: Please select a project to delete";
Example #2
0
<?php

require_once "dbconnector.php";
DeleteProject();
function DeleteProject()
{
    $newSport = false;
    $projectId = $_POST['projectId'];
    error_log("In DeleteProject - Proj ID : " . $projectId);
    $qry = "DELETE from tb_projects where id = " . $projectId;
    $dbConn = opendatabase();
    error_log("Deleting Project : " . $qry);
    if (!mysqli_query($dbConn, $qry)) {
        echo "error: deleting project!";
        error_log("Deleting Project : " . $qry);
        return false;
    } else {
        return true;
    }
    $dbConn . close();
}
Example #3
0
		case 'editform':
			DisplayProjectForm("edit", $id);
			break;
		case 'addform':
			DisplayProjectForm("add", "");
			break;
		case 'update':
			UpdateProject($id, $projectname, $admin, $pi, $instanceid, $sharing, $costcenter, $startdate, $enddate, $datausers, $phiusers);
			DisplayProjectList();
			break;
		case 'add':
			AddProject($projectname, $admin, $pi, $instanceid, $sharing, $costcenter, $startdate, $enddate, $datausers, $phiusers);
			DisplayProjectList();
			break;
		case 'delete':
			DeleteProject($id);
			break;
		default:
			DisplayProjectList();
	}
	
	
	/* ------------------------------------ functions ------------------------------------ */


	/* -------------------------------------------- */
	/* ------- UpdateProject ---------------------- */
	/* -------------------------------------------- */
	function UpdateProject($id, $projectname, $admin, $pi, $instanceid, $sharing, $costcenter, $startdate, $enddate, $datausers, $phiusers) {
		/* perform data checks */
		$projectname = mysql_real_escape_string($projectname);