コード例 #1
0
ファイル: admin_projects.php プロジェクト: amjadtbssm/website
require_once "page_blocks.php";
require_once "not_a_power_user.php";
if (!IsPower()) {
    die(GetNotAPowerUserPage());
}
$msg = "";
if (array_key_exists("action", $_POST)) {
    $action = $_POST["action"];
} else {
    $action = "";
}
if ($action == "add") {
    if (!IsAdmin()) {
        $result = "Only administrators may add projects in the system.";
    } else {
        $result = AddProject($_POST["name"], $_POST["description"], $_POST["reviewers_emails"], $_POST["admin_email"], array_key_exists("send_notifications", $_POST) ? $_POST["send_notifications"] : "", GetLoggedUserId());
    }
    if ($result == "") {
        $msg = "Add successful";
    } else {
        $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()) {
コード例 #2
0
	
	
	/* determine action */
	switch ($action) {
		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 ---------------------- */